diff --git a/Buffs/Alcohol/Trippy.cs b/Buffs/Alcohol/Trippy.cs index a8b9cacc85..b536f08765 100644 --- a/Buffs/Alcohol/Trippy.cs +++ b/Buffs/Alcohol/Trippy.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.Alcohol public override void SetDefaults() { DisplayName.SetDefault("Trippy"); - Description.SetDefault("You see the world for what it truly is...and you also have a 50% increase to all damage"); + Description.SetDefault("You see the world for what it truly is... and you also have a 50% increase to all damage"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; diff --git a/Buffs/DamageOverTime/ManaBurn.cs b/Buffs/DamageOverTime/ManaBurn.cs new file mode 100644 index 0000000000..1be76f5df5 --- /dev/null +++ b/Buffs/DamageOverTime/ManaBurn.cs @@ -0,0 +1,20 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.DamageOverTime +{ + public class ManaBurn : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Mana Burn"); + Description.SetDefault("The excess of mana sears your body and mind"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) => player.Calamity().ManaBurn = true; + } +} diff --git a/Buffs/DamageOverTime/ManaBurn.png b/Buffs/DamageOverTime/ManaBurn.png new file mode 100644 index 0000000000..58762d4d75 Binary files /dev/null and b/Buffs/DamageOverTime/ManaBurn.png differ diff --git a/Buffs/Mounts/DoGCartBuff.cs b/Buffs/Mounts/DoGCartBuff.cs new file mode 100644 index 0000000000..0b96dfaa7e --- /dev/null +++ b/Buffs/Mounts/DoGCartBuff.cs @@ -0,0 +1,24 @@ +using CalamityMod.Items.Mounts; +using CalamityMod.Items.Mounts.Minecarts; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Mounts +{ + public class DoGCartBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Devourer Cart"); + Description.SetDefault("Riding a cosmic terror"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.mount.SetMount(ModContent.MountType(), player); + player.buffTime[buffIndex] = 10; + } + } +} diff --git a/Buffs/Mounts/DoGCartBuff.png b/Buffs/Mounts/DoGCartBuff.png new file mode 100644 index 0000000000..95ffd9b47e Binary files /dev/null and b/Buffs/Mounts/DoGCartBuff.png differ diff --git a/Buffs/Mounts/DraedonGamerChairBuff.cs b/Buffs/Mounts/DraedonGamerChairBuff.cs new file mode 100644 index 0000000000..db7f56cb59 --- /dev/null +++ b/Buffs/Mounts/DraedonGamerChairBuff.cs @@ -0,0 +1,24 @@ +using CalamityMod.Items.Mounts; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Mounts +{ + public class DraedonGamerChairBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Exo Chair"); + Description.SetDefault("Riding a physics defying gamer chair"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.mount.SetMount(ModContent.MountType(), player); + player.buffTime[buffIndex] = 10; + player.Calamity().ExoChair = true; + } + } +} diff --git a/Buffs/Mounts/DraedonGamerChairBuff.png b/Buffs/Mounts/DraedonGamerChairBuff.png new file mode 100644 index 0000000000..9c3a83ed68 Binary files /dev/null and b/Buffs/Mounts/DraedonGamerChairBuff.png differ diff --git a/Buffs/Pets/SCalPetBuff.cs b/Buffs/Pets/SCalPetBuff.cs index 97c5974f70..f26eb3e5c8 100644 --- a/Buffs/Pets/SCalPetBuff.cs +++ b/Buffs/Pets/SCalPetBuff.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Buffs.Pets public override void SetDefaults() { DisplayName.SetDefault("Supreme Calamitas"); - Description.SetDefault("Watching over you with supreme calamitous energy...how adorable"); + Description.SetDefault("Watching over you with supreme calamitous energy... how adorable"); Main.buffNoTimeDisplay[Type] = true; Main.vanityPet[Type] = true; } diff --git a/Buffs/Potions/AbyssalWeapon.cs b/Buffs/Potions/AbyssalWeapon.cs index a728e072ed..4f386c6a7d 100644 --- a/Buffs/Potions/AbyssalWeapon.cs +++ b/Buffs/Potions/AbyssalWeapon.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.Potions public override void SetDefaults() { DisplayName.SetDefault("Abyssal Weapon"); - Description.SetDefault("Melee weapons inflict abyssal flames, 10% increased movement speed"); + Description.SetDefault("Melee and rogue weapons inflict abyssal flames, 10% increased movement speed"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; diff --git a/Buffs/Potions/YharimPower.cs b/Buffs/Potions/YharimPower.cs index 0db7a5081a..549f640804 100644 --- a/Buffs/Potions/YharimPower.cs +++ b/Buffs/Potions/YharimPower.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.Potions public override void SetDefaults() { DisplayName.SetDefault("Yharim's Power"); - Description.SetDefault("You feel like you can break the world in two...with your bare hands!"); + Description.SetDefault("You feel like you can break the world in two... with your bare hands!"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 8a6dd7ea52..39ff92eb89 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -13,6 +13,7 @@ using CalamityMod.Items.Armor; using CalamityMod.Items.DifficultyItems; using CalamityMod.Items.Dyes; using CalamityMod.Items.Mounts; +using CalamityMod.Items.Mounts.Minecarts; using CalamityMod.Items.Tools; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Melee; @@ -28,6 +29,7 @@ using CalamityMod.NPCs.Calamitas; using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs; using CalamityMod.NPCs.ExoMechs.Apollo; using CalamityMod.NPCs.GreatSandShark; using CalamityMod.NPCs.Leviathan; @@ -64,6 +66,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Reflection; using Terraria; using Terraria.DataStructures; using Terraria.GameInput; @@ -135,6 +138,9 @@ namespace CalamityMod.CalPlayer public float blazingMouseAuraFade = 0f; public float GeneralScreenShakePower = 0f; public bool GivenBrimstoneLocus = false; + public DoGCartSegment[] DoGCartSegments = new DoGCartSegment[DoGCartMount.SegmentCount]; + public float SmoothenedMinecartRotation; + public float MusicMuffleFactor; #endregion #region Tile Entity Trackers @@ -321,6 +327,7 @@ namespace CalamityMod.CalPlayer public bool angryDog = false; public bool fab = false; public bool crysthamyr = false; + public bool ExoChair = false; public AndromedaPlayerState andromedaState; public int andromedaCripple; public const float UnicornSpeedNerfPower = 0.8f; @@ -615,6 +622,9 @@ namespace CalamityMod.CalPlayer public bool rottenDogTooth = false; public bool angelicAlliance = false; public int angelicActivate = -1; + public bool BloomStoneRegen = false; + public bool ChaosStone = false; + public bool CryoStone = false; #endregion #region Armor Set @@ -785,6 +795,7 @@ namespace CalamityMod.CalPlayer public bool divineBlessCooldown = false; public bool banishingFire = false; public bool wither = false; + public bool ManaBurn = false; #endregion #region Buff @@ -1081,6 +1092,10 @@ namespace CalamityMod.CalPlayer public FireParticleSet ProvidenceBurnEffectDrawer = new FireParticleSet(-1, int.MaxValue, Color.Yellow, Color.Red * 1.2f, 10f, 0.65f); #endregion Draw Effects + #region Draedon Summoning + public bool AbleToSelectExoMech = false; + #endregion Draedon Summoning + #endregion #region SavingAndLoading @@ -1466,6 +1481,8 @@ namespace CalamityMod.CalPlayer ResetRogueStealth(); + MusicMuffleFactor = 0f; + contactDamageReduction = 0D; projectileDamageReduction = 0D; @@ -1514,6 +1531,7 @@ namespace CalamityMod.CalPlayer angryDog = false; fab = false; crysthamyr = false; + ExoChair = false; miniOldDuke = false; abyssalDivingSuitPlates = false; @@ -1704,6 +1722,9 @@ namespace CalamityMod.CalPlayer roverDrive = false; rottenDogTooth = false; angelicAlliance = false; + BloomStoneRegen = false; + ChaosStone = false; + CryoStone = false; daedalusReflect = false; daedalusSplit = false; @@ -1865,6 +1886,7 @@ namespace CalamityMod.CalPlayer divineBlessCooldown = false; banishingFire = false; wither = false; + ManaBurn = false; revivify = false; trinketOfChiBuff = false; @@ -2110,6 +2132,8 @@ namespace CalamityMod.CalPlayer lastProjectileHit = null; + AbleToSelectExoMech = false; + CalamityPlayerMiscEffects.EnchantHeldItemEffects(player, player.Calamity(), player.ActiveItem()); } #endregion @@ -2275,6 +2299,7 @@ namespace CalamityMod.CalPlayer angryDog = false; fab = false; crysthamyr = false; + ExoChair = false; abyssalDivingSuitPlates = false; sirenWaterBuff = false; sirenIce = false; @@ -2502,27 +2527,8 @@ namespace CalamityMod.CalPlayer if (BossRushEvent.BossRushActive) { - if (!CalamityGlobalNPC.AnyLivingPlayers()) - { - BossRushEvent.BossRushActive = false; - BossRushEvent.BossRushStage = 0; - CalamityNetcode.SyncWorld(); - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossRushStage); - netMessage.Write(BossRushEvent.BossRushStage); - netMessage.Send(); - } - for (int doom = 0; doom < Main.maxNPCs; doom++) - { - if (Main.npc[doom].active && Main.npc[doom].boss) - { - Main.npc[doom].active = false; - Main.npc[doom].netUpdate = true; - } - } - } + if (player.whoAmI == 0 && !CalamityGlobalNPC.AnyLivingPlayers() && CalamityUtils.CountProjectiles(ModContent.ProjectileType()) == 0) + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); } if (player.respawnTimer > 300) @@ -2536,8 +2542,34 @@ namespace CalamityMod.CalPlayer #endregion #region BiomeStuff + internal static readonly FieldInfo EffectsField = typeof(SkyManager).GetField("_effects", BindingFlags.NonPublic | BindingFlags.Instance); + public override void UpdateBiomeVisuals() { + bool useBossRushBackground = BossRushEvent.BossRushActive && BossRushEvent.StartTimer > 100; + + player.ManageSpecialBiomeVisuals("CalamityMod:BossRush", useBossRushBackground); + if (useBossRushBackground) + { + // Clear all other skies, including the vanilla ones. + Dictionary skies = EffectsField.GetValue(SkyManager.Instance) as Dictionary; + bool updateRequired = false; + foreach (string skyName in skies.Keys) + { + if (skies[skyName].IsActive() && skyName != "CalamityMod:BossRush") + { + skies[skyName].Opacity = 0f; + skies[skyName].Deactivate(); + updateRequired = true; + } + } + + if (updateRequired) + SkyManager.Instance.Update(new GameTime()); + + return; + } + bool useNebula = NPC.AnyNPCs(ModContent.NPCType()); player.ManageSpecialBiomeVisuals("CalamityMod:DevourerofGodsHead", useNebula); @@ -2568,6 +2600,13 @@ namespace CalamityMod.CalPlayer SkyManager.Instance.Deactivate("CalamityMod:Cryogen"); } + bool useExoMechs = ExoMechsSky.CanSkyBeActive; + player.ManageSpecialBiomeVisuals("CalamityMod:ExoMechs", useExoMechs); + if (useExoMechs) + SkyManager.Instance.Activate("CalamityMod:ExoMechs", player.Center); + else + SkyManager.Instance.Deactivate("CalamityMod:ExoMechs"); + Point point = player.Center.ToTileCoordinates(); bool aboveGround = point.Y > Main.maxTilesY - 320; bool overworld = player.ZoneOverworldHeight && (point.X < 380 || point.X > Main.maxTilesX - 380); @@ -3160,7 +3199,7 @@ namespace CalamityMod.CalPlayer } // Trigger for pressing the God Slayer dash key - if (CalamityMod.GodSlayerDashHotKey.JustPressed && (player.controlUp || player.controlDown || player.controlLeft || player.controlRight)) + if (CalamityMod.GodSlayerDashHotKey.JustPressed && (player.controlUp || player.controlDown || player.controlLeft || player.controlRight) && !player.pulley && player.grappling[0] == -1 && !player.tongued && !player.mount.Active && !godSlayerCooldown && player.dashDelay == 0) godSlayerDashHotKeyPressed = true; // Trigger for pressing the Rage hotkey. @@ -3207,7 +3246,7 @@ namespace CalamityMod.CalPlayer } // Activating Rage Mode - if (rage >= rageMax && CalamityConfig.Instance.Rippers && !rageModeActive) + if (rage >= rageMax && !rageModeActive) { // Rage duration isn't calculated here because the buff keeps itself alive automatically as long as the player has Rage left. player.AddBuff(ModContent.BuffType(), 2); @@ -3237,7 +3276,7 @@ namespace CalamityMod.CalPlayer } // Trigger for pressing the Adrenaline hotkey. - if (CalamityMod.AdrenalineHotKey.JustPressed && CalamityConfig.Instance.Rippers && CalamityWorld.revenge) + if (CalamityMod.AdrenalineHotKey.JustPressed && CalamityWorld.revenge) { if (adrenaline == adrenalineMax && !adrenalineModeActive) { @@ -3658,14 +3697,15 @@ namespace CalamityMod.CalPlayer CalamityConfig.Instance.BossHealthBarExtraInfo = shouldDrawSmallText; - if (CalamityConfig.Instance.MiningSpeedBoost) - { - player.pickSpeed *= 0.75f; - } + // Increase tile placement speed to speed up early game a bit and make building more fun + player.tileSpeed += 0.5f; - // Takes the % move speed boost and reduces it to a quarter to get the actual speed increase - // 400% move speed boost = 80% run speed boost, so an 8 run speed would become 14.4 with a 400% move speed stat - float accRunSpeedMin = player.accRunSpeed * 0.5f; + // Increase wall placement speed to speed up early game a bit and make building more fun + player.wallSpeed += 0.5f; + + // Takes the % move speed boost and reduces it to a quarter to get the actual speed increase + // 400% move speed boost = 80% run speed boost, so an 8 run speed would become 14.4 with a 400% move speed stat + float accRunSpeedMin = player.accRunSpeed * 0.5f; player.accRunSpeed += player.accRunSpeed * moveSpeedStat * 0.002f; if (player.accRunSpeed < accRunSpeedMin) @@ -3901,6 +3941,47 @@ namespace CalamityMod.CalPlayer } #endregion + #region PreUpdateMovement + public override void PreUpdateMovement() + { + // Remove acceleration when using the exo chair. + if (ExoChair) + { + float speed = DraedonGamerChairMount.MovementSpeed; + if (CalamityMod.ExoChairSpeedupHotkey.Current) + speed *= 2f; + + if (player.controlLeft) + { + player.velocity.X = -speed; + player.direction = -1; + } + else if (player.controlRight) + { + player.velocity.X = speed; + player.direction = 1; + } + else + player.velocity.X = 0f; + + if (player.controlUp) + player.velocity.Y = -speed; + + else if (player.controlDown) + { + player.velocity.Y = speed; + if (Collision.TileCollision(player.position, player.velocity, player.width, player.height, true, false, (int)player.gravDir).Y == 0f) + player.velocity.Y = 0.5f; + } + else + player.velocity.Y = 0f; + + if (player.controlJump) + player.velocity *= 0.5f; + } + } + #endregion + #region PostUpdateBuffs public override void PostUpdateBuffs() => ForceVariousEffects(); #endregion @@ -3937,75 +4018,78 @@ namespace CalamityMod.CalPlayer public override void PostUpdateRunSpeeds() { - #region SpeedBoosts - float runAccMult = 1f + - (shadowSpeed ? 0.5f : 0f) + - (stressPills ? 0.05f : 0f) + - ((abyssalDivingSuit && player.IsUnderwater()) ? 0.05f : 0f) + - (sirenWaterBuff ? 0.15f : 0f) + - ((frostFlare && player.statLife < (int)(player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + - (auricSet ? 0.1f : 0f) + - (dragonScales ? 0.1f : 0f) + - (kamiBoost ? KamiBuff.RunAccelerationBoost : 0f) + - (cTracers ? 0.1f : 0f) + - (silvaSet ? 0.05f : 0f) + - (eTracers ? 0.05f : 0f) + - (blueCandle ? 0.05f : 0f) + - (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + - ((deepDiver && player.IsUnderwater()) ? 0.15f : 0f) + - (rogueStealthMax > 0f ? (rogueStealth >= rogueStealthMax ? rogueStealth * 0.05f : rogueStealth * 0.025f) : 0f); + #region SpeedBoosts + if (!player.mount.Active) + { + float runAccMult = 1f + + (shadowSpeed ? 0.5f : 0f) + + (stressPills ? 0.05f : 0f) + + ((abyssalDivingSuit && player.IsUnderwater()) ? 0.05f : 0f) + + (sirenWaterBuff ? 0.15f : 0f) + + ((frostFlare && player.statLife < (int)(player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + + (auricSet ? 0.1f : 0f) + + (dragonScales ? 0.1f : 0f) + + (kamiBoost ? KamiBuff.RunAccelerationBoost : 0f) + + (cTracers ? 0.1f : 0f) + + (silvaSet ? 0.05f : 0f) + + (eTracers ? 0.05f : 0f) + + (blueCandle ? 0.05f : 0f) + + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + + ((deepDiver && player.IsUnderwater()) ? 0.15f : 0f) + + (rogueStealthMax > 0f ? (rogueStealth >= rogueStealthMax ? rogueStealth * 0.05f : rogueStealth * 0.025f) : 0f); - float runSpeedMult = 1f + - (shadowSpeed ? 0.5f : 0f) + - (stressPills ? 0.05f : 0f) + - ((abyssalDivingSuit && player.IsUnderwater()) ? 0.05f : 0f) + - (sirenWaterBuff ? 0.15f : 0f) + - ((frostFlare && player.statLife < (int)(player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + - (auricSet ? 0.1f : 0f) + - (dragonScales ? 0.1f : 0f) + - (kamiBoost ? KamiBuff.RunSpeedBoost : 0f) + - (cTracers ? 0.1f : 0f) + - (silvaSet ? 0.05f : 0f) + - (eTracers ? 0.05f : 0f) + - (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + - ((deepDiver && player.IsUnderwater()) ? 0.15f : 0f) + - (rogueStealthMax > 0f ? (rogueStealth >= rogueStealthMax ? rogueStealth * 0.05f : rogueStealth * 0.025f) : 0f); + float runSpeedMult = 1f + + (shadowSpeed ? 0.5f : 0f) + + (stressPills ? 0.05f : 0f) + + ((abyssalDivingSuit && player.IsUnderwater()) ? 0.05f : 0f) + + (sirenWaterBuff ? 0.15f : 0f) + + ((frostFlare && player.statLife < (int)(player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + + (auricSet ? 0.1f : 0f) + + (dragonScales ? 0.1f : 0f) + + (kamiBoost ? KamiBuff.RunSpeedBoost : 0f) + + (cTracers ? 0.1f : 0f) + + (silvaSet ? 0.05f : 0f) + + (eTracers ? 0.05f : 0f) + + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + + ((deepDiver && player.IsUnderwater()) ? 0.15f : 0f) + + (rogueStealthMax > 0f ? (rogueStealth >= rogueStealthMax ? rogueStealth * 0.05f : rogueStealth * 0.025f) : 0f); - if (abyssalDivingSuit && !player.IsUnderwater()) - { - float multiplier = 0.4f + abyssalDivingSuitPlateHits * 0.2f; - runAccMult *= multiplier; - runSpeedMult *= multiplier; - } - if (fabledTortoise) - { - float multiplier = shellBoost ? 0.8f : 0.5f; - runAccMult *= multiplier; - runSpeedMult *= multiplier; - } - if (ursaSergeant) - { - runAccMult *= 0.65f; - runSpeedMult *= 0.65f; - } - if (elysianGuard) - { - runAccMult *= 0.5f; - runSpeedMult *= 0.5f; - } - if ((player.slippy || player.slippy2) && player.iceSkate) - { - runAccMult *= 0.6f; - } - if (CalamityWorld.death && deathModeBlizzardTime > 0) - { - float speedMult = (3600 - deathModeBlizzardTime) / 3600f; - runAccMult *= speedMult; - runSpeedMult *= speedMult; - } + if (abyssalDivingSuit && !player.IsUnderwater()) + { + float multiplier = 0.4f + abyssalDivingSuitPlateHits * 0.2f; + runAccMult *= multiplier; + runSpeedMult *= multiplier; + } + if (fabledTortoise) + { + float multiplier = shellBoost ? 0.8f : 0.5f; + runAccMult *= multiplier; + runSpeedMult *= multiplier; + } + if (ursaSergeant) + { + runAccMult *= 0.65f; + runSpeedMult *= 0.65f; + } + if (elysianGuard) + { + runAccMult *= 0.5f; + runSpeedMult *= 0.5f; + } + if ((player.slippy || player.slippy2) && player.iceSkate) + { + runAccMult *= 0.6f; + } + if (CalamityWorld.death && deathModeBlizzardTime > 0) + { + float speedMult = (3600 - deathModeBlizzardTime) / 3600f; + runAccMult *= speedMult; + runSpeedMult *= speedMult; + } - player.runAcceleration *= runAccMult; - player.maxRunSpeed *= runSpeedMult; + player.runAcceleration *= runAccMult; + player.maxRunSpeed *= runSpeedMult; + } #endregion #region DashEffects @@ -4121,7 +4205,7 @@ namespace CalamityMod.CalPlayer for (int j = 0; j < 30; j++) { - int num = Dust.NewDust(player.position, player.width, player.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num = Dust.NewDust(player.position, player.width, player.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[num]; dust.position.X += Main.rand.Next(-20, 21); dust.position.Y += Main.rand.Next(-20, 21); @@ -4526,7 +4610,7 @@ namespace CalamityMod.CalPlayer { damageSource = PlayerDeathReason.ByCustomReason(player.name + " vaporized into thin air."); } - if (manaOverloader) + if (manaOverloader || ManaBurn) { damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s life was completely converted into mana."); } @@ -5296,7 +5380,7 @@ namespace CalamityMod.CalPlayer if (witheredDebuff && witheringWeaponEnchant) damageMult += 0.6; - if (CalamityWorld.revenge && CalamityConfig.Instance.Rippers) + if (CalamityWorld.revenge) { CalamityUtils.ApplyRippersToDamage(this, ref damageMult); } @@ -5432,7 +5516,7 @@ namespace CalamityMod.CalPlayer if (witheredDebuff) damageMult += 0.6; - if (CalamityWorld.revenge && CalamityConfig.Instance.Rippers) + if (CalamityWorld.revenge) CalamityUtils.ApplyRippersToDamage(this, ref damageMult); if ((filthyGlove || electricianGlove) && proj.Calamity().stealthStrike && proj.Calamity().rogue) @@ -5819,17 +5903,14 @@ namespace CalamityMod.CalPlayer if (CalamityWorld.revenge) { - if (CalamityConfig.Instance.Rippers) - { - if (adrenaline == adrenalineMax && !adrenalineModeActive) - { - double adrenalineDRBoost = 0D + - (adrenalineBoostOne ? 0.05 : 0D) + - (adrenalineBoostTwo ? 0.05 : 0D) + - (adrenalineBoostThree ? 0.05 : 0D); - contactDamageReduction += 0.5 + adrenalineDRBoost; - } - } + if (adrenaline == adrenalineMax && !adrenalineModeActive) + { + double adrenalineDRBoost = 0D + + (adrenalineBoostOne ? 0.05 : 0D) + + (adrenalineBoostTwo ? 0.05 : 0D) + + (adrenalineBoostThree ? 0.05 : 0D); + contactDamageReduction += 0.5 + adrenalineDRBoost; + } } if (player.mount.Active && (player.mount.Type == ModContent.MountType() || player.mount.Type == ModContent.MountType()) && Math.Abs(player.velocity.X) > player.mount.RunSpeed / 2f) @@ -5915,7 +5996,7 @@ namespace CalamityMod.CalPlayer #region Modify Hit By Proj public override void ModifyHitByProjectile(Projectile proj, ref int damage, ref bool crit) { - if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => proj.type != x) && proj.active && !proj.friendly && proj.hostile) + if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => proj.type != x) && proj.active && !proj.friendly && proj.hostile && damage > 0) { if (player.ActiveItem().type == ModContent.ItemType() && player.altFunctionUse == 2 && Main.rand.NextBool(2)) { @@ -5924,11 +6005,9 @@ namespace CalamityMod.CalPlayer int dustIndex = Dust.NewDust(proj.position, proj.width, proj.height, 31, 0f, 0f, 0, default, 1f); Main.dust[dustIndex].velocity *= 0.3f; } - int damage2 = (int)(GaelsGreatsword.BaseDamage * player.MeleeDamage()); proj.hostile = false; proj.friendly = true; proj.velocity *= -1f; - proj.damage = damage2; proj.penetrate = 1; bool isImmune = false; for (int j = 0; j < player.hurtCooldowns.Length; j++) @@ -5980,11 +6059,9 @@ namespace CalamityMod.CalPlayer // The Evolution if (projRefRare) { - int damage2 = (int)(proj.damage * 10 * player.AverageDamage()); proj.hostile = false; proj.friendly = true; proj.velocity *= -2f; - proj.damage = damage2; proj.extraUpdates += 1; proj.penetrate = 1; bool isImmune = false; @@ -6015,11 +6092,9 @@ namespace CalamityMod.CalPlayer // Arcanum of the Void else if (projRef) { - int damage2 = (int)(proj.damage * 5 * player.AverageDamage()); proj.hostile = false; proj.friendly = true; proj.velocity *= -1f; - proj.damage = damage2; proj.extraUpdates += 1; proj.penetrate = 1; bool isImmune = false; @@ -6048,11 +6123,9 @@ namespace CalamityMod.CalPlayer // Daedalus Melee set bonus else if (daedalusReflect) { - int damage2 = (int)(proj.damage * player.AverageDamage()); proj.hostile = false; proj.friendly = true; proj.velocity *= -1f; - proj.damage = damage2; proj.penetrate = 1; bool isImmune = false; for (int j = 0; j < player.hurtCooldowns.Length; j++) @@ -6271,17 +6344,14 @@ namespace CalamityMod.CalPlayer if (CalamityWorld.revenge) { - if (CalamityConfig.Instance.Rippers) - { - if (adrenaline == adrenalineMax && !adrenalineModeActive) - { - double adrenalineDRBoost = 0D + - (adrenalineBoostOne ? 0.05 : 0D) + - (adrenalineBoostTwo ? 0.05 : 0D) + - (adrenalineBoostThree ? 0.05 : 0D); - projectileDamageReduction += 0.5 + adrenalineDRBoost; - } - } + if (adrenaline == adrenalineMax && !adrenalineModeActive) + { + double adrenalineDRBoost = 0D + + (adrenalineBoostOne ? 0.05 : 0D) + + (adrenalineBoostTwo ? 0.05 : 0D) + + (adrenalineBoostThree ? 0.05 : 0D); + projectileDamageReduction += 0.5 + adrenalineDRBoost; + } } if (player.mount.Active && (player.mount.Type == ModContent.MountType() || player.mount.Type == ModContent.MountType()) && Math.Abs(player.velocity.X) > player.mount.RunSpeed / 2f) @@ -6946,9 +7016,8 @@ namespace CalamityMod.CalPlayer } else if (proj.type == ProjectileID.CultistBossIceMist) { - player.AddBuff(BuffID.Frozen, 60); - player.AddBuff(BuffID.Chilled, 120); - player.AddBuff(BuffID.Frostburn, 240); + player.AddBuff(BuffID.Frozen, 90); + player.AddBuff(BuffID.Chilled, 180); } else if (proj.type == ProjectileID.CultistBossLightningOrbArc) { @@ -7202,6 +7271,18 @@ namespace CalamityMod.CalPlayer if (weakPetrification) WeakPetrification(); + // Disable vanilla dashes during god slayer dash + if (godSlayerDashHotKeyPressed) + { + // Set the player to have no registered vanilla dashes. + player.dash = 0; + + // Prevent the possibility of Shield of Cthulhu invulnerability exploits. + player.eocHit = -1; + if (player.eocDash != 0) + player.eocDash = 0; + } + if (lol || (silvaCountdown > 0 && hasSilvaEffect && silvaSet) || (dashMod == 9 && player.dashDelay < 0)) { if (player.lifeRegen < 0) @@ -7372,7 +7453,7 @@ namespace CalamityMod.CalPlayer // Shattered Community makes the player gain rage based on the amount of damage taken. // Also set the Rage gain cooldown to prevent bizarre abuse cases. - if (CalamityWorld.revenge && CalamityConfig.Instance.Rippers && shatteredCommunity && rageGainCooldown == 0) + if (CalamityWorld.revenge && shatteredCommunity && rageGainCooldown == 0) { float HPRatio = (float)damage / player.statLifeMax2; float rageConversionRatio = 0.8f; @@ -7431,7 +7512,7 @@ namespace CalamityMod.CalPlayer modStealth = 1f; // Give Rage combat frames because being hurt counts as combat. - if (CalamityConfig.Instance.Rippers && CalamityWorld.revenge) + if (CalamityWorld.revenge) rageCombatFrames = RageCombatDelayTime; if (player.whoAmI == Main.myPlayer) @@ -7476,7 +7557,7 @@ namespace CalamityMod.CalPlayer witheringDamageDone = 0; } - if (CalamityConfig.Instance.Rippers && CalamityWorld.revenge) + if (CalamityWorld.revenge) { if (!adrenalineModeActive && damage > 0) // To prevent paladin's shield ruining adren even with 0 dmg taken { @@ -8460,7 +8541,7 @@ namespace CalamityMod.CalPlayer for (int j = 0; j < 30; j++) { - int dust = Dust.NewDust(player.position, player.width, player.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(player.position, player.width, player.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Dust dust2 = Main.dust[dust]; dust2.position.X += Main.rand.Next(-20, 21); dust2.position.Y += Main.rand.Next(-20, 21); @@ -8676,7 +8757,7 @@ namespace CalamityMod.CalPlayer player.maxFallSpeed = 50f; for (int m = 0; m < 24; m++) { - int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2.75f); + int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2.75f); Main.dust[num14].velocity *= 0.1f; Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); @@ -8686,7 +8767,8 @@ namespace CalamityMod.CalPlayer Main.dust[num14].fadeIn = 0.5f; } } - num7 = 40f; + num7 = 40f; // 46 frames before hitting this gate value + num10 = 0.8f; } if (dashMod > 0) { @@ -8908,7 +8990,7 @@ namespace CalamityMod.CalPlayer for (int d = 0; d < 60; d++) { - int idx = Dust.NewDust(player.position, player.width, player.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); + int idx = Dust.NewDust(player.position, player.width, player.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Dust dust = Main.dust[idx]; dust.position.X += Main.rand.NextFloat(-5f, 5f); dust.position.Y += Main.rand.NextFloat(-5f, 5f); @@ -9191,7 +9273,7 @@ namespace CalamityMod.CalPlayer } else if (dashMod == 9) { - int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, (int)CalamityDusts.PurpleCosmolite, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); + int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, (int)CalamityDusts.PurpleCosmilite, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); Main.dust[num7].velocity.X *= 0.2f; Main.dust[num7].velocity.Y *= 0.2f; Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); @@ -9265,7 +9347,7 @@ namespace CalamityMod.CalPlayer } else if (dashMod == 9) { - int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, (int)CalamityDusts.PurpleCosmolite, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); + int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, (int)CalamityDusts.PurpleCosmilite, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); Main.dust[num12].velocity.X *= 0.2f; Main.dust[num12].velocity.Y *= 0.2f; Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index fbab0f5a76..2d68f6c4cd 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -428,6 +428,16 @@ namespace CalamityMod.CalPlayer else modPlayer.witheredWeaponHoldTime = 0; + if (modPlayer.ManaBurn) + { + int debuffIndex = player.FindBuffIndex(ModContent.BuffType()); + float debuffIntensity = debuffIndex == -1 ? 0f : player.buffTime[debuffIndex] / (float)Player.manaSickTimeMax; + + lifeRegenLost += (int)(Math.Sqrt(debuffIntensity) * Math.Pow(6D, debuffIntensity + 1f)); + if (player.lifeRegen > 0) + player.lifeRegen = 0; + } + player.lifeRegen -= (int)(lifeRegenLost * lifeRegenMult); // Buffs @@ -821,6 +831,15 @@ namespace CalamityMod.CalPlayer player.statLife += 1; } + if (modPlayer.BloomStoneRegen) + { + float dayTimeCompletion = !Main.dayTime ? 1f : (float)(Main.time / Main.dayLength); + float regenBenefitFactor = MathHelper.SmoothStep(0.25f, 1f, Utils.InverseLerp(0f, 0.24f, dayTimeCompletion, true) * Utils.InverseLerp(1f, 0.76f, dayTimeCompletion, true)); + + player.lifeRegen += (int)MathHelper.Lerp(2f, 6f, regenBenefitFactor); + player.lifeRegenTime += (int)MathHelper.Lerp(1f, 3f, regenBenefitFactor); + } + // Standing still healing bonuses (all exclusive with vanilla Shiny Stone) if (!player.shinyStone) { diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 05dfa7166f..d06f0c6a7e 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -5,14 +5,19 @@ using CalamityMod.Buffs.Potions; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon; +using CalamityMod.CustomRecipes; +using CalamityMod.DataStructures; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor; +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Dyes; using CalamityMod.Items.Fishing.AstralCatches; using CalamityMod.Items.Fishing.BrimstoneCragCatches; using CalamityMod.Items.Fishing.FishingRods; +using CalamityMod.Items.Mounts.Minecarts; using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.Weapons.Melee; @@ -39,6 +44,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; +using System.Linq; using Terraria; using Terraria.GameContent.Events; using Terraria.GameInput; @@ -124,6 +130,9 @@ namespace CalamityMod.CalPlayer // Potions (Quick Buff && Potion Sickness) HandlePotions(player, modPlayer); + // Check if schematics are present on the mouse, for the sake of registering their recipes. + CheckIfMouseItemIsSchematic(player); + // Update all particle sets for items. // This must be done here instead of in the item logic because these sets are not properly instanced // in the global classes. Attempting to update them there will cause multiple updates to one set for multiple items. @@ -154,57 +163,6 @@ namespace CalamityMod.CalPlayer { if (CalamityWorld.revenge || CalamityWorld.malice) { - // This effect is way too annoying during the fight so I disabled it - Fab - // Signus headcrab effect - /*if (CalamityGlobalNPC.signus != -1) - { - if (Main.npc[CalamityGlobalNPC.signus].active) - { - if (Vector2.Distance(player.Center, Main.npc[CalamityGlobalNPC.signus].Center) <= 5200f) - { - float signusLifeRatio = 1f - (Main.npc[CalamityGlobalNPC.signus].life / Main.npc[CalamityGlobalNPC.signus].lifeMax); - - // Reduce the power of Signus darkness based on your light level. - float multiplier = 1f; - switch (modPlayer.GetTotalLightStrength()) - { - case 0: - break; - case 1: - case 2: - multiplier = 0.75f; - break; - case 3: - case 4: - multiplier = 0.5f; - break; - case 5: - case 6: - multiplier = 0.25f; - break; - default: - multiplier = 0f; - break; - } - - // Increased darkness in Death Mode - if (CalamityWorld.death) - multiplier += (1f - multiplier) * 0.1f; - - // Total darkness - float signusDarkness = signusLifeRatio * multiplier; - - // Headcrab effect - if (!modPlayer.ZoneAbyss && !player.headcovered) - { - float screenObstructionAmt = MathHelper.Clamp(signusDarkness, 0f, 0.63f); - float targetValue = MathHelper.Clamp(screenObstructionAmt * 0.33f, 0.1f, 0.2f); - ScreenObstruction.screenObstruction = MathHelper.Lerp(ScreenObstruction.screenObstruction, screenObstructionAmt, targetValue); - } - } - } - }*/ - // Adjusts the life steal cap in rev/death float lifeStealCap = CalamityWorld.malice ? 30f : CalamityWorld.death ? 50f : 60f; /*if (Main.masterMode) @@ -237,7 +195,7 @@ namespace CalamityMod.CalPlayer } // Adrenaline and Rage - if (CalamityConfig.Instance.Rippers && CalamityWorld.revenge) + if (CalamityWorld.revenge) UpdateRippers(mod, player, modPlayer); } } @@ -468,7 +426,7 @@ namespace CalamityMod.CalPlayer void harmNPC(NPC npc) { - int damage = (int)(player.AverageDamage() * Main.rand.Next(1950, 2050)); + int damage = (int)(player.AverageDamage() * Main.rand.Next(550, 600)); npc.StrikeNPC(damage, 0f, 0); player.addDPS(damage); @@ -498,6 +456,45 @@ namespace CalamityMod.CalPlayer } } + // Calculate/reset DoG cart rotations based on whether the DoG cart is in use. + if (player.mount.Active && player.mount.Type == ModContent.MountType()) + { + modPlayer.SmoothenedMinecartRotation = MathHelper.Lerp(modPlayer.SmoothenedMinecartRotation, DelegateMethods.Minecart.rotation, 0.05f); + + // Initialize segments from null if necessary. + int direction = (player.velocity.SafeNormalize(Vector2.UnitX * player.direction).X > 0f).ToDirectionInt(); + if (player.velocity.X == 0f) + direction = player.direction; + + float idealRotation = DoGCartMount.CalculateIdealWormRotation(player); + float minecartRotation = DelegateMethods.Minecart.rotation; + if (Math.Abs(minecartRotation) < 0.5f) + minecartRotation = 0f; + Vector2 stickOffset = minecartRotation.ToRotationVector2() * player.velocity.Length() * direction * 1.25f; + for (int i = 0; i < modPlayer.DoGCartSegments.Length; i++) + { + if (modPlayer.DoGCartSegments[i] is null) + { + modPlayer.DoGCartSegments[i] = new DoGCartSegment + { + Center = player.Center - idealRotation.ToRotationVector2() * i * 20f + }; + } + } + + Vector2 startingStickPosition = player.Center + stickOffset + Vector2.UnitY * 12f; + modPlayer.DoGCartSegments[0].Update(player, startingStickPosition, idealRotation); + modPlayer.DoGCartSegments[0].Center = startingStickPosition; + + for (int i = 1; i < modPlayer.DoGCartSegments.Length; i++) + { + Vector2 waveOffset = DoGCartMount.CalculateSegmentWaveOffset(i, player); + modPlayer.DoGCartSegments[i].Update(player, modPlayer.DoGCartSegments[i - 1].Center + waveOffset, modPlayer.DoGCartSegments[i - 1].Rotation); + } + } + else + modPlayer.DoGCartSegments = new DoGCartSegment[modPlayer.DoGCartSegments.Length]; + // Dust on hand when holding the phosphorescent gauntlet. if (player.ActiveItem().type == ModContent.ItemType()) PhosphorescentGauntletPunches.GenerateDustOnOwnerHand(player); @@ -1308,6 +1305,20 @@ namespace CalamityMod.CalPlayer player.buffImmune[debuff] = true; } + // Auric dye cinders. + int auricDyeCount = player.dye.Count(dyeItem => dyeItem.type == ModContent.ItemType()); + if (auricDyeCount > 0) + { + int sparkCreationChance = (int)MathHelper.Lerp(15f, 50f, Utils.InverseLerp(4f, 1f, auricDyeCount, true)); + if (Main.rand.NextBool(sparkCreationChance)) + { + Dust spark = Dust.NewDustDirect(player.position, player.width, player.height, 267); + spark.color = Color.Lerp(Color.Cyan, Color.SeaGreen, Main.rand.NextFloat(0.5f)); + spark.velocity = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver2 * 1.33f) * Main.rand.NextFloat(2f, 5.4f); + spark.noGravity = true; + } + } + // Silva invincibility effects if (modPlayer.silvaCountdown > 0 && modPlayer.hasSilvaEffect && modPlayer.silvaSet) { @@ -3596,17 +3607,36 @@ namespace CalamityMod.CalPlayer { if (player.whoAmI == Main.myPlayer) { - for (int i = 0; i < Main.projectile.Length; i++) + int auraType = ModContent.ProjectileType(); + for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType() && Main.projectile[i].owner == player.whoAmI) - { - Main.projectile[i].Kill(); - break; - } + if (Main.projectile[i].type != auraType || !Main.projectile[i].active || Main.projectile[i].owner != player.whoAmI) + continue; + + Main.projectile[i].Kill(); + break; } } } + if (modPlayer.CryoStone) + { + if (player.whoAmI == Main.myPlayer && player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(player.AverageDamage() * 70), 0f, player.whoAmI); + } + else if (player.whoAmI == Main.myPlayer) + { + int shieldType = ModContent.ProjectileType(); + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].type != shieldType || !Main.projectile[i].active || Main.projectile[i].owner != player.whoAmI) + continue; + + Main.projectile[i].Kill(); + break; + } + } + if (modPlayer.prismaticLasers > 1800 && player.whoAmI == Main.myPlayer) { float shootSpeed = 18f; @@ -4227,6 +4257,54 @@ namespace CalamityMod.CalPlayer } #endregion + #region Mouse Item Checks + public static void CheckIfMouseItemIsSchematic(Player player) + { + if (Main.myPlayer != player.whoAmI) + return; + + bool shouldSync = false; + + // ActiveItem doesn't need to be checked as the other possibility involves + // the item in question already being in the inventory. + if (Main.mouseItem != null && !Main.mouseItem.IsAir) + { + if (Main.mouseItem.type == ModContent.ItemType() && !RecipeUnlockHandler.HasFoundSunkenSeaSchematic) + { + RecipeUnlockHandler.HasFoundSunkenSeaSchematic = true; + shouldSync = true; + } + + if (Main.mouseItem.type == ModContent.ItemType() && !RecipeUnlockHandler.HasFoundPlanetoidSchematic) + { + RecipeUnlockHandler.HasFoundPlanetoidSchematic = true; + shouldSync = true; + } + + if (Main.mouseItem.type == ModContent.ItemType() && !RecipeUnlockHandler.HasFoundJungleSchematic) + { + RecipeUnlockHandler.HasFoundJungleSchematic = true; + shouldSync = true; + } + + if (Main.mouseItem.type == ModContent.ItemType() && !RecipeUnlockHandler.HasFoundHellSchematic) + { + RecipeUnlockHandler.HasFoundHellSchematic = true; + shouldSync = true; + } + + if (Main.mouseItem.type == ModContent.ItemType() && !RecipeUnlockHandler.HasFoundIceSchematic) + { + RecipeUnlockHandler.HasFoundIceSchematic = true; + shouldSync = true; + } + } + + if (shouldSync) + CalamityNetcode.SyncWorld(); + } + #endregion + #region Potion Handling private static void HandlePotions(Player player, CalamityPlayer modPlayer) { diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 2862148680..737166b412 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -496,7 +496,7 @@ namespace CalamityMod.CalPlayer break; } } - int projectileIndex = Projectile.NewProjectile(projTileX * 16 + 8, projTileY * 16 - 24, 0f, 0f, ProjectileType(), (int)(400 * player.RogueDamage()), 15f, Main.myPlayer, 16f, 16f); + int projectileIndex = Projectile.NewProjectile(projTileX * 16 + 8, projTileY * 16 - 24, 0f, 0f, ProjectileType(), (int)(550 * player.RogueDamage()), 15f, Main.myPlayer, 16f, 16f); if (projectileIndex.WithinBounds(Main.maxProjectiles)) { Main.projectile[projectileIndex].Calamity().forceTypeless = true; @@ -809,7 +809,11 @@ namespace CalamityMod.CalPlayer { target.AddBuff(BuffID.Venom, 240); } - } + if (modPlayer.aWeapon) + { + CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); + } + } if (summon) { if (modPlayer.pArtifact && !modPlayer.profanedCrystal) @@ -956,7 +960,11 @@ namespace CalamityMod.CalPlayer { target.AddBuff(BuffID.Venom, 240); } - } + if (modPlayer.aWeapon) + { + CalamityUtils.Inflict246DebuffsPvp(target, BuffType()); + } + } if (summon) { if (modPlayer.pArtifact && !modPlayer.profanedCrystal) diff --git a/CalamityConfig.cs b/CalamityConfig.cs index b640141930..51c27677d8 100644 --- a/CalamityConfig.cs +++ b/CalamityConfig.cs @@ -148,24 +148,12 @@ namespace CalamityMod [Tooltip("Adds vanilla boss summons to NPC shops after the corresponding boss is defeated.\nThis does not affect Calamity's boss summons, which are always sold.\nTo apply changes, close and reopen the shop.")] public bool SellVanillaSummons { get; set; } - [Label("Boost Mining Speed")] - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(false)] - [Tooltip("Increases the player's mining speed by 75%.\nThis does not affect drills.")] - public bool MiningSpeedBoost { get; set; } - [Label("Boss Zen")] [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] [Tooltip("While a boss is alive, all players near a boss receive the Boss Effects buff, which drastically reduces enemy spawn rates.")] public bool BossZen { get; set; } - [Label("Never Weaken Reactive Boss DR")] - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(false)] - [Tooltip("Sets Reactive Boss DR to always be full strength, even if the boss has already been defeated.\nIf disabled, the effect is only 66% as powerful after the boss has been defeated.\n\nReactive Boss DR makes bosses smoothly take less damage if they are being killed very quickly.\nIn most cases, the system has no noticeable effect.")] - public bool FullPowerReactiveBossDR { get; set; } - [Label("Let Town NPCs spawn at night.")] [BackgroundColor(192, 54, 64, 192)] [DefaultValue(false)] @@ -211,12 +199,6 @@ namespace CalamityMod [Tooltip("When enabled, water in the Snow and Ice biomes will rapidly drain the player's breath instead of inflicting Chilled.")] public bool ReworkChilledWater { get; set; } - [Label("Reduce Celestial Pillar Kill Count")] - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(true)] - [Tooltip("Reduces the kills required to destroy a Celestial Pillar shield in Expert Mode from 150 to 100.\nThis makes the value equivalent to Normal Mode.")] - public bool NerfExpertPillars { get; set; } - [Label("Disable Expert Enemy Spawns in Towns")] [BackgroundColor(192, 54, 64, 192)] [DefaultValue(false)] @@ -225,12 +207,6 @@ namespace CalamityMod [Header("Revengeance Mode Changes")] - [Label("Rage and Adrenaline")] - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(true)] - [Tooltip("Enables Rage and Adrenaline, the two Revengeance Mode mechanics.")] - public bool Rippers { get; set; } - private const float MinMeterShake = 0f; private const float MaxMeterShake = 4f; diff --git a/CalamityLists.cs b/CalamityLists.cs index 5534173bbd..cb33cda65c 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Wings; using CalamityMod.Items.Ammo.FiniteUse; using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Fishing.AstralCatches; using CalamityMod.Items.Fishing.BrimstoneCragCatches; using CalamityMod.Items.Fishing.FishingRods; @@ -36,6 +37,7 @@ using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.DesertScourge; using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.NPCs.GreatSandShark; using CalamityMod.NPCs.HiveMind; @@ -75,7 +77,6 @@ namespace CalamityMod public class CalamityLists { public static IList donatorList; - public static List trueMeleeProjectileList; // DO NOT, EVER, DELETE THIS LIST, OR I WILL COME FOR YOU :D public static List rangedProjectileExceptionList; public static List projectileDestroyExceptionList; public static List projectileMinionList; @@ -152,8 +153,9 @@ namespace CalamityMod public static List minibossList; public static List heartDropBlockList; public static List pierceResistList; + public static List pierceResistExceptionList; - public static List legOverrideList; + public static List legOverrideList; public static List kamiDebuffColorImmuneList; @@ -161,6 +163,8 @@ namespace CalamityMod public static List ZeroMinionSlotExceptionList; public static List DontCopyOriginalMinionAIList; + public static Dictionary EncryptedSchematicIDRelationship; + public static void LoadLists() { donatorList = new List() @@ -510,73 +514,6 @@ namespace CalamityMod "James" }; - trueMeleeProjectileList = new List() - { - // Vanilla shit - ProjectileID.Spear, - ProjectileID.Trident, - ProjectileID.TheRottedFork, - ProjectileID.Swordfish, - ProjectileID.Arkhalis, - ProjectileID.DarkLance, - ProjectileID.CobaltNaginata, - ProjectileID.PalladiumPike, - ProjectileID.MythrilHalberd, - ProjectileID.OrichalcumHalberd, - ProjectileID.AdamantiteGlaive, - ProjectileID.TitaniumTrident, - ProjectileID.MushroomSpear, - ProjectileID.Gungnir, - ProjectileID.ObsidianSwordfish, - ProjectileID.MonkStaffT1, - ProjectileID.MonkStaffT2, - - // Tools - ProjectileID.CobaltDrill, - ProjectileID.MythrilDrill, - ProjectileID.AdamantiteDrill, - ProjectileID.PalladiumDrill, - ProjectileID.OrichalcumDrill, - ProjectileID.TitaniumDrill, - ProjectileID.ChlorophyteDrill, - ProjectileID.CobaltChainsaw, - ProjectileID.MythrilChainsaw, - ProjectileID.AdamantiteChainsaw, - ProjectileID.PalladiumChainsaw, - ProjectileID.OrichalcumChainsaw, - ProjectileID.TitaniumChainsaw, - ProjectileID.ChlorophyteChainsaw, - ProjectileID.VortexDrill, - ProjectileID.VortexChainsaw, - ProjectileID.NebulaDrill, - ProjectileID.NebulaChainsaw, - ProjectileID.SolarFlareDrill, - ProjectileID.SolarFlareChainsaw, - ProjectileID.StardustDrill, - ProjectileID.StardustChainsaw, - ProjectileID.Hamdrax, - ProjectileID.ChlorophyteJackhammer, - ProjectileID.SawtoothShark, - ProjectileID.ButchersChainsaw, - - // Calamity shit - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType() - }; - rangedProjectileExceptionList = new List() { ProjectileID.Phantasm, @@ -658,15 +595,23 @@ namespace CalamityMod ProjectileType(), ProjectileType(), - //Some hostile boss projectiles + // Some hostile boss projectiles + ProjectileID.SaucerDeathray, + ProjectileID.PhantasmalDeathray, + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType() - }; + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType() + }; projectileMinionList = new List() { @@ -2001,7 +1946,11 @@ namespace CalamityMod NPCType(), NPCType(), NPCType(), - NPCType() + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() }; needsDebuffIconDisplayList = new List() @@ -2768,7 +2717,56 @@ namespace CalamityMod NPCType(), NPCType(), NPCType(), - NPCType() + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + }; + + pierceResistExceptionList = new List() + { + ProjectileID.FlyingKnife, + ProjectileID.Arkhalis, + ProjectileID.MonkStaffT3, + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType() }; bossMinionList = new List() @@ -2910,12 +2908,19 @@ namespace CalamityMod { ProjectileType() }; + + EncryptedSchematicIDRelationship = new Dictionary() + { + [1] = ItemType(), + [2] = ItemType(), + [3] = ItemType(), + [4] = ItemType(), + }; } public static void UnloadLists() { donatorList = null; - trueMeleeProjectileList = null; rangedProjectileExceptionList = null; projectileDestroyExceptionList = null; projectileMinionList = null; @@ -2992,14 +2997,17 @@ namespace CalamityMod minibossList = null; heartDropBlockList = null; pierceResistList = null; + pierceResistExceptionList = null; - legOverrideList = null; + legOverrideList = null; kamiDebuffColorImmuneList = null; MinionsToNotResurrectList = null; ZeroMinionSlotExceptionList = null; DontCopyOriginalMinionAIList = null; + + EncryptedSchematicIDRelationship = null; } } } diff --git a/CalamityMod.cs b/CalamityMod.cs index 55d583a4d8..b7bff76bd1 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -84,6 +84,7 @@ namespace CalamityMod public static ModHotKey PlaguePackHotKey; public static ModHotKey AngelicAllianceHotKey; public static ModHotKey GodSlayerDashHotKey; + public static ModHotKey ExoChairSpeedupHotkey; // Boss Spawners public static int ghostKillCount = 0; @@ -182,8 +183,9 @@ namespace CalamityMod PlaguePackHotKey = RegisterHotKey("Booster Dash", "Q"); AngelicAllianceHotKey = RegisterHotKey("Angelic Alliance Blessing", "G"); GodSlayerDashHotKey = RegisterHotKey("God Slayer Dash", "H"); + ExoChairSpeedupHotkey = RegisterHotKey("Exo Chair Speed Up", "LeftShift"); - if (!Main.dedServ) + if (!Main.dedServ) LoadClient(); ILChanges.Load(); @@ -266,6 +268,12 @@ namespace CalamityMod Filters.Scene["CalamityMod:Signus"] = new Filter(new SignusScreenShaderData("FilterMiniTower").UseColor(0.35f, 0.1f, 0.55f).UseOpacity(0.35f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:Signus"] = new SignusSky(); + Filters.Scene["CalamityMod:BossRush"] = new Filter(new BossRushScreenShader("FilterMiniTower").UseColor(BossRushSky.GeneralColor).UseOpacity(0.75f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:BossRush"] = new BossRushSky(); + + Filters.Scene["CalamityMod:ExoMechs"] = new Filter(new ExoMechsScreenShaderData("FilterMiniTower").UseColor(ExoMechsSky.DrawColor).UseOpacity(0.25f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:ExoMechs"] = new ExoMechsSky(); + SkyManager.Instance["CalamityMod:Astral"] = new AstralSky(); SkyManager.Instance["CalamityMod:Cryogen"] = new CryogenSky(); SkyManager.Instance["CalamityMod:StormWeaverFlash"] = new StormWeaverFlashSky(); @@ -275,7 +283,14 @@ namespace CalamityMod RipperUI.Load(); AstralArcanumUI.Load(this); + Apollo.LoadHeadIcons(); + Artemis.LoadHeadIcons(); + Polterghast.LoadHeadIcons(); SupremeCalamitas.LoadHeadIcons(); + ThanatosHead.LoadHeadIcons(); + ThanatosBody1.LoadHeadIcons(); + ThanatosBody2.LoadHeadIcons(); + ThanatosTail.LoadHeadIcons(); GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(0, 255, 171), ((float)player.Calamity().adrenaline / (float)player.Calamity().adrenalineMax)))); GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(255, 83, 48), ((float)player.Calamity().rage / (float)player.Calamity().rageMax)))); @@ -544,10 +559,10 @@ namespace CalamityMod { ModContent.NPCType(), 5400 }, { ModContent.NPCType(), 7200 }, { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 3600 }, - { ModContent.NPCType(), 3600 }, - { ModContent.NPCType(), 3600 }, - { ModContent.NPCType(), 3600 }, + { ModContent.NPCType(), 5400 }, + { ModContent.NPCType(), 5400 }, + { ModContent.NPCType(), 5400 }, + { ModContent.NPCType(), 5400 }, { ModContent.NPCType(), 10800 }, { ModContent.NPCType(), 7200 }, { ModContent.NPCType(), 7200 }, @@ -821,13 +836,45 @@ namespace CalamityMod priority = MusicPriority.BossMedium; } } + + // This section handles boss rush music. However, at the time of PR-ing the boss rush visuals branch not all + // of the boss rush themes have been completed. As such, the custom music is intentionally omitted for the time being. + /* + if (BossRushEvent.BossRushActive && BossRushEvent.StartTimer >= BossRushEvent.StartEffectTotalTime) + { + music = BossRushEvent.MusicToPlay; + priority = MusicPriority.BossHigh; + } + */ } } } - #endregion + #endregion - #region Mod Support - public override void PostSetupContent() => WeakReferenceSupport.Setup(); + #region Lighting Effects + public override void ModifySunLightColor(ref Color tileColor, ref Color backgroundColor) + { + if (Main.gameMenu) + BossRushEvent.StartTimer = 0; + + if (BossRushEvent.BossRushActive || BossRushEvent.StartTimer > 0) + { + backgroundColor = Color.Lerp(backgroundColor, Color.LightGray, BossRushEvent.StartTimer / (float)BossRushEvent.StartEffectTotalTime); + tileColor = Color.Lerp(tileColor, Color.LightGray, BossRushEvent.StartTimer / (float)BossRushEvent.StartEffectTotalTime); + } + else if (SkyManager.Instance["CalamityMod:ExoMechs"].IsActive()) + { + float intensity = SkyManager.Instance["CalamityMod:ExoMechs"].Opacity; + backgroundColor = Color.Lerp(backgroundColor, Color.DarkGray, intensity * 0.9f); + backgroundColor = Color.Lerp(backgroundColor, Color.Black, intensity * 0.67f); + tileColor = Color.Lerp(tileColor, Color.DarkGray, intensity * 0.8f); + tileColor = Color.Lerp(tileColor, Color.Black, intensity * 0.3f); + } + } + #endregion + + #region Mod Support + public override void PostSetupContent() => WeakReferenceSupport.Setup(); public override object Call(params object[] args) => ModCalls.Call(args); #endregion @@ -920,6 +967,13 @@ namespace CalamityMod CalamitasEnchantUI.Draw(Main.spriteBatch); return true; }, InterfaceScaleType.None)); + + // Codebreaker UI. + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Codebreaker Decryption GUI", () => + { + CodebreakerUI.Draw(Main.spriteBatch); + return true; + }, InterfaceScaleType.None)); // Popup GUIs. layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Popup GUIs", () => @@ -927,6 +981,14 @@ namespace CalamityMod PopupGUIManager.UpdateAndDraw(Main.spriteBatch); return true; }, InterfaceScaleType.None)); + + // Exo Mech selection. + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Exo Mech Selection", () => + { + if (Main.LocalPlayer.Calamity().AbleToSelectExoMech) + ExoMechSelectionUI.Draw(Main.spriteBatch); + return true; + }, InterfaceScaleType.None)); } // Invasion UIs. diff --git a/CalamityNetcode.cs b/CalamityNetcode.cs index bfcc9a9013..0dcb703949 100644 --- a/CalamityNetcode.cs +++ b/CalamityNetcode.cs @@ -184,6 +184,15 @@ namespace CalamityMod case CalamityModMessageType.LabHologramProjector: TELabHologramProjector.ReadSyncPacket(mod, reader); break; + case CalamityModMessageType.UpdateCodebreakerConstituents: + TECodebreaker.ReadConstituentsUpdateSync(mod, reader); + break; + case CalamityModMessageType.UpdateCodebreakerContainedStuff: + TECodebreaker.ReadContainmentSync(mod, reader); + break; + case CalamityModMessageType.UpdateCodebreakerDecryptCountdown: + TECodebreaker.ReadDecryptCountdownSync(mod, reader); + break; // // Boss Rush @@ -193,6 +202,12 @@ namespace CalamityMod int stage = reader.ReadInt32(); BossRushEvent.BossRushStage = stage; break; + case CalamityModMessageType.BossRushStartTimer: + BossRushEvent.StartTimer = reader.ReadInt32(); + break; + case CalamityModMessageType.BossRushEndTimer: + BossRushEvent.EndTimer = reader.ReadInt32(); + break; case CalamityModMessageType.BossSpawnCountdownSync: int countdown2 = reader.ReadInt32(); CalamityWorld.bossSpawnCountdown = countdown2; @@ -201,6 +216,9 @@ namespace CalamityMod int type = reader.ReadInt32(); CalamityWorld.bossType = type; break; + case CalamityModMessageType.EndBossRush: + BossRushEvent.EndEffects(); + break; case CalamityModMessageType.BRHostileProjKillSync: int countdown3 = reader.ReadInt32(); CalamityWorld.bossRushHostileProjKillCounter = countdown3; @@ -225,6 +243,17 @@ namespace CalamityMod CalamityWorld.encounteredOldDuke = reader.ReadBoolean(); break; + // + // Draedon Summoner stuff + // + case CalamityModMessageType.CodebreakerSummonStuff: + CalamityWorld.DraedonSummonCountdown = reader.ReadInt32(); + CalamityWorld.DraedonSummonPosition = reader.ReadVector2(); + break; + case CalamityModMessageType.ExoMechSelection: + CalamityWorld.DraedonMechToSummon = (ExoMech)reader.ReadInt32(); + break; + // // Death Mode environmental syncs // @@ -340,11 +369,21 @@ namespace CalamityMod ChargingStationItemChange, Turret, LabHologramProjector, + UpdateCodebreakerConstituents, + UpdateCodebreakerContainedStuff, + UpdateCodebreakerDecryptCountdown, + + // Draedon Summoner + CodebreakerSummonStuff, + ExoMechSelection, // Boss Rush BossRushStage, + BossRushStartTimer, + BossRushEndTimer, BossSpawnCountdownSync, BossTypeSync, + EndBossRush, BRHostileProjKillSync, // TODO -- Simplify this. Only one packet needs be sent: "kill all hostile projectiles for N frames". TeleportPlayer, // also used by Astral Arcanum. diff --git a/CustomRecipes/ArsenalTierGatedRecipe.cs b/CustomRecipes/ArsenalTierGatedRecipe.cs new file mode 100644 index 0000000000..daae8f3b9a --- /dev/null +++ b/CustomRecipes/ArsenalTierGatedRecipe.cs @@ -0,0 +1,55 @@ +using CalamityMod.World; +using Terraria.ModLoader; + +namespace CalamityMod.CustomRecipes +{ + public class ArsenalTierGatedRecipe : ModRecipe + { + public int Tier; + public bool AllowedInOldWorlds; + public ArsenalTierGatedRecipe(Mod mod, int tier, bool allowedInOldWorlds = false) : base(mod) + { + Tier = tier; + AllowedInOldWorlds = allowedInOldWorlds; + } + + public static bool HasTierBeenLearned(int tier) + { + switch (tier) + { + case 1: + return RecipeUnlockHandler.HasUnlockedT1ArsenalRecipes; + case 2: + return RecipeUnlockHandler.HasUnlockedT2ArsenalRecipes; + case 3: + return RecipeUnlockHandler.HasUnlockedT3ArsenalRecipes; + case 4: + return RecipeUnlockHandler.HasUnlockedT4ArsenalRecipes; + case 5: + return RecipeUnlockHandler.HasUnlockedT5ArsenalRecipes; + } + return false; + } + + public override bool RecipeAvailable() + { + if (AllowedInOldWorlds && !CalamityWorld.IsWorldAfterDraedonUpdate) + return true; + + switch (Tier) + { + case 1: + return RecipeUnlockHandler.HasUnlockedT1ArsenalRecipes; + case 2: + return RecipeUnlockHandler.HasUnlockedT2ArsenalRecipes; + case 3: + return RecipeUnlockHandler.HasUnlockedT3ArsenalRecipes; + case 4: + return RecipeUnlockHandler.HasUnlockedT4ArsenalRecipes; + case 5: + return RecipeUnlockHandler.HasUnlockedT5ArsenalRecipes; + } + return false; + } + } +} \ No newline at end of file diff --git a/CustomRecipes/RecipeUnlockHandler.cs b/CustomRecipes/RecipeUnlockHandler.cs new file mode 100644 index 0000000000..7950a1f1fe --- /dev/null +++ b/CustomRecipes/RecipeUnlockHandler.cs @@ -0,0 +1,100 @@ +using System.Collections.Generic; +using System.IO; +using Terraria; + +namespace CalamityMod.CustomRecipes +{ + public static class RecipeUnlockHandler + { + public static bool HasUnlockedT1ArsenalRecipes = false; + public static bool HasUnlockedT2ArsenalRecipes = false; + public static bool HasUnlockedT3ArsenalRecipes = false; + public static bool HasUnlockedT4ArsenalRecipes = false; + public static bool HasUnlockedT5ArsenalRecipes = false; + + public static bool HasFoundSunkenSeaSchematic = false; + public static bool HasFoundPlanetoidSchematic = false; + public static bool HasFoundJungleSchematic = false; + public static bool HasFoundHellSchematic = false; + public static bool HasFoundIceSchematic = false; + + public static void Save(List boolTagContainer) + { + boolTagContainer.AddWithCondition("HasUnlockedT1ArsenalRecipes", HasUnlockedT1ArsenalRecipes); + boolTagContainer.AddWithCondition("HasUnlockedT2ArsenalRecipes", HasUnlockedT2ArsenalRecipes); + boolTagContainer.AddWithCondition("HasUnlockedT3ArsenalRecipes", HasUnlockedT3ArsenalRecipes); + boolTagContainer.AddWithCondition("HasUnlockedT4ArsenalRecipes", HasUnlockedT4ArsenalRecipes); + boolTagContainer.AddWithCondition("HasUnlockedT5ArsenalRecipes", HasUnlockedT5ArsenalRecipes); + + boolTagContainer.AddWithCondition("HasFoundSunkenSeaSchematic", HasFoundSunkenSeaSchematic); + boolTagContainer.AddWithCondition("HasFoundPlanetoidSchematic", HasFoundPlanetoidSchematic); + boolTagContainer.AddWithCondition("HasFoundJungleSchematic", HasFoundJungleSchematic); + boolTagContainer.AddWithCondition("HasFoundHellSchematic", HasFoundHellSchematic); + boolTagContainer.AddWithCondition("HasFoundIceSchematic", HasFoundIceSchematic); + + HasUnlockedT1ArsenalRecipes = false; + HasUnlockedT2ArsenalRecipes = false; + HasUnlockedT3ArsenalRecipes = false; + HasUnlockedT4ArsenalRecipes = false; + HasUnlockedT5ArsenalRecipes = false; + + HasFoundSunkenSeaSchematic = false; + HasFoundPlanetoidSchematic = false; + HasFoundJungleSchematic = false; + HasFoundHellSchematic = false; + HasFoundIceSchematic = false; + } + + public static void Load(IList boolTagContainer) + { + HasUnlockedT1ArsenalRecipes = boolTagContainer.Contains("HasUnlockedT1ArsenalRecipes"); + HasUnlockedT2ArsenalRecipes = boolTagContainer.Contains("HasUnlockedT2ArsenalRecipes"); + HasUnlockedT3ArsenalRecipes = boolTagContainer.Contains("HasUnlockedT3ArsenalRecipes"); + HasUnlockedT4ArsenalRecipes = boolTagContainer.Contains("HasUnlockedT4ArsenalRecipes"); + HasUnlockedT5ArsenalRecipes = boolTagContainer.Contains("HasUnlockedT5ArsenalRecipes"); + + HasFoundSunkenSeaSchematic = boolTagContainer.Contains("HasFoundSunkenSeaSchematic"); + HasFoundPlanetoidSchematic = boolTagContainer.Contains("HasFoundPlanetoidSchematic"); + HasFoundJungleSchematic = boolTagContainer.Contains("HasFoundJungleSchematic"); + HasFoundHellSchematic = boolTagContainer.Contains("HasFoundHellSchematic"); + HasFoundIceSchematic = boolTagContainer.Contains("HasFoundIceSchematic"); + } + + public static void SendData(BinaryWriter writer) + { + BitsByte flags = new BitsByte(); + flags[0] = HasUnlockedT1ArsenalRecipes; + flags[1] = HasUnlockedT2ArsenalRecipes; + flags[2] = HasUnlockedT3ArsenalRecipes; + flags[3] = HasUnlockedT4ArsenalRecipes; + flags[4] = HasUnlockedT5ArsenalRecipes; + flags[5] = HasFoundSunkenSeaSchematic; + flags[6] = HasFoundPlanetoidSchematic; + flags[7] = HasFoundJungleSchematic; + + BitsByte flags2 = new BitsByte(); + flags2[0] = HasFoundHellSchematic; + flags2[1] = HasFoundIceSchematic; + + writer.Write(flags); + writer.Write(flags2); + } + + public static void ReceiveData(BinaryReader reader) + { + BitsByte flags = reader.ReadByte(); + HasUnlockedT1ArsenalRecipes = flags[0]; + HasUnlockedT2ArsenalRecipes = flags[1]; + HasUnlockedT3ArsenalRecipes = flags[2]; + HasUnlockedT4ArsenalRecipes = flags[3]; + HasUnlockedT5ArsenalRecipes = flags[4]; + HasFoundSunkenSeaSchematic = flags[5]; + HasFoundPlanetoidSchematic = flags[6]; + HasFoundJungleSchematic = flags[7]; + + BitsByte flags2 = reader.ReadByte(); + HasFoundHellSchematic = flags2[0]; + HasFoundIceSchematic = flags2[1]; + } + } +} \ No newline at end of file diff --git a/CustomRecipes/SchematicRecipe.cs b/CustomRecipes/SchematicRecipe.cs new file mode 100644 index 0000000000..f097834200 --- /dev/null +++ b/CustomRecipes/SchematicRecipe.cs @@ -0,0 +1,33 @@ +using CalamityMod.World; +using Terraria.ModLoader; + +namespace CalamityMod.CustomRecipes +{ + public class SchematicRecipe : ModRecipe + { + public string SchematicName; + public SchematicRecipe(Mod mod, string schematicName) : base(mod) => SchematicName = schematicName; + + public override bool RecipeAvailable() + { + // Allow old worlds to craft the new schematics; They don't exist in old worlds + if (!CalamityWorld.IsWorldAfterDraedonUpdate) + return true; + + switch (SchematicName) + { + case "Sunken Sea": + return RecipeUnlockHandler.HasFoundSunkenSeaSchematic; + case "Planetoid": + return RecipeUnlockHandler.HasFoundPlanetoidSchematic; + case "Jungle": + return RecipeUnlockHandler.HasFoundJungleSchematic; + case "Hell": + return RecipeUnlockHandler.HasFoundHellSchematic; + case "Ice": + return RecipeUnlockHandler.HasFoundIceSchematic; + } + return false; + } + } +} \ No newline at end of file diff --git a/DataStructures/BezierCurve.cs b/DataStructures/BezierCurve.cs index 5bc5fb5efc..d814ab2e43 100644 --- a/DataStructures/BezierCurve.cs +++ b/DataStructures/BezierCurve.cs @@ -25,16 +25,16 @@ namespace CalamityMod.DataStructures private Vector2 PrivateEvaluate(Vector2[] points, float T) { - if (points.Length > 2) + while (points.Length > 2) { Vector2[] nextPoints = new Vector2[points.Length - 1]; for (int k = 0; k < points.Length - 1; k++) nextPoints[k] = Vector2.Lerp(points[k], points[k + 1], T); - return PrivateEvaluate(nextPoints, T); + points = nextPoints; } - else - return Vector2.Lerp(points[0], points[1], T); + + return Vector2.Lerp(points[0], points[1], T); } } } diff --git a/DataStructures/DoGCartSegment.cs b/DataStructures/DoGCartSegment.cs new file mode 100644 index 0000000000..e2f3ef6ba8 --- /dev/null +++ b/DataStructures/DoGCartSegment.cs @@ -0,0 +1,31 @@ +using Microsoft.Xna.Framework; +using Terraria; + +namespace CalamityMod.DataStructures +{ + public class DoGCartSegment + { + public Vector2 Center; + public float Rotation; + public int OldDirection; + public void Update(Player player, Vector2 aheadPosition, float idealRotation) + { + int direction = (player.velocity.SafeNormalize(Vector2.UnitX * player.direction).X > 0f).ToDirectionInt(); + if (player.velocity.X == 0f) + direction = player.direction; + if (OldDirection != direction) + { + // Flip the segments if the player flips their direction. + if (OldDirection != 0) + Center = player.Center - Center + player.Center; + + OldDirection = direction; + } + + Vector2 offsetDirection = (aheadPosition - Center).SafeNormalize(Vector2.Zero); + offsetDirection = offsetDirection.ToRotation().AngleTowards(idealRotation, 0.2f).ToRotationVector2(); + Rotation = offsetDirection.ToRotation(); + Center = aheadPosition - offsetDirection * 20f; + } + } +} diff --git a/Dusts/CalamityDusts.cs b/Dusts/CalamityDusts.cs index 7c4c028027..debcec0fd6 100644 --- a/Dusts/CalamityDusts.cs +++ b/Dusts/CalamityDusts.cs @@ -12,7 +12,9 @@ namespace CalamityMod.Dusts Phantoplasm = 60, Plague = 46, ProfanedFire = 244, - Nightwither = 185, - PurpleCosmolite = 173 + Nightwither = 185, + PurpleCosmilite = 173, + // This is what God Slayer Slugs use, at least. I'm not sure about other Cosmilite stuff, didn't bother to check. + BlueCosmilite = 180, } } \ No newline at end of file diff --git a/Effects/BordernadoFire.xnb b/Effects/BordernadoFire.xnb index 7dff3c4fba..9442fdfed4 100644 Binary files a/Effects/BordernadoFire.xnb and b/Effects/BordernadoFire.xnb differ diff --git a/Effects/CalamityShaders.cs b/Effects/CalamityShaders.cs index 7993b3bcd4..57c7475a92 100644 --- a/Effects/CalamityShaders.cs +++ b/Effects/CalamityShaders.cs @@ -12,22 +12,27 @@ namespace CalamityMod.Effects public static Effect LightShader; public static Effect SCalMouseShader; public static Effect TentacleShader; + public static Effect TeleportDisplacementShader; public static Effect LightDistortionShader; public static Effect PhaseslayerRipShader; public static Effect FadedUVMapStreakShader; + public static Effect FlameStreakShader; public static Effect FadingSolidTrailShader; public static Effect ScarletDevilShader; public static Effect BordernadoFireShader; public static Effect PrismCrystalShader; + public static Effect ImpFlameTrailShader; public static Effect SCalShieldShader; public static void LoadShaders() { if (Main.dedServ) return; + AstralFogShader = CalamityMod.Instance.GetEffect("Effects/CustomShader"); LightShader = CalamityMod.Instance.GetEffect("Effects/LightBurstShader"); TentacleShader = CalamityMod.Instance.GetEffect("Effects/TentacleShader"); + TeleportDisplacementShader = CalamityMod.Instance.GetEffect("Effects/TeleportDisplacementShader"); SCalMouseShader = CalamityMod.Instance.GetEffect("Effects/SCalMouseShader"); LightDistortionShader = CalamityMod.Instance.GetEffect("Effects/DistortionShader"); PhaseslayerRipShader = CalamityMod.Instance.GetEffect("Effects/PhaseslayerRipShader"); @@ -35,7 +40,9 @@ namespace CalamityMod.Effects BordernadoFireShader = CalamityMod.Instance.GetEffect("Effects/BordernadoFire"); PrismCrystalShader = CalamityMod.Instance.GetEffect("Effects/PrismCrystalStreak"); FadedUVMapStreakShader = CalamityMod.Instance.GetEffect("Effects/FadedUVMapStreak"); + FlameStreakShader = CalamityMod.Instance.GetEffect("Effects/Flame"); FadingSolidTrailShader = CalamityMod.Instance.GetEffect("Effects/FadingSolidTrail"); + ImpFlameTrailShader = CalamityMod.Instance.GetEffect("Effects/ImpFlameTrail"); SCalShieldShader = CalamityMod.Instance.GetEffect("Effects/SupremeShieldShader"); Filters.Scene["CalamityMod:Astral"] = new Filter(new AstralScreenShaderData(new Ref(AstralFogShader), "AstralPass").UseColor(0.18f, 0.08f, 0.24f), EffectPriority.VeryHigh); @@ -45,13 +52,16 @@ namespace CalamityMod.Effects GameShaders.Misc["CalamityMod:FireMouse"] = new MiscShaderData(new Ref(SCalMouseShader), "DyePass"); GameShaders.Misc["CalamityMod:SubsumingTentacle"] = new MiscShaderData(new Ref(TentacleShader), "BurstPass"); + GameShaders.Misc["CalamityMod:TeleportDisplacement"] = new MiscShaderData(new Ref(TeleportDisplacementShader), "GlitchPass"); GameShaders.Misc["CalamityMod:LightDistortion"] = new MiscShaderData(new Ref(LightDistortionShader), "DistortionPass"); GameShaders.Misc["CalamityMod:PhaseslayerRipEffect"] = new MiscShaderData(new Ref(PhaseslayerRipShader), "TrailPass"); GameShaders.Misc["CalamityMod:TrailStreak"] = new MiscShaderData(new Ref(FadedUVMapStreakShader), "TrailPass"); + GameShaders.Misc["CalamityMod:Flame"] = new MiscShaderData(new Ref(FlameStreakShader), "TrailPass"); GameShaders.Misc["CalamityMod:FadingSolidTrail"] = new MiscShaderData(new Ref(FadingSolidTrailShader), "TrailPass"); GameShaders.Misc["CalamityMod:OverpoweredTouhouSpearShader"] = new MiscShaderData(new Ref(ScarletDevilShader), "TrailPass"); GameShaders.Misc["CalamityMod:Bordernado"] = new MiscShaderData(new Ref(BordernadoFireShader), "TrailPass"); GameShaders.Misc["CalamityMod:PrismaticStreak"] = new MiscShaderData(new Ref(PrismCrystalShader), "TrailPass"); + GameShaders.Misc["CalamityMod:ImpFlameTrail"] = new MiscShaderData(new Ref(ImpFlameTrailShader), "TrailPass"); GameShaders.Misc["CalamityMod:SupremeShield"] = new MiscShaderData(new Ref(SCalShieldShader), "ShieldPass"); } } diff --git a/Effects/Dyes/AerialiteDyeShader.fx b/Effects/Dyes/AerialiteDyeShader.fx new file mode 100644 index 0000000000..ba6cfd4afd --- /dev/null +++ b/Effects/Dyes/AerialiteDyeShader.fx @@ -0,0 +1,57 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float BlendFunction(float from, float to) +{ + return (to <= 0.5) ? 2.22 * from * to : 1 - 2.22 * (1 - from) * (1 - to); +} +float3 BlendColor(float3 from, float3 to) +{ + return float3(BlendFunction(from.r, to.r), BlendFunction(from.g, to.g), BlendFunction(from.b, to.b)); +} + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; + + // Calculate an updraft noise color. This takes world position into account, allowing movement to influence the shader. + float updraftXCoord = sin(3.141 * frac(coords.x + uWorldPosition.x * 0.0003)); + float updraftYCoord = sin(3.141 * frac(pow(frameY, 4) + uTime * 1.21 + uWorldPosition.y * 0.0003)); + float2 updraftCoords = float2(updraftXCoord, updraftYCoord); + float4 updraftNoiseColor = tex2D(uImage1, updraftCoords * float2(0.075, 0.03)); + + float4 color = tex2D(uImage0, coords); + + // Calculate a cloud color based on noise. + float4 cloudColor = tex2D(uImage1, float2(coords.x + uTime * 0.11, frameY)); + cloudColor = pow(cloudColor, 2); + + // Calculate the updraft color based on the noise. + float4 updraftColor = float4(uSecondaryColor, 1) * pow(updraftNoiseColor.r, 3) * 4.7; + + // Along with the metal. + float4 metalColor = lerp(color, float4(BlendColor(color.rgb * 0.6, uColor), 1), 0.7); + + // And mix it all together. + return (color * 0.35 + metalColor * 0.65 + updraftColor * 0.8 + cloudColor * 0.3) * color.a * 0.85; +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/AerialiteDyeShader.xnb b/Effects/Dyes/AerialiteDyeShader.xnb new file mode 100644 index 0000000000..da8868af01 Binary files /dev/null and b/Effects/Dyes/AerialiteDyeShader.xnb differ diff --git a/Effects/Dyes/AstralBlueDyeShader.xnb b/Effects/Dyes/AstralBlueDyeShader.xnb index 9757c6ec19..e49d82be14 100644 Binary files a/Effects/Dyes/AstralBlueDyeShader.xnb and b/Effects/Dyes/AstralBlueDyeShader.xnb differ diff --git a/Effects/Dyes/AstralDyeShader.fx b/Effects/Dyes/AstralDyeShader.fx new file mode 100644 index 0000000000..df5d38fc28 --- /dev/null +++ b/Effects/Dyes/AstralDyeShader.fx @@ -0,0 +1,46 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; + + // Calculate noise for red flames. + float flameXCoord = sin(3.141 * frac(coords.x + 0.56)); + float flameYCoord = sin(3.141 * frac(frameY + uTime * 0.21)); + float2 flameCoords = float2(flameXCoord, flameYCoord); + float4 noiseColor = tex2D(uImage1, float2(coords.x, frameY) * 0.4); + + float4 color = tex2D(uImage0, coords); + + // Calculate the flame noise based on zoomed in noise coordinates. + float4 flameNoiseColor = tex2D(uImage1, flameCoords * float2(0.05, 0.06)); + float4 flameColor = float4(uSecondaryColor, 1) * pow(flameNoiseColor.r, 4) * 4.7; + + // Calculate the astal stone color by approaching the first inputted color from the pixel color with linear interpolation. + float4 stoneColor = lerp(color, float4(uColor, 1), 0.55) * color.a; + + // Become notably darker to reinforce the stone aesthetic. + stoneColor.rgb *= 0.2 + noiseColor.r * 0.65; + return (stoneColor + flameColor * 0.4) * color.a; +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/Dyes/AstralDyeShader.xnb b/Effects/Dyes/AstralDyeShader.xnb new file mode 100644 index 0000000000..2d0d8cd273 Binary files /dev/null and b/Effects/Dyes/AstralDyeShader.xnb differ diff --git a/Effects/Dyes/AstralOrangeDyeShader.xnb b/Effects/Dyes/AstralOrangeDyeShader.xnb index c420c03742..3b3ba572d1 100644 Binary files a/Effects/Dyes/AstralOrangeDyeShader.xnb and b/Effects/Dyes/AstralOrangeDyeShader.xnb differ diff --git a/Effects/Dyes/AstralSwirlDyeShader.xnb b/Effects/Dyes/AstralSwirlDyeShader.xnb index 0d70f87796..8cb8335ce7 100644 Binary files a/Effects/Dyes/AstralSwirlDyeShader.xnb and b/Effects/Dyes/AstralSwirlDyeShader.xnb differ diff --git a/Effects/Dyes/AuricDyeShader.fx b/Effects/Dyes/AuricDyeShader.fx new file mode 100644 index 0000000000..79b22fa0e0 --- /dev/null +++ b/Effects/Dyes/AuricDyeShader.fx @@ -0,0 +1,46 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; + + // Define a baseline gold color. This will be used when creating a reflective metal texture. + float3 goldColor = float3(228 / 255.0, 175 / 255.0, 72 / 255.0); + + // Calculate noise with a zoomed in Y texture coordinate. + float4 noiseColor = tex2D(uImage1, float2(coords.x, sin(3.141 * frac(frameY + frac(uTime * 0.51)))) * 0.067); + float4 color = tex2D(uImage0, coords); + + // Calculate a degree of shine depending on the noise. This is greatly expanded depending on the result. + float shineFactor = pow(noiseColor.r, 0.8); + color *= lerp(0.7, 5, shineFactor); + float3 metalColor = lerp(uColor, uSecondaryColor, shineFactor); + + // Fade to the metal color with linear interpolation. + color.rgb = lerp(color.rgb, metalColor, lerp(0.35, 0.8, shineFactor)); + + // Use a specialized blend method to create the shine effect. + color.rgb = (length(color.rgb) <= 0.5) ? 2 * color.rgb * goldColor : 1 - 2 * (1 - color.rgb) * (1 - goldColor); + return (color + noiseColor * 0.45) * color.a; +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/AuricDyeShader.xnb b/Effects/Dyes/AuricDyeShader.xnb new file mode 100644 index 0000000000..043a2aa01f Binary files /dev/null and b/Effects/Dyes/AuricDyeShader.xnb differ diff --git a/Effects/Dyes/BloodflareDyeShader.xnb b/Effects/Dyes/BloodflareDyeShader.xnb index 534222798e..38f007ade2 100644 Binary files a/Effects/Dyes/BloodflareDyeShader.xnb and b/Effects/Dyes/BloodflareDyeShader.xnb differ diff --git a/Effects/Dyes/BrimflameDyeShader.fx b/Effects/Dyes/BrimflameDyeShader.fx new file mode 100644 index 0000000000..a1ed9c52e5 --- /dev/null +++ b/Effects/Dyes/BrimflameDyeShader.fx @@ -0,0 +1,40 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; + float4 color = tex2D(uImage0, coords); + + float3 alteredColor = lerp(uColor, float3(1, 0, 0), 0.65); + float3 alteredSecondaryColor = lerp(uSecondaryColor, float3(1, 0, 0), 0.65); + + // Fade out at the edges of the trail to give a blur effect. + // This is very important. + float flameStreakBrightness = tex2D(uImage1, float2(frac(frameY + uTime * 1.4) * 0.4, coords.x * 0.65)).r; + float fadeToRed = lerp(0.2, 1, flameStreakBrightness); + float3 flameColor = lerp(alteredColor, alteredSecondaryColor, fadeToRed); + flameColor.r = 0.6 + sqrt(fadeToRed) * 0.4; + color = lerp(color, float4(flameColor, 1), 0.45) * color.a; + return color * lerp(1.3, 5.4, pow(flameStreakBrightness, 4.44)); +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/BrimflameDyeShader.xnb b/Effects/Dyes/BrimflameDyeShader.xnb new file mode 100644 index 0000000000..bc24979c8f Binary files /dev/null and b/Effects/Dyes/BrimflameDyeShader.xnb differ diff --git a/Effects/Dyes/CalamitousDyeShader.xnb b/Effects/Dyes/CalamitousDyeShader.xnb index 4287b463b7..6b978597fa 100644 Binary files a/Effects/Dyes/CalamitousDyeShader.xnb and b/Effects/Dyes/CalamitousDyeShader.xnb differ diff --git a/Effects/Dyes/CeaselessDyeShader.xnb b/Effects/Dyes/CeaselessDyeShader.xnb index 027bcbf063..6981b49bd1 100644 Binary files a/Effects/Dyes/CeaselessDyeShader.xnb and b/Effects/Dyes/CeaselessDyeShader.xnb differ diff --git a/Effects/Dyes/CosmicFlameShader.fx b/Effects/Dyes/CosmicFlameShader.fx index c1dee78a4f..c22f1386bd 100644 --- a/Effects/Dyes/CosmicFlameShader.fx +++ b/Effects/Dyes/CosmicFlameShader.fx @@ -16,11 +16,11 @@ float2 uImageSize1; float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 { float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. - float2 swirlOffset = float2(sin(uTime * 0.96 + 1.754) * 0.31, sin(uTime * 0.96) * 0.16) * uSaturation; + float2 swirlOffset = float2(sin(uTime * 0.26 + 1.754) * 0.31, sin(uTime * 0.26) * 0.16) * uSaturation; float4 color = tex2D(uImage0, coords); - float4 noiseColor = tex2D(uImage1, frac(float2(coords.x, frameY + uTime * 0.36) + swirlOffset - uWorldPosition * 0.0006) * 0.26); + float4 noiseColor = tex2D(uImage1, frac(float2(coords.x, frameY + uTime * 0.16) + swirlOffset - uWorldPosition * 0.0006) * 0.26); float4 flameColor = tex2D(uImage1, frac(float2(coords.x, frameY + uTime * 0.44)) * 0.1); - float brightnessFactor = noiseColor.r * 2; + float brightnessFactor = lerp(noiseColor.r, noiseColor.g, sin(uTime * 2.46) * 0.5 + 0.5) * 2.35; float normalizedDistanceFromCenter = distance(float2(coords.x, frameY), float2(0.5, 0.5)) * 2; diff --git a/Effects/Dyes/CosmicFlameShader.xnb b/Effects/Dyes/CosmicFlameShader.xnb index a526ff1430..5855010558 100644 Binary files a/Effects/Dyes/CosmicFlameShader.xnb and b/Effects/Dyes/CosmicFlameShader.xnb differ diff --git a/Effects/Dyes/CosmiliteDyeShader.fx b/Effects/Dyes/CosmiliteDyeShader.fx new file mode 100644 index 0000000000..9d82f896ee --- /dev/null +++ b/Effects/Dyes/CosmiliteDyeShader.fx @@ -0,0 +1,39 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; + float4 color = tex2D(uImage0, coords); + + float3 cosmiliteMetalColor = float3(122 / 255.0, 127 / 255.0, 155 / 255.0); + float4 noiseColor = tex2D(uImage1, float2(coords.x, frac(frameY + uTime * 1.51)) * 0.12); + float4 noiseColor2 = tex2D(uImage1, float2(coords.x, frac(frameY + uTime * 1.51 - 0.458)) * 0.12); + float opacity = color.a; + float3 baseColor = lerp(uColor, cosmiliteMetalColor, 0.3) * (1 - pow(noiseColor.r, 3) * 0.5); + baseColor = lerp(color.rgb, baseColor, 0.67); + baseColor *= 1 + pow(baseColor, 5).r * 8 - noiseColor2.r * 1.25; + baseColor = lerp(baseColor, uSecondaryColor * 2, pow(noiseColor.r, 2)); + + return float4(baseColor, 1) * opacity; +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/CosmiliteDyeShader.xnb b/Effects/Dyes/CosmiliteDyeShader.xnb new file mode 100644 index 0000000000..a93ea59ac9 Binary files /dev/null and b/Effects/Dyes/CosmiliteDyeShader.xnb differ diff --git a/Effects/Dyes/CryonicDyeShader.xnb b/Effects/Dyes/CryonicDyeShader.xnb index 93b9009e6a..b86a3506e9 100644 Binary files a/Effects/Dyes/CryonicDyeShader.xnb and b/Effects/Dyes/CryonicDyeShader.xnb differ diff --git a/Effects/Dyes/DefiledFlameDyeShader.xnb b/Effects/Dyes/DefiledFlameDyeShader.xnb index 6ffdc1214b..84676f2986 100644 Binary files a/Effects/Dyes/DefiledFlameDyeShader.xnb and b/Effects/Dyes/DefiledFlameDyeShader.xnb differ diff --git a/Effects/Dyes/DragonSoulDyeShader.xnb b/Effects/Dyes/DragonSoulDyeShader.xnb index f1f7b0901c..e1c9fcdecd 100644 Binary files a/Effects/Dyes/DragonSoulDyeShader.xnb and b/Effects/Dyes/DragonSoulDyeShader.xnb differ diff --git a/Effects/Dyes/ElementalDyeShader.xnb b/Effects/Dyes/ElementalDyeShader.xnb index d1eb643a82..7d9e250e94 100644 Binary files a/Effects/Dyes/ElementalDyeShader.xnb and b/Effects/Dyes/ElementalDyeShader.xnb differ diff --git a/Effects/Dyes/EndothermicDyeShader.xnb b/Effects/Dyes/EndothermicDyeShader.xnb index 3477734ded..cb7b1beb6a 100644 Binary files a/Effects/Dyes/EndothermicDyeShader.xnb and b/Effects/Dyes/EndothermicDyeShader.xnb differ diff --git a/Effects/Dyes/ExoDyeShader.fx b/Effects/Dyes/ExoDyeShader.fx new file mode 100644 index 0000000000..5c2192701c --- /dev/null +++ b/Effects/Dyes/ExoDyeShader.fx @@ -0,0 +1,69 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +float3 specialPalette[9] = +{ + float3(250, 255, 112) / 255.0, + float3(211, 235, 108) / 255.0, + float3(166, 240, 105) / 255.0, + float3(105, 240, 220) / 255.0, + float3(64, 130, 145) / 255.0, + float3(145, 96, 145) / 255.0, + float3(242, 112, 73) / 255.0, + float3(199, 62, 62) / 255.0, + float3(250, 255, 112) / 255.0, +}; + +float InverseLerp(float from, float to, float x) +{ + return saturate((x - from) / (to - from)); +} + +// Multi-color lerp which uses the palette. +float3 PaletteLerp(float interpolant) +{ + float startingIndex = floor(interpolant * 8); + float squashedInterpolant = frac(interpolant * 8); + return lerp(specialPalette[startingIndex], specialPalette[startingIndex + 1], squashedInterpolant); +} + +// (Co)sines use a lot of instructions. As such, a more linear wave constructed by moduli is used instead. +// Is this kind of ridiculous? Probably. But there's basically nothing I can do until 1.4 rolls around +// and the pathetically low instruction count cap is increased significantly. -Dominic +float TriangleWave(float x) +{ + if (x % 2 < 1) + return x % 2; + return -(x % 2) + 2; +} + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. + float4 noiseColor = tex2D(uImage1, float2(coords.x, frameY - uTime * 0.45) * 0.1); + float4 color = tex2D(uImage0, coords); + float3 blendColor = PaletteLerp(frac(frameY + uTime * 1.3)); + float blendFactor = (TriangleWave(uTime * 9 + coords.x * 2 - frameY * 2.1) * 0.5 + 0.5) * 0.5; + float brightness = (blendFactor * 0.4 + noiseColor.r * 0.9) * 1.2; + + float4 colorBlendMultiplier = lerp(float4(blendColor, 1), float4(1, 1, 1, 1), saturate(blendFactor * 1.5)); + return (lerp(color, float4(blendColor, 1), blendFactor * 0.5 + 0.2) * color.a) * colorBlendMultiplier * (1 + brightness); +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/ExoDyeShader.xnb b/Effects/Dyes/ExoDyeShader.xnb new file mode 100644 index 0000000000..c43b9ae8aa Binary files /dev/null and b/Effects/Dyes/ExoDyeShader.xnb differ diff --git a/Effects/Dyes/NightmareDyeShader.xnb b/Effects/Dyes/NightmareDyeShader.xnb index ebbf339232..246dc9627f 100644 Binary files a/Effects/Dyes/NightmareDyeShader.xnb and b/Effects/Dyes/NightmareDyeShader.xnb differ diff --git a/Effects/Dyes/PhantoplasmDyeShader.xnb b/Effects/Dyes/PhantoplasmDyeShader.xnb index d1d075c350..4b0384a249 100644 Binary files a/Effects/Dyes/PhantoplasmDyeShader.xnb and b/Effects/Dyes/PhantoplasmDyeShader.xnb differ diff --git a/Effects/Dyes/ProfanedFlameDyeShader.xnb b/Effects/Dyes/ProfanedFlameDyeShader.xnb index 8121fa4bfa..ae8ab62f8a 100644 Binary files a/Effects/Dyes/ProfanedFlameDyeShader.xnb and b/Effects/Dyes/ProfanedFlameDyeShader.xnb differ diff --git a/Effects/Dyes/ProfanedMoonlightDye.xnb b/Effects/Dyes/ProfanedMoonlightDye.xnb index c6650c5567..fcbbb887b5 100644 Binary files a/Effects/Dyes/ProfanedMoonlightDye.xnb and b/Effects/Dyes/ProfanedMoonlightDye.xnb differ diff --git a/Effects/Dyes/ReaverDyeShader.xnb b/Effects/Dyes/ReaverDyeShader.xnb index a1985cce56..0f1bb1d21b 100644 Binary files a/Effects/Dyes/ReaverDyeShader.xnb and b/Effects/Dyes/ReaverDyeShader.xnb differ diff --git a/Effects/Dyes/ShadowspecDyeShader.xnb b/Effects/Dyes/ShadowspecDyeShader.xnb index 6d2da86ec1..773d1339ab 100644 Binary files a/Effects/Dyes/ShadowspecDyeShader.xnb and b/Effects/Dyes/ShadowspecDyeShader.xnb differ diff --git a/Effects/Dyes/SlimeGodDyeShader.fx b/Effects/Dyes/SlimeGodDyeShader.fx new file mode 100644 index 0000000000..1aae18695a --- /dev/null +++ b/Effects/Dyes/SlimeGodDyeShader.fx @@ -0,0 +1,46 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; + float4 color = tex2D(uImage0, coords); + float4 noiseColor = tex2D(uImage1, float2(coords.x, frac(frameY - uTime * 0.27)) * 0.5) * 1.5; + float verticalFlowMovement = (sin(coords.x * 14.71 + frameY * 13.5 - uTime * 1.6) * 0.5 + 0.5) * noiseColor.r; + + // Adjust coords to have an offset to the sprite. + if (color.a == 0 && frameY < 0.82) + coords.y = saturate(coords.y + verticalFlowMovement / uSourceRect.w / 17); + + // Prepare the dark outlines. + float outlineFade = pow(1 - (color.r + color.g + color.b) / 3, 2); + color = lerp(color, float4(uColor * 0.8, 1), outlineFade * 0.7) * (color.a + outlineFade * color.a * 0.15); + + // Prepare the bright in-lines. + color = lerp(color, float4(uSecondaryColor * 0.85, 1), saturate(1 - outlineFade) * 0.4) * color.a; + + // Handle sludge fades based on noise. + color = lerp(color, float4(uSecondaryColor * 0.375, 1), pow(noiseColor.r, 3) * 0.3 + verticalFlowMovement * 0.3 + 0.13) * color.a; + + return color * (1 + (1 - outlineFade) * 0.1); +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/SlimeGodDyeShader.xnb b/Effects/Dyes/SlimeGodDyeShader.xnb new file mode 100644 index 0000000000..996324b2bb Binary files /dev/null and b/Effects/Dyes/SlimeGodDyeShader.xnb differ diff --git a/Effects/Dyes/StratusDyeShader.xnb b/Effects/Dyes/StratusDyeShader.xnb index 60b17c7761..5cf6bafdf6 100644 Binary files a/Effects/Dyes/StratusDyeShader.xnb and b/Effects/Dyes/StratusDyeShader.xnb differ diff --git a/Effects/FabstaffStreak.xnb b/Effects/FabstaffStreak.xnb index 9bf2e57eaa..d8ae178aed 100644 Binary files a/Effects/FabstaffStreak.xnb and b/Effects/FabstaffStreak.xnb differ diff --git a/Effects/FadedUVMapStreak.xnb b/Effects/FadedUVMapStreak.xnb index 0ccc66632f..ab7ac0bf48 100644 Binary files a/Effects/FadedUVMapStreak.xnb and b/Effects/FadedUVMapStreak.xnb differ diff --git a/Effects/FadingSolidTrail.xnb b/Effects/FadingSolidTrail.xnb index 1f44e50a54..b9c678eac6 100644 Binary files a/Effects/FadingSolidTrail.xnb and b/Effects/FadingSolidTrail.xnb differ diff --git a/Effects/Flame.fx b/Effects/Flame.fx new file mode 100644 index 0000000000..2fa2e1ffe6 --- /dev/null +++ b/Effects/Flame.fx @@ -0,0 +1,72 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +matrix uWorldViewProjection; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput) 0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +// The X coordinate is the trail completion, the Y coordinate is the same as any other. +// This is simply how the primitive TextCoord is layed out in the C# code. +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float4 color = input.Color; + float2 coords = input.TextureCoordinates; + + // Read the fade map as a streak. + float4 fadeMapColor = tex2D(uImage1, float2(frac(coords.y + cos(uTime) * 0.01), frac(coords.x - uTime * 1.4 * uSaturation))); + fadeMapColor.r *= pow(coords.x, 0.2); + + float opacity = lerp(1.45, 1.95, fadeMapColor.r) * color.a; + opacity *= pow(sin(coords.y * 3.141), lerp(1, 6, pow(coords.x, 2))); + opacity *= pow(sin(coords.x * 3.141), 0.4); + opacity *= fadeMapColor.r * 1.5 + 1; + opacity *= lerp(0.4, 0.9, fadeMapColor.r); + + float3 transformColor = lerp(float3(1, 205 / 255.0, 119 / 255.0), float3(1, 76 / 255.0, 79 / 255.0), fadeMapColor.r); + color.rgb = lerp(color.rgb, transformColor, fadeMapColor.r); + return color * opacity * 1.6; +} + +technique Technique1 +{ + pass TrailPass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/Flame.xnb b/Effects/Flame.xnb new file mode 100644 index 0000000000..b3778d965b Binary files /dev/null and b/Effects/Flame.xnb differ diff --git a/Effects/ImpFlameTrail.xnb b/Effects/ImpFlameTrail.xnb new file mode 100644 index 0000000000..bcd88aeb37 Binary files /dev/null and b/Effects/ImpFlameTrail.xnb differ diff --git a/Effects/PhaseslayerRipShader.xnb b/Effects/PhaseslayerRipShader.xnb index e51ba52a94..2f504e3583 100644 Binary files a/Effects/PhaseslayerRipShader.xnb and b/Effects/PhaseslayerRipShader.xnb differ diff --git a/Effects/PrismCrystalStreak.xnb b/Effects/PrismCrystalStreak.xnb index b0aed6e0a2..56f4eaa121 100644 Binary files a/Effects/PrismCrystalStreak.xnb and b/Effects/PrismCrystalStreak.xnb differ diff --git a/Effects/SCalMouseShader.xnb b/Effects/SCalMouseShader.xnb index 4c8990de6b..a3a34f5e0a 100644 Binary files a/Effects/SCalMouseShader.xnb and b/Effects/SCalMouseShader.xnb differ diff --git a/Effects/ScarletDevilStreak.xnb b/Effects/ScarletDevilStreak.xnb index 20fda783a8..7e4df7a9c9 100644 Binary files a/Effects/ScarletDevilStreak.xnb and b/Effects/ScarletDevilStreak.xnb differ diff --git a/Effects/SupremeShieldShader.xnb b/Effects/SupremeShieldShader.xnb index 5a46acbb23..69517504b6 100644 Binary files a/Effects/SupremeShieldShader.xnb and b/Effects/SupremeShieldShader.xnb differ diff --git a/Effects/TeleportDisplacementShader.fx b/Effects/TeleportDisplacementShader.fx new file mode 100644 index 0000000000..89eb599ac5 --- /dev/null +++ b/Effects/TeleportDisplacementShader.fx @@ -0,0 +1,42 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +float2 frameCount; + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + float frameY = coords.y * frameCount.y; + + // 17.07947 is 2pi * e, while 25.13274 is 8pi. + // When two sinusoids are added in this way and the periods of each sinusoid are irrational, + // the resulting sinusoid from the addition has no period, meaning that it has pseudo-random + // bumps and valleys. This is ideal for a glitch effect. The * 0.5 at the end is make the range + // of the result be -1 to 1 like a typical sine. + float offsetBase = (sin(frameY * 17.07947 + uTime * 16) + sin(coords.y * 25.13274)) * 0.5; + + // Here, a power is used to make the valleys and hills sharper, and bias everything else + // towards 0, making horizontal stretches more noticable and powerful when they happen. + // Higher values of uOpacity will result in more powerful offsets, with a uOpacity of 0 + // doing nothing at all. + float horizontalOffset = pow(offsetBase, 3) * uOpacity / frameCount.x * 0.46; + float2 samplePosition = float2(saturate(coords.x + horizontalOffset), coords.y); + return tex2D(uImage0, samplePosition) * float4(uSecondaryColor, uSaturation); +} +technique Technique1 +{ + pass GlitchPass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/TeleportDisplacementShader.xnb b/Effects/TeleportDisplacementShader.xnb new file mode 100644 index 0000000000..e36cadd48d Binary files /dev/null and b/Effects/TeleportDisplacementShader.xnb differ diff --git a/Enums/ExoMech.cs b/Enums/ExoMech.cs new file mode 100644 index 0000000000..bc83c71dda --- /dev/null +++ b/Enums/ExoMech.cs @@ -0,0 +1,10 @@ +namespace CalamityMod +{ + public enum ExoMech + { + None, + Destroyer, + Prime, + Twins + } +} diff --git a/Events/BossRushEvent.cs b/Events/BossRushEvent.cs index 8e7f94f3ed..33bd251e41 100644 --- a/Events/BossRushEvent.cs +++ b/Events/BossRushEvent.cs @@ -27,6 +27,7 @@ using CalamityMod.NPCs.SlimeGod; using CalamityMod.NPCs.StormWeaver; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.Yharon; +using CalamityMod.Projectiles.Typeless; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -84,7 +85,11 @@ namespace CalamityMod.Events public static List Bosses = new List(); public static Dictionary BossIDsAfterDeath = new Dictionary(); public static Dictionary> BossDeathEffects = new Dictionary>(); + public static int StartTimer; + public static int EndTimer; public static readonly Color XerocTextColor = Color.LightCoral; + public const int StartEffectTotalTime = 120; + public const int EndVisualEffectTime = 340; public static int ClosestPlayerToWorldCenter => Player.FindClosest(new Vector2(Main.maxTilesX, Main.maxTilesY) * 16f * 0.5f, 1, 1); public static int CurrentlyFoughtBoss => Bosses[BossRushStage].EntityID; public static int NextBossToFight => Bosses[BossRushStage + 1].EntityID; @@ -287,7 +292,7 @@ namespace CalamityMod.Events } Main.PlaySound(CalamityMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SupremeCalamitasSpawn"), Main.player[ClosestPlayerToWorldCenter].Center); CalamityUtils.SpawnBossBetter(Main.player[ClosestPlayerToWorldCenter].Top - new Vector2(42f, 84f), type); - }, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), + }, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), new Boss(ModContent.NPCType(), TimeChangeContext.Day, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType() }), @@ -321,22 +326,11 @@ namespace CalamityMod.Events }, [ModContent.NPCType()] = npc => { - DropHelper.DropItem(npc, ModContent.ItemType(), true); - BossRushStage = 0; CalamityUtils.KillAllHostileProjectiles(); CalamityWorld.bossRushHostileProjKillCounter = 3; - BossRushActive = false; - CalamityNetcode.SyncWorld(); - if (Main.netMode == NetmodeID.Server) - { - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossRushStage); - netMessage.Write(BossRushStage); - netMessage.Send(); - } - - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.BossRushTierFiveEndText", XerocTextColor); + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); } }; } @@ -347,10 +341,48 @@ namespace CalamityMod.Events BossIDsAfterDeath = null; BossDeathEffects = null; } - #endregion + #endregion - #region Updates - internal static void MiscUpdateEffects() + #region Properties + public static int CurrentTier + { + get + { + if (BossRushStage > Bosses.FindIndex(boss => boss.EntityID == NPCID.CultistBoss)) + return 3; + if (BossRushStage > Bosses.FindIndex(boss => boss.EntityID == NPCID.TheDestroyer)) + return 2; + return 1; + } + } + + public static int MusicToPlay + { + get + { + if (CalamityMod.Instance.musicMod != null) + return CalamityMod.Instance.GetMusicFromMusicMod($"BossRushTier{CurrentTier}") ?? 0; + + switch (CurrentTier) + { + case 1: + return MusicID.Boss1; + case 2: + return MusicID.Boss4; + case 3: + return MusicID.Boss2; + case 4: + return MusicID.Boss3; + case 5: + return MusicID.LunarBoss; + } + return 0; + } + } + #endregion Properties + + #region Updates + internal static void MiscUpdateEffects() { if (!BossRushActive) return; @@ -381,6 +413,7 @@ namespace CalamityMod.Events if (!BossRushActive) { BossRushSpawnCountdown = 180; + BossRushSky.CurrentInterestMin = 0f; if (BossRushStage != 0) { BossRushStage = 0; @@ -404,7 +437,7 @@ namespace CalamityMod.Events BossRushSpawnCountdown--; // Cooldown and boss spawn - if (BossRushSpawnCountdown <= 0) + if (BossRushSpawnCountdown <= 0 && BossRushStage < Bosses.Count) { // Cooldown before next boss spawns. BossRushSpawnCountdown = 60; @@ -429,6 +462,53 @@ namespace CalamityMod.Events Bosses[BossRushStage].SpawnContext.Invoke(CurrentlyFoughtBoss); } } + + if (EndTimer > 0) + BossRushSky.CurrentInterest = MathHelper.Lerp(0.5f, 0.75f, Utils.InverseLerp(5f, 145f, EndTimer, true)); + BossRushSky.CurrentInterestMin = MathHelper.Lerp(0f, 0.5f, (float)Math.Pow(BossRushStage / (float)Bosses.Count, 5D)); + } + + public static void End() + { + if (Main.netMode == NetmodeID.SinglePlayer) + { + EndEffects(); + return; + } + + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.EndBossRush); + netMessage.Send(); + } + + internal static void EndEffects() + { + for (int doom = 0; doom < Main.maxNPCs; doom++) + { + NPC n = Main.npc[doom]; + if (!n.active) + continue; + + // will also correctly despawn EoW because none of his segments are boss flagged + bool shouldDespawn = n.boss || n.type == NPCID.EaterofWorldsHead || n.type == NPCID.EaterofWorldsBody || n.type == NPCID.EaterofWorldsTail; + if (shouldDespawn) + { + n.life = 0; + n.HitEffect(); + n.checkDead(); + n.active = false; + } + } + + BossRushActive = false; + BossRushStage = 0; + StartTimer = 0; + EndTimer = 0; + CalamityUtils.KillAllHostileProjectiles(); + + // Send the EndBossRush packet again if this is called serverside to ensure that the changes are recieved by clients. + if (Main.netMode == NetmodeID.Server) + End(); } #endregion @@ -518,6 +598,35 @@ namespace CalamityMod.Events netMessage2.Write(CalamityWorld.bossRushHostileProjKillCounter); netMessage2.Send(); } + + BossRushSky.CurrentInterest = 0.85f; + } + #endregion + + #region Netcode + + public static void SyncStartTimer(int time) + { + StartTimer = time; + if (Main.netMode != NetmodeID.Server) + return; + + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.BossRushStartTimer); + netMessage.Write(StartTimer); + netMessage.Send(); + } + + public static void SyncEndTimer(int time) + { + EndTimer = time; + if (Main.netMode != NetmodeID.Server) + return; + + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.BossRushEndTimer); + netMessage.Write(EndTimer); + netMessage.Send(); } #endregion } diff --git a/Events/BossRushScreenShader.cs b/Events/BossRushScreenShader.cs new file mode 100644 index 0000000000..64832e0302 --- /dev/null +++ b/Events/BossRushScreenShader.cs @@ -0,0 +1,16 @@ +using Terraria; +using Terraria.Graphics.Shaders; + +namespace CalamityMod.Events +{ + public class BossRushScreenShader : ScreenShaderData + { + public BossRushScreenShader(string passName) : base(passName) { } + + public override void Apply() + { + UseTargetPosition(Main.LocalPlayer.Center); + base.Apply(); + } + } +} diff --git a/Events/BossRushSky.cs b/Events/BossRushSky.cs new file mode 100644 index 0000000000..783c3ef314 --- /dev/null +++ b/Events/BossRushSky.cs @@ -0,0 +1,109 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.ModLoader; + +namespace CalamityMod.Events +{ + public class BossRushSky : CustomSky + { + public bool CurrentlyActive = false; + public float Intensity = 0f; + public static float IdleTimer = 0f; + public static float CurrentInterest = 0f; + public static float IncrementalInterest = 0f; + public static float CurrentInterestMin = 0f; + public static Color GeneralColor => Color.LightGray * 0.2f; + + public override void Update(GameTime gameTime) + { + if (CurrentlyActive) + { + if (Intensity < 1f) + Intensity += 0.03f; + CurrentInterest = MathHelper.Clamp(CurrentInterest - 0.005f, CurrentInterestMin, 1f); + IncrementalInterest = MathHelper.Lerp(IncrementalInterest, CurrentInterest, 0.085f); + IdleTimer += MathHelper.Lerp(0.04f, 0.1f, IncrementalInterest); + } + else if (!CurrentlyActive && Intensity > 0f) + { + Intensity -= 0.03f; + CurrentInterest = 0f; + IncrementalInterest = 0f; + IdleTimer = 0f; + } + } + + private float GetIntensity() + { + float fadeRatio = BossRushEvent.StartTimer / (float)BossRushEvent.StartEffectTotalTime; + return Utils.InverseLerp(0.57f, 1f, fadeRatio, true); + } + + public override Color OnTileColor(Color inColor) => new Color(Vector4.Lerp(GeneralColor.ToVector4() * 0.5f, inColor.ToVector4(), 1f - GetIntensity())); + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (GetIntensity() == 0f) + return; + + if (maxDepth >= 0 && minDepth < 0 && GetIntensity() > 0f) + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), GeneralColor * GetIntensity() * 0.5f); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive); + + // Make the entire background fade to white at the end of the event. + if (BossRushEvent.EndTimer >= 100f) + { + Texture2D whiteTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/XerocLight"); + Vector2 screenCenter = new Vector2(Main.screenWidth, Main.screenHeight) * 0.5f; + float fadeToWhite = Utils.InverseLerp(110f, 140f, BossRushEvent.EndTimer, true); + fadeToWhite *= Utils.InverseLerp(BossRushEvent.EndVisualEffectTime - 5f, BossRushEvent.EndVisualEffectTime - 25f, BossRushEvent.EndTimer, true); + float backScale = MathHelper.Lerp(0.01f, 8f, fadeToWhite); + Color backFadeColor = Color.White * fadeToWhite * 0.64f; + + spriteBatch.Draw(whiteTexture, screenCenter, null, backFadeColor, 0f, whiteTexture.Size() * 0.5f, backScale, SpriteEffects.None, 0f); + } + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(); + + // Draw the Xeroc eye at the back of the background. + if (maxDepth >= float.MaxValue && minDepth < float.MaxValue && BossRushEvent.EndTimer < BossRushEvent.EndVisualEffectTime - 40f) + { + Vector2 screenCenter = Main.screenPosition + new Vector2(Main.screenWidth, Main.screenHeight) * 0.5f; + float scale = MathHelper.Lerp(0.8f, 0.9f, IncrementalInterest) + (float)Math.Sin(IdleTimer) * 0.01f; + Vector2 drawWorldPosition = new Vector2(Main.LocalPlayer.Center.X, 1120f); + Vector2 drawPosition = (drawWorldPosition - screenCenter) * 0.097f + screenCenter - Main.screenPosition - Vector2.UnitY * 100f; + + Texture2D eyeTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/XerocEye"); + Color baseColorDraw = Color.Lerp(Color.White, Color.Red, IncrementalInterest); + + spriteBatch.Draw(eyeTexture, drawPosition, null, baseColorDraw, 0f, eyeTexture.Size() * 0.5f, scale, SpriteEffects.None, 0f); + Color fadedColor = Color.Lerp(baseColorDraw, Color.Coral, 0.3f) * MathHelper.Lerp(0.18f, 0.3f, IncrementalInterest); + fadedColor.A = 0; + + float backEyeOutwardness = MathHelper.Lerp(8f, 4f, IncrementalInterest); + int backInstances = (int)MathHelper.Lerp(6f, 24f, IncrementalInterest); + for (int i = 0; i < backInstances; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * 2f * i / backInstances + Main.GlobalTime * 2.1f).ToRotationVector2() * backEyeOutwardness; + spriteBatch.Draw(eyeTexture, drawPosition + drawOffset, null, fadedColor, 0f, eyeTexture.Size() * 0.5f, scale, SpriteEffects.None, 0f); + } + } + } + + public override float GetCloudAlpha() => 1f - GetIntensity(); + + public override void Activate(Vector2 position, params object[] args) => CurrentlyActive = true; + + public override void Deactivate(params object[] args) => CurrentlyActive = false; + + public override void Reset() => CurrentlyActive = false; + + public override bool IsActive() => CurrentlyActive || Intensity > 0f; + } +} diff --git a/ExtraTextures/ApolloFireballSplitTelegraph.png b/ExtraTextures/ApolloFireballSplitTelegraph.png new file mode 100644 index 0000000000..ee708170f6 Binary files /dev/null and b/ExtraTextures/ApolloFireballSplitTelegraph.png differ diff --git a/ExtraTextures/ApolloFireballSplitTelegraphGlow.png b/ExtraTextures/ApolloFireballSplitTelegraphGlow.png new file mode 100644 index 0000000000..515cbcadd8 Binary files /dev/null and b/ExtraTextures/ApolloFireballSplitTelegraphGlow.png differ diff --git a/ExtraTextures/DoGCartBody.png b/ExtraTextures/DoGCartBody.png new file mode 100644 index 0000000000..c801465603 Binary files /dev/null and b/ExtraTextures/DoGCartBody.png differ diff --git a/ExtraTextures/DoGCartTail.png b/ExtraTextures/DoGCartTail.png new file mode 100644 index 0000000000..a5cd0ee524 Binary files /dev/null and b/ExtraTextures/DoGCartTail.png differ diff --git a/ExtraTextures/Lasers/ExoDestroyerBeamEnd.png b/ExtraTextures/Lasers/ExoDestroyerBeamEnd.png deleted file mode 100644 index 8facdfbb48..0000000000 Binary files a/ExtraTextures/Lasers/ExoDestroyerBeamEnd.png and /dev/null differ diff --git a/ExtraTextures/Lasers/ExoDestroyerBeamMiddle.png b/ExtraTextures/Lasers/ExoDestroyerBeamMiddle.png deleted file mode 100644 index fe2d7fe372..0000000000 Binary files a/ExtraTextures/Lasers/ExoDestroyerBeamMiddle.png and /dev/null differ diff --git a/ExtraTextures/Lasers/ThanatosBeamEnd.png b/ExtraTextures/Lasers/ThanatosBeamEnd.png new file mode 100644 index 0000000000..09aae21f06 Binary files /dev/null and b/ExtraTextures/Lasers/ThanatosBeamEnd.png differ diff --git a/ExtraTextures/Lasers/ThanatosBeamMiddle.png b/ExtraTextures/Lasers/ThanatosBeamMiddle.png new file mode 100644 index 0000000000..0d1e82c2a6 Binary files /dev/null and b/ExtraTextures/Lasers/ThanatosBeamMiddle.png differ diff --git a/ExtraTextures/SharpNoise.png b/ExtraTextures/SharpNoise.png new file mode 100644 index 0000000000..e57ada51fd Binary files /dev/null and b/ExtraTextures/SharpNoise.png differ diff --git a/ExtraTextures/UI/BossRushIcon.png b/ExtraTextures/UI/BossRushIcon.png index ee56fb7957..08b0444f88 100644 Binary files a/ExtraTextures/UI/BossRushIcon.png and b/ExtraTextures/UI/BossRushIcon.png differ diff --git a/ExtraTextures/UI/CodebreakerDecyptionBar.png b/ExtraTextures/UI/CodebreakerDecyptionBar.png new file mode 100644 index 0000000000..63a3f1d1d2 Binary files /dev/null and b/ExtraTextures/UI/CodebreakerDecyptionBar.png differ diff --git a/ExtraTextures/UI/CodebreakerDecyptionBarCharge.png b/ExtraTextures/UI/CodebreakerDecyptionBarCharge.png new file mode 100644 index 0000000000..3b4109eb2b Binary files /dev/null and b/ExtraTextures/UI/CodebreakerDecyptionBarCharge.png differ diff --git a/ExtraTextures/UI/ContactIcon_Ares.png b/ExtraTextures/UI/ContactIcon_Ares.png new file mode 100644 index 0000000000..494e0c4b97 Binary files /dev/null and b/ExtraTextures/UI/ContactIcon_Ares.png differ diff --git a/ExtraTextures/UI/ContactIcon_THanos.png b/ExtraTextures/UI/ContactIcon_THanos.png new file mode 100644 index 0000000000..fc8a6fddb4 Binary files /dev/null and b/ExtraTextures/UI/ContactIcon_THanos.png differ diff --git a/ExtraTextures/UI/ContactIcon_Twins.png b/ExtraTextures/UI/ContactIcon_Twins.png new file mode 100644 index 0000000000..9e654fccf0 Binary files /dev/null and b/ExtraTextures/UI/ContactIcon_Twins.png differ diff --git a/ExtraTextures/UI/DecryptCancelIcon.png b/ExtraTextures/UI/DecryptCancelIcon.png new file mode 100644 index 0000000000..e718452a8b Binary files /dev/null and b/ExtraTextures/UI/DecryptCancelIcon.png differ diff --git a/ExtraTextures/UI/DecryptIcon.png b/ExtraTextures/UI/DecryptIcon.png new file mode 100644 index 0000000000..5b43bd3919 Binary files /dev/null and b/ExtraTextures/UI/DecryptIcon.png differ diff --git a/ExtraTextures/UI/DraedonDecrypterBackground.png b/ExtraTextures/UI/DraedonDecrypterBackground.png new file mode 100644 index 0000000000..10ced3699f Binary files /dev/null and b/ExtraTextures/UI/DraedonDecrypterBackground.png differ diff --git a/ExtraTextures/UI/DraedonDecrypterScreen.png b/ExtraTextures/UI/DraedonDecrypterScreen.png new file mode 100644 index 0000000000..6631b7dc02 Binary files /dev/null and b/ExtraTextures/UI/DraedonDecrypterScreen.png differ diff --git a/ExtraTextures/UI/EncryptedSchematicSlotBackground.png b/ExtraTextures/UI/EncryptedSchematicSlotBackground.png new file mode 100644 index 0000000000..75f2f538b5 Binary files /dev/null and b/ExtraTextures/UI/EncryptedSchematicSlotBackground.png differ diff --git a/ExtraTextures/UI/HeadIcon_Ares.png b/ExtraTextures/UI/HeadIcon_Ares.png new file mode 100644 index 0000000000..04e2526e68 Binary files /dev/null and b/ExtraTextures/UI/HeadIcon_Ares.png differ diff --git a/ExtraTextures/UI/HeadIcon_ArtemisApollo.png b/ExtraTextures/UI/HeadIcon_ArtemisApollo.png new file mode 100644 index 0000000000..bd061e097c Binary files /dev/null and b/ExtraTextures/UI/HeadIcon_ArtemisApollo.png differ diff --git a/ExtraTextures/UI/HeadIcon_THanos.png b/ExtraTextures/UI/HeadIcon_THanos.png new file mode 100644 index 0000000000..88e6edf8ef Binary files /dev/null and b/ExtraTextures/UI/HeadIcon_THanos.png differ diff --git a/ExtraTextures/XerocEye.png b/ExtraTextures/XerocEye.png new file mode 100644 index 0000000000..1e1c8c52e4 Binary files /dev/null and b/ExtraTextures/XerocEye.png differ diff --git a/ExtraTextures/XerocLight.png b/ExtraTextures/XerocLight.png new file mode 100644 index 0000000000..99ce67a851 Binary files /dev/null and b/ExtraTextures/XerocLight.png differ diff --git a/Gores/Apollo/Apollo1.png b/Gores/Apollo/Apollo1.png new file mode 100644 index 0000000000..a825864900 Binary files /dev/null and b/Gores/Apollo/Apollo1.png differ diff --git a/Gores/Apollo/Apollo2.png b/Gores/Apollo/Apollo2.png new file mode 100644 index 0000000000..2aafda7769 Binary files /dev/null and b/Gores/Apollo/Apollo2.png differ diff --git a/Gores/Apollo/Apollo3.png b/Gores/Apollo/Apollo3.png new file mode 100644 index 0000000000..94b806b9d1 Binary files /dev/null and b/Gores/Apollo/Apollo3.png differ diff --git a/Gores/Apollo/Apollo4.png b/Gores/Apollo/Apollo4.png new file mode 100644 index 0000000000..92ebc571dd Binary files /dev/null and b/Gores/Apollo/Apollo4.png differ diff --git a/Gores/Apollo/Apollo5.png b/Gores/Apollo/Apollo5.png new file mode 100644 index 0000000000..10395dbee9 Binary files /dev/null and b/Gores/Apollo/Apollo5.png differ diff --git a/Gores/Artemis/Artemis1.png b/Gores/Artemis/Artemis1.png new file mode 100644 index 0000000000..5af28138b8 Binary files /dev/null and b/Gores/Artemis/Artemis1.png differ diff --git a/Gores/Artemis/Artemis2.png b/Gores/Artemis/Artemis2.png new file mode 100644 index 0000000000..53232d4e97 Binary files /dev/null and b/Gores/Artemis/Artemis2.png differ diff --git a/Gores/Artemis/Artemis3.png b/Gores/Artemis/Artemis3.png new file mode 100644 index 0000000000..f05cc9edc8 Binary files /dev/null and b/Gores/Artemis/Artemis3.png differ diff --git a/Gores/Artemis/Artemis4.png b/Gores/Artemis/Artemis4.png new file mode 100644 index 0000000000..bd9d9295d3 Binary files /dev/null and b/Gores/Artemis/Artemis4.png differ diff --git a/Gores/Artemis/Artemis5.png b/Gores/Artemis/Artemis5.png new file mode 100644 index 0000000000..a9e3488323 Binary files /dev/null and b/Gores/Artemis/Artemis5.png differ diff --git a/Gores/Draedon/Chair1.png b/Gores/Draedon/Chair1.png new file mode 100644 index 0000000000..e514084ae2 Binary files /dev/null and b/Gores/Draedon/Chair1.png differ diff --git a/Gores/Draedon/Chair2.png b/Gores/Draedon/Chair2.png new file mode 100644 index 0000000000..99377710bc Binary files /dev/null and b/Gores/Draedon/Chair2.png differ diff --git a/Gores/Draedon/Chair3.png b/Gores/Draedon/Chair3.png new file mode 100644 index 0000000000..3d1a32e2bc Binary files /dev/null and b/Gores/Draedon/Chair3.png differ diff --git a/Gores/Draedon/Chair4.png b/Gores/Draedon/Chair4.png new file mode 100644 index 0000000000..767c9e1f02 Binary files /dev/null and b/Gores/Draedon/Chair4.png differ diff --git a/Gores/Draedon/Draedon1.png b/Gores/Draedon/Draedon1.png new file mode 100644 index 0000000000..88bd633548 Binary files /dev/null and b/Gores/Draedon/Draedon1.png differ diff --git a/Gores/Draedon/Draedon2.png b/Gores/Draedon/Draedon2.png new file mode 100644 index 0000000000..9fd23773a0 Binary files /dev/null and b/Gores/Draedon/Draedon2.png differ diff --git a/Gores/Draedon/Draedon3.png b/Gores/Draedon/Draedon3.png new file mode 100644 index 0000000000..ca30e2e8b9 Binary files /dev/null and b/Gores/Draedon/Draedon3.png differ diff --git a/Gores/Draedon/Draedon4.png b/Gores/Draedon/Draedon4.png new file mode 100644 index 0000000000..7343b8d0ec Binary files /dev/null and b/Gores/Draedon/Draedon4.png differ diff --git a/Gores/DraedonLabCritters/RepairUnit1.png b/Gores/DraedonLabCritters/RepairUnit1.png new file mode 100644 index 0000000000..c7fa6eae85 Binary files /dev/null and b/Gores/DraedonLabCritters/RepairUnit1.png differ diff --git a/Gores/DraedonLabCritters/RepairUnit2.png b/Gores/DraedonLabCritters/RepairUnit2.png new file mode 100644 index 0000000000..b4974143b2 Binary files /dev/null and b/Gores/DraedonLabCritters/RepairUnit2.png differ diff --git a/Gores/DraedonLabCritters/RepairUnit3.png b/Gores/DraedonLabCritters/RepairUnit3.png new file mode 100644 index 0000000000..971883e554 Binary files /dev/null and b/Gores/DraedonLabCritters/RepairUnit3.png differ diff --git a/ILEditing/ILChanges.cs b/ILEditing/ILChanges.cs index 8fad4398c0..a7b7155fa4 100644 --- a/ILEditing/ILChanges.cs +++ b/ILEditing/ILChanges.cs @@ -1,9 +1,15 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; +using CalamityMod.Events; using CalamityMod.NPCs; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.Crabulon; +using CalamityMod.NPCs.Ravager; using CalamityMod.Projectiles; using CalamityMod.Tiles.DraedonStructures; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Graphics; using Mono.Cecil.Cil; using MonoMod.Cil; @@ -108,6 +114,7 @@ namespace CalamityMod.ILEditing aLabDoorClosed = ModContent.TileType(); // Mechanics / features + On.Terraria.NPC.ApplyTileCollision += AllowTriggeredFallthrough; IL.Terraria.Main.UpdateTime += PermitNighttimeTownNPCSpawning; On.Terraria.Main.UpdateTime_SpawnTownNPCs += AlterTownNPCSpawnRate; IL.Terraria.Player.Hurt += RemoveRNGFromBlackBelt; @@ -118,6 +125,14 @@ namespace CalamityMod.ILEditing On.Terraria.Item.AffixName += IncorporateEnchantmentInAffix; On.Terraria.Projectile.NewProjectile_float_float_float_float_int_int_float_int_float_float += IncorporateMinionExplodingCountdown; On.Terraria.Main.DrawCursor += UseCoolFireCursorEffect; + IL.Terraria.Player.QuickHeal += ApplyManaBurnIfNeeded; + IL.Terraria.Player.QuickMana += ApplyManaBurnIfNeeded; + IL.Terraria.Player.ItemCheck += ApplyManaBurnIfNeeded; + IL.Terraria.Player.AddBuff += AllowBuffTimeStackingForManaBurn; + IL.Terraria.Main.UpdateAudio += ManipulateSoundMuffleFactor; + + // Ravager platform fall fix + On.Terraria.NPC.Collision_DecideFallThroughPlatforms += EnableCalamityBossPlatformCollision; // Damage and health balance IL.Terraria.Main.DamageVar += AdjustDamageVariance; @@ -125,7 +140,8 @@ namespace CalamityMod.ILEditing IL.Terraria.Projectile.Damage += RemoveAerialBaneDamageBoost; IL.Terraria.Projectile.AI_001 += AdjustChlorophyteBullets; - // Movement speed balance + // Movement speed balance + IL.Terraria.Player.Update += MaxRunSpeedAdjustment; IL.Terraria.Player.Update += RunSpeedAdjustments; IL.Terraria.Player.Update += ReduceWingHoverVelocities; @@ -156,6 +172,7 @@ namespace CalamityMod.ILEditing labDoorOpen = labDoorClosed = aLabDoorOpen = aLabDoorClosed = -1; // Mechanics / features + On.Terraria.NPC.ApplyTileCollision -= AllowTriggeredFallthrough; IL.Terraria.Main.UpdateTime -= PermitNighttimeTownNPCSpawning; On.Terraria.Main.UpdateTime_SpawnTownNPCs -= AlterTownNPCSpawnRate; IL.Terraria.Player.Hurt -= RemoveRNGFromBlackBelt; @@ -166,15 +183,24 @@ namespace CalamityMod.ILEditing On.Terraria.Item.AffixName -= IncorporateEnchantmentInAffix; On.Terraria.Projectile.NewProjectile_float_float_float_float_int_int_float_int_float_float -= IncorporateMinionExplodingCountdown; On.Terraria.Main.DrawCursor -= UseCoolFireCursorEffect; + IL.Terraria.Player.QuickHeal -= ApplyManaBurnIfNeeded; + IL.Terraria.Player.QuickMana -= ApplyManaBurnIfNeeded; + IL.Terraria.Player.ItemCheck -= ApplyManaBurnIfNeeded; + IL.Terraria.Player.AddBuff -= AllowBuffTimeStackingForManaBurn; + IL.Terraria.Main.UpdateAudio -= ManipulateSoundMuffleFactor; - // Damage and health balance - IL.Terraria.Main.DamageVar -= AdjustDamageVariance; + // Ravager platform fall fix + On.Terraria.NPC.Collision_DecideFallThroughPlatforms -= EnableCalamityBossPlatformCollision; + + // Damage and health balance + IL.Terraria.Main.DamageVar -= AdjustDamageVariance; IL.Terraria.NPC.scaleStats -= RemoveExpertHardmodeScaling; IL.Terraria.Projectile.Damage -= RemoveAerialBaneDamageBoost; IL.Terraria.Projectile.AI_001 -= AdjustChlorophyteBullets; - // Movement speed balance - IL.Terraria.Player.Update -= RunSpeedAdjustments; + // Movement speed balance + IL.Terraria.Player.Update -= MaxRunSpeedAdjustment; + IL.Terraria.Player.Update -= RunSpeedAdjustments; IL.Terraria.Player.Update -= ReduceWingHoverVelocities; // World generation @@ -199,6 +225,15 @@ namespace CalamityMod.ILEditing #region IL Editing Routines and Injections #region Mechanics / features + + // Why this isn't a mechanism provided by TML itself or vanilla itself is beyond me. + private static void AllowTriggeredFallthrough(On.Terraria.NPC.orig_ApplyTileCollision orig, NPC self, bool fall, Vector2 cPosition, int cWidth, int cHeight) + { + if (self.active && self.Calamity().ShouldFallThroughPlatforms) + fall = true; + orig(self, fall, cPosition, cWidth, cHeight); + } + private static void PermitNighttimeTownNPCSpawning(ILContext il) { // Don't do town NPC spawning at the end (which lies after a !Main.dayTime return). @@ -313,6 +348,15 @@ namespace CalamityMod.ILEditing return orig(i, j, forced); } + private static bool EnableCalamityBossPlatformCollision(On.Terraria.NPC.orig_Collision_DecideFallThroughPlatforms orig, NPC self) + { + if ((self.type == ModContent.NPCType() || self.type == ModContent.NPCType() || self.type == ModContent.NPCType()) && + self.target >= 0 && Main.player[self.target].position.Y > self.position.Y + self.height) + return true; + + return orig(self); + } + private static void DisableTeleporters(On.Terraria.Wiring.orig_Teleport orig) { if (CalamityPlayer.areThereAnyDamnBosses) @@ -372,6 +416,115 @@ namespace CalamityMod.ILEditing return proj; } + private static void ApplyManaBurnIfNeeded(ILContext il) + { + ILCursor cursor = new ILCursor(il); + + if (!cursor.TryGotoNext(c => c.MatchLdcI4(BuffID.ManaSickness))) + { + LogFailure("Mana Burn Application", "Could not locate the mana sickness buff ID."); + return; + } + + cursor.Remove(); + cursor.Emit(OpCodes.Ldarg_0); + cursor.EmitDelegate>(player => + { + if (!player.active || !player.Calamity().ChaosStone) + return BuffID.ManaSickness; + return ModContent.BuffType(); + }); + } + + private static void AllowBuffTimeStackingForManaBurn(ILContext il) + { + ILCursor cursor = new ILCursor(il); + + // Get a label that points to the final return before doing anything else. + cursor.GotoFinalRet(); + + ILLabel finalReturn = cursor.DefineLabel(); + cursor.MarkLabel(finalReturn); + + // After the label has been created go back to the beginning of the method. + cursor.Goto(0); + + if (!cursor.TryGotoNext(MoveType.Before, c => c.MatchStloc(4))) + { + LogFailure("Mana Burn Time Stacking", "Could not locate the buff loop incremental variable."); + return; + } + + int startOfBuffTimeLogic = cursor.Index - 1; + + if (!cursor.TryGotoNext(MoveType.Before, c => c.MatchLdsfld
("vanityPet"))) + { + LogFailure("Mana Burn Time Stacking", "Could not locate the Main.vanityPet load."); + return; + } + + // Clear away the vanilla logic and re-add it with a delegate. + // The alternative is a mess of various labels and branches. + int endOfBuffTimeLogic = cursor.Index; + cursor.Goto(startOfBuffTimeLogic); + cursor.RemoveRange(endOfBuffTimeLogic - startOfBuffTimeLogic); + + cursor.Emit(OpCodes.Ldarg_0); + cursor.Emit(OpCodes.Ldarg_1); + cursor.Emit(OpCodes.Ldloc_0); + cursor.EmitDelegate>((player, type, buffTime) => + { + for (int j = 0; j < Player.MaxBuffs; j++) + { + if (player.buffType[j] == type) + { + if (!BuffLoader.ReApply(type, player, buffTime, j)) + { + if (type == BuffID.ManaSickness || type == ModContent.BuffType()) + { + player.buffTime[j] += buffTime; + if (player.buffTime[j] > Player.manaSickTimeMax) + player.buffTime[j] = Player.manaSickTimeMax; + + } + else if (player.buffTime[j] < buffTime) + player.buffTime[j] = buffTime; + } + return true; + } + } + return false; + }); + cursor.Emit(OpCodes.Brtrue, finalReturn); + } + + private static void ManipulateSoundMuffleFactor(ILContext il) + { + ILCursor cursor = new ILCursor(il); + cursor.GotoNext(MoveType.After, i => i.MatchStloc(20)); + + cursor.Emit(OpCodes.Ldloc, 20); + cursor.EmitDelegate>(originalMuffleFactor => + { + if (Main.gameMenu || !Main.LocalPlayer.active) + return originalMuffleFactor; + + float playerMuffleFactor = 1f - Main.LocalPlayer.Calamity().MusicMuffleFactor; + float result = MathHelper.Clamp(originalMuffleFactor * playerMuffleFactor, -1f, 1f); + if (result <= 0) + { + for (int i = 0; i < Main.music.Length; i++) + { + if (Main.music[i] != null && Main.music[i].IsPlaying) + Main.music[i].Stop(AudioStopOptions.Immediate); + } + Main.curMusic = 0; + } + return result; + }); + cursor.Emit(OpCodes.Stloc, 20); + } + #region Fire Cursor private static void UseCoolFireCursorEffect(On.Terraria.Main.orig_DrawCursor orig, Vector2 bonus, bool smart) { @@ -546,11 +699,24 @@ namespace CalamityMod.ILEditing cursor.Remove(); cursor.Emit(OpCodes.Ldc_R4, 150f); // Reduce homing range by 50%. } - #endregion + #endregion - #region Movement speed balance - private static void RunSpeedAdjustments(ILContext il) - { + #region Movement speed balance + private static void MaxRunSpeedAdjustment(ILContext il) + { + // Increase the base max run speed of the player to make early game less of a slog. + var cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(3f))) // The maxRunSpeed variable is set to this specific value before anything else occurs. + { + LogFailure("Base Max Run Speed Buff", "Could not locate the max run speed variable."); + return; + } + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_R4, 4.5f); // Increase by 50%. + } + + private static void RunSpeedAdjustments(ILContext il) + { var cursor = new ILCursor(il); float horizontalSpeedCap = 3f; // +200%, aka triple speed. Vanilla caps at +60% float asphaltTopSpeedMultiplier = 1.75f; // +75%. Vanilla is +250% diff --git a/Items/Accessories/AngelTreads.cs b/Items/Accessories/AngelTreads.cs index c0c74887dc..723b96c2af 100644 --- a/Items/Accessories/AngelTreads.cs +++ b/Items/Accessories/AngelTreads.cs @@ -66,7 +66,6 @@ namespace CalamityMod.Items.Accessories recipe.AddIngredient(ItemID.LavaWaders); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddIngredient(ItemID.SoulofMight); recipe.AddIngredient(ItemID.SoulofSight); recipe.AddIngredient(ItemID.SoulofFright); diff --git a/Items/Accessories/ArcanumoftheVoid.cs b/Items/Accessories/ArcanumoftheVoid.cs index 3935938937..ec885d4ba3 100644 --- a/Items/Accessories/ArcanumoftheVoid.cs +++ b/Items/Accessories/ArcanumoftheVoid.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Arcanum of the Void"); Tooltip.SetDefault("You reflect projectiles when they hit you\n" + - "Reflected projectiles deal 5 times damage to enemies and no damage to you\n" + + "Reflected projectiles deal no damage to you\n" + "This reflect has a 90 second cooldown which is shared with all other dodges and reflects\n"); } diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index dd4bb6d019..d8b772547c 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -2,13 +2,14 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - [AutoloadEquip(EquipType.Shield)] + [AutoloadEquip(EquipType.Shield)] public class AsgardianAegis : ModItem { public override void SetStaticDefaults() @@ -49,13 +50,13 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.dashMod = 4; + modPlayer.dashMod = 4; modPlayer.elysianAegis = true; modPlayer.abaddon = true; player.noKnockback = true; player.fireWalk = true; player.statLifeMax2 += 40; - player.lifeRegen++; + player.lifeRegen++; player.buffImmune[BuffID.Chilled] = true; player.buffImmune[BuffID.Frostburn] = true; player.buffImmune[BuffID.Weak] = true; @@ -81,8 +82,9 @@ namespace CalamityMod.Items.Accessories ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/AstralArcanum.cs b/Items/Accessories/AstralArcanum.cs index ffbd94d85c..e1bf06ca35 100644 --- a/Items/Accessories/AstralArcanum.cs +++ b/Items/Accessories/AstralArcanum.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("Taking damage drops astral stars from the sky\n" + "Provides immunity to the astral infection debuff\n" + "You reflect projectiles when they hit you\n" + - "Reflected projectiles deal 5 times damage to enemies and no damage to you\n" + + "Reflected projectiles deal no damage to you\n" + "This reflect has a 90 second cooldown which is shared with all other dodges and reflects\n" + "Boosts life regen even while under the effects of a damaging debuff\n" + "While under the effects of a damaging debuff you will gain 20 defense\n" + diff --git a/Items/Accessories/BloomStone.cs b/Items/Accessories/BloomStone.cs index bcc9f448a3..7b7ab61e3e 100644 --- a/Items/Accessories/BloomStone.cs +++ b/Items/Accessories/BloomStone.cs @@ -1,8 +1,5 @@ using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,122 +11,118 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Bloom Stone"); Tooltip.SetDefault("One of the ancient relics\n" + - "I don't know what else this should do, pls help\n" + - "You grow flowers on the grass beneath you, chance to grow very random dye plants on grassless dirt"); + "You quickly regenerate life while on the ground\n" + + "This effect works best during daytime\n" + + "Flowers grow if you are standing on grass\n" + + "Random dye plants will grow while standing on grassless dirt"); } public override void SetDefaults() { item.width = 38; item.height = 54; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Yellow; + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = ItemRarityID.Lime; item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.25f, 0.4f, 0.2f); - //Flower Boots code + // Provide life benefits if the player is standing on ground and has typical gravity. + int x = (int)player.Center.X / 16; + int y = (int)(player.Bottom.Y - 1f) / 16; + Tile groundTile = CalamityUtils.ParanoidTileRetrieval(x, y + 1); + bool groundTileIsSolid = groundTile.nactive() && (Main.tileSolid[groundTile.type] || Main.tileSolidTop[groundTile.type]); + if (groundTileIsSolid && player.gravDir == 1f) + modPlayer.BloomStoneRegen = true; + + // Flower boots effects. if (player.whoAmI == Main.myPlayer && player.velocity.Y == 0f && player.grappling[0] == -1) { - int x = (int)player.Center.X / 16; - int y = (int)(player.position.Y + (float)player.height - 1f) / 16; - Tile tile = Main.tile[x, y]; - if (tile == null) + Tile walkTile = CalamityUtils.ParanoidTileRetrieval(x, y); + if (!walkTile.active() && walkTile.liquid == 0 && groundTile != null && WorldGen.SolidTile(groundTile)) { - tile = new Tile(); - } - if (!tile.active() && tile.liquid == 0 && Main.tile[x, y + 1] != null && WorldGen.SolidTile(x, y + 1)) - { - tile.frameY = 0; - tile.slope(0); - tile.halfBrick(false); - //On dirt blocks, there's a small chance to grow a dye plant - if (Main.tile[x, y + 1].type == TileID.Dirt) + walkTile.frameY = 0; + walkTile.slope(0); + walkTile.halfBrick(false); + // On dirt blocks, there's a small chance to grow a dye plant. + if (groundTile.type == TileID.Dirt) { if (Main.rand.NextBool(1000)) { - tile.active(true); - tile.type = TileID.DyePlants; - tile.frameX = (short)(34 * Main.rand.Next(1, 13)); - while (tile.frameX == 144) - { - tile.frameX = (short)(34 * Main.rand.Next(1, 13)); - } + walkTile.active(true); + walkTile.type = TileID.DyePlants; + walkTile.frameX = (short)(34 * Main.rand.Next(1, 13)); + while (walkTile.frameX == 144) + walkTile.frameX = (short)(34 * Main.rand.Next(1, 13)); } + if (Main.netMode == NetmodeID.MultiplayerClient) - { NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); - } } - //On grass, grow flowers - if (Main.tile[x, y + 1].type == TileID.Grass) + + // On grass, grow flowers. + if (groundTile.type == TileID.Grass) { if (Main.rand.NextBool(2)) { - tile.active(true); - tile.type = TileID.Plants; - tile.frameX = (short)(18 * Main.rand.Next(6, 11)); - while (tile.frameX == 144) - { - tile.frameX = (short)(18 * Main.rand.Next(6, 11)); - } + walkTile.active(true); + walkTile.type = TileID.Plants; + walkTile.frameX = (short)(18 * Main.rand.Next(6, 11)); + + while (walkTile.frameX == 144) + walkTile.frameX = (short)(18 * Main.rand.Next(6, 11)); } else { - tile.active(true); - tile.type = TileID.Plants2; - tile.frameX = (short)(18 * Main.rand.Next(6, 21)); - while (tile.frameX == 144) - { - tile.frameX = (short)(18 * Main.rand.Next(6, 21)); - } + walkTile.active(true); + walkTile.type = TileID.Plants2; + walkTile.frameX = (short)(18 * Main.rand.Next(6, 21)); + + while (walkTile.frameX == 144) + walkTile.frameX = (short)(18 * Main.rand.Next(6, 21)); } + if (Main.netMode == NetmodeID.MultiplayerClient) - { NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); - } } - //On hallowed grass, grow hallowed flowers - else if (Main.tile[x, y + 1].type == TileID.HallowedGrass) + + // On hallowed grass, grow hallowed flowers. + else if (groundTile.type == TileID.HallowedGrass) { if (Main.rand.NextBool(2)) { - tile.active(true); - tile.type = TileID.HallowedPlants; - tile.frameX = (short)(18 * Main.rand.Next(4, 7)); - while (tile.frameX == 90) - { - tile.frameX = (short)(18 * Main.rand.Next(4, 7)); - } + walkTile.active(true); + walkTile.type = TileID.HallowedPlants; + walkTile.frameX = (short)(18 * Main.rand.Next(4, 7)); + while (walkTile.frameX == 90) + walkTile.frameX = (short)(18 * Main.rand.Next(4, 7)); } else { - tile.active(true); - tile.type = TileID.HallowedPlants2; - tile.frameX = (short)(18 * Main.rand.Next(2, 8)); - while (tile.frameX == 90) - { - tile.frameX = (short)(18 * Main.rand.Next(2, 8)); - } + walkTile.active(true); + walkTile.type = TileID.HallowedPlants2; + walkTile.frameX = (short)(18 * Main.rand.Next(2, 8)); + while (walkTile.frameX == 90) + walkTile.frameX = (short)(18 * Main.rand.Next(2, 8)); } + if (Main.netMode == NetmodeID.MultiplayerClient) - { NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); - } } - //On jungle grass, grow jungle flowers - else if (Main.tile[x, y + 1].type == TileID.JungleGrass) + + // On jungle grass, grow jungle flowers. + else if (groundTile.type == TileID.JungleGrass) { - tile.active(true); - tile.type = TileID.JunglePlants2; - tile.frameX = (short)(18 * Main.rand.Next(9, 17)); + walkTile.active(true); + walkTile.type = TileID.JunglePlants2; + walkTile.frameX = (short)(18 * Main.rand.Next(9, 17)); + if (Main.netMode == NetmodeID.MultiplayerClient) - { NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); - } } } } diff --git a/Items/Accessories/ChaosStone.cs b/Items/Accessories/ChaosStone.cs index 454bf36d2b..a6345bd3b2 100644 --- a/Items/Accessories/ChaosStone.cs +++ b/Items/Accessories/ChaosStone.cs @@ -11,7 +11,9 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Chaos Stone"); Tooltip.SetDefault("One of the ancient relics\n" + - "I don't know what this should do, pls help"); + "Mana Sickness from drinking mana potions is replaced by Mana Burn\n" + + "Mana Burn deals damage over time relative to the intensity of the debuff\n" + + "This debuff does not reduce your magic damage"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(8, 7)); } @@ -24,9 +26,6 @@ namespace CalamityMod.Items.Accessories item.accessory = true; } - /*public override void UpdateAccessory(Player player, bool hideVisual) - { - - }*/ + public override void UpdateAccessory(Player player, bool hideVisual) => player.Calamity().ChaosStone = true; } } diff --git a/Items/Accessories/CoreOfTheBloodGod.cs b/Items/Accessories/CoreOfTheBloodGod.cs index bc1bfda6b2..e630de6917 100644 --- a/Items/Accessories/CoreOfTheBloodGod.cs +++ b/Items/Accessories/CoreOfTheBloodGod.cs @@ -44,8 +44,8 @@ namespace CalamityMod.Items.Accessories recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/CryoStone.cs b/Items/Accessories/CryoStone.cs index ad18876f66..dcda6173ef 100644 --- a/Items/Accessories/CryoStone.cs +++ b/Items/Accessories/CryoStone.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Cryo Stone"); Tooltip.SetDefault("One of the ancient relics\n" + - "Creates a rotating ice shield around you that damages enemies on contact"); + "Creates a rotating ice shield around you that damages and slows down enemies on contact"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(4, 4)); } @@ -24,9 +24,6 @@ namespace CalamityMod.Items.Accessories item.accessory = true; } - /*public override void UpdateAccessory(Player player, bool hideVisual) - { - - }*/ + public override void UpdateAccessory(Player player, bool hideVisual) => player.Calamity().CryoStone = true; } } diff --git a/Items/Accessories/DaawnlightSpiritOrigin.cs b/Items/Accessories/DaawnlightSpiritOrigin.cs index 4fb6a7463a..458100ccb3 100644 --- a/Items/Accessories/DaawnlightSpiritOrigin.cs +++ b/Items/Accessories/DaawnlightSpiritOrigin.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.Pets; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -86,8 +87,7 @@ namespace CalamityMod.Items.Accessories recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ModContent.ItemType(), 4); - // TODO -- cosmic anvil - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/DarkSunRing.cs b/Items/Accessories/DarkSunRing.cs index 104901d01b..dadf4df362 100644 --- a/Items/Accessories/DarkSunRing.cs +++ b/Items/Accessories/DarkSunRing.cs @@ -1,33 +1,34 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; -using Terraria.ID; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - public class DarkSunRing : ModItem + public class DarkSunRing : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("Dark Sun Ring"); Tooltip.SetDefault("Contains the power of the dark sun\n" + - "12% increase to damage and melee speed\n" + + "12% increase to damage and melee speed\n" + "+1 life regen, 15% increased pick speed and +2 max minions\n" + "Increased minion knockback\n" + "During the day the player has +3 life regen\n" + "During the night the player has +15 defense\n" + - "Both of these bonuses are granted during an eclipse"); + "Both of these bonuses are granted during an eclipse"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 7)); } public override void SetDefaults() { - item.width = 54; - item.height = 58; + item.width = 42; + item.height = 60; item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; + item.rare = ItemRarityID.Purple; item.defense = 10; item.lifeRegen = 1; item.accessory = true; @@ -44,8 +45,8 @@ namespace CalamityMod.Items.Accessories { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 50); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/DarkSunRing.png b/Items/Accessories/DarkSunRing.png index 52de47bd09..3f0962fcbf 100644 Binary files a/Items/Accessories/DarkSunRing.png and b/Items/Accessories/DarkSunRing.png differ diff --git a/Items/Accessories/DimensionalSoulArtifact.cs b/Items/Accessories/DimensionalSoulArtifact.cs index 9da87af51c..7133641ac3 100644 --- a/Items/Accessories/DimensionalSoulArtifact.cs +++ b/Items/Accessories/DimensionalSoulArtifact.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Dimensional Soul Artifact"); Tooltip.SetDefault("Power\n" + - "Boosts all damage by 25%, but at what cost?\n" + + "Boosts all damage by 25%, but at what cost?\n" + "Increases all damage taken by 15%"); } public override void SetDefaults() { - item.width = 28; - item.height = 28; - item.accessory = true; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - } + item.width = 28; + item.height = 28; + item.accessory = true; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.value = CalamityGlobalItem.Rarity14BuyPrice; + } public override void UpdateAccessory(Player player, bool hideVisual) { @@ -37,10 +37,10 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.DemonAltar); + recipe.AddIngredient(ModContent.ItemType(), 25); + recipe.AddIngredient(ModContent.ItemType(), 25); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(TileID.DemonAltar); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/EclipseMirror.cs b/Items/Accessories/EclipseMirror.cs index 046765cd02..0e7385d48a 100644 --- a/Items/Accessories/EclipseMirror.cs +++ b/Items/Accessories/EclipseMirror.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -52,8 +53,8 @@ namespace CalamityMod.Items.Accessories ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/ElementalGauntlet.cs b/Items/Accessories/ElementalGauntlet.cs index fde102b84c..63e0c55ff9 100644 --- a/Items/Accessories/ElementalGauntlet.cs +++ b/Items/Accessories/ElementalGauntlet.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Elemental Gauntlet"); Tooltip.SetDefault("Melee attacks and projectiles inflict most debuffs\n" + "15% increased melee speed, damage, and 5% increased melee critical strike chance\n" + - "20% increased true melee damage\n" + + "20% increased true melee damage\n" + "Temporary immunity to lava\n" + "Increased melee knockback"); } @@ -32,17 +32,16 @@ namespace CalamityMod.Items.Accessories public override void ModifyTooltips(List list) { - if (CalamityWorld.death) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip6") - { - line2.text = "Melee attacks have a chance to instantly kill normal enemies\n" + - "Provides heat and cold protection in Death Mode"; - } - } - } + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip4") + { + line2.text += "\nProvides heat and cold protection in Death Mode"; + } + } + } } public override void UpdateAccessory(Player player, bool hideVisual) @@ -56,8 +55,10 @@ namespace CalamityMod.Items.Accessories ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.FireGauntlet); recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.LunarBar, 8); + recipe.AddIngredient(ModContent.ItemType(), 4); recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/ElementalQuiver.cs b/Items/Accessories/ElementalQuiver.cs index 9d28759915..9f4dfeffde 100644 --- a/Items/Accessories/ElementalQuiver.cs +++ b/Items/Accessories/ElementalQuiver.cs @@ -44,8 +44,10 @@ namespace CalamityMod.Items.Accessories ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.MagicQuiver); recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.LunarBar, 8); + recipe.AddIngredient(ModContent.ItemType(), 4); recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/EtherealTalisman.cs b/Items/Accessories/EtherealTalisman.cs index ea47de054c..e30a216a2c 100644 --- a/Items/Accessories/EtherealTalisman.cs +++ b/Items/Accessories/EtherealTalisman.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Ethereal Talisman"); Tooltip.SetDefault("15% increased magic damage, 5% increased magic critical strike chance and 10% decreased mana usage\n" + "+150 max mana\n" + - "Increases pickup range for mana stars\n" + + "Increases pickup range for mana stars\n" + "You automatically use mana potions when needed if visibility is on"); } @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.eTalisman = true; - player.manaMagnet = true; + player.manaMagnet = true; if (!hideVisual) player.manaFlower = true; @@ -47,8 +47,10 @@ namespace CalamityMod.Items.Accessories ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.ManaFlower); + recipe.AddIngredient(ItemID.LunarBar, 8); + recipe.AddIngredient(ModContent.ItemType(), 4); recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/Nanotech.cs b/Items/Accessories/Nanotech.cs index f9025cbe22..3bd7f659bf 100644 --- a/Items/Accessories/Nanotech.cs +++ b/Items/Accessories/Nanotech.cs @@ -3,23 +3,24 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; using System.Collections.Generic; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - public class Nanotech : ModItem + public class Nanotech : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("Nanotech"); Tooltip.SetDefault("Rogue projectiles create nanoblades as they travel\n" + "Stealth strikes summon nanobeams and sparks on enemy hits\n" + - "Stealth strikes have +20 armor penetration, deal 5% more damage, and heal for 1 HP\n" + + "Stealth strikes have +20 armor penetration, deal 5% more damage, and heal for 1 HP\n" + "15% increased rogue damage and 15% increased rogue velocity\n" + "Whenever you crit an enemy with a rogue weapon your rogue damage increases\n" + "This effect can stack up to 150 times\n" + - "Max rogue damage boost is 15%\n" + - "This line is modified below"); + "Max rogue damage boost is 15%\n" + + "This line is modified below"); } public override void SetDefaults() @@ -60,8 +61,10 @@ namespace CalamityMod.Items.Accessories recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.LunarBar, 8); + recipe.AddIngredient(ModContent.ItemType(), 4); recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/NebulousCore.cs b/Items/Accessories/NebulousCore.cs index 449f96c02d..8164838826 100644 --- a/Items/Accessories/NebulousCore.cs +++ b/Items/Accessories/NebulousCore.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.nCore = true; player.allDamage += 0.1f; - int damage = (int)(500 * player.AverageDamage()); + int damage = (int)(250 * player.AverageDamage()); float knockBack = 3f; if (Main.rand.NextBool(15)) { diff --git a/Items/Accessories/Nucleogenesis.cs b/Items/Accessories/Nucleogenesis.cs index 91161a160a..a1535c0b4b 100644 --- a/Items/Accessories/Nucleogenesis.cs +++ b/Items/Accessories/Nucleogenesis.cs @@ -2,6 +2,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -12,11 +13,11 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Nucleogenesis"); Tooltip.SetDefault("Increases max minions by 4, does not stack with downgrades\n" + - "15% increased minion damage\n" + + "15% increased minion damage\n" + "Increased minion knockback\n" + "Minions inflict a variety of debuffs\n" + "Minions spawn damaging sparks on enemy hits"); //subject to change to be "cooler" - } + } public override void SetDefaults() { @@ -44,8 +45,10 @@ namespace CalamityMod.Items.Accessories ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.LunarBar, 8); + recipe.AddIngredient(ModContent.ItemType(), 4); recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/ProfanedSoulCrystal.cs b/Items/Accessories/ProfanedSoulCrystal.cs index 898cea7fce..89cb96b407 100644 --- a/Items/Accessories/ProfanedSoulCrystal.cs +++ b/Items/Accessories/ProfanedSoulCrystal.cs @@ -274,13 +274,13 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { PSCRecipe recipe = new PSCRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.ObsidianRose); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 50); recipe.AddIngredient(ModContent.ItemType(), 100); - recipe.AddIngredient(ItemID.ObsidianRose); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(ModContent.TileType()); recipe.needLava = true; recipe.SetResult(this); diff --git a/Items/Accessories/RampartofDeities.cs b/Items/Accessories/RampartofDeities.cs index f2fbb00a57..7d42673b62 100644 --- a/Items/Accessories/RampartofDeities.cs +++ b/Items/Accessories/RampartofDeities.cs @@ -64,8 +64,9 @@ namespace CalamityMod.Items.Accessories recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/Sponge.cs b/Items/Accessories/Sponge.cs index adce09acc1..c6d7d8f8c2 100644 --- a/Items/Accessories/Sponge.cs +++ b/Items/Accessories/Sponge.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories { public class Sponge : ModItem { - public override string Texture => (DateTime.Now.Month == 4 && DateTime.Now.Day == 1) ? "CalamityMod/Items/Accessories/SpongeReal" : "CalamityMod/Items/Accessories/Sponge"; + public override string Texture => (DateTime.Now.Month == 4 && DateTime.Now.Day == 1) ? "CalamityMod/Items/Accessories/SpongeReal" : "CalamityMod/Items/Accessories/Sponge"; public override void SetStaticDefaults() { @@ -23,8 +23,8 @@ namespace CalamityMod.Items.Accessories "+30 max life and mana\n" + "5% increased movement and jump speed\n" + "Standing still boosts life and mana regen\n" + - "Increased defense, movement speed and damage reduction while submerged in liquid\n" + - "Enemies take damage when they hit you\n" + + "Increased defense, movement speed and damage reduction while submerged in liquid\n" + + "Enemies take damage when they hit you\n" + "You emit a cloud of mushroom spores when you are hit\n" + "6.25% of the damage from enemy attacks is absorbed and converted into healing"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 30)); @@ -42,27 +42,27 @@ namespace CalamityMod.Items.Accessories public override void ModifyTooltips(List list) { - if (CalamityWorld.death) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip8") - { - line2.text += "\nProvides cold protection in Death Mode"; - } - } - } + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip8") + { + line2.text += "\nProvides cold protection in Death Mode"; + } + } + } } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - // Removed Giant Shell speed boost from Sponge + // Removed Giant Shell speed boost from Sponge // modPlayer.gShell = true; modPlayer.fCarapace = true; modPlayer.seaShell = true; modPlayer.absorber = true; - modPlayer.sponge = true; + modPlayer.sponge = true; player.statManaMax2 += 30; } @@ -88,11 +88,11 @@ namespace CalamityMod.Items.Accessories { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/StatMeter.cs b/Items/Accessories/StatMeter.cs index 9a35e37599..7c703e4f5c 100644 --- a/Items/Accessories/StatMeter.cs +++ b/Items/Accessories/StatMeter.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Items.Accessories StringBuilder sb = new StringBuilder("Displays almost all player stats\nOffensive stats displayed vary with held item\n\n", 1024); // Only append rippers stats in Rev+, if rippers are enabled. - if (CalamityWorld.revenge && CalamityConfig.Instance.Rippers) + if (CalamityWorld.revenge) { sb.Append("Rage Damage Boost: ").Append(modPlayer.rageDamageStat).Append("%\n"); sb.Append("Adrenaline Damage Boost: ").Append(modPlayer.adrenalineDamageStat) diff --git a/Items/Accessories/StatisBeltOfCurses.cs b/Items/Accessories/StatisBeltOfCurses.cs index 766d3c4197..a2a18aaa3c 100644 --- a/Items/Accessories/StatisBeltOfCurses.cs +++ b/Items/Accessories/StatisBeltOfCurses.cs @@ -46,9 +46,9 @@ namespace CalamityMod.Items.Accessories ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 10); - //This is not a mistake. Only Nightmare Fuel is intentional for thematics. - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(ModContent.TileType()); + // This is not a mistake. Requiring only Nightmare Fuel is intentional for thematics. + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index 5a130f7fab..2b829f755e 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -65,8 +65,8 @@ namespace CalamityMod.Items.Accessories recipe.AddIngredient(ItemType(), 15); recipe.AddIngredient(ItemType(), 15); recipe.AddIngredient(ItemType(), 5); - recipe.AddIngredient(ItemType()); - recipe.AddTile(TileType()); + recipe.AddIngredient(ItemType(), 4); + recipe.AddTile(TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/TheEvolution.cs b/Items/Accessories/TheEvolution.cs index c3b338d1a8..828da011d6 100644 --- a/Items/Accessories/TheEvolution.cs +++ b/Items/Accessories/TheEvolution.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("The Evolution"); Tooltip.SetDefault("You reflect projectiles when they hit you\n" + - "Reflected projectiles deal 10 times damage to enemies and no damage to you\n" + + "Reflected projectiles deal no damage to you\n" + "This reflect has a 120 second cooldown which is shared with all other dodges and reflects\n" + "If this effect triggers you get a health regeneration boost for 5 seconds\n" + "If the same enemy projectile type hits you again you will resist its damage by 15%"); diff --git a/Items/Accessories/Wings/CelestialTracers.cs b/Items/Accessories/Wings/CelestialTracers.cs index efe1c41c87..2f7639ed9e 100644 --- a/Items/Accessories/Wings/CelestialTracers.cs +++ b/Items/Accessories/Wings/CelestialTracers.cs @@ -10,14 +10,14 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Wings { - [AutoloadEquip(EquipType.Wings)] + [AutoloadEquip(EquipType.Wings)] public class CelestialTracers : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("Celestial Tracers"); Tooltip.SetDefault("Taking speed EVEN FURTHER BEYOND!\n" + - "Counts as wings\n" + + "Counts as wings\n" + "Horizontal speed: 12\n" + "Acceleration multiplier: 3\n" + "Excellent vertical speed\n" + @@ -40,17 +40,17 @@ namespace CalamityMod.Items.Accessories.Wings public override void ModifyTooltips(List list) { - if (CalamityWorld.death) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip10") - { - line2.text = "Being hit for over 200 damage will make you immune for an extended period of time\n" + - "Provides heat protection in Death Mode"; - } - } - } + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip10") + { + line2.text = "Being hit for over 200 damage will make you immune for an extended period of time\n" + + "Provides heat protection in Death Mode"; + } + } + } } public override void UpdateAccessory(Player player, bool hideVisual) @@ -105,8 +105,8 @@ namespace CalamityMod.Items.Accessories.Wings ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/Wings/ElysianTracers.cs b/Items/Accessories/Wings/ElysianTracers.cs index d815858dde..82bda4fb23 100644 --- a/Items/Accessories/Wings/ElysianTracers.cs +++ b/Items/Accessories/Wings/ElysianTracers.cs @@ -1,11 +1,11 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.World; using Microsoft.Xna.Framework; using System.Collections.Generic; using Terraria; using Terraria.Graphics.Shaders; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Wings @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories.Wings { DisplayName.SetDefault("Elysian Tracers"); Tooltip.SetDefault("Ludicrous speed!\n" + - "Counts as wings\n" + + "Counts as wings\n" + "Horizontal speed: 10.5\n" + "Acceleration multiplier: 2.75\n" + "Great vertical speed\n" + @@ -39,17 +39,17 @@ namespace CalamityMod.Items.Accessories.Wings public override void ModifyTooltips(List list) { - if (CalamityWorld.death) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip9") - { - line2.text = "Temporary immunity to lava\n" + - "Provides heat protection in Death Mode"; - } - } - } + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip9") + { + line2.text = "Temporary immunity to lava\n" + + "Provides heat protection in Death Mode"; + } + } + } } public override void UpdateAccessory(Player player, bool hideVisual) @@ -105,7 +105,8 @@ namespace CalamityMod.Items.Accessories.Wings recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/Wings/SilvaWings.cs b/Items/Accessories/Wings/SilvaWings.cs index 368f287a46..a1dfdd014b 100644 --- a/Items/Accessories/Wings/SilvaWings.cs +++ b/Items/Accessories/Wings/SilvaWings.cs @@ -1,11 +1,12 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Graphics.Shaders; -using Terraria.ModLoader; using CalamityMod.Items.Armor; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Wings { @@ -20,14 +21,14 @@ namespace CalamityMod.Items.Accessories.Wings "Acceleration multiplier: 2.8\n" + "Excellent vertical speed\n" + "Flight time: 270\n" + - "The Silva revive heals you to half health while wearing the Silva armor"); + "The Silva revive heals you to half health while wearing the Silva armor"); } public override void SetDefaults() { item.width = 22; item.height = 20; - item.rare = ItemRarityID.Purple; + item.rare = ItemRarityID.Purple; item.value = CalamityGlobalItem.Rarity14BuyPrice; item.Calamity().customRarity = CalamityRarity.DarkBlue; item.accessory = true; @@ -83,7 +84,7 @@ namespace CalamityMod.Items.Accessories.Wings recipe.AddRecipeGroup("AnyGoldBar", 3); recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/Wings/XerocWings.cs b/Items/Accessories/Wings/XerocWings.cs index c1e2231571..73355f2d2f 100644 --- a/Items/Accessories/Wings/XerocWings.cs +++ b/Items/Accessories/Wings/XerocWings.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories.Wings item.width = 22; item.height = 20; item.value = CalamityGlobalItem.Rarity9BuyPrice; - item.rare = ItemRarityID.Cyan; + item.rare = ItemRarityID.Red; item.accessory = true; } @@ -79,7 +79,7 @@ namespace CalamityMod.Items.Accessories.Wings ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.SoulofFlight, 20); + recipe.AddIngredient(ItemID.LunarBar, 10); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Ammo/GodSlayerSlug.cs b/Items/Ammo/GodSlayerSlug.cs index a7a3b9bb59..8e8f2f9eaf 100644 --- a/Items/Ammo/GodSlayerSlug.cs +++ b/Items/Ammo/GodSlayerSlug.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,10 +12,9 @@ namespace CalamityMod.Items.Ammo public override void SetStaticDefaults() { DisplayName.SetDefault("God Slayer Slug"); - Tooltip.SetDefault("Pierces through unlimited targets\n" + - "After striking at least one enemy,\n" + - "if the bullet hits a wall or runs out of targets,\n" + - "it will warp backwards through space and explode on impact"); + Tooltip.SetDefault("Heavy ammunition with unlimited piercing that tears through spacetime\n" + + "After a slug lands a hit, if it strikes a wall or runs out of targets to pierce,\n" + + "it warps backwards through space and supercharges, exploding on impact"); } public override void SetDefaults() @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Ammo ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.EmptyBullet, 999); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this, 999); recipe.AddRecipe(); } diff --git a/Items/Ammo/VanquisherArrow.cs b/Items/Ammo/VanquisherArrow.cs index c3a3efd966..857d3d59c1 100644 --- a/Items/Ammo/VanquisherArrow.cs +++ b/Items/Ammo/VanquisherArrow.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria.ID; @@ -34,14 +35,14 @@ namespace CalamityMod.Items.Ammo public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Ammo/VanquisherArrowGlow")); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Ammo/VanquisherArrowGlow")); } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this, 999); recipe.AddRecipe(); } diff --git a/Items/Armor/AuricTeslaBodyArmor.cs b/Items/Armor/AuricTeslaBodyArmor.cs index 91321ffd37..feb2427e41 100644 --- a/Items/Armor/AuricTeslaBodyArmor.cs +++ b/Items/Armor/AuricTeslaBodyArmor.cs @@ -10,7 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor { - [AutoloadEquip(EquipType.Body)] + [AutoloadEquip(EquipType.Body)] public class AuricTeslaBodyArmor : ModItem { public override void SetStaticDefaults() @@ -32,17 +32,17 @@ namespace CalamityMod.Items.Armor public override void ModifyTooltips(List list) { - if (CalamityWorld.death) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip4") - { - line2.text = "You will freeze enemies near you when you are struck\n" + - "Provides heat and cold protection in Death Mode"; - } - } - } + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip4") + { + line2.text = "You will freeze enemies near you when you are struck\n" + + "Provides heat and cold protection in Death Mode"; + } + } + } } public override void UpdateEquip(Player player) @@ -62,9 +62,9 @@ namespace CalamityMod.Items.Armor recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 18); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/AuricTeslaCuisses.cs b/Items/Armor/AuricTeslaCuisses.cs index 76d71bb386..25adcfdf7a 100644 --- a/Items/Armor/AuricTeslaCuisses.cs +++ b/Items/Armor/AuricTeslaCuisses.cs @@ -6,7 +6,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor { - [AutoloadEquip(EquipType.Legs)] + [AutoloadEquip(EquipType.Legs)] public class AuricTeslaCuisses : ModItem { public override void SetStaticDefaults() @@ -41,9 +41,9 @@ namespace CalamityMod.Items.Armor recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.AddIngredient(ItemID.FlyingCarpet); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ItemID.FlyingCarpet); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/AuricTeslaHelm.cs b/Items/Armor/AuricTeslaHelm.cs index de05c1cd72..1ee38c876c 100644 --- a/Items/Armor/AuricTeslaHelm.cs +++ b/Items/Armor/AuricTeslaHelm.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Armor player.lifeRegen += 10; } - if (!modPlayer.godSlayerCooldown && modPlayer.godSlayerDashHotKeyPressed) + if (modPlayer.godSlayerDashHotKeyPressed) modPlayer.dashMod = 9; } @@ -79,9 +79,9 @@ namespace CalamityMod.Items.Armor recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 12); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/AuricTeslaHoodedFacemask.cs b/Items/Armor/AuricTeslaHoodedFacemask.cs index 03e52fe7b2..de65feb360 100644 --- a/Items/Armor/AuricTeslaHoodedFacemask.cs +++ b/Items/Armor/AuricTeslaHoodedFacemask.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Armor player.lifeRegen += 10; } - if (!modPlayer.godSlayerCooldown && modPlayer.godSlayerDashHotKeyPressed) + if (modPlayer.godSlayerDashHotKeyPressed) modPlayer.dashMod = 9; } @@ -77,9 +77,9 @@ namespace CalamityMod.Items.Armor recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 12); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/AuricTeslaPlumedHelm.cs b/Items/Armor/AuricTeslaPlumedHelm.cs index 0975186372..c106bf807f 100644 --- a/Items/Armor/AuricTeslaPlumedHelm.cs +++ b/Items/Armor/AuricTeslaPlumedHelm.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor { - [AutoloadEquip(EquipType.Head)] + [AutoloadEquip(EquipType.Head)] public class AuricTeslaPlumedHelm : ModItem { public override void SetStaticDefaults() @@ -65,9 +65,9 @@ namespace CalamityMod.Items.Armor player.lifeRegen += 10; } - if (!modPlayer.godSlayerCooldown && modPlayer.godSlayerDashHotKeyPressed) - modPlayer.dashMod = 9; - } + if (modPlayer.godSlayerDashHotKeyPressed) + modPlayer.dashMod = 9; + } public override void UpdateEquip(Player player) { @@ -84,9 +84,9 @@ namespace CalamityMod.Items.Armor recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/AuricTeslaSpaceHelmet.cs b/Items/Armor/AuricTeslaSpaceHelmet.cs index cc89ef06c3..1de4379692 100644 --- a/Items/Armor/AuricTeslaSpaceHelmet.cs +++ b/Items/Armor/AuricTeslaSpaceHelmet.cs @@ -12,7 +12,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor { - [AutoloadEquip(EquipType.Head)] + [AutoloadEquip(EquipType.Head)] public class AuricTeslaSpaceHelmet : ModItem { public override void SetStaticDefaults() @@ -90,9 +90,9 @@ namespace CalamityMod.Items.Armor recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/AuricTeslaWireHemmedVisage.cs b/Items/Armor/AuricTeslaWireHemmedVisage.cs index 6a04f63679..d6b19304f2 100644 --- a/Items/Armor/AuricTeslaWireHemmedVisage.cs +++ b/Items/Armor/AuricTeslaWireHemmedVisage.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor { - [AutoloadEquip(EquipType.Head)] + [AutoloadEquip(EquipType.Head)] public class AuricTeslaWireHemmedVisage : ModItem { public override void SetStaticDefaults() @@ -76,9 +76,9 @@ namespace CalamityMod.Items.Armor recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/DemonshadeBreastplate.cs b/Items/Armor/DemonshadeBreastplate.cs index 9dcf859e53..c333eda127 100644 --- a/Items/Armor/DemonshadeBreastplate.cs +++ b/Items/Armor/DemonshadeBreastplate.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 18); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Armor/DemonshadeGreaves.cs b/Items/Armor/DemonshadeGreaves.cs index 8efdb8ca97..c6d61274c8 100644 --- a/Items/Armor/DemonshadeGreaves.cs +++ b/Items/Armor/DemonshadeGreaves.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 11); + recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Armor/DemonshadeHelm.cs b/Items/Armor/DemonshadeHelm.cs index 31be8d750b..9ec83ed12c 100644 --- a/Items/Armor/DemonshadeHelm.cs +++ b/Items/Armor/DemonshadeHelm.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 12); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Armor/FearmongerGreathelm.cs b/Items/Armor/FearmongerGreathelm.cs index e598777c6d..235af6c80a 100644 --- a/Items/Armor/FearmongerGreathelm.cs +++ b/Items/Armor/FearmongerGreathelm.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Fearmonger Greathelm"); Tooltip.SetDefault("Pure terror radiates from your eyes\n" + - "+60 max mana and 10% decreased mana usage\n" + - "10% increased minion damage"); + "+60 max mana and 10% decreased mana usage\n" + + "10% increased minion damage"); } public override void SetDefaults() @@ -48,25 +48,25 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - if (CalamityWorld.death) - { - player.setBonus = @"20% increased minion damage and +2 max minions + if (CalamityWorld.death) + { + player.setBonus = @"20% increased minion damage and +2 max minions The minion damage nerf while wielding weaponry is reduced Immunity to all forms of frost and flame All minion attacks grant colossal life regeneration 15% increased damage reduction during the Pumpkin and Frost Moons This extra damage reduction ignores the soft cap Provides cold protection in Death Mode"; - } - else - { - player.setBonus = @"20% increased minion damage and +2 max minions + } + else + { + player.setBonus = @"20% increased minion damage and +2 max minions The minion damage nerf while wielding weaponry is reduced Immunity to all forms of frost and flame All minion attacks grant colossal life regeneration 15% increased damage reduction during the Pumpkin and Frost Moons This extra damage reduction ignores the soft cap"; - } + } // This bool encompasses cross-class nerf immunity, colossal life regen on minion attack, and the holiday moon DR player.Calamity().fearmongerSet = true; @@ -74,9 +74,9 @@ This extra damage reduction ignores the soft cap"; // All-class armors count as rogue sets, but don't grant stealth bonuses player.Calamity().wearingRogueArmor = true; player.minionDamage += 0.2f; - player.maxMinions += 2; + player.maxMinions += 2; - int[] immuneDebuffs = { + int[] immuneDebuffs = { BuffID.OnFire, BuffID.Frostburn, BuffID.CursedInferno, @@ -103,9 +103,10 @@ This extra damage reduction ignores the soft cap"; { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.SpookyHelmet); - recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddIngredient(ModContent.ItemType(), 8); recipe.AddIngredient(ItemID.SoulofFright, 8); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/FearmongerGreaves.cs b/Items/Armor/FearmongerGreaves.cs index ffc8114b17..c131b591bf 100644 --- a/Items/Armor/FearmongerGreaves.cs +++ b/Items/Armor/FearmongerGreaves.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Fearmonger Greaves"); Tooltip.SetDefault("6% increased damage\n" + - "50% increased minion knockback\n" + - "10% increased movement speed\n" + - "Taking damage makes you move very fast for a short time"); + "50% increased minion knockback\n" + + "10% increased movement speed\n" + + "Taking damage makes you move very fast for a short time"); } public override void SetDefaults() @@ -39,9 +39,10 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.SpookyLeggings); - recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ItemID.SoulofFright, 10); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/FearmongerPlateMail.cs b/Items/Armor/FearmongerPlateMail.cs index 79fbe1938c..3cb9a6fb12 100644 --- a/Items/Armor/FearmongerPlateMail.cs +++ b/Items/Armor/FearmongerPlateMail.cs @@ -6,14 +6,14 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor { - [AutoloadEquip(EquipType.Body)] + [AutoloadEquip(EquipType.Body)] public class FearmongerPlateMail : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("Fearmonger Plate Mail"); Tooltip.SetDefault("+100 max life and 8% increased damage reduction\n" + - "5% increased damage and critical strike chance"); + "5% increased damage and critical strike chance"); } public override void SetDefaults() @@ -37,9 +37,10 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.SpookyBreastplate); - recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ModContent.ItemType(), 12); recipe.AddIngredient(ItemID.SoulofFright, 12); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/GodSlayerChestplate.cs b/Items/Armor/GodSlayerChestplate.cs index af49a5c1e8..ec700301b6 100644 --- a/Items/Armor/GodSlayerChestplate.cs +++ b/Items/Armor/GodSlayerChestplate.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Armor @@ -39,9 +39,8 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 23); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/GodSlayerHelm.cs b/Items/Armor/GodSlayerHelm.cs index b269d4e2a7..626a46e988 100644 --- a/Items/Armor/GodSlayerHelm.cs +++ b/Items/Armor/GodSlayerHelm.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Armor @@ -39,12 +39,12 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); modPlayer.godSlayer = true; modPlayer.godSlayerDamage = true; - string hotkey = CalamityMod.GodSlayerDashHotKey.TooltipHotkeyString(); - player.setBonus = "Allows you to dash for an immense distance in 8 directions\n" + - "Press " + hotkey + " while holding down the movement keys in the direction you want to dash\n" + - "Enemies you dash through take massive damage\n" + - "During the dash you are immune to most debuffs\n" + - "The dash has a 15 second cooldown\n" + + string hotkey = CalamityMod.GodSlayerDashHotKey.TooltipHotkeyString(); + player.setBonus = "Allows you to dash for an immense distance in 8 directions\n" + + "Press " + hotkey + " while holding down the movement keys in the direction you want to dash\n" + + "Enemies you dash through take massive damage\n" + + "During the dash you are immune to most debuffs\n" + + "The dash has a 15 second cooldown\n" + "Enemies are more likely to target you\n" + "Taking over 80 damage in one hit will cause you to release a swarm of high-damage god killer darts\n" + "Enemies take a lot of damage when they hit you\n" + @@ -52,9 +52,9 @@ namespace CalamityMod.Items.Armor player.thorns += 2.5f; player.aggro += 1000; - if (!modPlayer.godSlayerCooldown && modPlayer.godSlayerDashHotKeyPressed) - modPlayer.dashMod = 9; - } + if (modPlayer.godSlayerDashHotKeyPressed) + modPlayer.dashMod = 9; + } public override void UpdateEquip(Player player) { @@ -66,9 +66,8 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/GodSlayerHelmet.cs b/Items/Armor/GodSlayerHelmet.cs index 62b8c32f92..0102445e4d 100644 --- a/Items/Armor/GodSlayerHelmet.cs +++ b/Items/Armor/GodSlayerHelmet.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Armor @@ -39,16 +39,16 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); modPlayer.godSlayer = true; modPlayer.godSlayerRanged = true; - string hotkey = CalamityMod.GodSlayerDashHotKey.TooltipHotkeyString(); - player.setBonus = "Allows you to dash for an immense distance in 8 directions\n" + - "Press " + hotkey + " while holding down the movement keys in the direction you want to dash\n" + - "Enemies you dash through take massive damage\n" + - "During the dash you are immune to most debuffs\n" + - "The dash has a 15 second cooldown\n" + - "You fire a god killer shrapnel round while firing ranged weapons every 2.5 seconds"; + string hotkey = CalamityMod.GodSlayerDashHotKey.TooltipHotkeyString(); + player.setBonus = "Allows you to dash for an immense distance in 8 directions\n" + + "Press " + hotkey + " while holding down the movement keys in the direction you want to dash\n" + + "Enemies you dash through take massive damage\n" + + "During the dash you are immune to most debuffs\n" + + "The dash has a 15 second cooldown\n" + + "You fire a god killer shrapnel round while firing ranged weapons every 2.5 seconds"; - if (!modPlayer.godSlayerCooldown && modPlayer.godSlayerDashHotKeyPressed) - modPlayer.dashMod = 9; + if (modPlayer.godSlayerDashHotKeyPressed) + modPlayer.dashMod = 9; } public override void UpdateEquip(Player player) @@ -61,9 +61,8 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/GodSlayerLeggings.cs b/Items/Armor/GodSlayerLeggings.cs index cf56407976..b197f95630 100644 --- a/Items/Armor/GodSlayerLeggings.cs +++ b/Items/Armor/GodSlayerLeggings.cs @@ -1,6 +1,6 @@ using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Armor @@ -35,9 +35,8 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/GodSlayerMask.cs b/Items/Armor/GodSlayerMask.cs index 4a2c915cdd..7156bfaa4b 100644 --- a/Items/Armor/GodSlayerMask.cs +++ b/Items/Armor/GodSlayerMask.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Armor @@ -41,22 +41,22 @@ namespace CalamityMod.Items.Armor modPlayer.godSlayerThrowing = true; modPlayer.rogueStealthMax += 1.2f; modPlayer.wearingRogueArmor = true; - string hotkey = CalamityMod.GodSlayerDashHotKey.TooltipHotkeyString(); - player.setBonus = "Allows you to dash for an immense distance in 8 directions\n" + - "Press " + hotkey + " while holding down the movement keys in the direction you want to dash\n" + - "Enemies you dash through take massive damage\n" + - "During the dash you are immune to most debuffs\n" + - "The dash has a 15 second cooldown\n" + - "While at full HP all of your rogue stats are boosted by 10%\n" + + string hotkey = CalamityMod.GodSlayerDashHotKey.TooltipHotkeyString(); + player.setBonus = "Allows you to dash for an immense distance in 8 directions\n" + + "Press " + hotkey + " while holding down the movement keys in the direction you want to dash\n" + + "Enemies you dash through take massive damage\n" + + "During the dash you are immune to most debuffs\n" + + "The dash has a 15 second cooldown\n" + + "While at full HP all of your rogue stats are boosted by 10%\n" + "If you take over 80 damage in one hit you will be given extra immunity frames\n" + "Rogue stealth builds while not attacking and slower while moving, up to a max of 120\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - if (!modPlayer.godSlayerCooldown && modPlayer.godSlayerDashHotKeyPressed) - modPlayer.dashMod = 9; - } + if (modPlayer.godSlayerDashHotKeyPressed) + modPlayer.dashMod = 9; + } public override void UpdateEquip(Player player) { @@ -69,9 +69,8 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/SilvaArmor.cs b/Items/Armor/SilvaArmor.cs index 46369f5acc..44b3d13bcb 100644 --- a/Items/Armor/SilvaArmor.cs +++ b/Items/Armor/SilvaArmor.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Armor DisplayName.SetDefault("Silva Armor"); Tooltip.SetDefault("+80 max life\n" + "12% increased damage and 8% increased critical strike chance\n" + - "Grants immunity to the irradiated debuff"); + "Grants immunity to the irradiated debuff"); } public override void SetDefaults() @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Armor item.height = 24; item.value = Item.buyPrice(0, 72, 0, 0); item.defense = 44; - item.rare = ItemRarityID.Purple; + item.rare = ItemRarityID.Purple; item.Calamity().customRarity = CalamityRarity.DarkBlue; } @@ -43,9 +44,9 @@ namespace CalamityMod.Items.Armor recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddRecipeGroup("AnyGoldBar", 10); recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/SilvaHelmet.cs b/Items/Armor/SilvaHelmet.cs index 9f318c27bc..797ea91628 100644 --- a/Items/Armor/SilvaHelmet.cs +++ b/Items/Armor/SilvaHelmet.cs @@ -3,6 +3,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Summon; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -23,9 +24,9 @@ namespace CalamityMod.Items.Armor item.height = 24; item.value = Item.buyPrice(0, 90, 0, 0); item.defense = 13; //110 - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - } + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -60,8 +61,8 @@ namespace CalamityMod.Items.Armor } } player.minionDamage += 0.75f; - player.maxMinions += 5; - } + player.maxMinions += 5; + } public override void AddRecipes() { @@ -69,8 +70,8 @@ namespace CalamityMod.Items.Armor recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddRecipeGroup("AnyGoldBar", 5); recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/SilvaLeggings.cs b/Items/Armor/SilvaLeggings.cs index 3c1d235802..635538e6d3 100644 --- a/Items/Armor/SilvaLeggings.cs +++ b/Items/Armor/SilvaLeggings.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Armor recipe.AddIngredient(ModContent.ItemType(), 7); recipe.AddRecipeGroup("AnyGoldBar", 7); recipe.AddIngredient(ModContent.ItemType(), 9); - recipe.AddIngredient(ModContent.ItemType(), 7); + recipe.AddIngredient(ModContent.ItemType(), 2); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Armor/SilvaMaskedCap.cs b/Items/Armor/SilvaMaskedCap.cs index 536bc0e960..cf23909ece 100644 --- a/Items/Armor/SilvaMaskedCap.cs +++ b/Items/Armor/SilvaMaskedCap.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -23,9 +24,9 @@ namespace CalamityMod.Items.Armor item.height = 22; item.value = Item.buyPrice(0, 90, 0, 0); item.defense = 21; //110 - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - } + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -63,8 +64,8 @@ namespace CalamityMod.Items.Armor recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddRecipeGroup("AnyGoldBar", 5); recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/Vanity/ApolloMask.cs b/Items/Armor/Vanity/ApolloMask.cs new file mode 100644 index 0000000000..ddc4cd6c96 --- /dev/null +++ b/Items/Armor/Vanity/ApolloMask.cs @@ -0,0 +1,24 @@ +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Head)] + public class ApolloMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Apollo Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = ItemRarityID.Blue; + item.vanity = true; + } + + public override bool DrawHead() => false; + } +} diff --git a/Items/Armor/Vanity/ApolloMask.png b/Items/Armor/Vanity/ApolloMask.png new file mode 100644 index 0000000000..afe857f754 Binary files /dev/null and b/Items/Armor/Vanity/ApolloMask.png differ diff --git a/Items/Armor/Vanity/ApolloMask_Extra.png b/Items/Armor/Vanity/ApolloMask_Extra.png new file mode 100644 index 0000000000..b2ad1ea853 Binary files /dev/null and b/Items/Armor/Vanity/ApolloMask_Extra.png differ diff --git a/Items/Armor/Vanity/ApolloMask_Head.png b/Items/Armor/Vanity/ApolloMask_Head.png new file mode 100644 index 0000000000..1eb5862462 Binary files /dev/null and b/Items/Armor/Vanity/ApolloMask_Head.png differ diff --git a/Items/Armor/Vanity/AresMask.cs b/Items/Armor/Vanity/AresMask.cs new file mode 100644 index 0000000000..c840da136f --- /dev/null +++ b/Items/Armor/Vanity/AresMask.cs @@ -0,0 +1,24 @@ +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Head)] + public class AresMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ares Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = ItemRarityID.Blue; + item.vanity = true; + } + + public override bool DrawHead() => false; + } +} diff --git a/Items/Armor/Vanity/AresMask.png b/Items/Armor/Vanity/AresMask.png new file mode 100644 index 0000000000..25dcf27df4 Binary files /dev/null and b/Items/Armor/Vanity/AresMask.png differ diff --git a/Items/Armor/Vanity/AresMask_Head.png b/Items/Armor/Vanity/AresMask_Head.png new file mode 100644 index 0000000000..91263dfa83 Binary files /dev/null and b/Items/Armor/Vanity/AresMask_Head.png differ diff --git a/Items/Armor/Vanity/ArtemisMask.cs b/Items/Armor/Vanity/ArtemisMask.cs new file mode 100644 index 0000000000..20cea82b58 --- /dev/null +++ b/Items/Armor/Vanity/ArtemisMask.cs @@ -0,0 +1,24 @@ +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Head)] + public class ArtemisMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Artemis Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = ItemRarityID.Blue; + item.vanity = true; + } + + public override bool DrawHead() => false; + } +} diff --git a/Items/Armor/Vanity/ArtemisMask.png b/Items/Armor/Vanity/ArtemisMask.png new file mode 100644 index 0000000000..bf293d34d7 Binary files /dev/null and b/Items/Armor/Vanity/ArtemisMask.png differ diff --git a/Items/Armor/Vanity/ArtemisMask_Extra.png b/Items/Armor/Vanity/ArtemisMask_Extra.png new file mode 100644 index 0000000000..48bf528c6f Binary files /dev/null and b/Items/Armor/Vanity/ArtemisMask_Extra.png differ diff --git a/Items/Armor/Vanity/ArtemisMask_Head.png b/Items/Armor/Vanity/ArtemisMask_Head.png new file mode 100644 index 0000000000..dca1bfec9e Binary files /dev/null and b/Items/Armor/Vanity/ArtemisMask_Head.png differ diff --git a/Items/Armor/Vanity/DraedonMask.cs b/Items/Armor/Vanity/DraedonMask.cs new file mode 100644 index 0000000000..f876103d53 --- /dev/null +++ b/Items/Armor/Vanity/DraedonMask.cs @@ -0,0 +1,24 @@ +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Head)] + public class DraedonMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Draedon Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = ItemRarityID.Blue; + item.vanity = true; + } + + public override bool DrawHead() => false; + } +} diff --git a/Items/Armor/Vanity/DraedonMask.png b/Items/Armor/Vanity/DraedonMask.png new file mode 100644 index 0000000000..6b02f18c78 Binary files /dev/null and b/Items/Armor/Vanity/DraedonMask.png differ diff --git a/Items/Armor/Vanity/DraedonMask_Head.png b/Items/Armor/Vanity/DraedonMask_Head.png new file mode 100644 index 0000000000..82babf7e87 Binary files /dev/null and b/Items/Armor/Vanity/DraedonMask_Head.png differ diff --git a/Items/Armor/Vanity/ThanatosMask.cs b/Items/Armor/Vanity/ThanatosMask.cs new file mode 100644 index 0000000000..6a75359647 --- /dev/null +++ b/Items/Armor/Vanity/ThanatosMask.cs @@ -0,0 +1,24 @@ +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Head)] + public class ThanatosMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Thanatos Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = ItemRarityID.Blue; + item.vanity = true; + } + + public override bool DrawHead() => false; + } +} diff --git a/Items/Armor/Vanity/ThanatosMask.png b/Items/Armor/Vanity/ThanatosMask.png new file mode 100644 index 0000000000..d47fac5a9c Binary files /dev/null and b/Items/Armor/Vanity/ThanatosMask.png differ diff --git a/Items/Armor/Vanity/ThanatosMask_Head.png b/Items/Armor/Vanity/ThanatosMask_Head.png new file mode 100644 index 0000000000..05bb9ca597 Binary files /dev/null and b/Items/Armor/Vanity/ThanatosMask_Head.png differ diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 60996feb83..c5229d9deb 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -57,6 +57,7 @@ namespace CalamityMod.Items #endregion #region Enchantment Variables + public bool CannotBeEnchanted = false; public Enchantment? AppliedEnchantment = null; public float DischargeEnchantExhaustion = 0; public float DischargeExhaustionRatio @@ -80,18 +81,7 @@ namespace CalamityMod.Items public bool devItem = false; public bool challengeDrop = false; public bool canFirePointBlankShots = false; - - public static readonly Color[] ExoPalette = new Color[] - { - new Color(250, 255, 112), - new Color(211, 235, 108), - new Color(166, 240, 105), - new Color(105, 240, 220), - new Color(64, 130, 145), - new Color(145, 96, 145), - new Color(242, 112, 73), - new Color(199, 62, 62), - }; + public bool trueMelee = false; // See RogueWeapon.cs for rogue modifier shit #region Modifiers @@ -144,6 +134,62 @@ namespace CalamityMod.Items switch (item.type) { + // Pickaxe speed boosts + case ItemID.CactusPickaxe: + case ItemID.CopperPickaxe: + case ItemID.TinPickaxe: + item.useTime = 13; + break; + + case ItemID.IronPickaxe: + case ItemID.LeadPickaxe: + item.useTime = 12; + break; + + case ItemID.SilverPickaxe: + case ItemID.TungstenPickaxe: + item.useTime = 11; + break; + + case ItemID.GoldPickaxe: + case ItemID.PlatinumPickaxe: + case ItemID.CnadyCanePickaxe: + case ItemID.NightmarePickaxe: + case ItemID.DeathbringerPickaxe: + case ItemID.MoltenPickaxe: + item.useTime = 10; + break; + + case ItemID.CobaltPickaxe: + case ItemID.PalladiumPickaxe: + item.useTime = 9; + break; + + case ItemID.MythrilPickaxe: + case ItemID.OrichalcumPickaxe: + case ItemID.BonePickaxe: // Rare drop so it mines faster + item.useTime = 8; + break; + + case ItemID.AdamantitePickaxe: + case ItemID.TitaniumPickaxe: + case ItemID.SpectrePickaxe: // Slightly less because it has more tile range + item.useTime = 7; + break; + + case ItemID.PickaxeAxe: + case ItemID.ChlorophytePickaxe: + item.useTime = 6; + break; + + case ItemID.Picksaw: + case ItemID.StardustPickaxe: + case ItemID.VortexPickaxe: + case ItemID.SolarFlarePickaxe: + case ItemID.NebulaPickaxe: + item.useTime = 5; + break; + // Point-blank shot weapons case ItemID.WoodenBow: case ItemID.BorealWoodBow: @@ -216,6 +262,42 @@ namespace CalamityMod.Items canFirePointBlankShots = true; break; + // Set projectile true melee items to be true melee, this is so bosses know when the player is using a true melee projectile weapon + case ItemID.Spear: + case ItemID.Trident: + case ItemID.PalladiumPike: + case ItemID.ObsidianSwordfish: + case ItemID.CobaltDrill: + case ItemID.MythrilDrill: + case ItemID.AdamantiteDrill: + case ItemID.PalladiumDrill: + case ItemID.OrichalcumDrill: + case ItemID.TitaniumDrill: + case ItemID.ChlorophyteDrill: + case ItemID.CobaltChainsaw: + case ItemID.MythrilChainsaw: + case ItemID.AdamantiteChainsaw: + case ItemID.PalladiumChainsaw: + case ItemID.OrichalcumChainsaw: + case ItemID.TitaniumChainsaw: + case ItemID.ChlorophyteChainsaw: + case ItemID.VortexDrill: + case ItemID.VortexChainsaw: + case ItemID.NebulaDrill: + case ItemID.NebulaChainsaw: + case ItemID.SolarFlareDrill: + case ItemID.SolarFlareChainsaw: + case ItemID.StardustDrill: + case ItemID.StardustChainsaw: + case ItemID.Drax: + case ItemID.ChlorophyteJackhammer: + case ItemID.SawtoothShark: + case ItemID.Arkhalis: + case ItemID.ButchersChainsaw: + case ItemID.MonkStaffT2: + trueMelee = true; + break; + case ItemID.Dynamite: case ItemID.StickyDynamite: case ItemID.BouncyDynamite: @@ -325,6 +407,7 @@ namespace CalamityMod.Items break; case ItemID.AdamantiteGlaive: + trueMelee = true; item.damage = 65; item.shootSpeed *= 1.25f; break; @@ -334,25 +417,30 @@ namespace CalamityMod.Items break; case ItemID.CobaltNaginata: + trueMelee = true; item.damage = 90; break; case ItemID.Gungnir: + trueMelee = true; item.damage = 92; item.shootSpeed *= 1.25f; break; case ItemID.MythrilHalberd: + trueMelee = true; item.damage = 95; item.shootSpeed *= 1.25f; break; case ItemID.OrichalcumHalberd: + trueMelee = true; item.damage = 98; item.shootSpeed *= 1.25f; break; case ItemID.TitaniumTrident: + trueMelee = true; item.damage = 72; item.shootSpeed *= 1.25f; break; @@ -362,18 +450,22 @@ namespace CalamityMod.Items break; case ItemID.TheRottedFork: + trueMelee = true; item.damage = 20; break; case ItemID.Swordfish: + trueMelee = true; item.damage = 38; break; case ItemID.DarkLance: + trueMelee = true; item.damage = 68; break; case ItemID.MushroomSpear: + trueMelee = true; item.damage = 100; break; @@ -419,6 +511,7 @@ namespace CalamityMod.Items break; case ItemID.MonkStaffT1: + trueMelee = true; item.damage = 110; break; @@ -535,6 +628,10 @@ namespace CalamityMod.Items case ItemID.StarCannon: item.UseSound = null; break; + + case ItemID.EoCShield: + CannotBeEnchanted = true; + break; } if (CalamityLists.quadrupleDamageBuffList?.Contains(item.type) ?? false) @@ -831,7 +928,7 @@ namespace CalamityMod.Items #region SavingAndLoading public override bool NeedsSaving(Item item) { - return rogue || canFirePointBlankShots || timesUsed != 0 || customRarity != 0 || Charge != 0 || reforgeTier != 0 || AppliedEnchantment.HasValue || DischargeEnchantExhaustion != 0; + return rogue || canFirePointBlankShots || trueMelee || timesUsed != 0 || customRarity != 0 || Charge != 0 || reforgeTier != 0 || AppliedEnchantment.HasValue || DischargeEnchantExhaustion != 0; } public override TagCompound Save(Item item) @@ -845,7 +942,8 @@ namespace CalamityMod.Items ["reforgeTier"] = reforgeTier, ["enchantmentID"] = AppliedEnchantment.HasValue ? AppliedEnchantment.Value.ID : 0, ["DischargeEnchantExhaustion"] = DischargeEnchantExhaustion, - ["canFirePointBlankShots"] = canFirePointBlankShots + ["canFirePointBlankShots"] = canFirePointBlankShots, + ["trueMelee"] = trueMelee }; } @@ -853,6 +951,7 @@ namespace CalamityMod.Items { rogue = tag.GetBool("rogue"); canFirePointBlankShots = tag.GetBool("canFirePointBlankShots"); + trueMelee = tag.GetBool("trueMelee"); timesUsed = tag.GetInt("timesUsed"); customRarity = (CalamityRarity)tag.GetInt("rarity"); @@ -886,6 +985,7 @@ namespace CalamityMod.Items BitsByte flags = reader.ReadByte(); rogue = flags[0]; canFirePointBlankShots = flags[1]; + trueMelee = flags[2]; } else { @@ -898,6 +998,7 @@ namespace CalamityMod.Items BitsByte flags = new BitsByte(); flags[0] = rogue; flags[1] = canFirePointBlankShots; + flags[2] = trueMelee; writer.Write(flags); writer.Write((int)customRarity); @@ -913,6 +1014,7 @@ namespace CalamityMod.Items BitsByte flags = reader.ReadByte(); rogue = flags[0]; canFirePointBlankShots = flags[1]; + trueMelee = flags[2]; customRarity = (CalamityRarity)reader.ReadInt32(); timesUsed = reader.ReadInt32(); @@ -1159,7 +1261,7 @@ namespace CalamityMod.Items // If you have enough charge, decrement charge on the spot because this hook runs exactly once every time you use an item. // Mana has to be checked separately or you'll fail to use the weapon on a mana check later and still have consumed charge. - if (player.CheckMana(item)) + if (player.CheckMana(item) && item.modItem.CanUseItem(player)) Charge -= chargeNeeded; } } diff --git a/Items/CalamityGlobalItemLoot.cs b/Items/CalamityGlobalItemLoot.cs index 194fbee780..1518bfd1a3 100644 --- a/Items/CalamityGlobalItemLoot.cs +++ b/Items/CalamityGlobalItemLoot.cs @@ -112,6 +112,9 @@ namespace CalamityMod.Items DropHelper.DropEntireSet(player, DropHelper.BagWeaponDropRateFloat, planteraWeapons); DropHelper.BlockDrops(planteraWeapons); + // Equipment + DropHelper.DropItemChance(player, ModContent.ItemType(), 5); + DropHelper.DropItem(player, ModContent.ItemType(), 16, 22); DropHelper.DropItemChance(player, ItemID.JungleKey, 5); break; diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index ab56295a26..c71b0ab10a 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor; using CalamityMod.Items.Placeables.Furniture.Fountains; @@ -32,8 +33,8 @@ namespace CalamityMod.Items if (nameLine != null) ApplyRarityColor(item, nameLine); - // If the item is melee, add a true melee damage number adjacent to the standard damage number. - if (item.melee && item.damage > 0 && Main.LocalPlayer.Calamity().trueMeleeDamage > 0D) + // If the item is true melee, add a true melee damage number adjacent to the standard damage number. + if (item.melee && (item.shoot == ProjectileID.None || trueMelee) && item.damage > 0 && Main.LocalPlayer.Calamity().trueMeleeDamage > 0D) TrueMeleeDamageTooltip(item, tooltips); // Modify all vanilla tooltips before appending mod mechanics (if any). @@ -1078,6 +1079,19 @@ namespace CalamityMod.Items tooltips.Add(line); } } - #endregion - } + #endregion + + #region Schematic Knowledge Tooltip Utility + public static void InsertKnowledgeTooltip(List tooltips, int tier, bool allowOldWorlds = false) + { + TooltipLine line = new TooltipLine(CalamityMod.Instance, "SchematicKnowledge1", "You don't have sufficient knowledge to create this yet"); + TooltipLine line2 = new TooltipLine(CalamityMod.Instance, "SchematicKnowledge2", "A specific schematic must be deciphered first"); + line.overrideColor = line2.overrideColor = Color.Cyan; + + bool allowedDueToOldWorld = allowOldWorlds && CalamityWorld.IsWorldAfterDraedonUpdate; + tooltips.AddWithCondition(line, !ArsenalTierGatedRecipe.HasTierBeenLearned(tier) && !allowedDueToOldWorld); + tooltips.AddWithCondition(line2, !ArsenalTierGatedRecipe.HasTierBeenLearned(tier) && !allowedDueToOldWorld); + } + #endregion + } } diff --git a/Items/DifficultyItems/Revenge.cs b/Items/DifficultyItems/Revenge.cs index c345697fd0..7603218209 100644 --- a/Items/DifficultyItems/Revenge.cs +++ b/Items/DifficultyItems/Revenge.cs @@ -19,11 +19,12 @@ namespace CalamityMod.Items.DifficultyItems "You gain Rage when in proximity of enemies or by using special items.\n" + "ADRENALINE TOOLTIP LINE HERE\n" + "You gain Adrenaline whenever a boss is alive. Getting hit drops Adrenaline back to 0.\n" + - "All enemies drop 50% more coins and spawn 15% more frequently\n" + + "All enemies drop 50% more coins and spawn 15% more frequently.\n" + "Certain enemies and projectiles deal between 5% and 25% more damage.\n" + "Makes certain enemies block life steal and nerfs the effectiveness of life steal.\n" + "Nerfs the effectiveness of the Titanium Armor set bonus.\n" + - "Changes ALL boss AIs and some enemy AIs in vanilla and the Calamity Mod."); + "Changes ALL boss AIs and some enemy AIs in vanilla and the Calamity Mod.\n" + + "Most bosses will enter later phases sooner if the fight has gone on for a long time."); } public override void SetDefaults() diff --git a/Items/DraedonMisc/AdvancedDisplay.cs b/Items/DraedonMisc/AdvancedDisplay.cs new file mode 100644 index 0000000000..c43631ec7e --- /dev/null +++ b/Items/DraedonMisc/AdvancedDisplay.cs @@ -0,0 +1,68 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.DraedonSummoner; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using CalamityMod.TileEntities; +using CalamityMod.CustomRecipes; +using System.Collections.Generic; + +namespace CalamityMod.Items.DraedonMisc +{ + public class AdvancedDisplay : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Advanced Display"); + Tooltip.SetDefault("Can be placed on the Codebreaker"); + } + + public override void SetDefaults() + { + item.width = 52; + item.height = 52; + item.maxStack = 999; + item.consumable = true; + item.useStyle = ItemUseStyleID.SwingThrow; + item.rare = ItemRarityID.Yellow; + item.useTime = item.useAnimation = 15; + } + + public override bool UseItem(Player player) => true; + + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 3); + + public override bool ConsumeItem(Player player) + { + Point placeTileCoords = Main.MouseWorld.ToTileCoordinates(); + Tile tile = CalamityUtils.ParanoidTileRetrieval(placeTileCoords.X, placeTileCoords.Y); + float checkDistance = ((Player.tileRangeX + Player.tileRangeY) / 2f + player.blockRange) * 16f; + + if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.active() && tile.type == ModContent.TileType()) + { + TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); + if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsAdvancedDisplay) + return false; + + codebreakerTileEntity.ContainsAdvancedDisplay = true; + codebreakerTileEntity.SyncConstituents((short)Main.myPlayer); + return true; + } + + return false; + } + + public override void AddRecipes() + { + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 3); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ItemID.Glass, 20); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + } + } +} diff --git a/Items/DraedonMisc/AdvancedDisplay.png b/Items/DraedonMisc/AdvancedDisplay.png new file mode 100644 index 0000000000..c0a76b9fac Binary files /dev/null and b/Items/DraedonMisc/AdvancedDisplay.png differ diff --git a/Items/DraedonMisc/AuricQuantumCoolingCell.cs b/Items/DraedonMisc/AuricQuantumCoolingCell.cs new file mode 100644 index 0000000000..a635737937 --- /dev/null +++ b/Items/DraedonMisc/AuricQuantumCoolingCell.cs @@ -0,0 +1,85 @@ +using CalamityMod.CustomRecipes; +using CalamityMod.Items.Materials; +using CalamityMod.TileEntities; +using CalamityMod.Tiles.DraedonSummoner; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.World; + +namespace CalamityMod.Items.DraedonMisc +{ + public class AuricQuantumCoolingCell : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auric Quantum Cooling Cell"); + Tooltip.SetDefault("Can be placed in the Codebreaker, completing it\n" + + "The completion of the Codebreaker allows you to make contact with its original creator\n" + + "Attempting to do so may have dire consequences"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 44; + item.maxStack = 999; + item.consumable = true; + item.useStyle = ItemUseStyleID.SwingThrow; + item.rare = ItemRarityID.Red; + item.useTime = item.useAnimation = 15; + item.Calamity().customRarity = CalamityRarity.Violet; + } + + public override void ModifyTooltips(List tooltips) + { + tooltips.FirstOrDefault(x => x.Name == "Tooltip2" && x.mod == "Terraria").overrideColor = Color.DarkRed; + CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 5, true); + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); + Lighting.AddLight(item.Center, 1.2f * brightness, 0.4f * brightness, 0.8f); + } + + public override bool UseItem(Player player) => true; + + public override bool ConsumeItem(Player player) + { + Point placeTileCoords = Main.MouseWorld.ToTileCoordinates(); + Tile tile = CalamityUtils.ParanoidTileRetrieval(placeTileCoords.X, placeTileCoords.Y); + float checkDistance = ((Player.tileRangeX + Player.tileRangeY) / 2f + player.blockRange) * 16f; + + if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.active() && tile.type == ModContent.TileType()) + { + TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); + if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsCoolingCell || codebreakerTileEntity.DecryptionCountdown > 0) + return false; + + codebreakerTileEntity.ContainsCoolingCell = true; + codebreakerTileEntity.SyncConstituents((short)Main.myPlayer); + return true; + } + + return false; + } + + public override void AddRecipes() + { + // Old worlds can craft the cell immediately for the sake of being able to easily fight Draedon in endgame worlds. + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 5, true); + recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddIngredient(ItemID.Wire, 40); + recipe.AddIngredient(ModContent.ItemType(), 80); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/DraedonMisc/AuricQuantumCoolingCell.png b/Items/DraedonMisc/AuricQuantumCoolingCell.png new file mode 100644 index 0000000000..ed57707d71 Binary files /dev/null and b/Items/DraedonMisc/AuricQuantumCoolingCell.png differ diff --git a/Items/DraedonMisc/CodebreakerBase.cs b/Items/DraedonMisc/CodebreakerBase.cs new file mode 100644 index 0000000000..a6d5d5f160 --- /dev/null +++ b/Items/DraedonMisc/CodebreakerBase.cs @@ -0,0 +1,39 @@ +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.DraedonSummoner; +using CalamityMod.Items.Placeables.DraedonStructures; + +namespace CalamityMod.Items.DraedonMisc +{ + public class CodebreakerBase : ModItem + { + public override void SetStaticDefaults() => DisplayName.SetDefault("Codebreaker Base"); + + public override void SetDefaults() + { + item.useStyle = ItemUseStyleID.SwingThrow; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 42; + item.height = 32; + item.maxStack = 999; + item.rare = ItemRarityID.Orange; + item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ModContent.ItemType(), 35); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + } + } +} diff --git a/Items/DraedonMisc/CodebreakerBase.png b/Items/DraedonMisc/CodebreakerBase.png new file mode 100644 index 0000000000..eacc52b6c4 Binary files /dev/null and b/Items/DraedonMisc/CodebreakerBase.png differ diff --git a/Items/DraedonMisc/DecryptionComputer.cs b/Items/DraedonMisc/DecryptionComputer.cs new file mode 100644 index 0000000000..813891d5b2 --- /dev/null +++ b/Items/DraedonMisc/DecryptionComputer.cs @@ -0,0 +1,71 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.DraedonSummoner; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using CalamityMod.TileEntities; +using CalamityMod.CustomRecipes; +using System.Collections.Generic; + +namespace CalamityMod.Items.DraedonMisc +{ + public class DecryptionComputer : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Decryption Computer"); + Tooltip.SetDefault("Can be placed on the Codebreaker\n" + + "Allows you to decrypt advanced schematics\n" + + "Doing so allows you to learn how to craft new things"); + } + + public override void SetDefaults() + { + item.width = 42; + item.height = 40; + item.maxStack = 999; + item.consumable = true; + item.useStyle = ItemUseStyleID.SwingThrow; + item.rare = ItemRarityID.Orange; + item.useTime = item.useAnimation = 15; + } + + public override bool UseItem(Player player) => true; + + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1); + + public override bool ConsumeItem(Player player) + { + Point placeTileCoords = Main.MouseWorld.ToTileCoordinates(); + Tile tile = CalamityUtils.ParanoidTileRetrieval(placeTileCoords.X, placeTileCoords.Y); + float checkDistance = ((Player.tileRangeX + Player.tileRangeY) / 2f + player.blockRange) * 16f; + + if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.active() && tile.type == ModContent.TileType()) + { + TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); + if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsDecryptionComputer) + return false; + + codebreakerTileEntity.ContainsDecryptionComputer = true; + codebreakerTileEntity.SyncConstituents((short)Main.myPlayer); + return true; + } + + return false; + } + + public override void AddRecipes() + { + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 1); + recipe.AddIngredient(ModContent.ItemType(), 18); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ItemID.Wire, 300); // Anything prior to Tier 2 (Post-Mechs) is fair game. + recipe.AddRecipeGroup("AnyCopperBar", 10); + recipe.AddIngredient(ItemID.Glass, 15); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + } + } +} diff --git a/Items/DraedonMisc/DecryptionComputer.png b/Items/DraedonMisc/DecryptionComputer.png new file mode 100644 index 0000000000..bfe9dcbb2b Binary files /dev/null and b/Items/DraedonMisc/DecryptionComputer.png differ diff --git a/Items/DraedonMisc/EncryptedSchematic.cs b/Items/DraedonMisc/EncryptedSchematic.cs deleted file mode 100644 index 917e9198b9..0000000000 --- a/Items/DraedonMisc/EncryptedSchematic.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.DraedonMisc -{ - public class EncryptedSchematic : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Encrypted Schematic"); - Tooltip.SetDefault("It's impossible to decipher"); // But not for long. - } - - public override void SetDefaults() - { - item.width = 42; - item.height = 42; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; - item.maxStack = 999; - } - } -} diff --git a/Items/DraedonMisc/EncryptedSchematicHell.cs b/Items/DraedonMisc/EncryptedSchematicHell.cs new file mode 100644 index 0000000000..cac05ab946 --- /dev/null +++ b/Items/DraedonMisc/EncryptedSchematicHell.cs @@ -0,0 +1,46 @@ +using CalamityMod.CustomRecipes; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.DraedonMisc +{ + public class EncryptedSchematicHell : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Encrypted Schematic"); + Tooltip.SetDefault("Requires a Codebreaker with a sophisticated display to decrypt"); + } + + public override void SetDefaults() + { + item.width = 42; + item.height = 42; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + item.maxStack = 1; + } + + public override void UpdateInventory(Player player) + { + if (Main.myPlayer == player.whoAmI && !RecipeUnlockHandler.HasFoundHellSchematic) + { + RecipeUnlockHandler.HasFoundHellSchematic = true; + CalamityNetcode.SyncWorld(); + } + } + + public override void AddRecipes() + { + SchematicRecipe recipe = new SchematicRecipe(mod, "Hell"); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ItemID.Glass, 50); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + } + } +} diff --git a/Items/DraedonMisc/EncryptedSchematicHell.png b/Items/DraedonMisc/EncryptedSchematicHell.png new file mode 100644 index 0000000000..ee834c680c Binary files /dev/null and b/Items/DraedonMisc/EncryptedSchematicHell.png differ diff --git a/Items/DraedonMisc/EncryptedSchematicIce.cs b/Items/DraedonMisc/EncryptedSchematicIce.cs new file mode 100644 index 0000000000..b84d3b2f93 --- /dev/null +++ b/Items/DraedonMisc/EncryptedSchematicIce.cs @@ -0,0 +1,47 @@ +using CalamityMod.CustomRecipes; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.DraedonStructures; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.DraedonMisc +{ + public class EncryptedSchematicIce : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Encrypted Schematic"); + Tooltip.SetDefault("Requires a Codebreaker with a complex voltage regulation system to decrypt"); + } + + public override void SetDefaults() + { + item.width = 42; + item.height = 42; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + item.maxStack = 1; + } + + public override void UpdateInventory(Player player) + { + if (Main.myPlayer == player.whoAmI && !RecipeUnlockHandler.HasFoundIceSchematic) + { + RecipeUnlockHandler.HasFoundIceSchematic = true; + CalamityNetcode.SyncWorld(); + } + } + + public override void AddRecipes() + { + SchematicRecipe recipe = new SchematicRecipe(mod, "Ice"); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ItemID.Glass, 50); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + } + } +} diff --git a/Items/DraedonMisc/EncryptedSchematicIce.png b/Items/DraedonMisc/EncryptedSchematicIce.png new file mode 100644 index 0000000000..6cad0a82a1 Binary files /dev/null and b/Items/DraedonMisc/EncryptedSchematicIce.png differ diff --git a/Items/DraedonMisc/EncryptedSchematicJungle.cs b/Items/DraedonMisc/EncryptedSchematicJungle.cs new file mode 100644 index 0000000000..febfbe0ca6 --- /dev/null +++ b/Items/DraedonMisc/EncryptedSchematicJungle.cs @@ -0,0 +1,46 @@ +using CalamityMod.CustomRecipes; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.DraedonMisc +{ + public class EncryptedSchematicJungle : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Encrypted Schematic"); + Tooltip.SetDefault("Requires a Codebreaker with a fine tuned, long range sensor to decrypt"); + } + + public override void SetDefaults() + { + item.width = 42; + item.height = 42; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + item.maxStack = 1; + } + + public override void UpdateInventory(Player player) + { + if (Main.myPlayer == player.whoAmI && !RecipeUnlockHandler.HasFoundJungleSchematic) + { + RecipeUnlockHandler.HasFoundJungleSchematic = true; + CalamityNetcode.SyncWorld(); + } + } + + public override void AddRecipes() + { + SchematicRecipe recipe = new SchematicRecipe(mod, "Jungle"); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ItemID.Glass, 50); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + } + } +} diff --git a/Items/DraedonMisc/EncryptedSchematicJungle.png b/Items/DraedonMisc/EncryptedSchematicJungle.png new file mode 100644 index 0000000000..f89f6ef3d0 Binary files /dev/null and b/Items/DraedonMisc/EncryptedSchematicJungle.png differ diff --git a/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs b/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs new file mode 100644 index 0000000000..17f131482d --- /dev/null +++ b/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs @@ -0,0 +1,46 @@ +using CalamityMod.CustomRecipes; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.DraedonMisc +{ + public class EncryptedSchematicPlanetoid : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Encrypted Schematic"); + Tooltip.SetDefault("Requires a Codebreaker with a basic decryption computer to decrypt"); + } + + public override void SetDefaults() + { + item.width = 42; + item.height = 42; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + item.maxStack = 1; + } + + public override void UpdateInventory(Player player) + { + if (Main.myPlayer == player.whoAmI && !RecipeUnlockHandler.HasFoundPlanetoidSchematic) + { + RecipeUnlockHandler.HasFoundPlanetoidSchematic = true; + CalamityNetcode.SyncWorld(); + } + } + + public override void AddRecipes() + { + SchematicRecipe recipe = new SchematicRecipe(mod, "Planetoid"); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ItemID.Glass, 50); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + } + } +} diff --git a/Items/DraedonMisc/EncryptedSchematic.png b/Items/DraedonMisc/EncryptedSchematicPlanetoid.png similarity index 100% rename from Items/DraedonMisc/EncryptedSchematic.png rename to Items/DraedonMisc/EncryptedSchematicPlanetoid.png diff --git a/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs b/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs new file mode 100644 index 0000000000..f5e161e900 --- /dev/null +++ b/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs @@ -0,0 +1,52 @@ +using CalamityMod.CustomRecipes; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.DraedonMisc +{ + public class EncryptedSchematicSunkenSea : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Schematic"); + Tooltip.SetDefault("You can barely make out its text...\n" + + "Finely detailed diagrams of numerous devices and weaponry dance across the holographic screen\n" + + "Picking up this item or holding it in your inventory permanently unlocks new recipes"); + } + + public override void SetDefaults() + { + item.width = 42; + item.height = 42; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + item.maxStack = 1; + } + + public override void UpdateInventory(Player player) + { + // Since no decrypting is necessary for this item simply placing it in your inventory is sufficient enough to "learn" + // from it. + if (Main.myPlayer == player.whoAmI && (!RecipeUnlockHandler.HasUnlockedT1ArsenalRecipes || !RecipeUnlockHandler.HasFoundSunkenSeaSchematic)) + { + RecipeUnlockHandler.HasFoundSunkenSeaSchematic = true; + RecipeUnlockHandler.HasUnlockedT1ArsenalRecipes = true; + CalamityNetcode.SyncWorld(); + } + } + + // Recipe exists for posierity. + public override void AddRecipes() + { + SchematicRecipe recipe = new SchematicRecipe(mod, "Sunken Sea"); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ItemID.Glass, 50); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + } + } +} diff --git a/Items/DraedonMisc/EncryptedSchematicSunkenSea.png b/Items/DraedonMisc/EncryptedSchematicSunkenSea.png new file mode 100644 index 0000000000..86a157d03b Binary files /dev/null and b/Items/DraedonMisc/EncryptedSchematicSunkenSea.png differ diff --git a/Items/DraedonMisc/LongRangedSensorArray.cs b/Items/DraedonMisc/LongRangedSensorArray.cs new file mode 100644 index 0000000000..703d70282b --- /dev/null +++ b/Items/DraedonMisc/LongRangedSensorArray.cs @@ -0,0 +1,68 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.DraedonSummoner; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using CalamityMod.TileEntities; +using CalamityMod.CustomRecipes; +using System.Collections.Generic; + +namespace CalamityMod.Items.DraedonMisc +{ + public class LongRangedSensorArray : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Long Ranged Sensor Array"); + Tooltip.SetDefault("Can be placed on the Codebreaker"); + } + + public override void SetDefaults() + { + item.width = 52; + item.height = 52; + item.maxStack = 999; + item.consumable = true; + item.useStyle = ItemUseStyleID.SwingThrow; + item.rare = ItemRarityID.Pink; + item.useTime = item.useAnimation = 15; + } + + public override bool UseItem(Player player) => true; + + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 2); + + public override bool ConsumeItem(Player player) + { + Point placeTileCoords = Main.MouseWorld.ToTileCoordinates(); + Tile tile = CalamityUtils.ParanoidTileRetrieval(placeTileCoords.X, placeTileCoords.Y); + float checkDistance = ((Player.tileRangeX + Player.tileRangeY) / 2f + player.blockRange) * 16f; + + if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.active() && tile.type == ModContent.TileType()) + { + TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); + if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsSensorArray) + return false; + + codebreakerTileEntity.ContainsSensorArray = true; + codebreakerTileEntity.SyncConstituents((short)Main.myPlayer); + return true; + } + + return false; + } + + public override void AddRecipes() + { + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 2); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ItemID.HallowedBar, 10); + recipe.AddIngredient(ItemID.Wire, 50); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + } + } +} diff --git a/Items/DraedonMisc/LongRangedSensorArray.png b/Items/DraedonMisc/LongRangedSensorArray.png new file mode 100644 index 0000000000..3b9a2bb067 Binary files /dev/null and b/Items/DraedonMisc/LongRangedSensorArray.png differ diff --git a/Items/DraedonMisc/VoltageRegulationSystem.cs b/Items/DraedonMisc/VoltageRegulationSystem.cs new file mode 100644 index 0000000000..b027039de5 --- /dev/null +++ b/Items/DraedonMisc/VoltageRegulationSystem.cs @@ -0,0 +1,69 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.DraedonSummoner; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using CalamityMod.TileEntities; +using CalamityMod.CustomRecipes; +using System.Collections.Generic; + +namespace CalamityMod.Items.DraedonMisc +{ + public class VoltageRegulationSystem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Voltage Regulation System"); + Tooltip.SetDefault("Can be placed on the Codebreaker"); + } + + public override void SetDefaults() + { + item.width = 52; + item.height = 52; + item.maxStack = 999; + item.consumable = true; + item.useStyle = ItemUseStyleID.SwingThrow; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.useTime = item.useAnimation = 15; + } + + public override bool UseItem(Player player) => true; + + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 4); + + public override bool ConsumeItem(Player player) + { + Point placeTileCoords = Main.MouseWorld.ToTileCoordinates(); + Tile tile = CalamityUtils.ParanoidTileRetrieval(placeTileCoords.X, placeTileCoords.Y); + float checkDistance = ((Player.tileRangeX + Player.tileRangeY) / 2f + player.blockRange) * 16f; + + if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.active() && tile.type == ModContent.TileType()) + { + TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); + if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsVoltageRegulationSystem) + return false; + + codebreakerTileEntity.ContainsVoltageRegulationSystem = true; + codebreakerTileEntity.SyncConstituents((short)Main.myPlayer); + return true; + } + + return false; + } + + public override void AddRecipes() + { + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 4); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + } + } +} diff --git a/Items/DraedonMisc/VoltageRegulationSystem.png b/Items/DraedonMisc/VoltageRegulationSystem.png new file mode 100644 index 0000000000..4336750cba Binary files /dev/null and b/Items/DraedonMisc/VoltageRegulationSystem.png differ diff --git a/Items/Dyes/AerialiteDye.cs b/Items/Dyes/AerialiteDye.cs new file mode 100644 index 0000000000..e4360940d7 --- /dev/null +++ b/Items/Dyes/AerialiteDye.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Placeables.Ores; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Dyes +{ + public class AerialiteDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/AerialiteDyeShader")), "DyePass"). + UseColor(new Color(153, 200, 193)).UseSecondaryColor(new Color(236, 244, 213)).UseImage("Images/Misc/Perlin"); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Aerialite Dye"); + } + + public override void SafeSetDefaults() + { + item.rare = ItemRarityID.Green; + item.value = Item.sellPrice(0, 0, 50, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.DyeVat); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/AerialiteDye.png b/Items/Dyes/AerialiteDye.png new file mode 100644 index 0000000000..99402471c4 Binary files /dev/null and b/Items/Dyes/AerialiteDye.png differ diff --git a/Items/Dyes/AstralDye.cs b/Items/Dyes/AstralDye.cs new file mode 100644 index 0000000000..a42e9f20ec --- /dev/null +++ b/Items/Dyes/AstralDye.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Placeables; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Dyes +{ + public class AstralDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/AstralDyeShader")), "DyePass"). + UseColor(new Color(123, 99, 130)).UseSecondaryColor(new Color(189, 66, 84)).UseImage("Images/Misc/Perlin"); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Astral Flesh Dye"); + } + + public override void SafeSetDefaults() + { + item.rare = ItemRarityID.LightRed; + item.value = Item.sellPrice(0, 0, 65, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddTile(TileID.DyeVat); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Dyes/AstralDye.png b/Items/Dyes/AstralDye.png new file mode 100644 index 0000000000..3b29a4b108 Binary files /dev/null and b/Items/Dyes/AstralDye.png differ diff --git a/Items/Dyes/AuricDye.cs b/Items/Dyes/AuricDye.cs new file mode 100644 index 0000000000..09776eaa7f --- /dev/null +++ b/Items/Dyes/AuricDye.cs @@ -0,0 +1,38 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Dyes +{ + public class AuricDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/AuricDyeShader")), "DyePass"). + UseColor(new Color(170, 96, 60)).UseSecondaryColor(new Color(226, 196, 106)).SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/SharpNoise")); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Auric Dye"); + } + + public override void SafeSetDefaults() + { + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Violet; + item.value = Item.sellPrice(0, 9, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(TileID.DyeVat); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/AuricDye.png b/Items/Dyes/AuricDye.png new file mode 100644 index 0000000000..fc17ae5066 Binary files /dev/null and b/Items/Dyes/AuricDye.png differ diff --git a/Items/Dyes/BlueStatigelDye.cs b/Items/Dyes/BlueStatigelDye.cs new file mode 100644 index 0000000000..9c58bb79d5 --- /dev/null +++ b/Items/Dyes/BlueStatigelDye.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Items.Dyes +{ + public class BlueStatigelDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/SlimeGodDyeShader")), "DyePass"). + UseColor(new Color(80, 170, 206)).UseSecondaryColor(new Color(81, 87, 119)).UseImage("Images/Misc/Perlin"); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Blue Statigel Dye"); + } + + public override void SafeSetDefaults() + { + item.rare = ItemRarityID.LightRed; + item.value = CalamityGlobalItem.Rarity4BuyPrice; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater, 2); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.DyeVat); + recipe.SetResult(this, 2); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/BlueStatigelDye.png b/Items/Dyes/BlueStatigelDye.png new file mode 100644 index 0000000000..1d320cd8fb Binary files /dev/null and b/Items/Dyes/BlueStatigelDye.png differ diff --git a/Items/Dyes/BrimflameDye.cs b/Items/Dyes/BrimflameDye.cs new file mode 100644 index 0000000000..b8065e5dfa --- /dev/null +++ b/Items/Dyes/BrimflameDye.cs @@ -0,0 +1,37 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Microsoft.Xna.Framework; +using CalamityMod.Items.Placeables; + +namespace CalamityMod.Items.Dyes +{ + public class BrimflameDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/BrimflameDyeShader")), "DyePass"). + UseColor(new Color(252, 147, 34)).UseSecondaryColor(new Color(216, 41, 26)).UseImage("Images/Misc/Perlin"); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Brimflame Dye"); + } + + public override void SafeSetDefaults() + { + item.rare = ItemRarityID.Pink; + item.value = Item.sellPrice(0, 0, 75, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddTile(TileID.DyeVat); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Dyes/BrimflameDye.png b/Items/Dyes/BrimflameDye.png new file mode 100644 index 0000000000..4ad43ffc80 Binary files /dev/null and b/Items/Dyes/BrimflameDye.png differ diff --git a/Items/Dyes/CosmiliteDye.cs b/Items/Dyes/CosmiliteDye.cs new file mode 100644 index 0000000000..e115957b82 --- /dev/null +++ b/Items/Dyes/CosmiliteDye.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Dyes +{ + public class CosmiliteDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/CosmiliteDyeShader")), "DyePass"). + UseColor(new Color(154, 140, 191)).UseSecondaryColor(new Color(249, 109, 235)).UseImage("Images/Misc/Perlin"); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Cosmilite Dye"); + } + + public override void SafeSetDefaults() + { + item.rare = ItemRarityID.LightRed; + item.value = Item.sellPrice(0, 7, 50, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater, 2); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.DyeVat); + recipe.SetResult(this, 2); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Dyes/CosmiliteDye.png b/Items/Dyes/CosmiliteDye.png new file mode 100644 index 0000000000..77fca729bd Binary files /dev/null and b/Items/Dyes/CosmiliteDye.png differ diff --git a/Items/Dyes/ExoDye.cs b/Items/Dyes/ExoDye.cs new file mode 100644 index 0000000000..1e2f58d72c --- /dev/null +++ b/Items/Dyes/ExoDye.cs @@ -0,0 +1,39 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Dyes +{ + public class ExoDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind + { + get => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/ExoDyeShader")), "DyePass").UseImage("Images/Misc/Perlin"); + } + + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Exo Dye"); + } + + public override void SafeSetDefaults() + { + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Violet; + item.value = Item.sellPrice(0, 10, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater, 3); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.DyeVat); + recipe.SetResult(this, 3); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Dyes/ExoDye.png b/Items/Dyes/ExoDye.png new file mode 100644 index 0000000000..6cc8ebfeec Binary files /dev/null and b/Items/Dyes/ExoDye.png differ diff --git a/Items/Dyes/PinkStatigelDye.cs b/Items/Dyes/PinkStatigelDye.cs new file mode 100644 index 0000000000..8c9c650cc6 --- /dev/null +++ b/Items/Dyes/PinkStatigelDye.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Items.Dyes +{ + public class PinkStatigelDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/SlimeGodDyeShader")), "DyePass"). + UseColor(new Color(249, 129, 185)).UseSecondaryColor(new Color(131, 58, 103)).UseImage("Images/Misc/Perlin"); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Pink Statigel Dye"); + } + + public override void SafeSetDefaults() + { + item.rare = ItemRarityID.LightRed; + item.value = CalamityGlobalItem.Rarity4BuyPrice; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater, 2); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.DyeVat); + recipe.SetResult(this, 2); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/PinkStatigelDye.png b/Items/Dyes/PinkStatigelDye.png new file mode 100644 index 0000000000..c08c10cdf1 Binary files /dev/null and b/Items/Dyes/PinkStatigelDye.png differ diff --git a/Items/Dyes/SlimeGodDye.cs b/Items/Dyes/SlimeGodDye.cs new file mode 100644 index 0000000000..42ac4162c7 --- /dev/null +++ b/Items/Dyes/SlimeGodDye.cs @@ -0,0 +1,37 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Items.Dyes +{ + public class SlimeGodDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/SlimeGodDyeShader")), "DyePass"). + UseColor(new Color(80, 170, 206)).UseSecondaryColor(new Color(131, 58, 103)).UseImage("Images/Misc/Perlin"); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Slime God Dye"); + } + + public override void SafeSetDefaults() + { + item.rare = ItemRarityID.LightRed; + item.value = (int)(CalamityGlobalItem.Rarity4BuyPrice * 1.5); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.DyeVat); + recipe.SetResult(this, 2); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/SlimeGodDye.png b/Items/Dyes/SlimeGodDye.png new file mode 100644 index 0000000000..a1f8e81f2b Binary files /dev/null and b/Items/Dyes/SlimeGodDye.png differ diff --git a/Items/Fishing/FishingRods/TheDevourerofCods.cs b/Items/Fishing/FishingRods/TheDevourerofCods.cs index ace98ba9ab..25fe408bb1 100644 --- a/Items/Fishing/FishingRods/TheDevourerofCods.cs +++ b/Items/Fishing/FishingRods/TheDevourerofCods.cs @@ -4,28 +4,30 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; + namespace CalamityMod.Items.Fishing.FishingRods { - public class TheDevourerofCods : ModItem + public class TheDevourerofCods : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("The Devourer of Cods"); Tooltip.SetDefault("Fires ten lines at once. Line never snaps and can fish from lava.\n" + - "The devourer was once just an Eater of Shoals."); + "The devourer was once just an Eater of Shoals."); } public override void SetDefaults() { - item.width = 24; - item.height = 28; - item.useAnimation = 8; - item.useTime = 8; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - item.fishingPole = 75; - item.shootSpeed = 20f; - item.shoot = ModContent.ProjectileType(); + item.width = 24; + item.height = 28; + item.useAnimation = 8; + item.useTime = 8; + item.useStyle = ItemUseStyleID.SwingThrow; + item.UseSound = SoundID.Item1; + item.fishingPole = 75; + item.shootSpeed = 20f; + item.shoot = ModContent.ProjectileType(); item.value = Item.buyPrice(1, 80, 0, 0); item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.DarkBlue; @@ -45,8 +47,8 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/LabFinders/CyanSeekingMechanism.cs b/Items/LabFinders/CyanSeekingMechanism.cs new file mode 100644 index 0000000000..76ac4b77c6 --- /dev/null +++ b/Items/LabFinders/CyanSeekingMechanism.cs @@ -0,0 +1,44 @@ +using CalamityMod.Projectiles.Typeless; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LabFinders +{ + public class CyanSeekingMechanism : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cyan Seeking Mechanism"); + Tooltip.SetDefault("Moves swiftly towards a lab deep below the desert"); + } + + public override void SetDefaults() + { + item.width = 24; + item.height = 26; + item.noUseGraphic = true; + item.useStyle = ItemUseStyleID.SwingThrow; + item.useTime = item.useAnimation = 36; + item.shoot = ModContent.ProjectileType(); + item.Calamity().MaxCharge = 100; + item.Calamity().ChargePerUse = 15; + item.Calamity().UsesCharge = true; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + } + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && CalamityWorld.SunkenSeaLabCenter != Vector2.Zero; + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.WaterBucket); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/LabFinders/CyanSeekingMechanism.png b/Items/LabFinders/CyanSeekingMechanism.png new file mode 100644 index 0000000000..edd68f889e Binary files /dev/null and b/Items/LabFinders/CyanSeekingMechanism.png differ diff --git a/Items/LabFinders/GreenSeekingMechanism.cs b/Items/LabFinders/GreenSeekingMechanism.cs new file mode 100644 index 0000000000..da3188e614 --- /dev/null +++ b/Items/LabFinders/GreenSeekingMechanism.cs @@ -0,0 +1,44 @@ +using CalamityMod.Projectiles.Typeless; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LabFinders +{ + public class GreenSeekingMechanism : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Green Seeking Mechanism"); + Tooltip.SetDefault("Moves swiftly towards a lab within the jungle"); + } + + public override void SetDefaults() + { + item.width = 24; + item.height = 26; + item.noUseGraphic = true; + item.useStyle = ItemUseStyleID.SwingThrow; + item.useTime = item.useAnimation = 36; + item.shoot = ModContent.ProjectileType(); + item.Calamity().MaxCharge = 100; + item.Calamity().ChargePerUse = 15; + item.Calamity().UsesCharge = true; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + } + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && CalamityWorld.JungleLabCenter != Vector2.Zero; + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.Vine, 3); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/LabFinders/GreenSeekingMechanism.png b/Items/LabFinders/GreenSeekingMechanism.png new file mode 100644 index 0000000000..1f1377a9b9 Binary files /dev/null and b/Items/LabFinders/GreenSeekingMechanism.png differ diff --git a/Items/LabFinders/MysteriousMechanism.cs b/Items/LabFinders/MysteriousMechanism.cs new file mode 100644 index 0000000000..51dd30ac8d --- /dev/null +++ b/Items/LabFinders/MysteriousMechanism.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Typeless; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LabFinders +{ + public class MysteriousMechanism : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mysterious Mechanism"); + Tooltip.SetDefault("Used as a base for specialized homing technology"); + } + + public override void SetDefaults() + { + item.width = 24; + item.height = 26; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ItemID.IronBar, 10); + recipe.anyIronBar = true; + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/LabFinders/MysteriousMechanism.png b/Items/LabFinders/MysteriousMechanism.png new file mode 100644 index 0000000000..7f12c1775f Binary files /dev/null and b/Items/LabFinders/MysteriousMechanism.png differ diff --git a/Items/LabFinders/PurpleSeekingMechanism.cs b/Items/LabFinders/PurpleSeekingMechanism.cs new file mode 100644 index 0000000000..28e08b4a5b --- /dev/null +++ b/Items/LabFinders/PurpleSeekingMechanism.cs @@ -0,0 +1,44 @@ +using CalamityMod.Projectiles.Typeless; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LabFinders +{ + public class PurpleSeekingMechanism : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Purple Seeking Mechanism"); + Tooltip.SetDefault("Moves swiftly towards a lab within the sky"); + } + + public override void SetDefaults() + { + item.width = 24; + item.height = 26; + item.noUseGraphic = true; + item.useStyle = ItemUseStyleID.SwingThrow; + item.useTime = item.useAnimation = 36; + item.shoot = ModContent.ProjectileType(); + item.Calamity().MaxCharge = 100; + item.Calamity().ChargePerUse = 15; + item.Calamity().UsesCharge = true; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + } + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && CalamityWorld.PlanetoidLabCenter != Vector2.Zero; + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.Cloud, 20); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/LabFinders/PurpleSeekingMechanism.png b/Items/LabFinders/PurpleSeekingMechanism.png new file mode 100644 index 0000000000..aaf94eb5f1 Binary files /dev/null and b/Items/LabFinders/PurpleSeekingMechanism.png differ diff --git a/Items/LabFinders/RedSeekingMechanism.cs b/Items/LabFinders/RedSeekingMechanism.cs new file mode 100644 index 0000000000..ffd99cb84d --- /dev/null +++ b/Items/LabFinders/RedSeekingMechanism.cs @@ -0,0 +1,44 @@ +using CalamityMod.Projectiles.Typeless; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LabFinders +{ + public class RedSeekingMechanism : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Red Seeking Mechanism"); + Tooltip.SetDefault("Moves swiftly towards a lab within the underworld"); + } + + public override void SetDefaults() + { + item.width = 24; + item.height = 26; + item.noUseGraphic = true; + item.useStyle = ItemUseStyleID.SwingThrow; + item.useTime = item.useAnimation = 36; + item.shoot = ModContent.ProjectileType(); + item.Calamity().MaxCharge = 100; + item.Calamity().ChargePerUse = 15; + item.Calamity().UsesCharge = true; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + } + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && CalamityWorld.HellLabCenter != Vector2.Zero; + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.HellstoneBar, 4); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/LabFinders/RedSeekingMechanism.png b/Items/LabFinders/RedSeekingMechanism.png new file mode 100644 index 0000000000..0b1ff1cb19 Binary files /dev/null and b/Items/LabFinders/RedSeekingMechanism.png differ diff --git a/Items/LabFinders/YellowSeekingMechanism.cs b/Items/LabFinders/YellowSeekingMechanism.cs new file mode 100644 index 0000000000..a54448c777 --- /dev/null +++ b/Items/LabFinders/YellowSeekingMechanism.cs @@ -0,0 +1,44 @@ +using CalamityMod.Projectiles.Typeless; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LabFinders +{ + public class YellowSeekingMechanism : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yellow Seeking Mechanism"); + Tooltip.SetDefault("Moves swiftly towards a lab within the frozen caverns"); + } + + public override void SetDefaults() + { + item.width = 24; + item.height = 26; + item.noUseGraphic = true; + item.useStyle = ItemUseStyleID.SwingThrow; + item.useTime = item.useAnimation = 36; + item.shoot = ModContent.ProjectileType(); + item.Calamity().MaxCharge = 100; + item.Calamity().ChargePerUse = 15; + item.Calamity().UsesCharge = true; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + } + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && CalamityWorld.IceLabCenter != Vector2.Zero; + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.IceBlock, 50); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/LabFinders/YellowSeekingMechanism.png b/Items/LabFinders/YellowSeekingMechanism.png new file mode 100644 index 0000000000..d0d0dfe69c Binary files /dev/null and b/Items/LabFinders/YellowSeekingMechanism.png differ diff --git a/Items/LoreItems/KnowledgeBrimstoneCrag.cs b/Items/LoreItems/KnowledgeBrimstoneCrag.cs index be6cdbfdae..5d35401607 100644 --- a/Items/LoreItems/KnowledgeBrimstoneCrag.cs +++ b/Items/LoreItems/KnowledgeBrimstoneCrag.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.LoreItems public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Crag"); - Tooltip.SetDefault("Ah...this place.\n" + + Tooltip.SetDefault("Ah... this place.\n" + "The scent of broken promises, pain, and eventual death is heavy in the air..."); } diff --git a/Items/LoreItems/KnowledgeExoMechs.cs b/Items/LoreItems/KnowledgeExoMechs.cs new file mode 100644 index 0000000000..4a7bf9f19f --- /dev/null +++ b/Items/LoreItems/KnowledgeExoMechs.cs @@ -0,0 +1,39 @@ +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Items.LoreItems +{ + public class KnowledgeExoMechs : LoreItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Exo Mechanical Trio"); + Tooltip.SetDefault("The fruits of masterful craftsmanship and optimization, created only with the objective to destroy.\n" + + "Yet in the end, they achieved little more than the original designs they were derived from."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = ItemRarityID.Red; + item.consumable = false; + item.Calamity().customRarity = CalamityRarity.Violet; + } + + public override bool CanUseItem(Player player) => false; + + // Requires an Exo Mechs trophy. + /* + public override void AddRecipes() + { + ModRecipe r = new ModRecipe(mod); + r.SetResult(this); + r.AddTile(TileID.Bookcases); + r.AddIngredient(ModContent.ItemType()); + r.AddIngredient(ModContent.ItemType(), 10); + r.AddRecipe(); + } + */ + } +} diff --git a/Items/LoreItems/KnowledgeExoMechs.png b/Items/LoreItems/KnowledgeExoMechs.png new file mode 100644 index 0000000000..3f6628f7c4 Binary files /dev/null and b/Items/LoreItems/KnowledgeExoMechs.png differ diff --git a/Items/LoreItems/KnowledgeEyeofCthulhu.cs b/Items/LoreItems/KnowledgeEyeofCthulhu.cs index a3de3da84b..a4342feed6 100644 --- a/Items/LoreItems/KnowledgeEyeofCthulhu.cs +++ b/Items/LoreItems/KnowledgeEyeofCthulhu.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.LoreItems public override void SetStaticDefaults() { DisplayName.SetDefault("The Eye of Cthulhu"); - Tooltip.SetDefault("That eye...how peculiar.\n" + + Tooltip.SetDefault("That eye... how peculiar.\n" + "I sensed it watching you more intensely as you grew stronger."); } diff --git a/Items/LoreItems/KnowledgeLunaticCultist.cs b/Items/LoreItems/KnowledgeLunaticCultist.cs index 7163808564..9394a8d151 100644 --- a/Items/LoreItems/KnowledgeLunaticCultist.cs +++ b/Items/LoreItems/KnowledgeLunaticCultist.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("Lunatic Cultist"); Tooltip.SetDefault("The gifted one that terminated my grand summoning so long ago with his uncanny powers over the arcane.\n" + - "Someone I once held in such contempt for his actions is now...deceased, his sealing ritual undone...prepare for the end.\n" + + "Someone I once held in such contempt for his actions is now... deceased, his sealing ritual undone... prepare for the end.\n" + "Your impending doom approaches..."); } diff --git a/Items/LoreItems/KnowledgeMechs.cs b/Items/LoreItems/KnowledgeMechs.cs index f51348538d..38e780605a 100644 --- a/Items/LoreItems/KnowledgeMechs.cs +++ b/Items/LoreItems/KnowledgeMechs.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.LoreItems { public override void SetStaticDefaults() { - DisplayName.SetDefault("The Mechanical Bosses"); + DisplayName.SetDefault("The Mechanical Trio"); Tooltip.SetDefault("I see you have awakened Draedon's old toys.\n" + "Once useful tools turned into savage beasts when their AIs went rogue, a mistake that Draedon failed to rectify in time."); } diff --git a/Items/LoreItems/KnowledgeQueenBee.cs b/Items/LoreItems/KnowledgeQueenBee.cs index 8334c5f3f3..5de4682fcd 100644 --- a/Items/LoreItems/KnowledgeQueenBee.cs +++ b/Items/LoreItems/KnowledgeQueenBee.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.LoreItems public override void SetStaticDefaults() { DisplayName.SetDefault("Queen Bee"); - Tooltip.SetDefault("As crude as the giant insects are they can prove useful in certain situations...given the ability to control them."); + Tooltip.SetDefault("As crude as the giant insects are they can prove useful in certain situations... given the ability to control them."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeSkeletronPrime.cs b/Items/LoreItems/KnowledgeSkeletronPrime.cs index b825d2084b..b2fb80cd8b 100644 --- a/Items/LoreItems/KnowledgeSkeletronPrime.cs +++ b/Items/LoreItems/KnowledgeSkeletronPrime.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("Skeletron Prime"); Tooltip.SetDefault("What a silly and pointless contraption for something created with the essence of pure terror.\n" + - "Draedon obviously took several liberties with its design...I am not impressed."); + "Draedon obviously took several liberties with its design... I am not impressed."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeUnderworld.cs b/Items/LoreItems/KnowledgeUnderworld.cs index 06f48386f9..aea48d6bf3 100644 --- a/Items/LoreItems/KnowledgeUnderworld.cs +++ b/Items/LoreItems/KnowledgeUnderworld.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.LoreItems public override void SetStaticDefaults() { DisplayName.SetDefault("The Underworld"); - Tooltip.SetDefault("These obsidian and hellstone towers were once home to thousands of...'people'.\n" + + Tooltip.SetDefault("These obsidian and hellstone towers were once home to thousands of... 'people'.\n" + "Unfortunately for them, they were twisted by their inner demons until they were beyond saving."); } diff --git a/Items/Materials/AscendantSpiritEssence.cs b/Items/Materials/AscendantSpiritEssence.cs index c56c54e6f5..16234a3597 100644 --- a/Items/Materials/AscendantSpiritEssence.cs +++ b/Items/Materials/AscendantSpiritEssence.cs @@ -1,17 +1,16 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.DataStructures; namespace CalamityMod.Items.Materials { public class AscendantSpiritEssence : ModItem { - public int frameCounter = 0; - public int frame = 0; + public int frameCounter = 0; + public int frame = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Ascendant Spirit Essence"); @@ -26,21 +25,21 @@ namespace CalamityMod.Items.Materials item.maxStack = 999; item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.value = Item.sellPrice(gold: 25); + item.value = Item.sellPrice(gold: 40); } - public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) - { - Texture2D texture = Main.itemTexture[item.type]; - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - return false; - } + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = Main.itemTexture[item.type]; + spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + return false; + } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/AscendantSpiritEssenceGlow"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/AscendantSpiritEssenceGlow"); + spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } public override void Update(ref float gravity, ref float maxFallSpeed) { @@ -54,8 +53,8 @@ namespace CalamityMod.Items.Materials recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Materials/AuricBar.cs b/Items/Materials/AuricBar.cs index d223c55911..5b30482214 100644 --- a/Items/Materials/AuricBar.cs +++ b/Items/Materials/AuricBar.cs @@ -11,54 +11,54 @@ namespace CalamityMod.Items.Materials { public class AuricBar : ModItem { - public int frameCounter = 0; - public int frame = 0; + public int frameCounter = 0; + public int frame = 0; public override void SetStaticDefaults() { - DisplayName.SetDefault("Auric Tesla Bar"); - Tooltip.SetDefault("It radiates godly energy"); + DisplayName.SetDefault("Auric Bar"); + Tooltip.SetDefault("Godlike power emanates from the metal"); } public override void SetDefaults() { - item.createTile = ModContent.TileType(); + item.createTile = ModContent.TileType(); item.width = 50; item.height = 30; item.maxStack = 999; item.value = Item.sellPrice(gold: 60); item.Calamity().customRarity = CalamityRarity.Violet; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; + item.useStyle = ItemUseStyleID.SwingThrow; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; } - public override void UseStyle(Player player) - { - player.itemLocation += new Vector2(-10f * player.direction, 10f * player.gravDir).RotatedBy(player.itemRotation); - } + public override void UseStyle(Player player) + { + player.itemLocation += new Vector2(-10f * player.direction, 10f * player.gravDir).RotatedBy(player.itemRotation); + } - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) - { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/AuricBar_Animated"); - spriteBatch.Draw(texture, position, item.GetCurrentFrame(ref frame, ref frameCounter, 5, 15), Color.White, 0f, origin, scale, SpriteEffects.None, 0); - return false; - } + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/AuricBar_Animated"); + spriteBatch.Draw(texture, position, item.GetCurrentFrame(ref frame, ref frameCounter, 5, 15), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + return false; + } - public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) - { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/AuricBar_Animated"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 5, 15), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - return false; - } + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/AuricBar_Animated"); + spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 5, 15), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + return false; + } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/AuricBarGlow"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 5, 15, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/AuricBarGlow"); + spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 5, 15, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } public override void Update(ref float gravity, ref float maxFallSpeed) { @@ -69,15 +69,10 @@ namespace CalamityMod.Items.Materials public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 60); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this, 2); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this, 5); recipe.AddRecipe(); } } diff --git a/Items/Materials/CalamitousEssence.cs b/Items/Materials/CalamitousEssence.cs index 80c39e2ecc..3251382159 100644 --- a/Items/Materials/CalamitousEssence.cs +++ b/Items/Materials/CalamitousEssence.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { DisplayName.SetDefault("Ashes of Annihilation"); - Tooltip.SetDefault("It burns with untold power"); + Tooltip.SetDefault("The smoldering essence of the Witch's wrath"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(7, 6)); } @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Materials item.height = 56; item.maxStack = 999; item.rare = ItemRarityID.Purple; - item.value = Item.sellPrice(gold: 24); + item.value = Item.sellPrice(gold: 66, silver: 66, copper: 66); item.Calamity().customRarity = CalamityRarity.Violet; } diff --git a/Items/Materials/CoreofCalamity.cs b/Items/Materials/CoreofCalamity.cs index e6066a60a9..2fcf5f319c 100644 --- a/Items/Materials/CoreofCalamity.cs +++ b/Items/Materials/CoreofCalamity.cs @@ -33,6 +33,7 @@ namespace CalamityMod.Items.Materials recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Materials/CosmiliteBar.cs b/Items/Materials/CosmiliteBar.cs index f9cc4a27d8..5f620b9366 100644 --- a/Items/Materials/CosmiliteBar.cs +++ b/Items/Materials/CosmiliteBar.cs @@ -7,23 +7,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { - public class CosmiliteBar : ModItem - { + public class CosmiliteBar : ModItem + { public int frameCounter = 0; public int frame = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmilite Bar"); - Tooltip.SetDefault("A chunk of highly-resistant cosmic steel"); - } - public override void SetDefaults() - { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmilite Bar"); + Tooltip.SetDefault("A chunk of durable and highly resilient cosmic steel"); + } + + public override void SetDefaults() + { item.createTile = ModContent.TileType(); - item.width = 30; - item.height = 24; - item.maxStack = 999; - item.value = Item.buyPrice(0, 7, 0, 0); + item.width = 30; + item.height = 24; + item.maxStack = 999; + item.value = Item.sellPrice(gold: 20); item.rare = ItemRarityID.Purple; item.Calamity().customRarity = CalamityRarity.DarkBlue; item.useStyle = ItemUseStyleID.SwingThrow; @@ -32,7 +33,7 @@ namespace CalamityMod.Items.Materials item.useTime = 10; item.autoReuse = true; item.consumable = true; - } + } public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) { @@ -48,10 +49,10 @@ namespace CalamityMod.Items.Materials return false; } - public override void Update(ref float gravity, ref float maxFallSpeed) - { - float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); - Lighting.AddLight(item.Center, 0.5f * brightness, 0f, 0.5f * brightness); - } - } + public override void Update(ref float gravity, ref float maxFallSpeed) + { + float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); + Lighting.AddLight(item.Center, 0.5f * brightness, 0f, 0.5f * brightness); + } + } } diff --git a/Items/Materials/DarksunFragment.cs b/Items/Materials/DarksunFragment.cs index 4f3ebb9e58..ff79d29716 100644 --- a/Items/Materials/DarksunFragment.cs +++ b/Items/Materials/DarksunFragment.cs @@ -9,12 +9,12 @@ namespace CalamityMod.Items.Materials { public class DarksunFragment : ModItem { - public int frameCounter = 0; - public int frame = 0; + public int frameCounter = 0; + public int frame = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Darksun Fragment"); - Tooltip.SetDefault("A shard of lunar and solar energy"); + Tooltip.SetDefault("An impacted crystal suffused with opposing celestial energies"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 8)); } @@ -23,23 +23,23 @@ namespace CalamityMod.Items.Materials item.width = 28; item.height = 32; item.maxStack = 999; - item.rare = ItemRarityID.Purple; + item.rare = ItemRarityID.Purple; item.value = Item.sellPrice(gold: 12); item.Calamity().customRarity = CalamityRarity.DarkBlue; } - public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) - { - Texture2D texture = Main.itemTexture[item.type]; - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 8), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - return false; - } + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = Main.itemTexture[item.type]; + spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 8), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + return false; + } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/DarksunFragmentGlow"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 8, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/DarksunFragmentGlow"); + spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 8, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } public override void Update(ref float gravity, ref float maxFallSpeed) { diff --git a/Items/Materials/EndothermicEnergy.cs b/Items/Materials/EndothermicEnergy.cs index 3c3124302e..1777bc85ea 100644 --- a/Items/Materials/EndothermicEnergy.cs +++ b/Items/Materials/EndothermicEnergy.cs @@ -7,14 +7,14 @@ using Terraria.ID; namespace CalamityMod.Items.Materials { - public class EndothermicEnergy : ModItem + public class EndothermicEnergy : ModItem { - public int frameCounter = 0; - public int frame = 0; + public int frameCounter = 0; + public int frame = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Endothermic Energy"); - Tooltip.SetDefault("Great for preventing heat stroke"); + Tooltip.SetDefault("Its deathly chill sucks the life from its surroundings"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); } @@ -28,18 +28,18 @@ namespace CalamityMod.Items.Materials item.Calamity().customRarity = CalamityRarity.DarkBlue; } - public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) - { - Texture2D texture = Main.itemTexture[item.type]; - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - return false; - } + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = Main.itemTexture[item.type]; + spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + return false; + } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/EndothermicEnergyGlow"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/EndothermicEnergyGlow"); + spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } public override void Update(ref float gravity, ref float maxFallSpeed) { diff --git a/Items/Materials/ExoPrism.cs b/Items/Materials/ExoPrism.cs new file mode 100644 index 0000000000..640a5fb3ec --- /dev/null +++ b/Items/Materials/ExoPrism.cs @@ -0,0 +1,62 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Materials +{ + public class ExoPrism : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exo Prism"); + Tooltip.SetDefault("Fractal energies shimmer across its surface"); + } + + public override void SetDefaults() + { + item.width = 32; + item.height = 52; + item.maxStack = 999; + item.rare = ItemRarityID.Purple; + item.value = Item.sellPrice(gold: 60); + item.Calamity().customRarity = CalamityRarity.Violet; + } + + public void DrawBackAfterimage(SpriteBatch spriteBatch, Vector2 baseDrawPosition, Rectangle frame, float baseScale) + { + float pulse = Main.GlobalTime * 0.75f % 1f; + float outwardnessFactor = MathHelper.Lerp(0.9f, 1.3f, pulse); + Color drawColor = Color.MintCream * (1f - pulse) * 0.27f; + drawColor.A = 0; + for (int i = 0; i < 4; i++) + { + float scale = baseScale * outwardnessFactor; + Vector2 drawPosition = baseDrawPosition + (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 4f; + spriteBatch.Draw(Main.itemTexture[item.type], drawPosition, frame, drawColor, item.velocity.X * 0.2f, frame.Size() * 0.5f, scale, SpriteEffects.None, 0f); + } + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Rectangle frame = Main.itemTexture[item.type].Frame(); + DrawBackAfterimage(spriteBatch, item.position - Main.screenPosition + frame.Size() * 0.5f, frame, scale); + return true; + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); + Lighting.AddLight(item.Center, 0.6f * brightness, 0.64f * brightness, 0.6f * brightness); + + if (Main.rand.NextBool(3)) + { + Dust exoShine = Dust.NewDustDirect(item.position, (int)(item.width * item.scale), (int)(item.height * item.scale * 0.6f), 204); + exoShine.velocity = Vector2.Lerp(Main.rand.NextVector2Unit(), -Vector2.UnitY, 0.5f) * Main.rand.NextFloat(1.2f, 1.8f); + exoShine.fadeIn = 0.7f; + exoShine.noGravity = true; + } + } + } +} diff --git a/Items/Materials/ExoPrism.png b/Items/Materials/ExoPrism.png new file mode 100644 index 0000000000..213e3f09e9 Binary files /dev/null and b/Items/Materials/ExoPrism.png differ diff --git a/Items/Materials/HellcasterFragment.cs b/Items/Materials/HellcasterFragment.cs index 3b153a6f6e..0b16696df3 100644 --- a/Items/Materials/HellcasterFragment.cs +++ b/Items/Materials/HellcasterFragment.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Materials item.width = 10; item.height = 14; item.maxStack = 999; - item.value = Item.sellPrice(gold: 16); + item.value = Item.sellPrice(gold: 45); item.Calamity().customRarity = CalamityRarity.Violet; } } diff --git a/Items/Materials/MiracleMatter.cs b/Items/Materials/MiracleMatter.cs new file mode 100644 index 0000000000..7e4199965b --- /dev/null +++ b/Items/Materials/MiracleMatter.cs @@ -0,0 +1,95 @@ +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Materials +{ + public class MiracleMatter : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Miracle Matter"); + Tooltip.SetDefault("Its amorphous form contains untold potential\n" + "One is required for every Exo Weapon"); + } + + public override void SetDefaults() + { + item.width = 46; + item.height = 64; + item.maxStack = 999; + item.rare = ItemRarityID.Purple; + item.value = Item.sellPrice(platinum: 6, gold: 50); + item.Calamity().customRarity = CalamityRarity.Violet; + } + + public void DrawBackAfterimage(SpriteBatch spriteBatch, Vector2 baseDrawPosition, Rectangle frame, float baseScale) + { + if (item.velocity.X != 0f) + return; + + float pulse = (float)Math.Cos(1.61803398875f * Main.GlobalTime * 2f) + (float)Math.Cos(Math.E * Main.GlobalTime * 1.7f); + pulse = pulse * 0.25f + 0.5f; + + // Sharpen the pulse with a power to give erratic fire bursts. + pulse = (float)Math.Pow(pulse, 3D); + + float outwardnessFactor = MathHelper.Lerp(-0.3f, 1.2f, pulse); + Color drawColor = Color.Lerp(new Color(255, 218, 99), new Color(249, 134, 44), pulse); + drawColor *= MathHelper.Lerp(0.35f, 0.67f, CalamityUtils.Convert01To010(pulse)); + drawColor.A = 25; + for (int i = 0; i < 8; i++) + { + Vector2 drawPosition = baseDrawPosition + (MathHelper.TwoPi * i / 8f).ToRotationVector2() * outwardnessFactor * baseScale * 8f; + spriteBatch.Draw(Main.itemTexture[item.type], drawPosition, frame, drawColor, 0f, Vector2.Zero, baseScale, SpriteEffects.None, 0f); + } + } + + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Rectangle frame = Main.itemTexture[item.type].Frame(); + DrawBackAfterimage(spriteBatch, item.position - Main.screenPosition, frame, scale); + return true; + } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + item.velocity.X = 0f; + DrawBackAfterimage(spriteBatch, position, frame, scale); + return true; + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); + Lighting.AddLight(item.Center, 0.94f * brightness, 0.95f * brightness, 0.56f * brightness); + + if (Main.rand.NextBool(3)) + { + Dust exoFlame = Dust.NewDustDirect(item.position, (int)(item.width * item.scale), (int)(item.height * item.scale * 0.6f), 6); + exoFlame.velocity = Vector2.Lerp(Main.rand.NextVector2Unit(), -Vector2.UnitY, 0.5f) * Main.rand.NextFloat(1.8f, 2.6f); + exoFlame.scale *= Main.rand.NextFloat(0.85f, 1.15f); + exoFlame.fadeIn = 0.9f; + exoFlame.noGravity = true; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Materials/MiracleMatter.png b/Items/Materials/MiracleMatter.png new file mode 100644 index 0000000000..a313570748 Binary files /dev/null and b/Items/Materials/MiracleMatter.png differ diff --git a/Items/Materials/NightmareFuel.cs b/Items/Materials/NightmareFuel.cs index a5d4424624..960ba7b30e 100644 --- a/Items/Materials/NightmareFuel.cs +++ b/Items/Materials/NightmareFuel.cs @@ -7,10 +7,10 @@ using Terraria.ID; namespace CalamityMod.Items.Materials { - public class NightmareFuel : ModItem + public class NightmareFuel : ModItem { - public int frameCounter = 0; - public int frame = 0; + public int frameCounter = 0; + public int frame = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Nightmare Fuel"); @@ -28,18 +28,18 @@ namespace CalamityMod.Items.Materials item.Calamity().customRarity = CalamityRarity.DarkBlue; } - public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) - { - Texture2D texture = Main.itemTexture[item.type]; - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - return false; - } + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = Main.itemTexture[item.type]; + spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + return false; + } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/NightmareFuelGlow"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/NightmareFuelGlow"); + spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } public override void Update(ref float gravity, ref float maxFallSpeed) { diff --git a/Items/Materials/Phantoplasm.cs b/Items/Materials/Phantoplasm.cs index 823014cd4f..8294440c40 100644 --- a/Items/Materials/Phantoplasm.cs +++ b/Items/Materials/Phantoplasm.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { DisplayName.SetDefault("Phantoplasm"); + Tooltip.SetDefault("It churns and seethes with ghastly malice"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 5)); } @@ -20,8 +21,8 @@ namespace CalamityMod.Items.Materials item.height = 12; item.maxStack = 999; item.value = Item.sellPrice(gold: 1); - item.rare = ItemRarityID.Purple; - } + item.rare = ItemRarityID.Purple; + } public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 0); } diff --git a/Items/Materials/ShadowspecBar.cs b/Items/Materials/ShadowspecBar.cs index 93ab549fcb..93568afe8f 100644 --- a/Items/Materials/ShadowspecBar.cs +++ b/Items/Materials/ShadowspecBar.cs @@ -12,9 +12,11 @@ namespace CalamityMod.Items.Materials { public int frameCounter = 0; public int frame = 0; + public override void SetStaticDefaults() { DisplayName.SetDefault("Shadowspec Bar"); + Tooltip.SetDefault("A vile, black metal, so horrendous and powerful as to defy explanation"); } public override void SetDefaults() @@ -30,7 +32,7 @@ namespace CalamityMod.Items.Materials item.autoReuse = true; item.consumable = true; - item.value = Item.sellPrice(gold: 85); + item.value = Item.sellPrice(platinum: 1, gold: 92); item.Calamity().customRarity = CalamityRarity.HotPink; item.Calamity().devItem = true; } @@ -53,6 +55,7 @@ namespace CalamityMod.Items.Materials { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); diff --git a/Items/Mounts/AlicornMount.cs b/Items/Mounts/AlicornMount.cs index 268e7f16e4..cf26698eb5 100644 --- a/Items/Mounts/AlicornMount.cs +++ b/Items/Mounts/AlicornMount.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Mounts mountData.blockExtraJumps = false; mountData.totalFrames = 15; mountData.constantJump = false; - int baseYOffset = 24; + int baseYOffset = 26; int[] array = new int[mountData.totalFrames]; for (int l = 0; l < array.Length; l++) { @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Mounts mountData.playerYOffsets = array; mountData.xOffset = -4; mountData.bodyFrame = 3; - mountData.yOffset = 7; //-8 + mountData.yOffset = 5; //-8 mountData.playerHeadOffset = 36; //30 mountData.standingFrameCount = 1; mountData.standingFrameDelay = 12; diff --git a/Items/Mounts/DraedonGamerChairMount.cs b/Items/Mounts/DraedonGamerChairMount.cs new file mode 100644 index 0000000000..bae00c4bad --- /dev/null +++ b/Items/Mounts/DraedonGamerChairMount.cs @@ -0,0 +1,77 @@ +using CalamityMod.Buffs.Mounts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Mounts +{ + public class DraedonGamerChairMount : ModMountData + { + public const float MovementSpeed = 12f; + public override void SetDefaults() + { + mountData.spawnDust = 182; + mountData.spawnDustNoGravity = true; + mountData.buff = ModContent.BuffType(); + mountData.heightBoost = 0; + mountData.flightTimeMax = int.MaxValue; + mountData.fatigueMax = int.MaxValue; + mountData.fallDamage = 0f; + mountData.usesHover = true; + mountData.runSpeed = MovementSpeed; + mountData.dashSpeed = MovementSpeed; + mountData.acceleration = MovementSpeed; + mountData.swimSpeed = MovementSpeed; + mountData.jumpHeight = 8; + mountData.jumpSpeed = 8f; + mountData.blockExtraJumps = true; + mountData.totalFrames = 5; + + int[] verticalOffsets = new int[mountData.totalFrames]; + for (int l = 0; l < verticalOffsets.Length; l++) + verticalOffsets[l] = 0; + + mountData.playerYOffsets = verticalOffsets; + mountData.xOffset = 2; + mountData.bodyFrame = 3; + mountData.yOffset = 28; + mountData.playerHeadOffset = 3; + mountData.standingFrameCount = 5; + mountData.standingFrameDelay = 5; + mountData.standingFrameStart = 0; + mountData.runningFrameCount = 5; + mountData.runningFrameDelay = 5; + mountData.runningFrameStart = 0; + mountData.flyingFrameCount = 5; + mountData.flyingFrameDelay = 5; + mountData.flyingFrameStart = 0; + mountData.inAirFrameCount = 5; + mountData.inAirFrameDelay = 5; + mountData.inAirFrameStart = 0; + mountData.idleFrameCount = 5; + mountData.idleFrameDelay = 5; + mountData.idleFrameStart = 0; + mountData.idleFrameLoop = true; + mountData.swimFrameCount = 5; + mountData.swimFrameDelay = 5; + mountData.swimFrameStart = 0; + if (Main.netMode != NetmodeID.Server) + { + mountData.textureWidth = mountData.frontTexture.Width; + mountData.textureHeight = mountData.frontTexture.Height; + } + } + + public override bool Draw(List playerDrawData, int drawType, Player drawPlayer, ref Texture2D texture, ref Texture2D glowTexture, ref Vector2 drawPosition, ref Rectangle frame, ref Color drawColor, ref Color glowColor, ref float rotation, ref SpriteEffects spriteEffects, ref Vector2 drawOrigin, ref float drawScale, float shadow) + { + rotation = drawPlayer.velocity.X * 0.004f; + drawPlayer.fullRotation = rotation; + frame = texture.Frame(1, 5, 0, (int)(Main.GlobalTime * 13f) % 5); + return true; + } + } +} diff --git a/Items/Mounts/DraedonGamerChairMount_Back.png b/Items/Mounts/DraedonGamerChairMount_Back.png new file mode 100644 index 0000000000..c8ebb28168 Binary files /dev/null and b/Items/Mounts/DraedonGamerChairMount_Back.png differ diff --git a/Items/Mounts/DraedonGamerChairMount_Front.png b/Items/Mounts/DraedonGamerChairMount_Front.png new file mode 100644 index 0000000000..093609da69 Binary files /dev/null and b/Items/Mounts/DraedonGamerChairMount_Front.png differ diff --git a/Items/Mounts/DraedonGamerChairMount_Glowmask.png b/Items/Mounts/DraedonGamerChairMount_Glowmask.png new file mode 100644 index 0000000000..fd18744a7f Binary files /dev/null and b/Items/Mounts/DraedonGamerChairMount_Glowmask.png differ diff --git a/Items/Mounts/ExoThrone.cs b/Items/Mounts/ExoThrone.cs new file mode 100644 index 0000000000..611e01b6f6 --- /dev/null +++ b/Items/Mounts/ExoThrone.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Mounts +{ + public class ExoThrone : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exo Box"); + Tooltip.SetDefault("Materializes a quite cozy and extremely nimble flying Exo throne\n" + + "Replaced\n" + + "A comfortable gamer is a dangerous gamer"); + } + + public override void SetDefaults() + { + item.width = 32; + item.height = 34; + item.useTime = item.useAnimation = 20; + item.useStyle = ItemUseStyleID.HoldingOut; + item.UseSound = SoundID.Item94; + item.noMelee = true; + item.mountType = ModContent.MountType(); + + item.value = CalamityGlobalItem.RarityVioletBuyPrice; + item.Calamity().customRarity = CalamityRarity.Violet; + } + + public override void ModifyTooltips(List list) + { + string hotkey = CalamityMod.ExoChairSpeedupHotkey.TooltipHotkeyString(); + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + line2.text = $"Hold {hotkey} while sitting in the throne to move much faster\n"; + } + } + } +} diff --git a/Items/Mounts/ExoThrone.png b/Items/Mounts/ExoThrone.png new file mode 100644 index 0000000000..48f751425f Binary files /dev/null and b/Items/Mounts/ExoThrone.png differ diff --git a/Items/Mounts/GazeOfCrysthamyr.cs b/Items/Mounts/GazeOfCrysthamyr.cs index a6ce67377b..032c9cc707 100644 --- a/Items/Mounts/GazeOfCrysthamyr.cs +++ b/Items/Mounts/GazeOfCrysthamyr.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; @@ -35,9 +36,9 @@ namespace CalamityMod.Items.Mounts ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.DD2PetDragon); recipe.AddIngredient(ItemID.SoulofNight, 100); - recipe.AddIngredient(ModContent.ItemType(), 50); + recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Mounts/Minecarts/DoGCart.cs b/Items/Mounts/Minecarts/DoGCart.cs new file mode 100644 index 0000000000..d715135e6a --- /dev/null +++ b/Items/Mounts/Minecarts/DoGCart.cs @@ -0,0 +1,42 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Mounts.Minecarts +{ + public class DoGCart : ModItem + { + public override void SetStaticDefaults() => DisplayName.SetDefault("The Cart of Gods"); + + public override void SetDefaults() + { + item.width = 34; + item.height = 36; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = ItemUseStyleID.SwingThrow; + + item.value = Item.sellPrice(gold: 30); + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.Calamity().donorItem = true; + + item.UseSound = SoundID.Item68; + item.noMelee = true; + item.mountType = ModContent.MountType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.Wire, 60); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Mounts/Minecarts/DoGCart.png b/Items/Mounts/Minecarts/DoGCart.png new file mode 100644 index 0000000000..2823eccb57 Binary files /dev/null and b/Items/Mounts/Minecarts/DoGCart.png differ diff --git a/Items/Mounts/Minecarts/DoGCartMount.cs b/Items/Mounts/Minecarts/DoGCartMount.cs new file mode 100644 index 0000000000..44140b9e54 --- /dev/null +++ b/Items/Mounts/Minecarts/DoGCartMount.cs @@ -0,0 +1,153 @@ +using CalamityMod.Buffs.Mounts; +using CalamityMod.DataStructures; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Mounts.Minecarts +{ + public class DoGCartMount : ModMountData + { + public const int SegmentCount = 18; + public override void SetDefaults() + { + mountData.Minecart = true; + mountData.MinecartDust = CreateSparkDust; + MountID.Sets.Cart[ModContent.MountType()] = true; + + mountData.spawnDust = 173; + mountData.buff = ModContent.BuffType(); + + // Movement fields. + mountData.flightTimeMax = 0; + mountData.fallDamage = 1f; + + // Mechanical Cart in vanilla uses 20f and 0.1f respectively for these fields. + mountData.runSpeed = 22f; + mountData.acceleration = 0.16f; + + mountData.jumpHeight = 16; + mountData.jumpSpeed = 5.2f; + mountData.blockExtraJumps = true; + mountData.heightBoost = 12; + + // Drawing fields. + mountData.playerYOffsets = new int[] { 6, 6, 6 }; + mountData.xOffset = 2; + mountData.yOffset = 12; + mountData.bodyFrame = 3; + + // Animation fields. + mountData.totalFrames = 3; + mountData.standingFrameCount = 1; + mountData.standingFrameDelay = 12; + mountData.standingFrameStart = 0; + mountData.runningFrameCount = 3; + mountData.runningFrameDelay = 12; + mountData.runningFrameStart = 0; + mountData.flyingFrameCount = 0; + mountData.flyingFrameDelay = 0; + mountData.flyingFrameStart = 0; + mountData.inAirFrameCount = 0; + mountData.inAirFrameDelay = 0; + mountData.inAirFrameStart = 0; + mountData.idleFrameCount = 1; + mountData.idleFrameDelay = 10; + mountData.idleFrameStart = 0; + mountData.idleFrameLoop = false; + if (Main.netMode != NetmodeID.Server) + { + mountData.textureWidth = 74; + mountData.textureHeight = 114; + } + } + + public void CreateSparkDust(Vector2 dustPosition) + { + Vector2 offsetDirection = DelegateMethods.Minecart.rotation.ToRotationVector2(); + offsetDirection *= new Vector2(Main.rand.NextBool().ToDirectionInt(), 1f) * 13f; + dustPosition += offsetDirection; + + Dust spark = Dust.NewDustPerfect(dustPosition, 234); + spark.velocity = Main.rand.NextVector2Circular(4f, 4f); + spark.velocity.X *= Main.rand.NextFloat(0.25f, 1f); + spark.velocity.Y -= Main.rand.NextFloat(1.25f, 3f); + spark.position.Y -= 4f; + spark.scale = Main.rand.NextFloat(0.9f, 1.4f); + spark.noGravity = true; + + if (Main.rand.NextBool(8)) + spark.scale *= 1.5f; + if (Main.rand.NextBool(8)) + spark.scale *= 0.667f; + + if (Main.rand.NextBool(3)) + spark.scale *= 0.65f; + else + spark.noGravity = false; + } + + public static float CalculateIdealWormRotation(Player player) + { + int direction = (player.velocity.SafeNormalize(Vector2.UnitX * player.direction).X > 0f).ToDirectionInt(); + if (player.velocity.X == 0f) + direction = player.direction; + return (direction == 1 ? 0f : MathHelper.Pi) - DelegateMethods.Minecart.rotation * 0.1f; + } + + public static Vector2 CalculateSegmentWaveOffset(int index, Player player) + { + Vector2 baseDirection = (CalculateIdealWormRotation(player) - MathHelper.PiOver2 + DelegateMethods.Minecart.rotation).ToRotationVector2(); + Vector2 waveOffset = baseDirection * (float)Math.Sin(MathHelper.Pi * index / player.Calamity().DoGCartSegments.Length + Main.GameUpdateCount / 14f) * 5f; + waveOffset *= Utils.InverseLerp(10f, 4f, player.velocity.Length(), true); + + return waveOffset; + } + + public override bool Draw(List playerDrawData, int drawType, Player drawPlayer, ref Texture2D texture, ref Texture2D glowTexture, ref Vector2 drawPosition, ref Rectangle frame, ref Color drawColor, ref Color glowColor, ref float rotation, ref SpriteEffects spriteEffects, ref Vector2 drawOrigin, ref float drawScale, float shadow) + { + if (drawPlayer.Calamity().DoGCartSegments is null || drawPlayer.Calamity().DoGCartSegments[0] is null) + return true; + + // Account for stupid rotational issues. + List rotationAdjustedPositions = new List() + { + drawPlayer.Calamity().DoGCartSegments[0].Center + }; + + for (int i = 1; i < drawPlayer.Calamity().DoGCartSegments.Length; i++) + { + rotationAdjustedPositions.Add(drawPlayer.Center - (drawPlayer.Center - drawPlayer.Calamity().DoGCartSegments[i].Center).RotatedBy(-drawPlayer.Calamity().SmoothenedMinecartRotation)); + } + + for (int i = 0; i < SegmentCount; i++) + { + DoGCartSegment segment = drawPlayer.Calamity().DoGCartSegments[i]; + if (segment is null) + break; + + Texture2D segmentTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/DoGCartBody"); + if (i == SegmentCount - 1) + segmentTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/DoGCartTail"); + Vector2 segmentDrawPosition = rotationAdjustedPositions[i] + CalculateSegmentWaveOffset(i, drawPlayer); + + Color segmentColor = Lighting.GetColor((int)segmentDrawPosition.X / 16, (int)segmentDrawPosition.Y / 16); + Vector2 origin = segmentTexture.Size() * 0.5f; + float segmentRotation = segment.Rotation - DelegateMethods.Minecart.rotation; + DrawData segmentDrawData = new DrawData(segmentTexture, segmentDrawPosition - Main.screenPosition, null, segmentColor, segmentRotation, origin, Vector2.One, SpriteEffects.None, 0) + { + shader = Mount.currentShader + }; + + playerDrawData.Add(segmentDrawData); + } + return true; + } + } +} diff --git a/Items/Mounts/Minecarts/DoGCartMount_Front.png b/Items/Mounts/Minecarts/DoGCartMount_Front.png new file mode 100644 index 0000000000..98ea6a7509 Binary files /dev/null and b/Items/Mounts/Minecarts/DoGCartMount_Front.png differ diff --git a/Items/PermanentBoosters/Dragonfruit.cs b/Items/PermanentBoosters/Dragonfruit.cs index 2c626e61f3..f1e73dde93 100644 --- a/Items/PermanentBoosters/Dragonfruit.cs +++ b/Items/PermanentBoosters/Dragonfruit.cs @@ -59,11 +59,11 @@ namespace CalamityMod.Items.PermanentBoosters { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.LifeFruit, 5); - recipe.AddIngredient(ItemID.SkyBlueFlower); + recipe.AddIngredient(ItemID.SkyBlueFlower); recipe.AddIngredient(ItemID.FragmentSolar, 15); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Placeables/Furniture/AuricToilet.cs b/Items/Placeables/Furniture/AuricToilet.cs index 57bf4f34c2..ef70ecf3d9 100644 --- a/Items/Placeables/Furniture/AuricToilet.cs +++ b/Items/Placeables/Furniture/AuricToilet.cs @@ -37,9 +37,9 @@ namespace CalamityMod.Items.Placeables.Furniture recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs b/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs new file mode 100644 index 0000000000..e9635317aa --- /dev/null +++ b/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs @@ -0,0 +1,50 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture.CraftingStations +{ + public class CosmicAnvilItem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Anvil"); + Tooltip.SetDefault("An otherworldly anvil capable of withstanding the pressures of stellar collapse\n" + + "Also functions as every previous tier of anvil"); + } + + public override void SetDefaults() + { + item.width = 62; + item.height = 32; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createTile = ModContent.TileType(); + + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.value = Item.sellPrice(platinum: 2, gold: 50); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddRecipeGroup("HardmodeAnvil"); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ItemID.LunarBar, 10); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Furniture/CraftingStations/CosmicAnvil.png b/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.png similarity index 100% rename from Items/Placeables/Furniture/CraftingStations/CosmicAnvil.png rename to Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.png diff --git a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs index e664e22816..780af11da4 100644 --- a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs +++ b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs @@ -2,22 +2,22 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Items.Placeables.Furniture.CraftingStations { public class DraedonsForge : ModItem { - public override string Texture => "CalamityMod/Items/Placeables/Furniture/CraftingStations/CosmicAnvil"; - public override void SetStaticDefaults() { - DisplayName.SetDefault("Cosmic Anvil"); - Tooltip.SetDefault("Used to craft Cosmilite tier items"); + DisplayName.SetDefault("Draedon's Forge"); + Tooltip.SetDefault("A plasma-lattice nanoforge powered by limitless Exo energies\n" + + "Functions as every major crafting station simultaneously"); } public override void SetDefaults() { - item.width = 30; - item.height = 30; + item.width = 58; + item.height = 32; item.maxStack = 99; item.useTurn = true; item.autoReuse = true; @@ -25,23 +25,23 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.value = Item.sellPrice(platinum: 1); - item.rare = ItemRarityID.Red; item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.DarkBlue; + + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.Violet; + item.value = Item.sellPrice(platinum: 27, gold: 50); } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("HardmodeAnvil"); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddRecipeGroup("HardmodeForge"); recipe.AddIngredient(ItemID.TinkerersWorkshop); recipe.AddIngredient(ItemID.LunarCraftingStation); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddIngredient(ModContent.ItemType(), 25); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.png b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.png new file mode 100644 index 0000000000..6f0e74a782 Binary files /dev/null and b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.png differ diff --git a/Items/Placeables/Furniture/ThaumaticChair.cs b/Items/Placeables/Furniture/ThaumaticChair.cs index 30ba45205c..afd66c21e8 100644 --- a/Items/Placeables/Furniture/ThaumaticChair.cs +++ b/Items/Placeables/Furniture/ThaumaticChair.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Placeables.Furniture recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/Furniture/Trophies/ApolloTrophy.cs b/Items/Placeables/Furniture/Trophies/ApolloTrophy.cs new file mode 100644 index 0000000000..127189567f --- /dev/null +++ b/Items/Placeables/Furniture/Trophies/ApolloTrophy.cs @@ -0,0 +1,30 @@ +using CalamityMod.Tiles.Furniture; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture.Trophies +{ + public class ApolloTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Apollo Trophy"); + } + + public override void SetDefaults() + { + item.width = item.height = 32; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.value = 50000; + item.rare = ItemRarityID.Blue; + item.createTile = ModContent.TileType(); + item.placeStyle = 28; + } + } +} diff --git a/Items/Placeables/Furniture/Trophies/ApolloTrophy.png b/Items/Placeables/Furniture/Trophies/ApolloTrophy.png new file mode 100644 index 0000000000..40fd0f5d21 Binary files /dev/null and b/Items/Placeables/Furniture/Trophies/ApolloTrophy.png differ diff --git a/Items/Placeables/Furniture/Trophies/AresTrophy.cs b/Items/Placeables/Furniture/Trophies/AresTrophy.cs new file mode 100644 index 0000000000..89fbb30fb5 --- /dev/null +++ b/Items/Placeables/Furniture/Trophies/AresTrophy.cs @@ -0,0 +1,30 @@ +using CalamityMod.Tiles.Furniture; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture.Trophies +{ + public class AresTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ares Trophy"); + } + + public override void SetDefaults() + { + item.width = item.height = 32; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.value = 50000; + item.rare = ItemRarityID.Blue; + item.createTile = ModContent.TileType(); + item.placeStyle = 30; + } + } +} diff --git a/Items/Placeables/Furniture/Trophies/AresTrophy.png b/Items/Placeables/Furniture/Trophies/AresTrophy.png new file mode 100644 index 0000000000..bf0bba37be Binary files /dev/null and b/Items/Placeables/Furniture/Trophies/AresTrophy.png differ diff --git a/Items/Placeables/Furniture/Trophies/ArtemisTrophy.cs b/Items/Placeables/Furniture/Trophies/ArtemisTrophy.cs new file mode 100644 index 0000000000..2453bcba64 --- /dev/null +++ b/Items/Placeables/Furniture/Trophies/ArtemisTrophy.cs @@ -0,0 +1,30 @@ +using CalamityMod.Tiles.Furniture; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture.Trophies +{ + public class ArtemisTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Artemis Trophy"); + } + + public override void SetDefaults() + { + item.width = item.height = 32; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.value = 50000; + item.rare = ItemRarityID.Blue; + item.createTile = ModContent.TileType(); + item.placeStyle = 29; + } + } +} diff --git a/Items/Placeables/Furniture/Trophies/ArtemisTrophy.png b/Items/Placeables/Furniture/Trophies/ArtemisTrophy.png new file mode 100644 index 0000000000..753d6c6524 Binary files /dev/null and b/Items/Placeables/Furniture/Trophies/ArtemisTrophy.png differ diff --git a/Items/Placeables/Furniture/Trophies/ThanatosTrophy.cs b/Items/Placeables/Furniture/Trophies/ThanatosTrophy.cs new file mode 100644 index 0000000000..296fc30993 --- /dev/null +++ b/Items/Placeables/Furniture/Trophies/ThanatosTrophy.cs @@ -0,0 +1,30 @@ +using CalamityMod.Tiles.Furniture; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture.Trophies +{ + public class ThanatosTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Thanatos Trophy"); + } + + public override void SetDefaults() + { + item.width = item.height = 32; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.value = 50000; + item.rare = ItemRarityID.Blue; + item.createTile = ModContent.TileType(); + item.placeStyle = 31; + } + } +} diff --git a/Items/Placeables/Furniture/Trophies/ThanatosTrophy.png b/Items/Placeables/Furniture/Trophies/ThanatosTrophy.png new file mode 100644 index 0000000000..8a8a8a6d48 Binary files /dev/null and b/Items/Placeables/Furniture/Trophies/ThanatosTrophy.png differ diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBasin.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBasin.cs index d15abcae4c..2dc03b99d4 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBasin.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBasin.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddIngredient(ItemID.IronBar, 5); recipe.anyIronBar = true; recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBath.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBath.cs index f6fcf74f03..af2661ee4c 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBath.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBath.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 14); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs index 0c51fa3b94..ea22e7266c 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ItemID.Silk, 5); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs index acdb1974d2..10a93b62d5 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddIngredient(ItemID.Book, 10); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBrick.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBrick.cs index 3338a5158b..d793fe9e93 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBrick.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBrick.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddIngredient(ModContent.ItemType(), 1); recipe.AddIngredient(ItemID.StoneBlock, 20); recipe.SetResult(this, 20); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 4); @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 2); recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs index e9a05a0b51..02f362ec3c 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ItemID.Torch, 3); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs index cf3a11b1ce..bc4c4ead1f 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddIngredient(ModContent.ItemType(), 4); recipe.AddIngredient(ItemID.Torch); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs index d90e8b8ee9..c476c460d8 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 4); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs index 531966bd94..71c42fd1b4 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddIngredient(ItemID.Torch, 4); recipe.AddIngredient(ItemID.Chain); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteChest.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteChest.cs index bbdf50d9c2..9ca21cb4f3 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteChest.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteChest.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddIngredient(ItemID.IronBar, 2); recipe.anyIronBar = true; recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteClock.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteClock.cs index 22877525c1..8b0a05bbdf 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteClock.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteClock.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddIngredient(ItemID.Glass, 6); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs index e314fb019a..9d99653c81 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 6); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs index 106efab27d..9dfdcd4b76 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 16); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs index 608c5930f5..486a03073b 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddIngredient(ItemID.Torch); recipe.AddIngredient(ModContent.ItemType(), 3); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs index 956f037c86..e0d79c7a02 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddIngredient(ModContent.ItemType(), 6); recipe.AddIngredient(ItemID.Torch); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs b/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs index 2a086cbc71..09afdea1b2 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ItemID.Book); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs b/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs index ef66ca2f28..a8a98e921a 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.SetResult(this, 2); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs index 48f38948c2..d7522e7b48 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddIngredient(ItemID.Torch, 2); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs index 52f8cf9f0e..8d93ba03c1 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddIngredient(ModContent.ItemType(), 6); recipe.AddIngredient(ItemID.WaterBucket); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs index d103cb02c2..81c0dd224b 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ItemID.Silk, 2); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs index 742f932f5c..b25409c587 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 8); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteWorkbench.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteWorkbench.cs index 91ccd1a845..8ea676306f 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteWorkbench.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteWorkbench.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureOccult/OccultBathtub.cs b/Items/Placeables/FurnitureOccult/OccultBathtub.cs index 1f1077948f..d82db0625b 100644 --- a/Items/Placeables/FurnitureOccult/OccultBathtub.cs +++ b/Items/Placeables/FurnitureOccult/OccultBathtub.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 14); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureOccult/OccultBed.cs b/Items/Placeables/FurnitureOccult/OccultBed.cs index eddf26cdfb..095c525473 100644 --- a/Items/Placeables/FurnitureOccult/OccultBed.cs +++ b/Items/Placeables/FurnitureOccult/OccultBed.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ItemID.Silk, 5); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureOccult/OccultBookcase.cs b/Items/Placeables/FurnitureOccult/OccultBookcase.cs index c401cbf489..a8a66e367d 100644 --- a/Items/Placeables/FurnitureOccult/OccultBookcase.cs +++ b/Items/Placeables/FurnitureOccult/OccultBookcase.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddIngredient(ItemID.Book, 10); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureOccult/OccultCandelabra.cs b/Items/Placeables/FurnitureOccult/OccultCandelabra.cs index 85929b0a10..94282016da 100644 --- a/Items/Placeables/FurnitureOccult/OccultCandelabra.cs +++ b/Items/Placeables/FurnitureOccult/OccultCandelabra.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ModContent.ItemType(), 3); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureOccult/OccultCandle.cs b/Items/Placeables/FurnitureOccult/OccultCandle.cs index eec64d7e12..0e4d52f05e 100644 --- a/Items/Placeables/FurnitureOccult/OccultCandle.cs +++ b/Items/Placeables/FurnitureOccult/OccultCandle.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddIngredient(ModContent.ItemType(), 12); recipe.AddIngredient(ModContent.ItemType(), 1); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureOccult/OccultChair.cs b/Items/Placeables/FurnitureOccult/OccultChair.cs index 773ca0739e..7d7a514277 100644 --- a/Items/Placeables/FurnitureOccult/OccultChair.cs +++ b/Items/Placeables/FurnitureOccult/OccultChair.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 4); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureOccult/OccultChandelier.cs b/Items/Placeables/FurnitureOccult/OccultChandelier.cs index 503e12ecf4..419f18dc63 100644 --- a/Items/Placeables/FurnitureOccult/OccultChandelier.cs +++ b/Items/Placeables/FurnitureOccult/OccultChandelier.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddIngredient(ModContent.ItemType(), 12); recipe.AddIngredient(ModContent.ItemType(), 4); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureOccult/OccultChest.cs b/Items/Placeables/FurnitureOccult/OccultChest.cs index ef9e74d45c..332d2944e8 100644 --- a/Items/Placeables/FurnitureOccult/OccultChest.cs +++ b/Items/Placeables/FurnitureOccult/OccultChest.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddIngredient(ModContent.ItemType(), 8); recipe.AddIngredient(ModContent.ItemType(), 2); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureOccult/OccultClock.cs b/Items/Placeables/FurnitureOccult/OccultClock.cs index 805a9adaf5..334ed59da4 100644 --- a/Items/Placeables/FurnitureOccult/OccultClock.cs +++ b/Items/Placeables/FurnitureOccult/OccultClock.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddIngredient(ItemID.Glass, 6); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureOccult/OccultDoor.cs b/Items/Placeables/FurnitureOccult/OccultDoor.cs index d0f06f7677..b4927e1945 100644 --- a/Items/Placeables/FurnitureOccult/OccultDoor.cs +++ b/Items/Placeables/FurnitureOccult/OccultDoor.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 6); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureOccult/OccultDresser.cs b/Items/Placeables/FurnitureOccult/OccultDresser.cs index adc24ce45e..cfd8ef68b1 100644 --- a/Items/Placeables/FurnitureOccult/OccultDresser.cs +++ b/Items/Placeables/FurnitureOccult/OccultDresser.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 16); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureOccult/OccultLamp.cs b/Items/Placeables/FurnitureOccult/OccultLamp.cs index a17729a202..759062e291 100644 --- a/Items/Placeables/FurnitureOccult/OccultLamp.cs +++ b/Items/Placeables/FurnitureOccult/OccultLamp.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddIngredient(ModContent.ItemType(), 9); recipe.AddIngredient(ModContent.ItemType(), 1); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureOccult/OccultLantern.cs b/Items/Placeables/FurnitureOccult/OccultLantern.cs index be9214247c..9e70cd3729 100644 --- a/Items/Placeables/FurnitureOccult/OccultLantern.cs +++ b/Items/Placeables/FurnitureOccult/OccultLantern.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddIngredient(ModContent.ItemType(), 18); recipe.AddIngredient(ModContent.ItemType(), 1); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureOccult/OccultPiano.cs b/Items/Placeables/FurnitureOccult/OccultPiano.cs index 457ad4ce2a..eb67a6f0ef 100644 --- a/Items/Placeables/FurnitureOccult/OccultPiano.cs +++ b/Items/Placeables/FurnitureOccult/OccultPiano.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddIngredient(ItemID.Bone, 4); recipe.AddIngredient(ItemID.Book); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureOccult/OccultPlatform.cs b/Items/Placeables/FurnitureOccult/OccultPlatform.cs index 843f2a1386..8b3e182a08 100644 --- a/Items/Placeables/FurnitureOccult/OccultPlatform.cs +++ b/Items/Placeables/FurnitureOccult/OccultPlatform.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.SetResult(this, 2); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureOccult/OccultSink.cs b/Items/Placeables/FurnitureOccult/OccultSink.cs index 7945dfa7ce..c4f14ac627 100644 --- a/Items/Placeables/FurnitureOccult/OccultSink.cs +++ b/Items/Placeables/FurnitureOccult/OccultSink.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddIngredient(ModContent.ItemType(), 6); recipe.AddIngredient(ItemID.WaterBucket); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureOccult/OccultSofa.cs b/Items/Placeables/FurnitureOccult/OccultSofa.cs index d8f93887d7..bbadc05bb0 100644 --- a/Items/Placeables/FurnitureOccult/OccultSofa.cs +++ b/Items/Placeables/FurnitureOccult/OccultSofa.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ItemID.Silk, 2); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureOccult/OccultStone.cs b/Items/Placeables/FurnitureOccult/OccultStone.cs index e0854bc917..a9887c296f 100644 --- a/Items/Placeables/FurnitureOccult/OccultStone.cs +++ b/Items/Placeables/FurnitureOccult/OccultStone.cs @@ -1,8 +1,8 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Walls; -using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Items.Placeables.FurnitureOccult { public class OccultStone : ModItem @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.Silk, 15); recipe.SetResult(this, 150); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.AddRecipe(); recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 4); @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 2); recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureOccult/OccultTable.cs b/Items/Placeables/FurnitureOccult/OccultTable.cs index 2956927cca..80fc64eaf2 100644 --- a/Items/Placeables/FurnitureOccult/OccultTable.cs +++ b/Items/Placeables/FurnitureOccult/OccultTable.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 8); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureOccult/OccultWorkBench.cs b/Items/Placeables/FurnitureOccult/OccultWorkBench.cs index 90f58e5c73..f58ab2c52c 100644 --- a/Items/Placeables/FurnitureOccult/OccultWorkBench.cs +++ b/Items/Placeables/FurnitureOccult/OccultWorkBench.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.AddRecipe(); } } diff --git a/Items/Placeables/FurnitureSilva/SilvaCrystal.cs b/Items/Placeables/FurnitureSilva/SilvaCrystal.cs index 0ba123cb02..492271d146 100644 --- a/Items/Placeables/FurnitureSilva/SilvaCrystal.cs +++ b/Items/Placeables/FurnitureSilva/SilvaCrystal.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType()); recipe.SetResult(this, 400); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 4); diff --git a/Items/Placeables/Ores/AuricOre.cs b/Items/Placeables/Ores/AuricOre.cs index ab00f8060a..f920a0d970 100644 --- a/Items/Placeables/Ores/AuricOre.cs +++ b/Items/Placeables/Ores/AuricOre.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetStaticDefaults() { DisplayName.SetDefault("Auric Ore"); + Tooltip.SetDefault("Laced with the dormant power of a deity"); } public override void SetDefaults() @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Placeables.Ores item.width = 10; item.height = 10; item.maxStack = 999; - item.value = Item.sellPrice(gold: 2); + item.value = Item.sellPrice(gold: 4); item.Calamity().customRarity = CalamityRarity.Violet; } } diff --git a/Items/Placeables/SCalAltarItem.cs b/Items/Placeables/SCalAltarItem.cs index 1d015749e5..325efe2987 100644 --- a/Items/Placeables/SCalAltarItem.cs +++ b/Items/Placeables/SCalAltarItem.cs @@ -10,12 +10,10 @@ namespace CalamityMod.Items.Placeables { public override void SetStaticDefaults() { - DisplayName.SetDefault("Calamitous Altar"); - Tooltip.SetDefault("Death\n" + - "Allows you to summon Supreme Calamitas with Ashes of Calamity\n" + - "She creates a large square arena of blocks upon being summoned\n" + - "When she is summoned the arena will spawn around her with her at the center\n" + - "During the battle, heart pickups will heal half as much HP"); + DisplayName.SetDefault("Altar of the Accursed"); + Tooltip.SetDefault("Offer Ashes of Calamity at this altar to summon the Witch\n" + + "Doing so will create a square arena of blocks, with the altar at its center\n" + + "During the battle, heart pickups only heal for half as much"); } public override void SetDefaults() @@ -36,8 +34,10 @@ namespace CalamityMod.Items.Placeables public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 30); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Potions/CalamitasBrew.cs b/Items/Potions/CalamitasBrew.cs index 885a90793b..c21e608c30 100644 --- a/Items/Potions/CalamitasBrew.cs +++ b/Items/Potions/CalamitasBrew.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { DisplayName.SetDefault("Calamitas' Brew"); - Tooltip.SetDefault("Adds abyssal flames to your melee projectiles and melee attacks\n" + + Tooltip.SetDefault("Adds abyssal flames to your melee and rogue projectiles and melee attacks\n" + "Increases your movement speed by 10%"); } diff --git a/Items/Potions/OmegaHealingPotion.cs b/Items/Potions/OmegaHealingPotion.cs index dfea163aa9..ed3e582b53 100644 --- a/Items/Potions/OmegaHealingPotion.cs +++ b/Items/Potions/OmegaHealingPotion.cs @@ -27,16 +27,16 @@ namespace CalamityMod.Items.Potions item.consumable = true; item.potion = true; item.value = Item.buyPrice(0, 7, 0, 0); - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - } + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/SummonItems/Abomination.cs b/Items/SummonItems/Abomination.cs index 1b8cad366c..6b5e54564d 100644 --- a/Items/SummonItems/Abomination.cs +++ b/Items/SummonItems/Abomination.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.SummonItems { DisplayName.SetDefault("Abombination"); Tooltip.SetDefault("Calls in the airborne jungle abomination\n" + - "Summons the Plaguebringer Goliath"); + "Summons the Plaguebringer Goliath\n" + + "Not consumable"); } public override void SetDefaults() { item.width = 28; item.height = 18; - item.maxStack = 20; item.rare = ItemRarityID.Yellow; item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = true; + item.consumable = false; } public override bool CanUseItem(Player player) @@ -47,10 +47,10 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.IronBar, 5); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ItemID.IronBar, 8); recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.Stinger, 2); + recipe.AddIngredient(ItemID.Stinger, 5); recipe.AddIngredient(ItemID.Obsidian, 3); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); diff --git a/Items/SummonItems/BossRush.cs b/Items/SummonItems/BossRush.cs index 6c51ee2a83..b0ced86814 100644 --- a/Items/SummonItems/BossRush.cs +++ b/Items/SummonItems/BossRush.cs @@ -1,9 +1,5 @@ -using CalamityMod.Events; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Terraria; +using CalamityMod.Projectiles.Typeless; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.SummonItems @@ -26,50 +22,11 @@ namespace CalamityMod.Items.SummonItems item.height = 28; item.useAnimation = 45; item.useTime = 45; + item.channel = true; + item.noUseGraphic = true; + item.shoot = ModContent.ProjectileType(); item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item123; item.consumable = false; } - - public override bool UseItem(Player player) - { - for (int doom = 0; doom < 200; doom++) - { - NPC n = Main.npc[doom]; - if (!n.active) - continue; - - // will also correctly despawn EoW because none of his segments are boss flagged - bool shouldDespawn = n.boss || n.type == NPCID.EaterofWorldsHead || n.type == NPCID.EaterofWorldsBody || n.type == NPCID.EaterofWorldsTail; - if (shouldDespawn) - { - n.active = false; - n.netUpdate = true; - } - } - if (!BossRushEvent.BossRushActive) - { - BossRushEvent.BossRushStage = 0; - BossRushEvent.BossRushActive = true; - string key = "Mods.CalamityMod.BossRushStartText"; - Color messageColor = Color.LightCoral; - CalamityUtils.DisplayLocalizedText(key, messageColor); - } - else - { - BossRushEvent.BossRushStage = 0; - BossRushEvent.BossRushActive = false; - } - - CalamityNetcode.SyncWorld(); - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossRushStage); - netMessage.Write(BossRushEvent.BossRushStage); - netMessage.Send(); - } - return true; - } } } diff --git a/Items/SummonItems/EyeofExtinction.cs b/Items/SummonItems/EyeofExtinction.cs index a0c7b5f962..0fe520725a 100644 --- a/Items/SummonItems/EyeofExtinction.cs +++ b/Items/SummonItems/EyeofExtinction.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.SummonItems public override void SetStaticDefaults() { DisplayName.SetDefault("Eye of Extinction"); - Tooltip.SetDefault("Summons Supreme Calamitas at the altar but is not consumed"); + Tooltip.SetDefault("Use at the Altar of the Accursed to summon Supreme Calamitas\n" + "Not consumable"); } public override void SetDefaults() @@ -24,7 +24,7 @@ namespace CalamityMod.Items.SummonItems ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/SummonItems/Teratoma.cs b/Items/SummonItems/Teratoma.cs index 40dec85d52..d257e25088 100644 --- a/Items/SummonItems/Teratoma.cs +++ b/Items/SummonItems/Teratoma.cs @@ -34,17 +34,13 @@ namespace CalamityMod.Items.SummonItems public override bool UseItem(Player player) { - Main.PlaySound(SoundID.Roar, player.position, 0); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int npc = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-100, 100)), (int)(player.position.Y - 150f), ModContent.NPCType(), 1); - Main.npc[npc].timeLeft *= 20; - CalamityUtils.BossAwakenMessage(npc); - } - else - NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + Main.PlaySound(SoundID.Roar, player.position, 0); + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); - return true; + return true; } public override void AddRecipes() diff --git a/Items/Tools/BeastialPickaxe.cs b/Items/Tools/BeastialPickaxe.cs index 4921a13be8..5c76572f3b 100644 --- a/Items/Tools/BeastialPickaxe.cs +++ b/Items/Tools/BeastialPickaxe.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Tools item.melee = true; item.width = 48; item.height = 46; - item.useTime = 7; + item.useTime = 6; item.useAnimation = 15; item.useTurn = true; item.pick = 200; diff --git a/Items/Tools/BlossomPickaxe.cs b/Items/Tools/BlossomPickaxe.cs index 3f8aa12668..16915f49c8 100644 --- a/Items/Tools/BlossomPickaxe.cs +++ b/Items/Tools/BlossomPickaxe.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Tools item.melee = true; item.width = 50; item.height = 52; - item.useTime = 5; + item.useTime = 4; item.useAnimation = 10; item.useTurn = true; item.pick = 275; diff --git a/Items/Tools/FlamebeakHampick.cs b/Items/Tools/FlamebeakHampick.cs index dc892e9d83..5f0b0c55fc 100644 --- a/Items/Tools/FlamebeakHampick.cs +++ b/Items/Tools/FlamebeakHampick.cs @@ -24,7 +24,7 @@ Right click to use as a hammer"); item.melee = true; item.width = 52; item.height = 50; - item.useTime = 6; + item.useTime = 5; item.useAnimation = 15; item.useTurn = true; item.pick = PickPower; diff --git a/Items/Tools/GallantPickaxe.cs b/Items/Tools/GallantPickaxe.cs index 911f7606a2..4447ba76b2 100644 --- a/Items/Tools/GallantPickaxe.cs +++ b/Items/Tools/GallantPickaxe.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Tools item.melee = true; item.width = 84; item.height = 80; - item.useTime = 7; + item.useTime = 5; item.useAnimation = 14; item.useTurn = true; item.pick = 225; diff --git a/Items/Tools/Gelpick.cs b/Items/Tools/Gelpick.cs index b8d447cd47..a69898fe16 100644 --- a/Items/Tools/Gelpick.cs +++ b/Items/Tools/Gelpick.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Tools item.melee = true; item.width = 46; item.height = 46; - item.useTime = 16; + item.useTime = 10; item.useAnimation = 20; item.pick = 100; item.useStyle = ItemUseStyleID.SwingThrow; diff --git a/Items/Tools/GreatbayPickaxe.cs b/Items/Tools/GreatbayPickaxe.cs index fcb746f060..ce1801c047 100644 --- a/Items/Tools/GreatbayPickaxe.cs +++ b/Items/Tools/GreatbayPickaxe.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Tools item.melee = true; item.width = 44; item.height = 44; - item.useTime = 16; + item.useTime = 10; item.useAnimation = 16; item.useTurn = true; item.pick = 60; diff --git a/Items/Tools/MarniteObliterator.cs b/Items/Tools/MarniteObliterator.cs index 15f438f125..7c47be1e83 100644 --- a/Items/Tools/MarniteObliterator.cs +++ b/Items/Tools/MarniteObliterator.cs @@ -33,7 +33,8 @@ namespace CalamityMod.Items.Tools item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 40f; - } + item.Calamity().trueMelee = true; + } public override void AddRecipes() { diff --git a/Items/Tools/ShardlightPickaxe.cs b/Items/Tools/ShardlightPickaxe.cs index 7c646a27c3..d8f1def718 100644 --- a/Items/Tools/ShardlightPickaxe.cs +++ b/Items/Tools/ShardlightPickaxe.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Tools item.melee = true; item.width = 44; item.height = 44; - item.useTime = 6; + item.useTime = 7; item.useAnimation = 15; item.useTurn = true; item.pick = 190; diff --git a/Items/Tools/SkyfringePickaxe.cs b/Items/Tools/SkyfringePickaxe.cs index e7de69f517..a6384429fd 100644 --- a/Items/Tools/SkyfringePickaxe.cs +++ b/Items/Tools/SkyfringePickaxe.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Tools item.melee = true; item.width = 44; item.height = 44; - item.useTime = 14; + item.useTime = 10; item.useAnimation = 16; item.useTurn = true; item.pick = 95; diff --git a/Items/Tools/WulfrumPickaxe.cs b/Items/Tools/WulfrumPickaxe.cs index 5e97591432..d3ca33c00f 100644 --- a/Items/Tools/WulfrumPickaxe.cs +++ b/Items/Tools/WulfrumPickaxe.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Tools item.melee = true; item.width = 46; item.height = 38; - item.useTime = 16; + item.useTime = 12; item.useAnimation = 16; item.useTurn = true; item.pick = 35; diff --git a/Items/TreasureBags/AstrageldonBag.cs b/Items/TreasureBags/AstrageldonBag.cs index 96195471c8..5713875591 100644 --- a/Items/TreasureBags/AstrageldonBag.cs +++ b/Items/TreasureBags/AstrageldonBag.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.TreasureBags // Materials DropHelper.DropItem(player, ModContent.ItemType(), 12, 16); DropHelper.DropItem(player, ModContent.ItemType(), 30, 40); - DropHelper.DropItem(player, ItemID.FallenStar, 30, 50); + DropHelper.DropItem(player, ItemID.FallenStar, 20, 30); // Weapons float w = DropHelper.BagWeaponDropRateFloat; @@ -59,7 +59,7 @@ namespace CalamityMod.Items.TreasureBags ); // Equipment - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge && NPC.downedMoonlord); + DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedMoonlord); DropHelper.DropItem(player, ModContent.ItemType()); // Vanity diff --git a/Items/TreasureBags/AstrumDeusBag.cs b/Items/TreasureBags/AstrumDeusBag.cs index 1992ad1554..42b6acb68d 100644 --- a/Items/TreasureBags/AstrumDeusBag.cs +++ b/Items/TreasureBags/AstrumDeusBag.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.TreasureBags // Materials DropHelper.DropItem(player, ModContent.ItemType(), 60, 90); - DropHelper.DropItem(player, ItemID.FallenStar, 100, 180); + DropHelper.DropItem(player, ItemID.FallenStar, 30, 50); // Weapons float w = DropHelper.BagWeaponDropRateFloat; diff --git a/Items/TreasureBags/BrimstoneWaifuBag.cs b/Items/TreasureBags/BrimstoneWaifuBag.cs index 92cd4116b1..aaa2dffc91 100644 --- a/Items/TreasureBags/BrimstoneWaifuBag.cs +++ b/Items/TreasureBags/BrimstoneWaifuBag.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Items.TreasureBags DropHelper.DropItem(player, ModContent.ItemType()); DropHelper.DropItem(player, ModContent.ItemType()); DropHelper.DropItemChance(player, ModContent.ItemType(), 5); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge && CalamityWorld.downedProvidence); + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedProvidence); // Vanity DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge); diff --git a/Items/TreasureBags/DraedonTreasureBag.cs b/Items/TreasureBags/DraedonTreasureBag.cs index 2d427947ab..0e3add631a 100644 --- a/Items/TreasureBags/DraedonTreasureBag.cs +++ b/Items/TreasureBags/DraedonTreasureBag.cs @@ -1,14 +1,13 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Mounts; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.NPCs.ExoMechs.Apollo; using CalamityMod.NPCs.ExoMechs.Ares; -using CalamityMod.NPCs.ExoMechs.Artemis; -using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.World; using Terraria; using Terraria.ID; @@ -44,25 +43,54 @@ namespace CalamityMod.Items.TreasureBags { player.TryGettingDevArmor(); - // Weapons - float w = DropHelper.BagWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(player, - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w) - ); + // Materials + DropHelper.DropItem(player, ModContent.ItemType(), 30, 40); + + // Weapons + // Higher chance due to how the drops work + float w = DropHelper.BagWeaponDropRateFloat * 2f; + if (CalamityWorld.downedAres) + { + DropHelper.DropEntireWeightedSet(player, + DropHelper.WeightStack(w), + DropHelper.WeightStack(w) + ); + } + if (CalamityWorld.downedThanatos) + { + DropHelper.DropEntireWeightedSet(player, + DropHelper.WeightStack(w), + DropHelper.WeightStack(w) + ); + } + if (CalamityWorld.downedArtemisAndApollo) + { + DropHelper.DropEntireWeightedSet(player, + DropHelper.WeightStack(w), + DropHelper.WeightStack(w) + ); + } // Equipment DropHelper.DropItem(player, ModContent.ItemType()); + DropHelper.DropItemChance(player, ModContent.ItemType(), 5); // Vanity - // DropHelper.DropItemChance(player, ModContent.ItemType(), 7); - // DropHelper.DropItemChance(player, ModContent.ItemType(), 7); - // DropHelper.DropItemChance(player, ModContent.ItemType(), 7); - // DropHelper.DropItemChance(player, ModContent.ItemType(), 7); + // Higher chance due to how the drops work + float maskDropRate = 1f / 3.5f; + if (CalamityWorld.downedThanatos) + DropHelper.DropItemChance(player, ModContent.ItemType(), maskDropRate); + + if (CalamityWorld.downedArtemisAndApollo) + { + DropHelper.DropItemChance(player, ModContent.ItemType(), maskDropRate); + DropHelper.DropItemChance(player, ModContent.ItemType(), maskDropRate); + } + + if (CalamityWorld.downedAres) + DropHelper.DropItemChance(player, ModContent.ItemType(), maskDropRate); + + DropHelper.DropItemChance(player, ModContent.ItemType(), maskDropRate); } } } diff --git a/Items/TreasureBags/HiveMindBag.cs b/Items/TreasureBags/HiveMindBag.cs index 01cc8ff554..b6f9979729 100644 --- a/Items/TreasureBags/HiveMindBag.cs +++ b/Items/TreasureBags/HiveMindBag.cs @@ -42,9 +42,9 @@ namespace CalamityMod.Items.TreasureBags public override void OpenBossBag(Player player) { // Materials - DropHelper.DropItem(player, ItemID.RottenChunk, 10, 20); - DropHelper.DropItem(player, ItemID.DemoniteBar, 9, 14); DropHelper.DropItem(player, ModContent.ItemType(), 30, 40); + DropHelper.DropItem(player, ItemID.DemoniteBar, 9, 14); + DropHelper.DropItem(player, ItemID.RottenChunk, 10, 20); DropHelper.DropItemCondition(player, ItemID.CursedFlame, Main.hardMode, 15, 30); // Weapons diff --git a/Items/TreasureBags/PerforatorBag.cs b/Items/TreasureBags/PerforatorBag.cs index 16e83a6c5b..40f29b93b5 100644 --- a/Items/TreasureBags/PerforatorBag.cs +++ b/Items/TreasureBags/PerforatorBag.cs @@ -42,9 +42,9 @@ namespace CalamityMod.Items.TreasureBags public override void OpenBossBag(Player player) { // Materials - DropHelper.DropItem(player, ItemID.Vertebrae, 10, 20); - DropHelper.DropItem(player, ItemID.CrimtaneBar, 9, 14); DropHelper.DropItem(player, ModContent.ItemType(), 30, 40); + DropHelper.DropItem(player, ItemID.CrimtaneBar, 9, 14); + DropHelper.DropItem(player, ItemID.Vertebrae, 10, 20); DropHelper.DropItemCondition(player, ItemID.Ichor, Main.hardMode, 15, 30); // Weapons diff --git a/Items/TreasureBags/PlaguebringerGoliathBag.cs b/Items/TreasureBags/PlaguebringerGoliathBag.cs index 558b709431..1540818f16 100644 --- a/Items/TreasureBags/PlaguebringerGoliathBag.cs +++ b/Items/TreasureBags/PlaguebringerGoliathBag.cs @@ -64,7 +64,6 @@ namespace CalamityMod.Items.TreasureBags // Equipment DropHelper.DropItem(player, ModContent.ItemType()); - DropHelper.DropItemChance(player, ModContent.ItemType(), 5); // Vanity DropHelper.DropItemChance(player, ModContent.ItemType(), 7); diff --git a/Items/TreasureBags/SCalBag.cs b/Items/TreasureBags/SCalBag.cs index 0478b55c4a..35f7816689 100644 --- a/Items/TreasureBags/SCalBag.cs +++ b/Items/TreasureBags/SCalBag.cs @@ -1,14 +1,15 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Items.Materials; using CalamityMod.Items.Pets; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using Terraria; -using Terraria.ModLoader; using Terraria.ID; - +using Terraria.ModLoader; using SCalBoss = CalamityMod.NPCs.SupremeCalamitas.SupremeCalamitas; namespace CalamityMod.Items.TreasureBags @@ -39,21 +40,27 @@ namespace CalamityMod.Items.TreasureBags { player.TryGettingDevArmor(); + // Materials + DropHelper.DropItem(player, ModContent.ItemType(), 25, 35); + // Weapons float w = DropHelper.BagWeaponDropRateFloat; DropHelper.DropEntireWeightedSet(player, - DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), DropHelper.WeightStack(w), + DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w) - ); + DropHelper.WeightStack(w) + ); // Equipment DropHelper.DropItem(player, ModContent.ItemType()); // Vanity + + // SCal vanity set (This drops all at once, or not at all) if (Main.rand.NextBool(7)) { DropHelper.DropItem(player, ModContent.ItemType()); @@ -61,6 +68,9 @@ namespace CalamityMod.Items.TreasureBags DropHelper.DropItem(player, ModContent.ItemType()); DropHelper.DropItem(player, ModContent.ItemType()); } + + // The Brimstone Jewel is an expert-only vanity + DropHelper.DropItem(player, ModContent.ItemType()); } } } diff --git a/Items/TreasureBags/SlimeGodBag.cs b/Items/TreasureBags/SlimeGodBag.cs index 533e2d577c..76b2a4071f 100644 --- a/Items/TreasureBags/SlimeGodBag.cs +++ b/Items/TreasureBags/SlimeGodBag.cs @@ -41,8 +41,8 @@ namespace CalamityMod.Items.TreasureBags public override void OpenBossBag(Player player) { // Materials - DropHelper.DropItem(player, ItemID.Gel, 30, 60); - DropHelper.DropItem(player, ModContent.ItemType(), 35, 55); + // No Gel is dropped here because the boss drops Gel directly + DropHelper.DropItem(player, ModContent.ItemType(), 40, 52); // Weapons float w = DropHelper.BagWeaponDropRateFloat; diff --git a/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs b/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs index 7c4d99b2c1..703bc5730c 100644 --- a/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs +++ b/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs @@ -1,7 +1,9 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -50,6 +52,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 2); + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); @@ -60,7 +64,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 2); recipe.AddIngredient(ModContent.ItemType(), 8); recipe.AddIngredient(ModContent.ItemType(), 12); recipe.AddIngredient(ItemID.HallowedBar, 10); diff --git a/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs b/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs index a55146abb1..816c0561d0 100644 --- a/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs +++ b/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs @@ -1,6 +1,8 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -50,6 +52,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 3); + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { float swingOffset = Main.rand.NextFloat(0.5f, 1f) * item.shootSpeed * 1.6f * player.direction; @@ -59,7 +63,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 3); recipe.AddIngredient(ModContent.ItemType(), 12); recipe.AddIngredient(ModContent.ItemType(), 18); recipe.AddIngredient(ModContent.ItemType(), 5); diff --git a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs index 0b1bd13c12..3e5ed17b95 100644 --- a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs +++ b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs @@ -1,6 +1,8 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -53,6 +55,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 3); + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); @@ -63,7 +67,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 3); recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ModContent.ItemType(), 5); diff --git a/Items/Weapons/DraedonsArsenal/GaussDagger.cs b/Items/Weapons/DraedonsArsenal/GaussDagger.cs index fb0c702115..22455c6a18 100644 --- a/Items/Weapons/DraedonsArsenal/GaussDagger.cs +++ b/Items/Weapons/DraedonsArsenal/GaussDagger.cs @@ -1,6 +1,8 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -43,6 +45,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal modItem.ChargePerUse = 0.05f; } + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1); + public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) { target.Calamity().GaussFluxTimer += 50; @@ -61,7 +65,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 1); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 7); recipe.AddIngredient(ModContent.ItemType(), 4); diff --git a/Items/Weapons/DraedonsArsenal/GaussPistol.cs b/Items/Weapons/DraedonsArsenal/GaussPistol.cs index ff9b51e329..3a0479552d 100644 --- a/Items/Weapons/DraedonsArsenal/GaussPistol.cs +++ b/Items/Weapons/DraedonsArsenal/GaussPistol.cs @@ -1,5 +1,7 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using System.Collections.Generic; using Terraria.ID; using Terraria.ModLoader; @@ -43,9 +45,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal modItem.ChargePerUse = 0.05f; } + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 2); + public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 2); recipe.AddIngredient(ModContent.ItemType(), 12); recipe.AddIngredient(ModContent.ItemType(), 8); recipe.AddIngredient(ItemID.HallowedBar, 10); diff --git a/Items/Weapons/DraedonsArsenal/GaussRifle.cs b/Items/Weapons/DraedonsArsenal/GaussRifle.cs index 9616aed0c3..0645432e36 100644 --- a/Items/Weapons/DraedonsArsenal/GaussRifle.cs +++ b/Items/Weapons/DraedonsArsenal/GaussRifle.cs @@ -1,6 +1,8 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -50,9 +52,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal return false; } + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 3); + public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 3); recipe.AddIngredient(ModContent.ItemType(), 18); recipe.AddIngredient(ModContent.ItemType(), 12); recipe.AddIngredient(ModContent.ItemType(), 5); diff --git a/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs b/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs index bce57c4285..96311baab1 100644 --- a/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs +++ b/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs @@ -1,5 +1,7 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -43,6 +45,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.melee = true; item.channel = true; + modItem.trueMelee = true; modItem.UsesCharge = true; modItem.MaxCharge = 85f; modItem.ChargePerUse = 0f; // This weapon is a holdout. Charge is consumed by the holdout projectile. @@ -50,9 +53,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && item.Calamity().Charge > 0; + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 2); + public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 2); recipe.AddIngredient(ModContent.ItemType(), 8); recipe.AddIngredient(ModContent.ItemType(), 12); recipe.AddIngredient(ItemID.HallowedBar, 10); diff --git a/Items/Weapons/DraedonsArsenal/LaserRifle.cs b/Items/Weapons/DraedonsArsenal/LaserRifle.cs index 8c7c871921..929cda4cdb 100644 --- a/Items/Weapons/DraedonsArsenal/LaserRifle.cs +++ b/Items/Weapons/DraedonsArsenal/LaserRifle.cs @@ -1,6 +1,8 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -62,6 +64,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal return false; } + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 4); + public override Vector2? HoldoutOffset() { return new Vector2(-20, 0); @@ -69,7 +73,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 4); recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ModContent.ItemType(), 8); diff --git a/Items/Weapons/DraedonsArsenal/MatterModulator.cs b/Items/Weapons/DraedonsArsenal/MatterModulator.cs index 3a23cd49a4..3356fa79e6 100644 --- a/Items/Weapons/DraedonsArsenal/MatterModulator.cs +++ b/Items/Weapons/DraedonsArsenal/MatterModulator.cs @@ -1,6 +1,8 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -55,9 +57,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal return false; } + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 2); + public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 2); recipe.AddIngredient(ModContent.ItemType(), 12); recipe.AddIngredient(ModContent.ItemType(), 8); recipe.AddIngredient(ItemID.HallowedBar, 10); diff --git a/Items/Weapons/DraedonsArsenal/MountedScanner.cs b/Items/Weapons/DraedonsArsenal/MountedScanner.cs index 111768cff3..51db8b0507 100644 --- a/Items/Weapons/DraedonsArsenal/MountedScanner.cs +++ b/Items/Weapons/DraedonsArsenal/MountedScanner.cs @@ -1,6 +1,8 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -84,9 +86,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal return false; } + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 2); + public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 2); recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ItemID.HallowedBar, 10); diff --git a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs index 9ac5070780..9a917740b1 100644 --- a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs +++ b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs @@ -1,7 +1,9 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -69,13 +71,16 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal return false; } + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 5); + public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 5); recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ModContent.ItemType(), 25); + recipe.AddIngredient(ModContent.ItemType(), 8); recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs index 670409b303..a9033eac84 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs @@ -1,6 +1,8 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -95,9 +97,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal return new Vector2(-10, 0); } + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 4); + public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 4); recipe.AddIngredient(ModContent.ItemType(), 18); recipe.AddIngredient(ModContent.ItemType(), 12); recipe.AddIngredient(ModContent.ItemType(), 8); diff --git a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs index 01199662ac..1346f4f8bb 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs @@ -1,8 +1,10 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -51,19 +53,22 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal if (player.Calamity().StealthStrikeAvailable()) damage = (int)(damage * 1.05); - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 5); + public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 5); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this, 999); recipe.AddRecipe(); } diff --git a/Items/Weapons/DraedonsArsenal/PoleWarper.cs b/Items/Weapons/DraedonsArsenal/PoleWarper.cs index 5155800c48..f9da2e0cfb 100644 --- a/Items/Weapons/DraedonsArsenal/PoleWarper.cs +++ b/Items/Weapons/DraedonsArsenal/PoleWarper.cs @@ -1,7 +1,9 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -22,7 +24,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal CalamityGlobalItem modItem = item.Calamity(); item.shootSpeed = 10f; - item.damage = 248; + item.damage = 310; item.mana = 12; item.width = 38; item.height = 24; @@ -80,13 +82,16 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal return false; } + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 52); + public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 5); recipe.AddIngredient(ModContent.ItemType(), 25); recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 8); recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/DraedonsArsenal/PulseDragon.cs b/Items/Weapons/DraedonsArsenal/PulseDragon.cs index f647169ffa..81eee4591f 100644 --- a/Items/Weapons/DraedonsArsenal/PulseDragon.cs +++ b/Items/Weapons/DraedonsArsenal/PulseDragon.cs @@ -1,6 +1,8 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -58,9 +60,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal return false; } + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 4); + public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 4); recipe.AddIngredient(ModContent.ItemType(), 12); recipe.AddIngredient(ModContent.ItemType(), 18); recipe.AddIngredient(ModContent.ItemType(), 8); diff --git a/Items/Weapons/DraedonsArsenal/PulsePistol.cs b/Items/Weapons/DraedonsArsenal/PulsePistol.cs index 0659abbf32..1fec36a440 100644 --- a/Items/Weapons/DraedonsArsenal/PulsePistol.cs +++ b/Items/Weapons/DraedonsArsenal/PulsePistol.cs @@ -1,6 +1,8 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -52,9 +54,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override Vector2? HoldoutOffset() => new Vector2(10f, 0f); + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1); + public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 1); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 7); recipe.AddIngredient(ModContent.ItemType(), 4); diff --git a/Items/Weapons/DraedonsArsenal/PulseRifle.cs b/Items/Weapons/DraedonsArsenal/PulseRifle.cs index a3284c60a7..ce71f5608b 100644 --- a/Items/Weapons/DraedonsArsenal/PulseRifle.cs +++ b/Items/Weapons/DraedonsArsenal/PulseRifle.cs @@ -1,7 +1,9 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -67,13 +69,16 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 4); + public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 4); recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ModContent.ItemType(), 8); recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs index 9cc1ac8f71..d83697b76a 100644 --- a/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs +++ b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs @@ -1,6 +1,8 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -57,9 +59,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal return false; } + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 3); + public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 3); recipe.AddIngredient(ModContent.ItemType(), 12); recipe.AddIngredient(ModContent.ItemType(), 18); recipe.AddIngredient(ModContent.ItemType(), 5); diff --git a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs index 2051589a03..b29efef263 100644 --- a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs +++ b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs @@ -1,7 +1,9 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -53,9 +55,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal return false; } + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 4); + public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 4); recipe.AddIngredient(ModContent.ItemType(), 18); recipe.AddIngredient(ModContent.ItemType(), 12); recipe.AddIngredient(ModContent.ItemType(), 8); diff --git a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs index 162ed1187d..33eb8cdbef 100644 --- a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs +++ b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs @@ -1,6 +1,8 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -55,9 +57,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal return false; } + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1); + public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 1); recipe.AddIngredient(ModContent.ItemType(), 8); recipe.AddIngredient(ModContent.ItemType(), 4); recipe.AddIngredient(ModContent.ItemType(), 4); diff --git a/Items/Weapons/DraedonsArsenal/SystemBane.cs b/Items/Weapons/DraedonsArsenal/SystemBane.cs index 43cb0cfddf..64991564af 100644 --- a/Items/Weapons/DraedonsArsenal/SystemBane.cs +++ b/Items/Weapons/DraedonsArsenal/SystemBane.cs @@ -1,7 +1,9 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -58,9 +60,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal return false; } + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 3); + public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 3); recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 5); diff --git a/Items/Weapons/DraedonsArsenal/Taser.cs b/Items/Weapons/DraedonsArsenal/Taser.cs index 19f7a9c04a..cec40c61eb 100644 --- a/Items/Weapons/DraedonsArsenal/Taser.cs +++ b/Items/Weapons/DraedonsArsenal/Taser.cs @@ -1,5 +1,7 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -45,9 +47,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1); + public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 1); recipe.AddIngredient(ModContent.ItemType(), 7); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 4); diff --git a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs index 30df63274a..14ab9d1ac1 100644 --- a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs +++ b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs @@ -1,7 +1,9 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -68,13 +70,16 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override Vector2? HoldoutOffset() => new Vector2(-20, 0); + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 5); + public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 5); recipe.AddIngredient(ModContent.ItemType(), 25); recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 8); recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs index 08db5e5ffc..d61410933e 100644 --- a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs +++ b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs @@ -1,7 +1,9 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -58,9 +60,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal return false; } + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1); + public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 1); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 7); recipe.AddIngredient(ModContent.ItemType(), 4); diff --git a/Items/Weapons/DraedonsArsenal/WavePounder.cs b/Items/Weapons/DraedonsArsenal/WavePounder.cs index 4de1908432..dd5cb060aa 100644 --- a/Items/Weapons/DraedonsArsenal/WavePounder.cs +++ b/Items/Weapons/DraedonsArsenal/WavePounder.cs @@ -1,7 +1,9 @@ +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -56,9 +58,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal return false; } + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 4); + public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); + ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 4); recipe.AddIngredient(ModContent.ItemType(), 12); recipe.AddIngredient(ModContent.ItemType(), 18); recipe.AddIngredient(ModContent.ItemType(), 8); diff --git a/Items/Weapons/Magic/AlphaRay.cs b/Items/Weapons/Magic/AlphaRay.cs index d728535cfa..e197165583 100644 --- a/Items/Weapons/Magic/AlphaRay.cs +++ b/Items/Weapons/Magic/AlphaRay.cs @@ -77,11 +77,11 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 2); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Magic/BlushieStaff.cs b/Items/Weapons/Magic/BlushieStaff.cs index 17c1f0f639..444111f0ed 100644 --- a/Items/Weapons/Magic/BlushieStaff.cs +++ b/Items/Weapons/Magic/BlushieStaff.cs @@ -41,8 +41,9 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 100); - recipe.AddIngredient(ModContent.ItemType(), 50); + recipe.AddIngredient(ItemID.SapphireStaff); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Magic/Climax.cs b/Items/Weapons/Magic/Climax.cs index 15d9c50a84..560ac88c2f 100644 --- a/Items/Weapons/Magic/Climax.cs +++ b/Items/Weapons/Magic/Climax.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Items.Weapons.Magic item.mana = 30; item.width = 78; item.height = 78; - item.useTime = 55; - item.useAnimation = 55; + item.useTime = 33; + item.useAnimation = 33; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5f; @@ -82,8 +82,8 @@ namespace CalamityMod.Items.Weapons.Magic { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Magic/Eternity.cs b/Items/Weapons/Magic/Eternity.cs index ff5129e621..6234807a9f 100644 --- a/Items/Weapons/Magic/Eternity.cs +++ b/Items/Weapons/Magic/Eternity.cs @@ -66,8 +66,8 @@ namespace CalamityMod.Items.Weapons.Magic recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ItemID.UnicornHorn, 5); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Magic/EventHorizon.cs b/Items/Weapons/Magic/EventHorizon.cs index 115962a0e6..c523d60ef4 100644 --- a/Items/Weapons/Magic/EventHorizon.cs +++ b/Items/Weapons/Magic/EventHorizon.cs @@ -57,7 +57,8 @@ namespace CalamityMod.Items.Weapons.Magic recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 8); recipe.AddTile(TileID.Bookcases); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Magic/Fabstaff.cs b/Items/Weapons/Magic/Fabstaff.cs index 7a3808bd52..d3a8abe281 100644 --- a/Items/Weapons/Magic/Fabstaff.cs +++ b/Items/Weapons/Magic/Fabstaff.cs @@ -48,9 +48,9 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RainbowRod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ItemID.RainbowRod); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Magic/FaceMelter.cs b/Items/Weapons/Magic/FaceMelter.cs index 90c6ace174..3201f0e701 100644 --- a/Items/Weapons/Magic/FaceMelter.cs +++ b/Items/Weapons/Magic/FaceMelter.cs @@ -49,9 +49,9 @@ namespace CalamityMod.Items.Weapons.Magic recipe.AddIngredient(ItemID.TheAxe); recipe.AddIngredient(ItemID.MagicalHarp); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Magic/HadopelagicEcho.cs b/Items/Weapons/Magic/HadopelagicEcho.cs index 8fbdcfc37c..4598e96fa7 100644 --- a/Items/Weapons/Magic/HadopelagicEcho.cs +++ b/Items/Weapons/Magic/HadopelagicEcho.cs @@ -10,15 +10,15 @@ namespace CalamityMod.Items.Weapons.Magic { public class HadopelagicEcho : ModItem { - private int counter = 0; + private int counter = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Hadopelagic Echo"); Tooltip.SetDefault("Fires a string of bouncing sound waves\n" + - "Sound waves fired later in the chain deal more damage\n" + - "Sound waves echo additional sound waves on enemy hits\n" + - "Sound waves deal more damage the more they pierce"); + "Sound waves fired later in the chain deal more damage\n" + + "Sound waves echo additional sound waves on enemy hits\n" + + "Sound waves deal more damage the more they pierce"); } public override void SetDefaults() @@ -49,18 +49,18 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float damageMult = 1f; - if (counter == 1) - damageMult = 1.1f; - if (counter == 2) - damageMult = 1.2f; - if (counter == 3) - damageMult = 1.35f; - if (counter == 4) - damageMult = 1.5f; + float damageMult = 1f; + if (counter == 1) + damageMult = 1.1f; + if (counter == 2) + damageMult = 1.2f; + if (counter == 3) + damageMult = 1.35f; + if (counter == 4) + damageMult = 1.5f; Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)(damage * damageMult), knockBack, player.whoAmI, counter, 0f); - counter++; - if (counter >= 5) + counter++; + if (counter >= 5) counter = 0; return false; } @@ -72,8 +72,8 @@ namespace CalamityMod.Items.Weapons.Magic recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Magic/HeliumFlash.cs b/Items/Weapons/Magic/HeliumFlash.cs index 6430560952..6b1cfe1816 100644 --- a/Items/Weapons/Magic/HeliumFlash.cs +++ b/Items/Weapons/Magic/HeliumFlash.cs @@ -1,7 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; -using Microsoft.Xna.Framework; -using System; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +9,8 @@ namespace CalamityMod.Items.Weapons.Magic { public class HeliumFlash : ModItem { + internal const float ExplosionDamageMultiplier = 0.125f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Helium Flash"); @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Magic item.width = 76; item.height = 76; item.magic = true; - item.damage = 1111; + item.damage = 3875; item.knockBack = 9.5f; item.mana = 26; item.useAnimation = 37; @@ -42,6 +43,8 @@ namespace CalamityMod.Items.Weapons.Magic item.shootSpeed = 15f; } + // TODO -- Fancy visual flare doesn't work with resprited Helium Flash, adjust dust positions + /* // Creates dust at the tip of the staff when used. public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -89,18 +92,19 @@ namespace CalamityMod.Items.Weapons.Magic } return true; } + */ public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); r.SetResult(this); - r.AddTile(TileID.LunarCraftingStation); r.AddIngredient(ModContent.ItemType()); r.AddIngredient(ModContent.ItemType()); r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 4); r.AddIngredient(ItemID.FragmentSolar, 20); r.AddIngredient(ItemID.FragmentNebula, 5); + r.AddIngredient(ModContent.ItemType(), 5); + r.AddTile(ModContent.TileType()); r.AddRecipe(); } } diff --git a/Items/Weapons/Magic/IceBarrage.cs b/Items/Weapons/Magic/IceBarrage.cs index 7978b1cd4c..12ef782e39 100644 --- a/Items/Weapons/Magic/IceBarrage.cs +++ b/Items/Weapons/Magic/IceBarrage.cs @@ -71,7 +71,8 @@ namespace CalamityMod.Items.Weapons.Magic recipe.AddIngredient(ItemID.BlizzardStaff); recipe.AddIngredient(ItemID.IceRod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 23); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 40); recipe.AddIngredient(ModContent.ItemType(), 18); recipe.AddTile(TileID.IceMachine); recipe.SetResult(this); diff --git a/Items/Weapons/Magic/LightGodsBrilliance.cs b/Items/Weapons/Magic/LightGodsBrilliance.cs index bf0a6c890e..94e3482229 100644 --- a/Items/Weapons/Magic/LightGodsBrilliance.cs +++ b/Items/Weapons/Magic/LightGodsBrilliance.cs @@ -54,9 +54,10 @@ namespace CalamityMod.Items.Weapons.Magic recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.HolyWater, 10); - recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.SoulofLight, 30); recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddTile(TileID.Bookcases); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Magic/PrimordialAncient.cs b/Items/Weapons/Magic/PrimordialAncient.cs index 7817b6accb..83e8c1b6b1 100644 --- a/Items/Weapons/Magic/PrimordialAncient.cs +++ b/Items/Weapons/Magic/PrimordialAncient.cs @@ -42,8 +42,8 @@ namespace CalamityMod.Items.Weapons.Magic ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddTile(TileID.Bookcases); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Magic/RecitationoftheBeast.cs b/Items/Weapons/Magic/RecitationoftheBeast.cs index 70c73c1e1d..032cfc6cd8 100644 --- a/Items/Weapons/Magic/RecitationoftheBeast.cs +++ b/Items/Weapons/Magic/RecitationoftheBeast.cs @@ -14,13 +14,13 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Recitation of the Beast"); Tooltip.SetDefault("A thousand years sealed in the demon's realm will teach you a thing or two\n" + - "Summons beast scythes around the player in a small circle,\n" + + "Summons beast scythes around the player in a small circle,\n" + "before firing toward the cursor and home in to nearby enemies"); } public override void SetDefaults() { - item.mana = 24; + item.mana = 24; item.width = 38; item.height = 34; item.damage = 128; @@ -39,22 +39,22 @@ namespace CalamityMod.Items.Weapons.Magic item.Calamity().customRarity = CalamityRarity.DarkBlue; } - // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 20; + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 20; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float spread = 60f * 0.0174f; - double startAngle = Math.Atan2(speedX, speedY) - spread / 2; - double deltaAngle = spread / 6f; - double offsetAngle; - int i; - for (i = 0; i < 3; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), type, damage, knockBack, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), type, damage, knockBack, Main.myPlayer, 0f, 0f); - } + float spread = 60f * 0.0174f; + double startAngle = Math.Atan2(speedX, speedY) - spread / 2; + double deltaAngle = spread / 6f; + double offsetAngle; + int i; + for (i = 0; i < 3; i++) + { + offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; + Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), type, damage, knockBack, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), type, damage, knockBack, Main.myPlayer, 0f, 0f); + } return false; } @@ -62,8 +62,9 @@ namespace CalamityMod.Items.Weapons.Magic { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.DemonScythe); - recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ModContent.ItemType(), 12); recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddTile(TileID.Bookcases); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Magic/SoulPiercer.cs b/Items/Weapons/Magic/SoulPiercer.cs index 95d6f233fb..d9b59d5bfa 100644 --- a/Items/Weapons/Magic/SoulPiercer.cs +++ b/Items/Weapons/Magic/SoulPiercer.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -8,7 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic { - public class SoulPiercer : ModItem + public class SoulPiercer : ModItem { public override void SetStaticDefaults() { @@ -44,14 +45,14 @@ namespace CalamityMod.Items.Weapons.Magic public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SoulPiercerGlow")); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SoulPiercerGlow")); } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Magic/SubsumingVortex.cs b/Items/Weapons/Magic/SubsumingVortex.cs index 01566b5b5f..ea34617737 100644 --- a/Items/Weapons/Magic/SubsumingVortex.cs +++ b/Items/Weapons/Magic/SubsumingVortex.cs @@ -9,7 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic { - public class SubsumingVortex : ModItem + public class SubsumingVortex : ModItem { public override void SetStaticDefaults() { @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Magic item.knockBack = 5f; item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.Violet; - item.value = Item.buyPrice(platinum: 2, gold: 50); + item.value = CalamityGlobalItem.Rarity15BuyPrice; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 7f; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SubsumingVortexGlow")); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SubsumingVortexGlow")); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -56,8 +56,8 @@ namespace CalamityMod.Items.Weapons.Magic recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Magic/T1000.cs b/Items/Weapons/Magic/T1000.cs index 8ac53ca068..9732ac2fda 100644 --- a/Items/Weapons/Magic/T1000.cs +++ b/Items/Weapons/Magic/T1000.cs @@ -30,13 +30,13 @@ namespace CalamityMod.Items.Weapons.Magic item.noUseGraphic = true; item.channel = true; item.knockBack = 4f; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = ItemRarityID.Purple; - item.autoReuse = true; + item.value = CalamityGlobalItem.Rarity15BuyPrice; + item.rare = ItemRarityID.Purple; + item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 24f; - item.Calamity().customRarity = CalamityRarity.Violet; - } + item.Calamity().customRarity = CalamityRarity.Violet; + } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; @@ -44,9 +44,8 @@ namespace CalamityMod.Items.Weapons.Magic { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Magic/TheWand.cs b/Items/Weapons/Magic/TheWand.cs index 43f34b0c29..a96f424ca0 100644 --- a/Items/Weapons/Magic/TheWand.cs +++ b/Items/Weapons/Magic/TheWand.cs @@ -26,8 +26,8 @@ namespace CalamityMod.Items.Weapons.Magic item.mana = 150; item.magic = true; item.noMelee = true; - item.useAnimation = 250; - item.useTime = 250; + item.useAnimation = 19; + item.useTime = 19; item.useTurn = true; item.useStyle = ItemUseStyleID.HoldingOut; item.knockBack = 0.5f; @@ -41,9 +41,20 @@ namespace CalamityMod.Items.Weapons.Magic item.Calamity().customRarity = CalamityRarity.Violet; } - public override Vector2? HoldoutOrigin() + public override bool CanUseItem(Player player) { - return new Vector2(10, 10); + int numWandBolts = player.ownedProjectileCounts[ModContent.ProjectileType()]; + int numTornadoStarters = player.ownedProjectileCounts[ModContent.ProjectileType()]; + int numTornadoPieces = player.ownedProjectileCounts[ModContent.ProjectileType()]; + return numWandBolts + numTornadoStarters + numTornadoPieces < 1; + } + + public override Vector2? HoldoutOrigin() => new Vector2(10, 10); + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 6); } public override void AddRecipes() @@ -51,17 +62,9 @@ namespace CalamityMod.Items.Weapons.Magic ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.WandofSparking); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 6); - } - } } } diff --git a/Items/Weapons/Magic/VividClarity.cs b/Items/Weapons/Magic/VividClarity.cs index a602bd5e23..78523538c4 100644 --- a/Items/Weapons/Magic/VividClarity.cs +++ b/Items/Weapons/Magic/VividClarity.cs @@ -14,10 +14,10 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Vivid Clarity"); Tooltip.SetDefault("Fires five randomized beams of elemental energy at the cursor\n" + - "On enemy and tile hits, beams either explode into a big flash,\n" + - "summon an additonal laser from the sky,\n" + - "or split into energy orbs\n" + - "High IQ increases the weapon's potential"); + "On enemy and tile hits, beams either explode into a big flash,\n" + + "summon an additonal laser from the sky,\n" + + "or split into energy orbs\n" + + "Its majesty inspires a stroke of unparalleled genius"); Item.staff[item.type] = true; } @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 7.5f; - item.value = Item.buyPrice(2, 50, 0, 0); + item.value = CalamityGlobalItem.Rarity15BuyPrice; item.rare = ItemRarityID.Red; item.UseSound = SoundID.Item60; item.autoReuse = true; @@ -84,8 +84,8 @@ namespace CalamityMod.Items.Weapons.Magic recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Magic/VoidVortex.cs b/Items/Weapons/Magic/VoidVortex.cs index c199cf4eaf..9b3873fc9a 100644 --- a/Items/Weapons/Magic/VoidVortex.cs +++ b/Items/Weapons/Magic/VoidVortex.cs @@ -28,15 +28,15 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 0f; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.Calamity().customRarity = CalamityRarity.Violet; - item.rare = ItemRarityID.Purple; + item.value = CalamityGlobalItem.Rarity15BuyPrice; + item.Calamity().customRarity = CalamityRarity.Violet; + item.rare = ItemRarityID.Purple; item.UseSound = SoundID.Item20; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; - item.Calamity().challengeDrop = true; - } + item.Calamity().challengeDrop = true; + } public override Vector2? HoldoutOrigin() { diff --git a/Items/Weapons/Melee/AncientCrusher.cs b/Items/Weapons/Melee/AncientCrusher.cs index 9f320ff101..cfa53755ed 100644 --- a/Items/Weapons/Melee/AncientCrusher.cs +++ b/Items/Weapons/Melee/AncientCrusher.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Melee recipe.AddIngredient(ItemID.Amber, 8); recipe.AddIngredient(ItemID.FossilOre, 35); recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.MythrilAnvil); + recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Melee/Animus.cs b/Items/Weapons/Melee/Animus.cs index 6a087479bf..b97aa9ed01 100644 --- a/Items/Weapons/Melee/Animus.cs +++ b/Items/Weapons/Melee/Animus.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee { item.width = 82; item.height = 84; - item.scale = 1.5f; + item.scale = 1.5f; item.damage = 800; item.melee = true; item.useAnimation = 11; @@ -45,11 +45,11 @@ namespace CalamityMod.Items.Weapons.Melee } public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) - { - float damageMult = player.Calamity().animusBoost; - damageMult -= 1f; - mult += damageMult; - } + { + float damageMult = player.Calamity().animusBoost; + damageMult -= 1f; + mult += damageMult; + } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { diff --git a/Items/Weapons/Melee/ArkoftheCosmos.cs b/Items/Weapons/Melee/ArkoftheCosmos.cs index aeef4ac3ea..2f4deca036 100644 --- a/Items/Weapons/Melee/ArkoftheCosmos.cs +++ b/Items/Weapons/Melee/ArkoftheCosmos.cs @@ -41,8 +41,8 @@ namespace CalamityMod.Items.Weapons.Melee item.Calamity().customRarity = CalamityRarity.Violet; } - // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 15; + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 15; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -109,8 +109,8 @@ namespace CalamityMod.Items.Weapons.Melee ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } @@ -127,8 +127,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - CalamityPlayer modPlayer = player.Calamity(); - bool astral = modPlayer.ZoneAstral; + CalamityPlayer modPlayer = player.Calamity(); + bool astral = modPlayer.ZoneAstral; bool jungle = player.ZoneJungle; bool snow = player.ZoneSnow; bool beach = player.ZoneBeach; diff --git a/Items/Weapons/Melee/AstralPike.cs b/Items/Weapons/Melee/AstralPike.cs index 70de4755f0..f2220b17a8 100644 --- a/Items/Weapons/Melee/AstralPike.cs +++ b/Items/Weapons/Melee/AstralPike.cs @@ -33,7 +33,8 @@ namespace CalamityMod.Items.Weapons.Melee item.rare = ItemRarityID.Cyan; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 13f; - } + item.Calamity().trueMelee = true; + } // Terraria seems to really dislike high crit values in SetDefaults public override void GetWeaponCrit(Player player, ref int crit) => crit += 25; diff --git a/Items/Weapons/Melee/Ataraxia.cs b/Items/Weapons/Melee/Ataraxia.cs index 1a40403a52..dc28239a46 100644 --- a/Items/Weapons/Melee/Ataraxia.cs +++ b/Items/Weapons/Melee/Ataraxia.cs @@ -136,10 +136,11 @@ namespace CalamityMod.Items.Weapons.Melee { ModRecipe r = new ModRecipe(mod); r.AddIngredient(ItemID.BrokenHeroSword); - r.AddIngredient(ModContent.ItemType(), 4); - r.AddIngredient(ModContent.ItemType(), 12); - r.AddIngredient(ModContent.ItemType(), 6); - r.AddTile(ModContent.TileType()); + r.AddIngredient(ModContent.ItemType(), 5); + r.AddIngredient(ModContent.ItemType(), 8); + r.AddIngredient(ModContent.ItemType(), 2); + r.AddIngredient(ModContent.ItemType(), 20); + r.AddTile(ModContent.TileType()); r.SetResult(this); r.AddRecipe(); } diff --git a/Items/Weapons/Melee/Azathoth.cs b/Items/Weapons/Melee/Azathoth.cs index 7257e550ae..30b428cdb8 100644 --- a/Items/Weapons/Melee/Azathoth.cs +++ b/Items/Weapons/Melee/Azathoth.cs @@ -50,8 +50,8 @@ namespace CalamityMod.Items.Weapons.Melee { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.Terrarian); - recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Melee/Brimlance.cs b/Items/Weapons/Melee/Brimlance.cs index 81c28ce962..6f145669ee 100644 --- a/Items/Weapons/Melee/Brimlance.cs +++ b/Items/Weapons/Melee/Brimlance.cs @@ -32,7 +32,8 @@ namespace CalamityMod.Items.Weapons.Melee item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; - } + item.Calamity().trueMelee = true; + } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; } diff --git a/Items/Weapons/Melee/CosmicDischarge.cs b/Items/Weapons/Melee/CosmicDischarge.cs index 149440d644..05c22b177f 100644 --- a/Items/Weapons/Melee/CosmicDischarge.cs +++ b/Items/Weapons/Melee/CosmicDischarge.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee { item.width = 50; item.height = 52; - item.damage = 1000; + item.damage = 500; item.noMelee = true; item.noUseGraphic = true; item.channel = true; diff --git a/Items/Weapons/Melee/CosmicShiv.cs b/Items/Weapons/Melee/CosmicShiv.cs index df5fba12a9..589961e72c 100644 --- a/Items/Weapons/Melee/CosmicShiv.cs +++ b/Items/Weapons/Melee/CosmicShiv.cs @@ -6,6 +6,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Tiles.Furniture.CraftingStations; namespace CalamityMod.Items.Weapons.Melee { @@ -54,8 +55,8 @@ namespace CalamityMod.Items.Weapons.Melee ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Melee/CrystalBlade.cs b/Items/Weapons/Melee/CrystalBlade.cs index 1f769f5039..18abf9ad92 100644 --- a/Items/Weapons/Melee/CrystalBlade.cs +++ b/Items/Weapons/Melee/CrystalBlade.cs @@ -36,16 +36,9 @@ namespace CalamityMod.Items.Weapons.Melee { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.CrystalShard, 10); - recipe.AddIngredient(ItemID.CobaltSword); + recipe.AddRecipeGroup("AnyCobaltBar", 8); recipe.AddIngredient(ItemID.PixieDust, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrystalShard, 10); - recipe.AddIngredient(ItemID.PalladiumSword); - recipe.AddIngredient(ItemID.PixieDust, 10); - recipe.AddTile(TileID.MythrilAnvil); + recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Melee/DevilsDevastation.cs b/Items/Weapons/Melee/DevilsDevastation.cs index 96bab233f9..363286dcf8 100644 --- a/Items/Weapons/Melee/DevilsDevastation.cs +++ b/Items/Weapons/Melee/DevilsDevastation.cs @@ -107,9 +107,9 @@ namespace CalamityMod.Items.Weapons.Melee ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Melee/DevilsSunrise.cs b/Items/Weapons/Melee/DevilsSunrise.cs index 9ddc1e4168..85facd6e4d 100644 --- a/Items/Weapons/Melee/DevilsSunrise.cs +++ b/Items/Weapons/Melee/DevilsSunrise.cs @@ -36,7 +36,8 @@ namespace CalamityMod.Items.Weapons.Melee item.Calamity().customRarity = CalamityRarity.Turquoise; item.Calamity().donorItem = true; - item.shoot = ModContent.ProjectileType(); + item.Calamity().trueMelee = true; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 24f; } diff --git a/Items/Weapons/Melee/DiseasedPike.cs b/Items/Weapons/Melee/DiseasedPike.cs index 096fd9403f..a7988c2481 100644 --- a/Items/Weapons/Melee/DiseasedPike.cs +++ b/Items/Weapons/Melee/DiseasedPike.cs @@ -32,7 +32,8 @@ namespace CalamityMod.Items.Weapons.Melee item.rare = ItemRarityID.Yellow; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - } + item.Calamity().trueMelee = true; + } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; } diff --git a/Items/Weapons/Melee/DraedonsExoblade.cs b/Items/Weapons/Melee/DraedonsExoblade.cs index 3497a7d3a6..2496b82d26 100644 --- a/Items/Weapons/Melee/DraedonsExoblade.cs +++ b/Items/Weapons/Melee/DraedonsExoblade.cs @@ -8,17 +8,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class DraedonsExoblade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Exoblade"); - Tooltip.SetDefault("Ancient blade of Yharim's weapons and armors expert, Draedon\n" + - "Fires an exo beam that homes in on the player and explodes\n" + - "Striking an enemy with the blade causes several comets to fire\n" + - "All attacks briefly freeze enemies hit\n" + - "Enemies hit at very low HP explode into frost energy and freeze nearby enemies"); - } + public class DraedonsExoblade : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exoblade"); + Tooltip.SetDefault("Ancient blade of Yharim's weapons and armors expert, Draedon\n" + + "Fires an exo beam that homes in on the player and explodes\n" + + "Striking an enemy with the blade causes several comets to fire\n" + + "All attacks briefly freeze enemies hit\n" + + "Enemies hit at very low HP explode into frost energy and freeze nearby enemies"); + } public override void SetDefaults() { @@ -33,103 +33,103 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 114; - item.value = Item.buyPrice(2, 50, 0, 0); + item.value = CalamityGlobalItem.Rarity15BuyPrice; item.rare = ItemRarityID.Red; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 19f; item.Calamity().customRarity = CalamityRarity.Violet; } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(4)) - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 107, 0f, 0f, 100, new Color(0, 255, 255)); - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(4)) + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 107, 0f, 0f, 100, new Color(0, 255, 255)); + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (crit) - damage /= 2; + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (crit) + damage /= 2; - if (target.life <= (target.lifeMax * 0.05f)) - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, Main.myPlayer); + if (target.life <= (target.lifeMax * 0.05f)) + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, Main.myPlayer); - target.ExoDebuffs(); - Main.PlaySound(SoundID.Item88, player.Center); - float xPos = player.position.X + 800 * Main.rand.NextBool(2).ToDirectionInt(); - float yPos = player.position.Y + Main.rand.Next(-800, 801); - Vector2 startPos = new Vector2(xPos, yPos); - Vector2 velocity = target.position - startPos; - float dir = 10 / startPos.X; - velocity.X *= dir * 150; - velocity.Y *= dir * 150; - velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f); - velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 8) - { - for (int comet = 0; comet < 2; comet++) - { - float ai1 = Main.rand.NextFloat() + 0.5f; - Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, ai1); - } - } + target.ExoDebuffs(); + Main.PlaySound(SoundID.Item88, player.Center); + float xPos = player.position.X + 800 * Main.rand.NextBool(2).ToDirectionInt(); + float yPos = player.position.Y + Main.rand.Next(-800, 801); + Vector2 startPos = new Vector2(xPos, yPos); + Vector2 velocity = target.position - startPos; + float dir = 10 / startPos.X; + velocity.X *= dir * 150; + velocity.Y *= dir * 150; + velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f); + velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 8) + { + for (int comet = 0; comet < 2; comet++) + { + float ai1 = Main.rand.NextFloat() + 0.5f; + Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, ai1); + } + } - if (!target.canGhostHeal || player.moonLeech) - return; + if (!target.canGhostHeal || player.moonLeech) + return; - int healAmount = Main.rand.Next(3) + 5; - player.statLife += healAmount; - player.HealEffect(healAmount); - } + int healAmount = Main.rand.Next(3) + 5; + player.statLife += healAmount; + player.HealEffect(healAmount); + } - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - if (crit) - damage /= 2; + public override void OnHitPvp(Player player, Player target, int damage, bool crit) + { + if (crit) + damage /= 2; - if (target.statLife <= (target.statLifeMax2 * 0.05f)) - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), damage, item.knockBack, Main.myPlayer); + if (target.statLife <= (target.statLifeMax2 * 0.05f)) + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), damage, item.knockBack, Main.myPlayer); - target.ExoDebuffs(); - Main.PlaySound(SoundID.Item88, player.Center); - float xPos = player.position.X + 800 * Main.rand.NextBool(2).ToDirectionInt(); - float yPos = player.position.Y + Main.rand.Next(-800, 801); - Vector2 startPos = new Vector2(xPos, yPos); - Vector2 velocity = target.position - startPos; - float dir = 10 / startPos.X; - velocity.X *= dir * 150; - velocity.Y *= dir * 150; - velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f); - velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 8) - { - for (int comet = 0; comet < 2; comet++) - { - float ai1 = Main.rand.NextFloat() + 0.5f; - Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), damage, item.knockBack, player.whoAmI, 0f, ai1); - } - } + target.ExoDebuffs(); + Main.PlaySound(SoundID.Item88, player.Center); + float xPos = player.position.X + 800 * Main.rand.NextBool(2).ToDirectionInt(); + float yPos = player.position.Y + Main.rand.Next(-800, 801); + Vector2 startPos = new Vector2(xPos, yPos); + Vector2 velocity = target.position - startPos; + float dir = 10 / startPos.X; + velocity.X *= dir * 150; + velocity.Y *= dir * 150; + velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f); + velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 8) + { + for (int comet = 0; comet < 2; comet++) + { + float ai1 = Main.rand.NextFloat() + 0.5f; + Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), damage, item.knockBack, player.whoAmI, 0f, ai1); + } + } - if (player.moonLeech) - return; + if (player.moonLeech) + return; - int healAmount = Main.rand.Next(3) + 5; - player.statLife += healAmount; - player.HealEffect(healAmount); - } + int healAmount = Main.rand.Next(3) + 5; + player.statLife += healAmount; + player.HealEffect(healAmount); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Melee/DragonPow.cs b/Items/Weapons/Melee/DragonPow.cs index e67e97b43a..207b4c3057 100644 --- a/Items/Weapons/Melee/DragonPow.cs +++ b/Items/Weapons/Melee/DragonPow.cs @@ -53,7 +53,6 @@ Summons a barrage of petals and waterfalls on enemy hits"); { ModRecipe r = new ModRecipe(mod); r.SetResult(this); - r.AddTile(ModContent.TileType()); r.AddIngredient(ModContent.ItemType()); r.AddIngredient(ItemID.DaoofPow); r.AddIngredient(ItemID.FlowerPow); @@ -61,8 +60,9 @@ Summons a barrage of petals and waterfalls on enemy hits"); r.AddIngredient(ModContent.ItemType()); r.AddIngredient(ModContent.ItemType()); r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 4); r.AddIngredient(ModContent.ItemType(), 4); + r.AddIngredient(ModContent.ItemType(), 5); + r.AddTile(ModContent.TileType()); r.AddRecipe(); } } diff --git a/Items/Weapons/Melee/DragonRage.cs b/Items/Weapons/Melee/DragonRage.cs index 87d83b467d..3e2e7036c9 100644 --- a/Items/Weapons/Melee/DragonRage.cs +++ b/Items/Weapons/Melee/DragonRage.cs @@ -35,6 +35,7 @@ namespace CalamityMod.Items.Weapons.Melee item.value = CalamityGlobalItem.Rarity15BuyPrice; item.rare = ItemRarityID.Purple; item.Calamity().customRarity = CalamityRarity.Violet; - } + item.Calamity().trueMelee = true; + } } } diff --git a/Items/Weapons/Melee/ElementalExcalibur.cs b/Items/Weapons/Melee/ElementalExcalibur.cs index 1174c47e2b..09898f2aaf 100644 --- a/Items/Weapons/Melee/ElementalExcalibur.cs +++ b/Items/Weapons/Melee/ElementalExcalibur.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Elemental Excalibur"); Tooltip.SetDefault("Freezes enemies and heals the player on hit\n" + "Fires rainbow beams that change their behavior based on their color\n" + - "Right click for true melee"); + "Right click for true melee"); } public override void SetDefaults() @@ -45,12 +45,12 @@ namespace CalamityMod.Items.Weapons.Melee item.Calamity().customRarity = CalamityRarity.Rainbow; } - // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 10; + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 10; public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/ElementalExcaliburGlow")); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/ElementalExcaliburGlow")); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -64,37 +64,37 @@ namespace CalamityMod.Items.Weapons.Melee return false; } - public override bool AltFunctionUse(Player player) => true; + public override bool AltFunctionUse(Player player) => true; - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.shoot = ProjectileID.None; - item.shootSpeed = 0f; - } - else - { - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.shoot = ProjectileID.None; + item.shootSpeed = 0f; + } + else + { + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 12f; + } - return base.CanUseItem(player); - } + return base.CanUseItem(player); + } - public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) - { - if (player.altFunctionUse == 2) - damage *= 2; - } + public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) + { + if (player.altFunctionUse == 2) + damage *= 2; + } - public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) - { - if (player.altFunctionUse == 2) - damage *= 2; - } + public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) + { + if (player.altFunctionUse == 2) + damage *= 2; + } - public override void MeleeEffects(Player player, Rectangle hitbox) + public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(4)) { @@ -175,8 +175,8 @@ namespace CalamityMod.Items.Weapons.Melee target.AddBuff(BuffID.OnFire, 240); target.AddBuff(BuffID.Ichor, 240); - if (player.moonLeech) - return; + if (player.moonLeech) + return; int healAmount = Main.rand.Next(3) + 10; player.statLife += healAmount; @@ -188,14 +188,14 @@ namespace CalamityMod.Items.Weapons.Melee ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.TrueExcalibur); - recipe.AddIngredient(ItemID.LargeDiamond, 3); - recipe.AddIngredient(ItemID.LightShard, 10); - recipe.AddIngredient(ItemID.DarkShard, 10); + recipe.AddIngredient(ItemID.LargeDiamond); + recipe.AddIngredient(ItemID.LightShard, 3); + recipe.AddIngredient(ItemID.DarkShard, 3); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.SoulofLight, 50); - recipe.AddIngredient(ItemID.SoulofNight, 50); + recipe.AddIngredient(ItemID.SoulofLight, 20); + recipe.AddIngredient(ItemID.SoulofNight, 20); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Melee/EmpyreanKnives.cs b/Items/Weapons/Melee/EmpyreanKnives.cs index a7da8b946f..5c173f9264 100644 --- a/Items/Weapons/Melee/EmpyreanKnives.cs +++ b/Items/Weapons/Melee/EmpyreanKnives.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; using Terraria; @@ -102,8 +103,9 @@ namespace CalamityMod.Items.Weapons.Melee ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.VampireKnives); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Melee/EssenceFlayer.cs b/Items/Weapons/Melee/EssenceFlayer.cs index 084a423fb9..03a4f8b4f2 100644 --- a/Items/Weapons/Melee/EssenceFlayer.cs +++ b/Items/Weapons/Melee/EssenceFlayer.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -39,14 +40,14 @@ namespace CalamityMod.Items.Weapons.Melee public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/EssenceFlayerGlow")); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/EssenceFlayerGlow")); } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 11); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Melee/EvilSmasher.cs b/Items/Weapons/Melee/EvilSmasher.cs index 5e83b123f6..575e9c6dcf 100644 --- a/Items/Weapons/Melee/EvilSmasher.cs +++ b/Items/Weapons/Melee/EvilSmasher.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Evil Smasher"); - Tooltip.SetDefault("EViL! sMaSH eVIl! SmAsh...ER!\n" + + Tooltip.SetDefault("EViL! sMaSH eVIl! SmAsh... ER!\n" + "For every enemy you kill this hammer gains stat bonuses\n" + "These bonuses stack until a cap is reached\n" + "The bonus stacks will reset if you select a different item\n" + diff --git a/Items/Weapons/Melee/ExoGladius.cs b/Items/Weapons/Melee/ExoGladius.cs index 38ce59ea03..c366f358a6 100644 --- a/Items/Weapons/Melee/ExoGladius.cs +++ b/Items/Weapons/Melee/ExoGladius.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.useTurn = true; item.autoReuse = true; - item.value = Item.buyPrice(2, 50, 0, 0); + item.value = CalamityGlobalItem.Rarity15BuyPrice; item.rare = ItemRarityID.Red; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 19f; @@ -52,8 +51,8 @@ namespace CalamityMod.Items.Weapons.Melee recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } @@ -64,27 +63,27 @@ namespace CalamityMod.Items.Weapons.Melee Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 107); } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.ExoDebuffs(); - OnHitEffects(player); - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.ExoDebuffs(); + OnHitEffects(player); + } - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - target.ExoDebuffs(); - OnHitEffects(player); - } + public override void OnHitPvp(Player player, Player target, int damage, bool crit) + { + target.ExoDebuffs(); + OnHitEffects(player); + } private void OnHitEffects(Player player) { - bool isImmune = false; - for (int j = 0; j < player.hurtCooldowns.Length; j++) - { - if (player.hurtCooldowns[j] > 0) - isImmune = true; - } - if (!isImmune) + bool isImmune = false; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + { + if (player.hurtCooldowns[j] > 0) + isImmune = true; + } + if (!isImmune) { player.immune = true; if (player.immuneTime < item.useTime) @@ -101,5 +100,5 @@ namespace CalamityMod.Items.Weapons.Melee CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 25f, ModContent.ProjectileType(), damage, 15f, player.whoAmI); } } - } + } } diff --git a/Items/Weapons/Melee/ExsanguinationLance.cs b/Items/Weapons/Melee/ExsanguinationLance.cs index e142c93180..82160962de 100644 --- a/Items/Weapons/Melee/ExsanguinationLance.cs +++ b/Items/Weapons/Melee/ExsanguinationLance.cs @@ -33,7 +33,8 @@ namespace CalamityMod.Items.Weapons.Melee item.rare = ItemRarityID.Yellow; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - } + item.Calamity().trueMelee = true; + } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; diff --git a/Items/Weapons/Melee/FourSeasonsGalaxia.cs b/Items/Weapons/Melee/FourSeasonsGalaxia.cs index 2fd527bd97..30ce17dd99 100644 --- a/Items/Weapons/Melee/FourSeasonsGalaxia.cs +++ b/Items/Weapons/Melee/FourSeasonsGalaxia.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 70; - item.damage = 66; + item.damage = 99; item.melee = true; item.useAnimation = 18; item.useTime = 18; @@ -55,9 +55,9 @@ namespace CalamityMod.Items.Weapons.Melee { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Melee/FulgurationHalberd.cs b/Items/Weapons/Melee/FulgurationHalberd.cs index df4e313394..9b4dd908ec 100644 --- a/Items/Weapons/Melee/FulgurationHalberd.cs +++ b/Items/Weapons/Melee/FulgurationHalberd.cs @@ -33,7 +33,8 @@ namespace CalamityMod.Items.Weapons.Melee item.value = Item.buyPrice(0, 36, 0, 0); item.rare = ItemRarityID.Pink; item.shootSpeed = 8f; - } + item.Calamity().trueMelee = true; + } public override bool AltFunctionUse(Player player) { @@ -80,13 +81,7 @@ namespace CalamityMod.Items.Weapons.Melee { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.CrystalShard, 10); - recipe.AddIngredient(ItemID.AdamantiteBar, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrystalShard, 10); - recipe.AddIngredient(ItemID.TitaniumBar, 10); + recipe.AddRecipeGroup("AnyAdamantiteBar", 10); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Melee/GalaxySmasherMelee.cs b/Items/Weapons/Melee/GalaxySmasherMelee.cs index f79fef9d42..a7762cb416 100644 --- a/Items/Weapons/Melee/GalaxySmasherMelee.cs +++ b/Items/Weapons/Melee/GalaxySmasherMelee.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -7,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class GalaxySmasherMelee : ModItem + public class GalaxySmasherMelee : ModItem { public static int BaseDamage = 264; public static float Speed = 18f; @@ -53,8 +54,8 @@ namespace CalamityMod.Items.Weapons.Melee ModRecipe r = new ModRecipe(mod); r.SetResult(this); r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 5); - r.AddTile(TileID.LunarCraftingStation); + r.AddIngredient(ModContent.ItemType(), 10); + r.AddTile(ModContent.TileType()); r.AddRecipe(); } } diff --git a/Items/Weapons/Melee/GildedProboscis.cs b/Items/Weapons/Melee/GildedProboscis.cs index e3892577bc..45e411a0e3 100644 --- a/Items/Weapons/Melee/GildedProboscis.cs +++ b/Items/Weapons/Melee/GildedProboscis.cs @@ -32,7 +32,8 @@ namespace CalamityMod.Items.Weapons.Melee item.rare = ItemRarityID.Purple; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 13f; - } + item.Calamity().trueMelee = true; + } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; } diff --git a/Items/Weapons/Melee/GreatswordofBlah.cs b/Items/Weapons/Melee/GreatswordofBlah.cs index e8708bf5f3..8225336918 100644 --- a/Items/Weapons/Melee/GreatswordofBlah.cs +++ b/Items/Weapons/Melee/GreatswordofBlah.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = item.height = 102; - item.damage = 125; + item.damage = 138; item.melee = true; item.useAnimation = 18; item.useStyle = ItemUseStyleID.SwingThrow; @@ -42,8 +42,9 @@ namespace CalamityMod.Items.Weapons.Melee { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Melee/MarniteSpear.cs b/Items/Weapons/Melee/MarniteSpear.cs index 0084cb1ec6..214bba9f81 100644 --- a/Items/Weapons/Melee/MarniteSpear.cs +++ b/Items/Weapons/Melee/MarniteSpear.cs @@ -31,7 +31,8 @@ namespace CalamityMod.Items.Weapons.Melee item.rare = ItemRarityID.Green; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 5f; - } + item.Calamity().trueMelee = true; + } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; diff --git a/Items/Weapons/Melee/Murasama.cs b/Items/Weapons/Melee/Murasama.cs index 49d498e579..24abe58de2 100644 --- a/Items/Weapons/Melee/Murasama.cs +++ b/Items/Weapons/Melee/Murasama.cs @@ -42,6 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shootSpeed = 24f; item.Calamity().customRarity = CalamityRarity.Violet; Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 14)); + item.Calamity().trueMelee = true; } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Melee/Nadir.cs b/Items/Weapons/Melee/Nadir.cs index 75b6e8d8fe..b639822bf1 100644 --- a/Items/Weapons/Melee/Nadir.cs +++ b/Items/Weapons/Melee/Nadir.cs @@ -50,9 +50,9 @@ namespace CalamityMod.Items.Weapons.Melee ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Melee/Omniblade.cs b/Items/Weapons/Melee/Omniblade.cs index 566097b9bd..39fae23d88 100644 --- a/Items/Weapons/Melee/Omniblade.cs +++ b/Items/Weapons/Melee/Omniblade.cs @@ -34,7 +34,8 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 24f; item.rare = ItemRarityID.Yellow; - } + item.Calamity().trueMelee = true; + } // Terraria seems to really dislike high crit values in SetDefaults public override void GetWeaponCrit(Player player, ref int crit) => crit += 45; diff --git a/Items/Weapons/Melee/Oracle.cs b/Items/Weapons/Melee/Oracle.cs index 4dd5bd38ac..41666a615f 100644 --- a/Items/Weapons/Melee/Oracle.cs +++ b/Items/Weapons/Melee/Oracle.cs @@ -62,14 +62,10 @@ namespace CalamityMod.Items.Weapons.Melee { ModRecipe r = new ModRecipe(mod); r.SetResult(this); - r.AddTile(ModContent.TileType()); + r.AddIngredient(ModContent.ItemType()); r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 4); + r.AddIngredient(ModContent.ItemType(), 5); + r.AddTile(ModContent.TileType()); r.AddRecipe(); } } diff --git a/Items/Weapons/Melee/PhosphorescentGauntlet.cs b/Items/Weapons/Melee/PhosphorescentGauntlet.cs index 8c977ce9b8..6c67ff0990 100644 --- a/Items/Weapons/Melee/PhosphorescentGauntlet.cs +++ b/Items/Weapons/Melee/PhosphorescentGauntlet.cs @@ -34,6 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 1f; item.Calamity().customRarity = CalamityRarity.PureGreen; + item.Calamity().trueMelee = true; } // Terraria seems to really dislike high crit values in SetDefaults. diff --git a/Items/Weapons/Melee/PrismaticBreaker.cs b/Items/Weapons/Melee/PrismaticBreaker.cs index da46d4a986..47693bf1e0 100644 --- a/Items/Weapons/Melee/PrismaticBreaker.cs +++ b/Items/Weapons/Melee/PrismaticBreaker.cs @@ -161,8 +161,9 @@ namespace CalamityMod.Items.Weapons.Melee recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Melee/RemsRevenge.cs b/Items/Weapons/Melee/RemsRevenge.cs index 2aff20909c..15266bf64e 100644 --- a/Items/Weapons/Melee/RemsRevenge.cs +++ b/Items/Weapons/Melee/RemsRevenge.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 415; + item.damage = 375; item.melee = true; item.width = 44; item.height = 34; diff --git a/Items/Weapons/Melee/Roxcalibur.cs b/Items/Weapons/Melee/Roxcalibur.cs index c2227a10c5..19624d72da 100644 --- a/Items/Weapons/Melee/Roxcalibur.cs +++ b/Items/Weapons/Melee/Roxcalibur.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Melee recipe.AddIngredient(ItemID.Obsidian, 10); recipe.AddIngredient(ItemID.StoneBlock, 100); recipe.AddIngredient(ItemID.Amethyst, 2); - recipe.AddTile(TileID.MythrilAnvil); + recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Melee/RoyalKnivesMelee.cs b/Items/Weapons/Melee/RoyalKnivesMelee.cs index a1121b06a9..4df0a352a5 100644 --- a/Items/Weapons/Melee/RoyalKnivesMelee.cs +++ b/Items/Weapons/Melee/RoyalKnivesMelee.cs @@ -103,9 +103,9 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Melee/SausageMaker.cs b/Items/Weapons/Melee/SausageMaker.cs index bcd63e15e9..47f2b94d96 100644 --- a/Items/Weapons/Melee/SausageMaker.cs +++ b/Items/Weapons/Melee/SausageMaker.cs @@ -33,7 +33,8 @@ namespace CalamityMod.Items.Weapons.Melee item.rare = ItemRarityID.Orange; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 6f; - } + item.Calamity().trueMelee = true; + } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; diff --git a/Items/Weapons/Melee/ScourgeoftheCosmos.cs b/Items/Weapons/Melee/ScourgeoftheCosmos.cs index e6ab4a736a..47c45c2a0b 100644 --- a/Items/Weapons/Melee/ScourgeoftheCosmos.cs +++ b/Items/Weapons/Melee/ScourgeoftheCosmos.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -27,10 +28,10 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 5f; item.UseSound = SoundID.Item109; item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.shoot = ModContent.ProjectileType(); + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; } @@ -40,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee recipe.AddIngredient(ItemID.ScourgeoftheCorruptor); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Melee/StreamGouge.cs b/Items/Weapons/Melee/StreamGouge.cs index 2b01247bbe..8b96482352 100644 --- a/Items/Weapons/Melee/StreamGouge.cs +++ b/Items/Weapons/Melee/StreamGouge.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Spears; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -49,8 +50,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Melee/TheEnforcer.cs b/Items/Weapons/Melee/TheEnforcer.cs index f73a27cef9..2809fa81d2 100644 --- a/Items/Weapons/Melee/TheEnforcer.cs +++ b/Items/Weapons/Melee/TheEnforcer.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -20,9 +21,9 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 100; - item.height = 100; - item.scale = 1.5f; - item.damage = 890; + item.height = 100; + item.scale = 1.5f; + item.damage = 890; item.melee = true; item.useAnimation = 17; item.useStyle = ItemUseStyleID.SwingThrow; @@ -39,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/TheEnforcerGlow")); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/TheEnforcerGlow")); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) @@ -145,8 +146,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Melee/YateveoBloom.cs b/Items/Weapons/Melee/YateveoBloom.cs index a50307d9a7..c58001d435 100644 --- a/Items/Weapons/Melee/YateveoBloom.cs +++ b/Items/Weapons/Melee/YateveoBloom.cs @@ -45,7 +45,8 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = ShootSpeed; - } + item.Calamity().trueMelee = true; + } public override bool AltFunctionUse(Player player) { diff --git a/Items/Weapons/Ranged/AMR.cs b/Items/Weapons/Ranged/AMR.cs index f06bbd0fee..4a4a709eec 100644 --- a/Items/Weapons/Ranged/AMR.cs +++ b/Items/Weapons/Ranged/AMR.cs @@ -1,9 +1,10 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { @@ -35,32 +36,32 @@ namespace CalamityMod.Items.Weapons.Ranged item.shootSpeed = 12f; item.useAmmo = AmmoID.Bullet; item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().canFirePointBlankShots = true; - } + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); - // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 20; + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 20; public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - if (type == ProjectileID.Bullet) - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); - else - Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 1.3), knockBack, player.whoAmI); + if (type == ProjectileID.Bullet) + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 1.3), knockBack, player.whoAmI); - return false; + return false; } } } diff --git a/Items/Weapons/Ranged/AcesHigh.cs b/Items/Weapons/Ranged/AcesHigh.cs index 49a26ce573..25423a610a 100644 --- a/Items/Weapons/Ranged/AcesHigh.cs +++ b/Items/Weapons/Ranged/AcesHigh.cs @@ -51,12 +51,11 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Revolver); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 52); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Ranged/Alluvion.cs b/Items/Weapons/Ranged/Alluvion.cs index 3b4e1c9946..8153a926f4 100644 --- a/Items/Weapons/Ranged/Alluvion.cs +++ b/Items/Weapons/Ranged/Alluvion.cs @@ -95,12 +95,12 @@ namespace CalamityMod.Items.Weapons.Ranged { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Ranged/CleansingBlaze.cs b/Items/Weapons/Ranged/CleansingBlaze.cs index 7c691feecb..3eef254804 100644 --- a/Items/Weapons/Ranged/CleansingBlaze.cs +++ b/Items/Weapons/Ranged/CleansingBlaze.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -39,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/CleansingBlazeGlow")); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/CleansingBlazeGlow")); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -70,7 +71,7 @@ namespace CalamityMod.Items.Weapons.Ranged { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Ranged/Contagion.cs b/Items/Weapons/Ranged/Contagion.cs index 9ee11ae909..8c2c809f2f 100644 --- a/Items/Weapons/Ranged/Contagion.cs +++ b/Items/Weapons/Ranged/Contagion.cs @@ -37,16 +37,17 @@ namespace CalamityMod.Items.Weapons.Ranged item.value = CalamityGlobalItem.Rarity16BuyPrice; item.Calamity().customRarity = CalamityRarity.HotPink; item.Calamity().devItem = true; - item.Calamity().canFirePointBlankShots = true; - } + item.Calamity().canFirePointBlankShots = true; + } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Ranged/Drataliornus.cs b/Items/Weapons/Ranged/Drataliornus.cs index 05c1402721..43d9633703 100644 --- a/Items/Weapons/Ranged/Drataliornus.cs +++ b/Items/Weapons/Ranged/Drataliornus.cs @@ -102,16 +102,10 @@ Right click to fire two devastating barrages of five empowered fireballs. { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 60); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Ranged/HeavenlyGale.cs b/Items/Weapons/Ranged/HeavenlyGale.cs index a72de55197..ee6008bfc4 100644 --- a/Items/Weapons/Ranged/HeavenlyGale.cs +++ b/Items/Weapons/Ranged/HeavenlyGale.cs @@ -110,7 +110,7 @@ namespace CalamityMod.Items.Weapons.Ranged recipe.AddIngredient(ItemType()); recipe.AddIngredient(ItemType()); recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemType(), 4); + recipe.AddIngredient(ItemType()); recipe.AddTile(TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Ranged/Karasawa.cs b/Items/Weapons/Ranged/Karasawa.cs index d3457396b7..e09e7a9a9c 100644 --- a/Items/Weapons/Ranged/Karasawa.cs +++ b/Items/Weapons/Ranged/Karasawa.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Karasawa"); - Tooltip.SetDefault("...This is heavy...too heavy."); + Tooltip.SetDefault("...This is heavy... too heavy."); } public override void SetDefaults() @@ -77,10 +77,12 @@ namespace CalamityMod.Items.Weapons.Ranged { ModRecipe r = new ModRecipe(mod); r.AddIngredient(ItemID.LargeRuby); + r.AddIngredient(ModContent.ItemType(), 25); + r.AddIngredient(ModContent.ItemType(), 15); r.AddIngredient(ModContent.ItemType(), 5); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddIngredient(ModContent.ItemType(), 15); - r.AddTile(ModContent.TileType()); + r.AddIngredient(ModContent.ItemType(), 8); + r.AddIngredient(ModContent.ItemType(), 20); + r.AddTile(ModContent.TileType()); r.SetResult(this); r.AddRecipe(); } diff --git a/Items/Weapons/Ranged/MagnomalyCannon.cs b/Items/Weapons/Ranged/MagnomalyCannon.cs index 69e1b179d9..038a5f6335 100644 --- a/Items/Weapons/Ranged/MagnomalyCannon.cs +++ b/Items/Weapons/Ranged/MagnomalyCannon.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged { DisplayName.SetDefault("Magnomaly Cannon"); Tooltip.SetDefault("Launches a powerful exo rocket to nuke anything and everything\n" + - "Rockets are surrounded by an invisible damaging aura and split into damaging beams on hit\n" + + "Rockets are surrounded by an invisible damaging aura and split into damaging beams on hit\n" + "66% chance to not consume rockets"); } @@ -65,8 +65,8 @@ namespace CalamityMod.Items.Weapons.Ranged recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.ElectrosphereLauncher); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Ranged/Megafleet.cs b/Items/Weapons/Ranged/Megafleet.cs index 916f0af691..5a156dce90 100644 --- a/Items/Weapons/Ranged/Megafleet.cs +++ b/Items/Weapons/Ranged/Megafleet.cs @@ -36,8 +36,8 @@ namespace CalamityMod.Items.Weapons.Ranged item.value = CalamityGlobalItem.Rarity16BuyPrice; item.Calamity().customRarity = CalamityRarity.HotPink; item.Calamity().devItem = true; - item.Calamity().canFirePointBlankShots = true; - } + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { @@ -64,8 +64,8 @@ namespace CalamityMod.Items.Weapons.Ranged { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.SoulofFright, 30); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.SoulofMight, 30); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Ranged/Minigun.cs b/Items/Weapons/Ranged/Minigun.cs index 264737882c..0ceb575b93 100644 --- a/Items/Weapons/Ranged/Minigun.cs +++ b/Items/Weapons/Ranged/Minigun.cs @@ -34,8 +34,8 @@ namespace CalamityMod.Items.Weapons.Ranged item.shootSpeed = 22f; item.useAmmo = AmmoID.Bullet; item.Calamity().customRarity = CalamityRarity.Violet; - item.Calamity().canFirePointBlankShots = true; - } + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { @@ -61,8 +61,9 @@ namespace CalamityMod.Items.Weapons.Ranged { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.ChainGun); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Ranged/Onyxia.cs b/Items/Weapons/Ranged/Onyxia.cs index 339b09ecaf..184b09b546 100644 --- a/Items/Weapons/Ranged/Onyxia.cs +++ b/Items/Weapons/Ranged/Onyxia.cs @@ -79,9 +79,9 @@ namespace CalamityMod.Items.Weapons.Ranged { ModRecipe r = new ModRecipe(mod); r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddIngredient(ModContent.ItemType(), 2); - r.AddTile(ModContent.TileType()); + r.AddIngredient(ModContent.ItemType(), 8); + r.AddIngredient(ModContent.ItemType(), 8); + r.AddTile(ModContent.TileType()); r.SetResult(this); r.AddRecipe(); } diff --git a/Items/Weapons/Ranged/Phangasm.cs b/Items/Weapons/Ranged/Phangasm.cs index d661f44127..1137124739 100644 --- a/Items/Weapons/Ranged/Phangasm.cs +++ b/Items/Weapons/Ranged/Phangasm.cs @@ -37,8 +37,8 @@ namespace CalamityMod.Items.Weapons.Ranged item.shootSpeed = 20f; item.useAmmo = AmmoID.Arrow; item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().canFirePointBlankShots = true; - } + item.Calamity().canFirePointBlankShots = true; + } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; @@ -52,9 +52,10 @@ namespace CalamityMod.Items.Weapons.Ranged { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.Phantasm); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Ranged/Photoviscerator.cs b/Items/Weapons/Ranged/Photoviscerator.cs index 0bfa278040..1c9e1adbb6 100644 --- a/Items/Weapons/Ranged/Photoviscerator.cs +++ b/Items/Weapons/Ranged/Photoviscerator.cs @@ -110,7 +110,7 @@ namespace CalamityMod.Items.Weapons.Ranged recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Ranged/RubicoPrime.cs b/Items/Weapons/Ranged/RubicoPrime.cs index 786a4e731a..c1f0a1a8de 100644 --- a/Items/Weapons/Ranged/RubicoPrime.cs +++ b/Items/Weapons/Ranged/RubicoPrime.cs @@ -51,9 +51,9 @@ namespace CalamityMod.Items.Weapons.Ranged { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Ranged/SDFMG.cs b/Items/Weapons/Ranged/SDFMG.cs index db5d24a737..9408f12bd1 100644 --- a/Items/Weapons/Ranged/SDFMG.cs +++ b/Items/Weapons/Ranged/SDFMG.cs @@ -69,12 +69,12 @@ namespace CalamityMod.Items.Weapons.Ranged ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.SDMG); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Ranged/SomaPrime.cs b/Items/Weapons/Ranged/SomaPrime.cs index b32aa6ea8b..d826ea3932 100644 --- a/Items/Weapons/Ranged/SomaPrime.cs +++ b/Items/Weapons/Ranged/SomaPrime.cs @@ -47,9 +47,9 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Ranged/StarfleetMK2.cs b/Items/Weapons/Ranged/StarfleetMK2.cs index 0e71a2c4b9..4a994de9b3 100644 --- a/Items/Weapons/Ranged/StarfleetMK2.cs +++ b/Items/Weapons/Ranged/StarfleetMK2.cs @@ -60,10 +60,10 @@ namespace CalamityMod.Items.Weapons.Ranged ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Ranged/Svantechnical.cs b/Items/Weapons/Ranged/Svantechnical.cs index 8945b125ce..37b9a3dbc3 100644 --- a/Items/Weapons/Ranged/Svantechnical.cs +++ b/Items/Weapons/Ranged/Svantechnical.cs @@ -100,10 +100,10 @@ namespace CalamityMod.Items.Weapons.Ranged { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ItemID.SoulofMight, 10); recipe.AddIngredient(ItemID.SoulofSight, 10); recipe.AddIngredient(ItemID.SoulofFright, 10); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Ranged/ThePack.cs b/Items/Weapons/Ranged/ThePack.cs index c3e7aa4aba..d74a78ba1b 100644 --- a/Items/Weapons/Ranged/ThePack.cs +++ b/Items/Weapons/Ranged/ThePack.cs @@ -54,9 +54,10 @@ namespace CalamityMod.Items.Weapons.Ranged ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.MarbleBlock, 50); - recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Ranged/TyrannysEnd.cs b/Items/Weapons/Ranged/TyrannysEnd.cs index 60ea879ec3..3cc474a04a 100644 --- a/Items/Weapons/Ranged/TyrannysEnd.cs +++ b/Items/Weapons/Ranged/TyrannysEnd.cs @@ -50,11 +50,10 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Ranged/Ultima.cs b/Items/Weapons/Ranged/Ultima.cs index 4454ddcbbf..8091eaa700 100644 --- a/Items/Weapons/Ranged/Ultima.cs +++ b/Items/Weapons/Ranged/Ultima.cs @@ -43,8 +43,8 @@ namespace CalamityMod.Items.Weapons.Ranged item.value = CalamityGlobalItem.Rarity14BuyPrice; item.Calamity().customRarity = CalamityRarity.DarkBlue; item.Calamity().donorItem = true; - item.Calamity().canFirePointBlankShots = true; - } + item.Calamity().canFirePointBlankShots = true; + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -60,10 +60,10 @@ namespace CalamityMod.Items.Weapons.Ranged recipe.AddIngredient(ItemID.LaserRifle); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs index 79cc9e9d75..22412bd062 100644 --- a/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs +++ b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Rogue ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.AdamantiteBar); recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 25); + recipe.SetResult(this, 100); recipe.AddRecipe(); } } diff --git a/Items/Weapons/Rogue/BlazingStar.cs b/Items/Weapons/Rogue/BlazingStar.cs index 95f4522aee..f25b3fe360 100644 --- a/Items/Weapons/Rogue/BlazingStar.cs +++ b/Items/Weapons/Rogue/BlazingStar.cs @@ -13,13 +13,13 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Blazing Star"); - Tooltip.SetDefault("Stacks up to 3\n" + + Tooltip.SetDefault("Stacks up to 4\n" + "Stealth strikes release all stars at once with infinite piercing"); } public override void SafeSetDefaults() { - item.damage = 92; + item.damage = 129; item.Calamity().rogue = true; item.noMelee = true; item.noUseGraphic = true; @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.value = Item.buyPrice(0, 4, 0, 0); item.rare = ItemRarityID.LightRed; item.UseSound = SoundID.Item1; - item.maxStack = 3; + item.maxStack = 4; item.shootSpeed = Speed; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Rogue/BouncySpikyBall.cs b/Items/Weapons/Rogue/BouncySpikyBall.cs index 75b0f0789e..1d1dc2d57d 100644 --- a/Items/Weapons/Rogue/BouncySpikyBall.cs +++ b/Items/Weapons/Rogue/BouncySpikyBall.cs @@ -53,10 +53,10 @@ Stealth strikes provide a bigger boost after richocheting"); public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpikyBall, 3); + recipe.AddIngredient(ItemID.SpikyBall, 20); recipe.AddIngredient(ItemID.PinkGel); recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this, 3); + recipe.SetResult(this, 20); recipe.AddRecipe(); } } diff --git a/Items/Weapons/Rogue/BurningStrife.cs b/Items/Weapons/Rogue/BurningStrife.cs index 29b15827e6..950405d6a8 100644 --- a/Items/Weapons/Rogue/BurningStrife.cs +++ b/Items/Weapons/Rogue/BurningStrife.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.useAnimation = 25; item.useTime = 25; - item.damage = 80; + item.damage = 96; item.shootSpeed = 8f; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Rogue/Celestus.cs b/Items/Weapons/Rogue/Celestus.cs index 8fcae4a0c3..6a571f8c47 100644 --- a/Items/Weapons/Rogue/Celestus.cs +++ b/Items/Weapons/Rogue/Celestus.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 240; + item.damage = 280; item.knockBack = 6f; item.useAnimation = item.useTime = 22; item.Calamity().rogue = true; @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.UseSound = SoundID.Item1; item.noMelee = true; item.noUseGraphic = true; - item.value = Item.buyPrice(platinum: 2, gold: 50); + item.value = CalamityGlobalItem.Rarity15BuyPrice; item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.Violet; } @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Rogue recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Rogue/CobaltKunai.cs b/Items/Weapons/Rogue/CobaltKunai.cs index ceb5c94eda..bcd696302c 100644 --- a/Items/Weapons/Rogue/CobaltKunai.cs +++ b/Items/Weapons/Rogue/CobaltKunai.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 18; - item.damage = 36; + item.damage = 50; item.noMelee = true; item.consumable = true; item.noUseGraphic = true; @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Rogue ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.CobaltBar); recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 30); + recipe.SetResult(this, 100); recipe.AddRecipe(); } } diff --git a/Items/Weapons/Rogue/CrystalPiercer.cs b/Items/Weapons/Rogue/CrystalPiercer.cs index 09e0b2b8e8..78b38ddcb2 100644 --- a/Items/Weapons/Rogue/CrystalPiercer.cs +++ b/Items/Weapons/Rogue/CrystalPiercer.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Rogue ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 20); + recipe.SetResult(this, 100); recipe.AddRecipe(); } } diff --git a/Items/Weapons/Rogue/EclipsesFall.cs b/Items/Weapons/Rogue/EclipsesFall.cs index 39f4604d36..660bf75dc4 100644 --- a/Items/Weapons/Rogue/EclipsesFall.cs +++ b/Items/Weapons/Rogue/EclipsesFall.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -52,9 +53,10 @@ namespace CalamityMod.Items.Weapons.Rogue { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Rogue/ExecutionersBlade.cs b/Items/Weapons/Rogue/ExecutionersBlade.cs index 050935ff19..70f4a249ec 100644 --- a/Items/Weapons/Rogue/ExecutionersBlade.cs +++ b/Items/Weapons/Rogue/ExecutionersBlade.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -10,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Rogue { public class ExecutionersBlade : RogueWeapon { - private int counter = 0; + private int counter = 0; public override void SetStaticDefaults() { @@ -43,14 +44,14 @@ namespace CalamityMod.Items.Weapons.Rogue public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/ExecutionersBladeGlow")); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/ExecutionersBladeGlow")); } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 11); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } @@ -65,9 +66,9 @@ namespace CalamityMod.Items.Weapons.Rogue if (usingStealth && stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; - counter++; - if (counter >= item.useAnimation / item.useTime) - counter = 0; + counter++; + if (counter >= item.useAnimation / item.useTime) + counter = 0; return false; } } diff --git a/Items/Weapons/Rogue/FantasyTalisman.cs b/Items/Weapons/Rogue/FantasyTalisman.cs index 200cbbc478..50296d545c 100644 --- a/Items/Weapons/Rogue/FantasyTalisman.cs +++ b/Items/Weapons/Rogue/FantasyTalisman.cs @@ -55,10 +55,10 @@ Stealth strikes release more souls and leave behind souls as they travel"); { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.Silk, 3); - recipe.AddIngredient(ItemID.Ectoplasm, 5); + recipe.AddIngredient(ItemID.Silk); + recipe.AddIngredient(ItemID.Ectoplasm); recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 150); + recipe.SetResult(this, 100); recipe.AddRecipe(); } } diff --git a/Items/Weapons/Rogue/FeatherKnife.cs b/Items/Weapons/Rogue/FeatherKnife.cs index f5b7503340..557c58e41a 100644 --- a/Items/Weapons/Rogue/FeatherKnife.cs +++ b/Items/Weapons/Rogue/FeatherKnife.cs @@ -44,7 +44,7 @@ Stealth strike throws a volley of knives"); ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this, 30); + recipe.SetResult(this, 100); recipe.AddRecipe(); } diff --git a/Items/Weapons/Rogue/GodsParanoia.cs b/Items/Weapons/Rogue/GodsParanoia.cs index 6314525c45..cff7db5e37 100644 --- a/Items/Weapons/Rogue/GodsParanoia.cs +++ b/Items/Weapons/Rogue/GodsParanoia.cs @@ -1,14 +1,15 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Rogue; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Weapons.Rogue { - public class GodsParanoia : RogueWeapon + public class GodsParanoia : RogueWeapon { private static int damage = 98; private static int knockBack = 5; @@ -46,33 +47,33 @@ Right click to delete all existing spiky balls"); } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.shoot = ProjectileID.None; - item.shootSpeed = 0f; - return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; - } - else - { - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5f; - int UseMax = item.stack; - return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; - } - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.shoot = ProjectileID.None; + item.shootSpeed = 0f; + return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; + } + else + { + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 5f; + int UseMax = item.stack; + return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; + } + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.killSpikyBalls = false; + modPlayer.killSpikyBalls = false; if (modPlayer.StealthStrikeAvailable()) //setting the stealth strike { damage = (int)(damage * 1.345); int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - if (stealth.WithinBounds(Main.maxProjectiles)) - Main.projectile[stealth].Calamity().stealthStrike = true; + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; @@ -81,7 +82,7 @@ Right click to delete all existing spiky balls"); public override bool AltFunctionUse(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.killSpikyBalls = true; + modPlayer.killSpikyBalls = true; return true; } @@ -90,8 +91,8 @@ Right click to delete all existing spiky balls"); ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.SpikyBall, 200); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Rogue/HardenedHoneycomb.cs b/Items/Weapons/Rogue/HardenedHoneycomb.cs index ed7456e999..5b86ea89fb 100644 --- a/Items/Weapons/Rogue/HardenedHoneycomb.cs +++ b/Items/Weapons/Rogue/HardenedHoneycomb.cs @@ -60,7 +60,7 @@ Stealth strikes can bounce off walls and enemies"); recipe.AddIngredient(ItemID.CrispyHoneyBlock); recipe.AddIngredient(ItemID.BeeWax); recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 10); + recipe.SetResult(this, 20); recipe.AddRecipe(); } } diff --git a/Items/Weapons/Rogue/Hypothermia.cs b/Items/Weapons/Rogue/Hypothermia.cs index ddd8c0c2d6..daa44fd7eb 100644 --- a/Items/Weapons/Rogue/Hypothermia.cs +++ b/Items/Weapons/Rogue/Hypothermia.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -81,10 +82,11 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 24); + recipe.AddIngredient(ItemID.IceBlock, 100); recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Rogue/IchorSpear.cs b/Items/Weapons/Rogue/IchorSpear.cs index c8c2d0b979..6ac896daf4 100644 --- a/Items/Weapons/Rogue/IchorSpear.cs +++ b/Items/Weapons/Rogue/IchorSpear.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 52; - item.damage = 40; + item.damage = 76; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 20; diff --git a/Items/Weapons/Rogue/IronFrancisca.cs b/Items/Weapons/Rogue/IronFrancisca.cs index 7a3b1d209d..da6ec9a684 100644 --- a/Items/Weapons/Rogue/IronFrancisca.cs +++ b/Items/Weapons/Rogue/IronFrancisca.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Rogue recipe.anyWood = true; recipe.AddIngredient(ItemID.IronBar); recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 50); + recipe.SetResult(this, 100); recipe.AddRecipe(); } } diff --git a/Items/Weapons/Rogue/KelvinCatalyst.cs b/Items/Weapons/Rogue/KelvinCatalyst.cs index 9064404d67..e3b0e95312 100644 --- a/Items/Weapons/Rogue/KelvinCatalyst.cs +++ b/Items/Weapons/Rogue/KelvinCatalyst.cs @@ -55,7 +55,6 @@ namespace CalamityMod.Items.Weapons.Rogue ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 200); recipe.AddIngredient(ItemID.FrozenKey); - recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 2); recipe.AddIngredient(ModContent.ItemType(), 2); diff --git a/Items/Weapons/Rogue/LeadTomahawk.cs b/Items/Weapons/Rogue/LeadTomahawk.cs index 187e90ec67..0456d3e129 100644 --- a/Items/Weapons/Rogue/LeadTomahawk.cs +++ b/Items/Weapons/Rogue/LeadTomahawk.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Rogue recipe.anyWood = true; recipe.AddIngredient(ItemID.LeadBar); recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 50); + recipe.SetResult(this, 100); recipe.AddRecipe(); } } diff --git a/Items/Weapons/Rogue/MythrilKnife.cs b/Items/Weapons/Rogue/MythrilKnife.cs index 1dea9f1038..832eb81f83 100644 --- a/Items/Weapons/Rogue/MythrilKnife.cs +++ b/Items/Weapons/Rogue/MythrilKnife.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Rogue ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.MythrilBar); recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 40); + recipe.SetResult(this, 100); recipe.AddRecipe(); } } diff --git a/Items/Weapons/Rogue/NanoblackReaperRogue.cs b/Items/Weapons/Rogue/NanoblackReaperRogue.cs index 4630e9d635..ba3f97d8b6 100644 --- a/Items/Weapons/Rogue/NanoblackReaperRogue.cs +++ b/Items/Weapons/Rogue/NanoblackReaperRogue.cs @@ -56,13 +56,13 @@ namespace CalamityMod.Items.Weapons.Rogue { ModRecipe r = new ModRecipe(mod); r.SetResult(this); - r.AddTile(ModContent.TileType()); r.AddIngredient(ModContent.ItemType()); r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 5); r.AddIngredient(ModContent.ItemType(), 40); r.AddIngredient(ModContent.ItemType(), 20); r.AddIngredient(ItemID.Nanites, 400); + r.AddIngredient(ModContent.ItemType(), 5); + r.AddTile(ModContent.TileType()); r.AddRecipe(); } } diff --git a/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs index 4b01ee1864..7779835a32 100644 --- a/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs +++ b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Rogue ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.OrichalcumBar); recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 50); + recipe.SetResult(this, 100); recipe.AddRecipe(); } } diff --git a/Items/Weapons/Rogue/PalladiumJavelin.cs b/Items/Weapons/Rogue/PalladiumJavelin.cs index d093957879..13a6ecd2cb 100644 --- a/Items/Weapons/Rogue/PalladiumJavelin.cs +++ b/Items/Weapons/Rogue/PalladiumJavelin.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 44; - item.damage = 50; + item.damage = 68; item.noMelee = true; item.consumable = true; item.noUseGraphic = true; @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Rogue ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.PalladiumBar); recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 20); + recipe.SetResult(this, 100); recipe.AddRecipe(); } } diff --git a/Items/Weapons/Rogue/Penumbra.cs b/Items/Weapons/Rogue/Penumbra.cs index afb2183f5e..6a70ba8894 100644 --- a/Items/Weapons/Rogue/Penumbra.cs +++ b/Items/Weapons/Rogue/Penumbra.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -7,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Penumbra : RogueWeapon + public class Penumbra : RogueWeapon { public static float ShootSpeed = 8f; public override void SetStaticDefaults() @@ -40,8 +41,8 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().rogue = true; } - // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 16; + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 16; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -61,8 +62,8 @@ namespace CalamityMod.Items.Weapons.Rogue } vector2 += new Vector2(num78, num79); int proj = Projectile.NewProjectile(vector2, new Vector2(0f,-0.5f), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 1f); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].Calamity().stealthStrike = true; + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = true; return false; } return true; @@ -71,10 +72,10 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 24); recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Rogue/Plaguenade.cs b/Items/Weapons/Rogue/Plaguenade.cs index 814ecda2b4..50100950cf 100644 --- a/Items/Weapons/Rogue/Plaguenade.cs +++ b/Items/Weapons/Rogue/Plaguenade.cs @@ -54,12 +54,10 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Beenade, 15); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ItemID.Obsidian, 2); - recipe.AddIngredient(ItemID.Stinger); + recipe.AddIngredient(ItemID.Beenade, 20); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 30); + recipe.SetResult(this, 100); recipe.AddRecipe(); } } diff --git a/Items/Weapons/Rogue/Prismalline.cs b/Items/Weapons/Rogue/Prismalline.cs index 47f5108f95..af6fb5a4b7 100644 --- a/Items/Weapons/Rogue/Prismalline.cs +++ b/Items/Weapons/Rogue/Prismalline.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 46; - item.damage = 18; + item.damage = 24; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 16; diff --git a/Items/Weapons/Rogue/ProfanedPartisan.cs b/Items/Weapons/Rogue/ProfanedPartisan.cs index 0f05ee5748..96fcd96bc1 100644 --- a/Items/Weapons/Rogue/ProfanedPartisan.cs +++ b/Items/Weapons/Rogue/ProfanedPartisan.cs @@ -59,7 +59,7 @@ Stealth strikes spawn smaller spears to fly along side it"); { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 200); + recipe.AddIngredient(ModContent.ItemType(), 500); recipe.AddIngredient(ModContent.ItemType(), 6); recipe.AddIngredient(ModContent.ItemType(), 4); recipe.AddIngredient(ModContent.ItemType (), 25); diff --git a/Items/Weapons/Rogue/ProfanedTrident.cs b/Items/Weapons/Rogue/ProfanedTrident.cs index 31030aa6b5..b3240cce14 100644 --- a/Items/Weapons/Rogue/ProfanedTrident.cs +++ b/Items/Weapons/Rogue/ProfanedTrident.cs @@ -37,6 +37,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { + if (player.Calamity().StealthStrikeAvailable()) + damage = (int)(damage * 0.67f); + int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); diff --git a/Items/Weapons/Rogue/ShockGrenade.cs b/Items/Weapons/Rogue/ShockGrenade.cs index d41b96b6ff..2a40f95ca2 100644 --- a/Items/Weapons/Rogue/ShockGrenade.cs +++ b/Items/Weapons/Rogue/ShockGrenade.cs @@ -57,11 +57,11 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Grenade, 10); - recipe.AddIngredient(ItemID.MartianConduitPlating, 2); - recipe.AddIngredient(ItemID.Nanites, 1); + recipe.AddIngredient(ItemID.Grenade, 20); + recipe.AddIngredient(ItemID.MartianConduitPlating, 5); + recipe.AddIngredient(ItemID.Nanites, 5); recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this, 10); + recipe.SetResult(this, 100); recipe.AddRecipe(); } } diff --git a/Items/Weapons/Rogue/SludgeSplotch.cs b/Items/Weapons/Rogue/SludgeSplotch.cs index 664dda4466..7c1394c98b 100644 --- a/Items/Weapons/Rogue/SludgeSplotch.cs +++ b/Items/Weapons/Rogue/SludgeSplotch.cs @@ -54,10 +54,10 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddRecipeGroup("Boss2Material", 5); - recipe.SetResult(this, 50); + recipe.AddRecipeGroup("Boss2Material"); + recipe.SetResult(this, 100); recipe.AddRecipe(); } } diff --git a/Items/Weapons/Rogue/StickySpikyBall.cs b/Items/Weapons/Rogue/StickySpikyBall.cs index 146f0ec7fe..2581fb174d 100644 --- a/Items/Weapons/Rogue/StickySpikyBall.cs +++ b/Items/Weapons/Rogue/StickySpikyBall.cs @@ -61,10 +61,10 @@ Stealth strikes throw seven at once and last a lot longer"); public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpikyBall, 3); + recipe.AddIngredient(ItemID.SpikyBall, 20); recipe.AddIngredient(ItemID.Gel); recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this, 3); + recipe.SetResult(this, 20); recipe.AddRecipe(); } } diff --git a/Items/Weapons/Rogue/Supernova.cs b/Items/Weapons/Rogue/Supernova.cs index a0819b7d78..ce3aba61f0 100644 --- a/Items/Weapons/Rogue/Supernova.cs +++ b/Items/Weapons/Rogue/Supernova.cs @@ -31,7 +31,7 @@ Stealth strikes release energy as they fly"); item.UseSound = SoundID.Item15; item.autoReuse = true; item.height = 36; - item.value = Item.buyPrice(platinum: 2, gold: 50); + item.value = CalamityGlobalItem.Rarity15BuyPrice; item.rare = ItemRarityID.Red; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; @@ -43,10 +43,10 @@ Stealth strikes release energy as they fly"); { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - damage = (int)(damage * 0.9f); + damage = (int)(damage * 1.08f); int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - if (stealth.WithinBounds(Main.maxProjectiles)) - Main.projectile[stealth].Calamity().stealthStrike = true; + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; @@ -61,10 +61,9 @@ Stealth strikes release energy as they fly"); recipe.AddIngredient(ModContent.ItemType(), 200); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Rogue/TarragonThrowingDart.cs b/Items/Weapons/Rogue/TarragonThrowingDart.cs index 8298c0a940..2728cb504b 100644 --- a/Items/Weapons/Rogue/TarragonThrowingDart.cs +++ b/Items/Weapons/Rogue/TarragonThrowingDart.cs @@ -56,7 +56,7 @@ Stealth strikes erupt into thorns on enemy hits"); ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 100); + recipe.SetResult(this, 333); recipe.AddRecipe(); } } diff --git a/Items/Weapons/Rogue/TheAtomSplitter.cs b/Items/Weapons/Rogue/TheAtomSplitter.cs index e640233cc8..ce31d0b5ba 100644 --- a/Items/Weapons/Rogue/TheAtomSplitter.cs +++ b/Items/Weapons/Rogue/TheAtomSplitter.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = item.height = 128; - item.damage = 410; + item.damage = 320; item.knockBack = 7f; item.useAnimation = item.useTime = 25; item.Calamity().rogue = true; diff --git a/Items/Weapons/Rogue/ThrowingBrick.cs b/Items/Weapons/Rogue/ThrowingBrick.cs index 1440e588e3..4e0a84a112 100644 --- a/Items/Weapons/Rogue/ThrowingBrick.cs +++ b/Items/Weapons/Rogue/ThrowingBrick.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Rogue ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.RedBrick, 5); recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 15); + recipe.SetResult(this, 20); recipe.AddRecipe(); } } diff --git a/Items/Weapons/Rogue/TitaniumShuriken.cs b/Items/Weapons/Rogue/TitaniumShuriken.cs index e5667fcc74..d0949574c6 100644 --- a/Items/Weapons/Rogue/TitaniumShuriken.cs +++ b/Items/Weapons/Rogue/TitaniumShuriken.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Rogue ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.TitaniumBar); recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 30); + recipe.SetResult(this, 100); recipe.AddRecipe(); } } diff --git a/Items/Weapons/Rogue/WebBall.cs b/Items/Weapons/Rogue/WebBall.cs index 1d51578630..c781573ae6 100644 --- a/Items/Weapons/Rogue/WebBall.cs +++ b/Items/Weapons/Rogue/WebBall.cs @@ -51,8 +51,8 @@ Stealth strikes slow enemies down longer"); public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Cobweb, 3); - recipe.SetResult(this); + recipe.AddIngredient(ItemID.Cobweb, 5); + recipe.SetResult(this, 20); recipe.AddRecipe(); } } diff --git a/Items/Weapons/Rogue/WulfrumKnife.cs b/Items/Weapons/Rogue/WulfrumKnife.cs index 9a24f519bf..e5627f493f 100644 --- a/Items/Weapons/Rogue/WulfrumKnife.cs +++ b/Items/Weapons/Rogue/WulfrumKnife.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Rogue ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 50); + recipe.SetResult(this, 100); recipe.AddRecipe(); } diff --git a/Items/Weapons/Rogue/XerocPitchfork.cs b/Items/Weapons/Rogue/XerocPitchfork.cs index cc0eb2c397..cb7e081ce6 100644 --- a/Items/Weapons/Rogue/XerocPitchfork.cs +++ b/Items/Weapons/Rogue/XerocPitchfork.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Rogue ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 20); + recipe.SetResult(this, 100); recipe.AddRecipe(); } } diff --git a/Items/Weapons/Summon/BensUmbrella.cs b/Items/Weapons/Summon/BensUmbrella.cs index 5f970ff13e..357223e1cc 100644 --- a/Items/Weapons/Summon/BensUmbrella.cs +++ b/Items/Weapons/Summon/BensUmbrella.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Summon recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.Umbrella); recipe.AddIngredient(ItemID.TopHat); - recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Summon/CorvidHarbringerStaff.cs b/Items/Weapons/Summon/CorvidHarbringerStaff.cs index 5c9550ae63..f4e6f1aa3e 100644 --- a/Items/Weapons/Summon/CorvidHarbringerStaff.cs +++ b/Items/Weapons/Summon/CorvidHarbringerStaff.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon item.UseSound = SoundID.DD2_BetsyFlyingCircleAttack; item.summon = true; item.mana = 10; - item.damage = 97; + item.damage = 114; item.knockBack = 2f; item.autoReuse = true; item.useTime = item.useAnimation = 10; @@ -50,9 +51,9 @@ namespace CalamityMod.Items.Weapons.Summon { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.RavenStaff); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Summon/CosmicImmaterializer.cs b/Items/Weapons/Summon/CosmicImmaterializer.cs index 275ed972c3..1f93c01ea4 100644 --- a/Items/Weapons/Summon/CosmicImmaterializer.cs +++ b/Items/Weapons/Summon/CosmicImmaterializer.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Summon item.useTime = item.useAnimation = 10; item.noMelee = true; item.knockBack = 0f; - item.value = Item.buyPrice(2, 50, 0, 0); + item.value = CalamityGlobalItem.Rarity15BuyPrice; item.rare = ItemRarityID.Red; item.UseSound = SoundID.Item60; item.shoot = ModContent.ProjectileType(); @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Summon recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Summon/CosmicViperEngine.cs b/Items/Weapons/Summon/CosmicViperEngine.cs index 13e8d4b50c..d59405d503 100644 --- a/Items/Weapons/Summon/CosmicViperEngine.cs +++ b/Items/Weapons/Summon/CosmicViperEngine.cs @@ -1,6 +1,7 @@ -using CalamityMod.Projectiles.Summon; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; using Terraria; @@ -19,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 111; + item.damage = 138; item.mana = 10; item.width = 46; item.height = 28; @@ -37,51 +38,51 @@ namespace CalamityMod.Items.Weapons.Summon item.Calamity().customRarity = CalamityRarity.DarkBlue; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (player.altFunctionUse != 2) { - int i = Main.myPlayer; - float num72 = item.shootSpeed; - float knockback = knockBack; - knockback = player.GetWeaponKnockback(item, knockback); - player.itemTime = item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Vector2 spinningpoint = new Vector2(num78, num79); - spinningpoint = spinningpoint.RotatedBy(MathHelper.PiOver2, default); - Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, type, damage, knockback, i, 0f, 1f); - } - return false; + int i = Main.myPlayer; + float num72 = item.shootSpeed; + float knockback = knockBack; + knockback = player.GetWeaponKnockback(item, knockback); + player.itemTime = item.useTime; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + vector2.X = (float)Main.mouseX + Main.screenPosition.X; + vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; + Vector2 spinningpoint = new Vector2(num78, num79); + spinningpoint = spinningpoint.RotatedBy(MathHelper.PiOver2, default); + Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, type, damage, knockback, i, 0f, 1f); + } + return false; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Summon/EndoHydraStaff.cs b/Items/Weapons/Summon/EndoHydraStaff.cs index 7895ed20d6..c5123dc0ff 100644 --- a/Items/Weapons/Summon/EndoHydraStaff.cs +++ b/Items/Weapons/Summon/EndoHydraStaff.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon item.UseSound = SoundID.Item60; item.summon = true; item.mana = 10; - item.damage = 180; + item.damage = 225; item.knockBack = 3f; item.autoReuse = true; item.useTime = item.useAnimation = 10; @@ -77,9 +78,9 @@ namespace CalamityMod.Items.Weapons.Summon { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.StaffoftheFrostHydra); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Summon/Endogenesis.cs b/Items/Weapons/Summon/Endogenesis.cs index d71f77e32c..4f51ebcc00 100644 --- a/Items/Weapons/Summon/Endogenesis.cs +++ b/Items/Weapons/Summon/Endogenesis.cs @@ -56,12 +56,12 @@ namespace CalamityMod.Items.Weapons.Summon if (player.altFunctionUse != 2) { player.itemTime = item.useTime; - CalamityUtils.KillShootProjectileMany(player, new int[] - { - type, - ModContent.ProjectileType(), - ModContent.ProjectileType() - }); + CalamityUtils.KillShootProjectileMany(player, new int[] + { + type, + ModContent.ProjectileType(), + ModContent.ProjectileType() + }); SummonEndoCooper(AttackMode, Main.MouseWorld, damage, knockBack, player, out _, out _); @@ -97,9 +97,9 @@ namespace CalamityMod.Items.Weapons.Summon ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.BlizzardStaff); - recipe.AddIngredient(ModContent.ItemType(), 99); + recipe.AddIngredient(ModContent.ItemType(), 100); + recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Summon/HauntedScroll.cs b/Items/Weapons/Summon/HauntedScroll.cs index b204063ee5..e2ea262f53 100644 --- a/Items/Weapons/Summon/HauntedScroll.cs +++ b/Items/Weapons/Summon/HauntedScroll.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Summon recipe.AddIngredient(ItemID.SoulofLight, 5); recipe.AddIngredient(ItemID.SoulofNight, 5); recipe.AddIngredient(ItemID.Bowl); - recipe.AddTile(TileID.MythrilAnvil); + recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Summon/MidnightSunBeacon.cs b/Items/Weapons/Summon/MidnightSunBeacon.cs index aa6fda68b0..669778fc5b 100644 --- a/Items/Weapons/Summon/MidnightSunBeacon.cs +++ b/Items/Weapons/Summon/MidnightSunBeacon.cs @@ -1,5 +1,6 @@ -using CalamityMod.Projectiles.Summon; using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -31,10 +32,10 @@ namespace CalamityMod.Items.Weapons.Summon item.shootSpeed = 10f; item.summon = true; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; - } + item.value = CalamityGlobalItem.Rarity15BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Violet; + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); @@ -45,8 +46,8 @@ namespace CalamityMod.Items.Weapons.Summon ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.XenoStaff); recipe.AddIngredient(ItemID.MoonlordTurretStaff); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Summon/PrototypeAndromechaRing.cs b/Items/Weapons/Summon/PrototypeAndromechaRing.cs index e5f2a09002..e5208ee7e4 100644 --- a/Items/Weapons/Summon/PrototypeAndromechaRing.cs +++ b/Items/Weapons/Summon/PrototypeAndromechaRing.cs @@ -47,15 +47,17 @@ namespace CalamityMod.Items.Weapons.Summon item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; item.summon = true; + item.Calamity().CannotBeEnchanted = true; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ModContent.ItemType(), 40); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.WingsVortex); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Summon/SarosPossession.cs b/Items/Weapons/Summon/SarosPossession.cs index 3794d0f2f1..ad07758adb 100644 --- a/Items/Weapons/Summon/SarosPossession.cs +++ b/Items/Weapons/Summon/SarosPossession.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -9,14 +10,14 @@ namespace CalamityMod.Items.Weapons.Summon { public class SarosPossession : ModItem { - int radianceSlots; + int radianceSlots; public override void SetStaticDefaults() { DisplayName.SetDefault("Saros Possession"); Tooltip.SetDefault("Gain absolute control over light itself\n" + - "Summons a radiant aura\n" + + "Summons a radiant aura\n" + "Consumes all of the remaining minion slots on use\n" + - "Must be used from the hotbar\n" + + "Must be used from the hotbar\n" + "Increased power based on the number of minion slots used"); } @@ -30,39 +31,39 @@ namespace CalamityMod.Items.Weapons.Summon item.summon = true; item.mana = 10; - item.damage = 145; + item.damage = 171; item.knockBack = 4f; item.useTime = item.useAnimation = 10; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - } + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + } - public override void HoldItem(Player player) + public override void HoldItem(Player player) { - double minionCount = 0; - for (int j = 0; j < Main.projectile.Length; j++) - { + double minionCount = 0; + for (int j = 0; j < Main.projectile.Length; j++) + { Projectile proj = Main.projectile[j]; - if (proj.active && proj.owner == player.whoAmI && proj.minion && proj.type != item.shoot) - { - minionCount += proj.minionSlots; - } - } + if (proj.active && proj.owner == player.whoAmI && proj.minion && proj.type != item.shoot) + { + minionCount += proj.minionSlots; + } + } radianceSlots = (int)(player.maxMinions - minionCount); - } + } public override bool CanUseItem(Player player) - { - return radianceSlots >= 1; - } + { + return radianceSlots >= 1; + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - CalamityUtils.KillShootProjectiles(true, type, player); + CalamityUtils.KillShootProjectiles(true, type, player); Projectile.NewProjectile(position, Vector2.Zero, type, damage, knockBack, player.whoAmI, radianceSlots); return false; } @@ -71,8 +72,9 @@ namespace CalamityMod.Items.Weapons.Summon { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Summon/StaffoftheMechworm.cs b/Items/Weapons/Summon/StaffoftheMechworm.cs index 01d1650b6b..2502066191 100644 --- a/Items/Weapons/Summon/StaffoftheMechworm.cs +++ b/Items/Weapons/Summon/StaffoftheMechworm.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Summon public class StaffoftheMechworm : ModItem { // This value is also referenced by the God Slayer and Auric summoner helmets. - public const int BaseDamage = 144; // originally 325 + public const int BaseDamage = 161; // originally 325 public override void SetStaticDefaults() { DisplayName.SetDefault("Staff of the Mechworm"); diff --git a/Items/Weapons/Summon/UniverseSplitter.cs b/Items/Weapons/Summon/UniverseSplitter.cs index 10806aa174..c303101123 100644 --- a/Items/Weapons/Summon/UniverseSplitter.cs +++ b/Items/Weapons/Summon/UniverseSplitter.cs @@ -81,7 +81,7 @@ namespace CalamityMod.Items.Weapons.Summon { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); diff --git a/Items/Weapons/Summon/ViralSprout.cs b/Items/Weapons/Summon/ViralSprout.cs index 77be9227c7..2535fcc77c 100644 --- a/Items/Weapons/Summon/ViralSprout.cs +++ b/Items/Weapons/Summon/ViralSprout.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 32; + item.damage = 24; item.mana = 10; item.width = 48; item.height = 56; diff --git a/Items/Weapons/Typeless/RelicOfDeliverance.cs b/Items/Weapons/Typeless/RelicOfDeliverance.cs index 206c8f88d7..e6a33b94df 100644 --- a/Items/Weapons/Typeless/RelicOfDeliverance.cs +++ b/Items/Weapons/Typeless/RelicOfDeliverance.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.Accessories; using CalamityMod.Projectiles.Typeless; using Terraria; using Terraria.ID; @@ -11,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Typeless { DisplayName.SetDefault("Relic of Deliverance"); Tooltip.SetDefault("Summons a spear that causes you to lunge towards the mouse position\n" + - "The spear requires a charge-up. The longer the charge, the more strong the lunge\n" + + "The spear requires a charge-up. The longer the charge, the stronger the lunge\n" + "The spear disappears immediately if you are not holding this item while charging\n" + "If enough time has passed or the spear collides into a wall, the spear dies and the lunge ends"); } @@ -31,6 +32,7 @@ namespace CalamityMod.Items.Weapons.Typeless item.value = CalamityGlobalItem.Rarity11BuyPrice; item.rare = ItemRarityID.Purple; item.shoot = ModContent.ProjectileType(); + item.Calamity().CannotBeEnchanted = true; } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Localization/CalamityLocalization.cs b/Localization/CalamityLocalization.cs index 07aca5bfa0..b4e0af8fe8 100644 --- a/Localization/CalamityLocalization.cs +++ b/Localization/CalamityLocalization.cs @@ -58,35 +58,33 @@ namespace CalamityMod.Localization new [] { "SCalSepulcher2Text", "Once the dust has settled and only one remains, if it is you, what value will this have had?!" }, new [] { "SCalDesparationText1", "Just stop!" }, new [] { "SCalDesparationText2", "I have no future if I lose here." }, - new [] { "SCalDesparationText3", "Once you have bested me, you too will only have one path forward." }, + new [] { "SCalDesparationText3", "Once you have bested me, you will only have one path forward." }, new [] { "SCalDesparationText4", "And that path... also has no future." }, new [] { "SCalAcceptanceText1", "Even if he has thrown all else away, his power remains." }, new [] { "SCalAcceptanceText2", "I have no more energy left to resent him, or you..." }, new [] { "SCalAcceptanceText3", "It will all be in your hands now." }, - // Some of these keys are incorrect in terms of their contents, but they remain as their bases + an addon at the end to make it + // Some of these keys are incorrect in terms of their contents, but they remain as their bases + an addon at the end to make it // easier to define them. - new [] { "SCalSummonTextRematch", "You called? If you're looking to get scorched, you've got the right person." }, - new [] { "SCalStartTextRematch", "Ha! You saw it coming this time." }, - new [] { "SCalBH2TextRematch", "Don't get cocky just because you've won once." }, - new [] { "SCalBH3TextRematch", "You know, I was expecting a house call from the Tyrant at this point. Think he died?" }, - new [] { "SCalBH3TextRematch2", "Haha, no way." }, - new [] { "SCalBrothersTextRematch", "Would you like to meet my family? Horrible, isn't it?" }, - new [] { "SCalBrothersTextRematch2", "I'm joking. They are but empty shells now. Did I frighten you?" }, + new [] { "SCalSummonTextRematch", "If you’re looking for some fourth-degree burns, you’ve got the right person." }, + new [] { "SCalStartTextRematch", "When the time comes, would you like to join my creation?" }, + new [] { "SCalBH2TextRematch", "You’ll still have to work hard for this victory." }, + new [] { "SCalBH3TextRematch", "I haven’t had such an interesting target dummy to test my magic on in a long time." }, + new [] { "SCalBrothersTextRematch", "Empty shells of their former selves. I doubt even a scrap of their spirits remain." }, new [] { "SCalPhase2TextRematch", "Here we go again." }, - new [] { "SCalBH4TextRematch", "Remember these? I bet you've seen them a few times since the last battle... in your nightmares." }, - new [] { "SCalSeekerRingTextRematch", "It seems your skill hasn't faltered in the least." }, - new [] { "SCalBH5TextRematch", "One last go." }, - new [] { "SCalSepulcher2TextRematch", "And... you never cease to amaze." }, - new [] { "SCalDesparationText1Rematch", "You may even have a proper chance now." }, - new [] { "SCalDesparationText2Rematch", "I wonder if you've met his mechanic yet." }, + new [] { "SCalBH4TextRematch", "I wonder if you’ve seen these in your nightmares since our first battle?" }, + new [] { "SCalSeekerRingTextRematch", "Your skill hasn't faltered in the least." }, + new [] { "SCalBH5TextRematch", "Isn't this exciting?" }, + new [] { "SCalSepulcher2TextRematch", "Here comes the crawling tomb, one last time." }, + new [] { "SCalDesparationText1Rematch", "A terrific display, I concede this match to you." }, + new [] { "SCalDesparationText2Rematch", "No doubt you will face enemies stronger than I." }, new [] { "SCalDesparationText3Rematch", "I trust you will not make the same mistakes he did." }, - new [] { "SCalDesparationText4Rematch", "Now... even I cannot see what your future holds." }, + new [] { "SCalDesparationText4Rematch", "I can’t imagine what your future holds now." }, new [] { "SCalFunnyCheatText", "Go to hell." }, new [] { "EdgyBossText", "Don't get cocky, kid!" }, - new [] { "EdgyBossText2", "You think...you can butcher...ME!?" }, + new [] { "EdgyBossText2", "You think... you can butcher... ME!?" }, new [] { "EdgyBossText3", "A fatal mistake!" }, new [] { "EdgyBossText4", "Good luck recovering from that!" }, new [] { "EdgyBossText5", "Delicious..." }, @@ -96,7 +94,7 @@ namespace CalamityMod.Localization new [] { "EdgyBossText9", "Of all my segments to get hit by..." }, new [] { "EdgyBossText10", "It's not over yet, kid!" }, new [] { "EdgyBossText11", "A GOD DOES NOT FEAR DEATH!" }, - new [] { "EdgyBossText12", "You are no god...but I shall feast upon your essence regardless!" }, + new [] { "EdgyBossText12", "You are no god... but I shall feast upon your essence regardless!" }, new [] { "DoGBossText", "The frigid moon shimmers brightly." }, new [] { "DoGBossText2", "The harvest moon glows eerily." }, @@ -117,7 +115,15 @@ namespace CalamityMod.Localization new [] { "CryogenBossText", "Cryogen is derping out!" }, - new [] { "HardmodeOreTier1Text", "Your world has been blessed with Cobalt and Palladium!" }, + new [] { "DraedonIntroductionText1", "This is a meeting that has been a long time coming." }, + new [] { "DraedonIntroductionText2", "The machine you constructed, deciphering and incercepting my channels of communication. It is no small feat of ingenuity." }, + new [] { "DraedonIntroductionText3", "I must be upfront, as this is a unique opportunity. Your observations have not been one-sided, and I have grown " + + "interested in your remarkable progression." }, + new [] { "DraedonIntroductionText4", "Humor me, in a battle with the results of my tinkering." }, + new [] { "DraedonIntroductionText5", "You may choose your first opponent." }, + new [] { "DraedonAresEnrageText", "How foolish. You cannot escape." }, + + new [] { "HardmodeOreTier1Text", "Your world has been blessed with Cobalt and Palladium!" }, new [] { "HardmodeOreTier2Text", "Your world has been blessed with Mythril and Orichalcum!" }, new [] { "HardmodeOreTier3Text", "Your world has been blessed with Adamantite and Titanium!" }, new [] { "HardmodeOreTier4Text", "The hallow has been blessed with consecrated stone!" }, @@ -181,7 +187,7 @@ namespace CalamityMod.Localization new [] { "AprilFools2", "A boomer awaits..." }, //possible alternative to GhostBossText4 new [] { "AcidRainStart", "A toxic downpour falls over the wasteland seas!" }, - new [] { "AcidRainEnd", "The sulphuric skies begin to clear..." } + new [] { "AcidRainEnd", "The sulphuric skies begin to clear..." }, }; } diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 791f79bd8e..2a982e75d2 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -414,7 +414,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("PlaguebringerGoliath", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemID.Stinger, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.GreaterHealingPotion }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemID.Stinger, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.GreaterHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}] in the Jungle Biome"; string despawn = CalamityUtils.ColorMessage("HOSTILE SPECIMENS TERMINATED. INITIATE RECALL TO HOME BASE.", new Color(0x00, 0xFF, 0x00)); @@ -585,11 +585,11 @@ namespace CalamityMod BossDifficulty.TryGetValue("ExoMechs", out float order); List bosses = new List() { NPCType(), NPCType(), NPCType(), NPCType() }; List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; - //List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; - string instructions = "By using a high-tech computer thing"; - string despawn = CalamityUtils.ColorMessage("An imperfection after all...what a shame.", new Color(0x7F, 0xFF, 0xD4)); - //string bossLogTex = "CalamityMod/NPCs/ExoMechs/ExoMechs_BossChecklist"; - //AddBoss(bossChecklist, calamity, "ExoMechs", order, bosses, DownedExoMechs, null, loot, collection, instructions, despawn, bossLogTex); + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + string instructions = "By using a high-tech computer"; + string despawn = CalamityUtils.ColorMessage("An imperfection after all... what a shame.", new Color(0x7F, 0xFF, 0xD4)); + string bossLogTex = "CalamityMod/NPCs/ExoMechs/ExoMechs_BossChecklist"; + AddBoss(bossChecklist, calamity, "Exo Mechs", order, bosses, DownedExoMechs, null, loot, collection, instructions, despawn, bossLogTex); } // Supreme Calamitas @@ -727,7 +727,7 @@ namespace CalamityMod // Plantera AddLoot(bossChecklist, "Plantera", - new List() { ItemType(), ItemType(), ItemID.JungleKey }, + new List() { ItemType(), ItemType(), ItemType(), ItemID.JungleKey }, new List() { ItemType() } ); AddSummons(bossChecklist, "Plantera", new List() { ItemType() }); diff --git a/NPCs/Abyss/EidolonWyrmHeadHuge.cs b/NPCs/Abyss/EidolonWyrmHeadHuge.cs index 4dea815380..8d64f1014f 100644 --- a/NPCs/Abyss/EidolonWyrmHeadHuge.cs +++ b/NPCs/Abyss/EidolonWyrmHeadHuge.cs @@ -147,9 +147,12 @@ namespace CalamityMod.NPCs.Abyss // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } // Phases bool phase2 = lifeRatio < 0.8f; @@ -443,6 +446,8 @@ namespace CalamityMod.NPCs.Abyss chargeDestination = destination + chargeVectorFlipped + player.velocity * chargePredictionAmt; npc.velocity = Vector2.Normalize(chargeDestination - npc.Center) * baseVelocity; + npc.netUpdate = true; + npc.netSpam -= 5; } else { @@ -620,6 +625,8 @@ namespace CalamityMod.NPCs.Abyss chargeDestination = destination + chargeVectorFlipped + player.velocity * chargePredictionAmt; npc.velocity = Vector2.Normalize(chargeDestination - npc.Center) * baseVelocity; + npc.netUpdate = true; + npc.netSpam -= 5; } else { @@ -726,6 +733,8 @@ namespace CalamityMod.NPCs.Abyss chargeDestination = destination + chargeVectorFlipped + player.velocity * chargePredictionAmt; npc.velocity = Vector2.Normalize(chargeDestination - npc.Center) * baseVelocity; + npc.netUpdate = true; + npc.netSpam -= 5; } else { @@ -885,7 +894,7 @@ namespace CalamityMod.NPCs.Abyss { calamityGlobalNPC.newAI[2] += 1f; - float spinVelocityDivisor = baseVelocity * 2f; + float spinVelocityDivisor = targetDownDeep ? 180f : 120f; if (rotationDirection == 0) { // Set spin direction @@ -998,6 +1007,8 @@ namespace CalamityMod.NPCs.Abyss chargeDestination = destination + lightningChargeVectorFlipped + player.velocity * chargePredictionAmt; npc.velocity = Vector2.Normalize(chargeDestination - npc.Center) * baseVelocity; + npc.netUpdate = true; + npc.netSpam -= 5; } else { @@ -1161,7 +1172,7 @@ namespace CalamityMod.NPCs.Abyss if ((destination - npc.Center).Length() < spinLocationDistance || calamityGlobalNPC.newAI[1] > 0f) { calamityGlobalNPC.newAI[1] += 1f; - float spinVelocityDivisor = baseVelocity * 2f; + float spinVelocityDivisor = targetDownDeep ? 180f : 120f; if (rotationDirection == 0) { // Set spin direction diff --git a/NPCs/Astral/AstralProbe.cs b/NPCs/Astral/AstralProbe.cs index 19031a1f44..3686bedb2c 100644 --- a/NPCs/Astral/AstralProbe.cs +++ b/NPCs/Astral/AstralProbe.cs @@ -258,7 +258,7 @@ namespace CalamityMod.NPCs.Astral npc.Center = npc.position; for (int d = 0; d < 5; d++) { - int purple = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int purple = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[purple].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -268,10 +268,10 @@ namespace CalamityMod.NPCs.Astral } for (int d = 0; d < 10; d++) { - int cosmos = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); + int cosmos = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[cosmos].noGravity = true; Main.dust[cosmos].velocity *= 5f; - cosmos = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + cosmos = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[cosmos].velocity *= 2f; } CalamityUtils.ExplosionGores(npc.Center, 3); diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index c3b4448cbb..c96b26ee26 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -3,6 +3,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; +using CalamityMod.Items.Mounts; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Potions; using CalamityMod.Items.TreasureBags; @@ -46,7 +47,7 @@ namespace CalamityMod.NPCs.AstrumAureus npc.height = 280; npc.defense = 40; npc.DR_NERD(0.15f); - npc.LifeMaxNERB(84000, NPC.downedMoonlord ? 292500 : 107000, 740000); // 30 seconds in boss rush + npc.LifeMaxNERB(NPC.downedMoonlord ? 230000 : 84000, NPC.downedMoonlord ? 292500 : 107000, 740000); // 30 seconds in boss rush npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; @@ -55,7 +56,7 @@ namespace CalamityMod.NPCs.AstrumAureus npc.DeathSound = SoundID.NPCDeath14; music = CalamityMod.Instance.GetMusicFromMusicMod("Astrageldon") ?? MusicID.Boss3; bossBag = ModContent.ItemType(); - if (NPC.downedMoonlord && CalamityWorld.revenge) + if (NPC.downedMoonlord) { npc.value = Item.buyPrice(0, 25, 0, 0); } @@ -332,8 +333,8 @@ namespace CalamityMod.NPCs.AstrumAureus if (!Main.expertMode) { // Materials - DropHelper.DropItemSpray(npc, ModContent.ItemType(), 20, 30); - DropHelper.DropItemSpray(npc, ItemID.FallenStar, 25, 40); + DropHelper.DropItemSpray(npc, ModContent.ItemType(), 20, 30, 2); + DropHelper.DropItemSpray(npc, ItemID.FallenStar, 18, 24, 2); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; @@ -345,8 +346,11 @@ namespace CalamityMod.NPCs.AstrumAureus DropHelper.WeightStack(w) ); - // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + // Equipment + DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedMoonlord); + + // Vanity + DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); // Other DropHelper.DropItem(npc, ModContent.ItemType(), 9, 12); @@ -382,7 +386,7 @@ namespace CalamityMod.NPCs.AstrumAureus for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { @@ -394,7 +398,7 @@ namespace CalamityMod.NPCs.AstrumAureus npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 50; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { diff --git a/NPCs/AstrumAureus/AureusSpawn.cs b/NPCs/AstrumAureus/AureusSpawn.cs index 542c154698..2150d249cb 100644 --- a/NPCs/AstrumAureus/AureusSpawn.cs +++ b/NPCs/AstrumAureus/AureusSpawn.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.AstrumAureus npc.height = 60; npc.alpha = 255; npc.defense = 10; - npc.lifeMax = 3000; + npc.lifeMax = NPC.downedMoonlord ? 8250 : 3000; npc.knockBackResist = 0f; npc.noGravity = true; npc.noTileCollide = true; @@ -310,7 +310,7 @@ namespace CalamityMod.NPCs.AstrumAureus Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 14); npc.position.X = npc.position.X + (float)(npc.width / 2); npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.damage = npc.defDamage; + npc.damage = (NPC.downedMoonlord && !BossRushEvent.BossRushActive) ? npc.defDamage * 2 : npc.defDamage; npc.width = npc.height = 432; npc.position.X = npc.position.X - (float)(npc.width / 2); npc.position.Y = npc.position.Y - (float)(npc.height / 2); diff --git a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs index b9791d57d8..40cc236563 100644 --- a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs @@ -184,7 +184,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { diff --git a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs index 9b0f7640d1..8a9db4814b 100644 --- a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs @@ -177,7 +177,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -244,18 +244,18 @@ namespace CalamityMod.NPCs.AstrumDeus DropHelper.DropItemCondition(npc, ModContent.ItemType(), !CalamityWorld.downedStarGod); // Drop a large spray of all 4 lunar fragments - int minFragments = Main.expertMode ? 20 : 12; - int maxFragments = Main.expertMode ? 32 : 20; - DropHelper.DropItemSpray(npc, ItemID.FragmentSolar, minFragments, maxFragments); - DropHelper.DropItemSpray(npc, ItemID.FragmentVortex, minFragments, maxFragments); - DropHelper.DropItemSpray(npc, ItemID.FragmentNebula, minFragments, maxFragments); - DropHelper.DropItemSpray(npc, ItemID.FragmentStardust, minFragments, maxFragments); + int minFragments = Main.expertMode ? 20 : 16; + int maxFragments = Main.expertMode ? 32 : 24; + DropHelper.DropItemSpray(npc, ItemID.FragmentSolar, minFragments, maxFragments, 4); + DropHelper.DropItemSpray(npc, ItemID.FragmentVortex, minFragments, maxFragments, 4); + DropHelper.DropItemSpray(npc, ItemID.FragmentNebula, minFragments, maxFragments, 4); + DropHelper.DropItemSpray(npc, ItemID.FragmentStardust, minFragments, maxFragments, 4); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) { DropHelper.DropItemSpray(npc, ModContent.ItemType(), 50, 80, 5); - DropHelper.DropItemSpray(npc, ItemID.FallenStar, 80, 150); + DropHelper.DropItemSpray(npc, ItemID.FallenStar, 25, 40, 5); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; diff --git a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs index 3c533db815..c9aab7eaf6 100644 --- a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs @@ -155,7 +155,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index b3d2ff17cf..5028ba34db 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; +using CalamityMod.Items.Mounts; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Magic; @@ -161,7 +162,8 @@ namespace CalamityMod.NPCs.BrimstoneElemental { //Materials DropHelper.DropItemSpray(npc, ModContent.ItemType(), 4, 8); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedProvidence, 1f, 20, 30); + if (CalamityWorld.downedProvidence) + DropHelper.DropItemSpray(npc, ModContent.ItemType(), 20, 30, 2); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; @@ -174,9 +176,10 @@ namespace CalamityMod.NPCs.BrimstoneElemental // Equipment DropHelper.DropItemChance(npc, ModContent.ItemType(), 5); DropHelper.DropItemChance(npc, ModContent.ItemType(), 2); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedProvidence); - // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + // Vanity + DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); } //if brimmy hasn't been killed, you can mine charred ore diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index 5f19f42c20..3ffcfe54aa 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -106,9 +106,12 @@ namespace CalamityMod.NPCs.Bumblebirb // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } // Phases bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death; @@ -195,9 +198,12 @@ namespace CalamityMod.NPCs.Bumblebirb // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } // Phases bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death; diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index dd811b12cc..c92021857b 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -66,14 +66,17 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } + // Phases bool phase2 = lifeRatio < 0.75f; bool phase3 = lifeRatio < 0.5f; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - // Homing only works if the boss is hostile if (head) npc.chaseable = calamityGlobalNPC.newAI[0] == 1f; @@ -668,10 +671,6 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - // Variables for buffing the AI bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; bool enraged = calamityGlobalNPC.enraged > 0; @@ -679,6 +678,14 @@ namespace CalamityMod.NPCs bool expertMode = Main.expertMode || malice; bool revenge = CalamityWorld.revenge || malice; bool death = CalamityWorld.death || malice; + + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } + bool phase2 = lifeRatio < 0.5f && revenge; bool phase3 = lifeRatio < 0.33f; @@ -1209,9 +1216,12 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } // Phases bool phase3 = lifeRatio < 0.7f; @@ -1637,7 +1647,7 @@ namespace CalamityMod.NPCs // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num824 *= 0.5f; } @@ -1753,7 +1763,7 @@ namespace CalamityMod.NPCs // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num833 *= 0.5f; } @@ -1980,10 +1990,6 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - // Emit light Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); @@ -1996,6 +2002,13 @@ namespace CalamityMod.NPCs bool expertMode = Main.expertMode || malice; bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } + // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); @@ -2273,10 +2286,6 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - // Emit light Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); @@ -2289,6 +2298,13 @@ namespace CalamityMod.NPCs bool expertMode = Main.expertMode || malice; bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } + // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); @@ -2568,13 +2584,12 @@ namespace CalamityMod.NPCs CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + bool postMoonLordBuff = NPC.downedMoonlord && !BossRushEvent.BossRushActive; + npc.damage = postMoonLordBuff ? npc.defDamage * 2 : npc.defDamage; + // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - // Variables bool enraged = calamityGlobalNPC.enraged > 0; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; @@ -2582,7 +2597,14 @@ namespace CalamityMod.NPCs bool revenge = CalamityWorld.revenge || malice; bool death = CalamityWorld.death || malice; - float shootTimer = 1f; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } + + float shootTimer = 1f; if (expertMode) shootTimer += death ? (float)Math.Round(3f * (1f - lifeRatio)) : (float)Math.Round(2f * (1f - lifeRatio)); @@ -2616,6 +2638,7 @@ namespace CalamityMod.NPCs // Phases bool phase2 = lifeRatio < 0.75f; bool phase3 = lifeRatio < 0.5f; + bool reduceFallSpeed = npc.velocity.Y > 0f && npc.Bottom.Y > player.Top.Y && npc.ai[0] == 4f; bool despawnDistance = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; @@ -2674,8 +2697,9 @@ namespace CalamityMod.NPCs float velocity = death ? 8f : 7f; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - if (NPC.downedMoonlord && revenge && !BossRushEvent.BossRushActive) + if (postMoonLordBuff) damage *= 2; + float spreadLimit = (phase3 ? 100f : 50f) + enrageScale * 50f; float randomSpread = (Main.rand.NextFloat() - 0.5f) * spreadLimit; Vector2 spawnVector = new Vector2(npc.Center.X, npc.Center.Y - 80f); @@ -2717,7 +2741,7 @@ namespace CalamityMod.NPCs int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - if (NPC.downedMoonlord && revenge && !BossRushEvent.BossRushActive) + if (postMoonLordBuff) damage *= 2; for (int i = 0; i < maxProjectiles; i++) @@ -2773,7 +2797,7 @@ namespace CalamityMod.NPCs // Increase defense npc.defense = npc.defDefense; - // Stop colliding with tiles + // Stop colliding with tiles npc.noTileCollide = true; // Set AI to next phase (Walk) and reset other AI @@ -2782,8 +2806,8 @@ namespace CalamityMod.NPCs npc.ai[1] = 0f; npc.netUpdate = true; } - - CustomGravity(); + else + CustomGravity(); } // Walk @@ -2815,41 +2839,50 @@ namespace CalamityMod.NPCs npc.velocity.X = (npc.velocity.X * 20f - num823) / 21f; } - // Walk through tiles if colliding with tiles and player is out of reach - int num854 = 80; - int num855 = 20; - Vector2 position2 = new Vector2(npc.Center.X - (num854 / 2), npc.position.Y + npc.height - num855); - - bool flag52 = false; - if (npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width && npc.position.Y + npc.height < player.position.Y + player.height - 16f) - flag52 = true; - - if (flag52) + if (Collision.CanHit(npc.position, npc.width, npc.height, player.Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height) && player.position.Y <= npc.position.Y + npc.height) { - npc.velocity.Y += 0.5f; - } - else if (Collision.SolidCollision(position2, num854, num855)) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = 0f; - - if (npc.velocity.Y > -0.2) - npc.velocity.Y -= 0.025f; - else - npc.velocity.Y -= 0.2f; - - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; + CustomGravity(); + npc.noTileCollide = false; } else { - if (npc.velocity.Y < 0f) - npc.velocity.Y = 0f; + npc.noTileCollide = true; + // Walk through tiles if colliding with tiles and player is out of reach + int num854 = 80; + int num855 = 20; + Vector2 position2 = new Vector2(npc.Center.X - (num854 / 2), npc.position.Y + npc.height - num855); - if (npc.velocity.Y < 0.1) - npc.velocity.Y += 0.025f; - else + bool flag52 = false; + if (npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width && npc.position.Y + npc.height < player.position.Y + player.height - 16f) + flag52 = true; + + if (flag52) + { npc.velocity.Y += 0.5f; + } + else if (Collision.SolidCollision(position2, num854, num855)) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y = 0f; + + if (npc.velocity.Y > -0.2) + npc.velocity.Y -= 0.025f; + else + npc.velocity.Y -= 0.2f; + + if (npc.velocity.Y < -4f) + npc.velocity.Y = -4f; + } + else + { + if (npc.velocity.Y < 0f) + npc.velocity.Y = 0f; + + if (npc.velocity.Y < 0.1) + npc.velocity.Y += 0.025f; + else + npc.velocity.Y += 0.5f; + } } // Walk for a maximum of 6 seconds @@ -2994,8 +3027,9 @@ namespace CalamityMod.NPCs num182 *= num183; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - if (NPC.downedMoonlord && revenge && !BossRushEvent.BossRushActive) + if (postMoonLordBuff) damage *= 2; + value9.X += num180; value9.Y += num182; for (int i = 0; i < maxProjectiles; i++) @@ -3204,9 +3238,9 @@ namespace CalamityMod.NPCs void CustomGravity() { float gravity = 0.36f + 0.12f * enrageScale; - float maxFallSpeed = 12f + 4f * enrageScale; + float maxFallSpeed = reduceFallSpeed ? 12f : 12f + 4f * enrageScale; - if (calamityGlobalNPC.newAI[0] > 1f) + if (calamityGlobalNPC.newAI[0] > 1f && !reduceFallSpeed) maxFallSpeed *= calamityGlobalNPC.newAI[0]; npc.velocity.Y += gravity; @@ -3276,9 +3310,12 @@ namespace CalamityMod.NPCs // Life float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } // Phases based on life percentage bool halfHealth = npc.life / (float)npc.lifeMax < 0.5f; @@ -3940,12 +3977,6 @@ namespace CalamityMod.NPCs // Percent life remaining double lifeRatio = npc.life / (double)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - - int lifePercentage = (int)(100.0 * lifeRatio); - // Difficulty modes bool enraged = calamityGlobalNPC.enraged > 0; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; @@ -3953,6 +3984,13 @@ namespace CalamityMod.NPCs bool revenge = CalamityWorld.revenge || malice; bool death = CalamityWorld.death || malice; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } + // Phases bool phase2 = lifeRatio <= 0.7; bool phase3 = lifeRatio <= 0.4; @@ -4320,7 +4358,7 @@ namespace CalamityMod.NPCs dustVelocity = dustVelocityScalar / dustVelocity; dustVelocityX *= dustVelocity; dustVelocityY *= dustVelocity; - int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 5f); + int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 5f); Main.dust[dust].noGravity = true; Main.dust[dust].position.X = vector.X; Main.dust[dust].position.Y = vector.Y; @@ -4617,9 +4655,12 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } // Phases bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f); @@ -5215,16 +5256,20 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - // Variables bool enraged = calamityGlobalNPC.enraged > 0; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || malice; bool revenge = CalamityWorld.revenge || malice; bool death = CalamityWorld.death || malice; + + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } + bool phase2 = lifeRatio <= (death ? 0.8f : revenge ? 0.7f : 0.5f); bool phase3 = lifeRatio <= (death ? 0.5f : (revenge ? 0.35f : 0.2f)) && expertMode; bool phase2AI = npc.ai[0] > 4f; diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 2fdfc7d835..a0b066a89c 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -5401,7 +5401,7 @@ namespace CalamityMod.NPCs num422 = 0.175f; } // Reduce acceleration if target is holding a true melee weapon - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num421 *= 0.75f; num422 *= 0.5f; @@ -5512,7 +5512,7 @@ namespace CalamityMod.NPCs num431 = 0.25f; } // Reduce acceleration if target is holding a true melee weapon - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num430 *= 0.75f; num431 *= 0.5f; @@ -5974,7 +5974,7 @@ namespace CalamityMod.NPCs // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num399 *= 0.75f; num400 *= 0.5f; @@ -6084,7 +6084,7 @@ namespace CalamityMod.NPCs // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num409 *= 0.75f; num410 *= 0.5f; @@ -7409,7 +7409,7 @@ namespace CalamityMod.NPCs // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { acceleration *= 0.5f; } @@ -9896,8 +9896,10 @@ namespace CalamityMod.NPCs npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && (enrage || turboEnrage)) || enraged; - // Alpha - if (npc.alpha > 0) + bool reduceFallSpeed = npc.velocity.Y > 0f && npc.Bottom.Y > Main.player[npc.target].Top.Y; + + // Alpha + if (npc.alpha > 0) { npc.alpha -= 10; if (npc.alpha < 0) @@ -9959,11 +9961,17 @@ namespace CalamityMod.NPCs } } - // Jump - if (npc.ai[0] == 0f) - { - npc.noTileCollide = false; + if (npc.noTileCollide && !Main.player[npc.target].dead) + { + if (npc.velocity.Y > 0f && npc.Bottom.Y > Main.player[npc.target].Top.Y) + npc.noTileCollide = false; + else if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.noTileCollide = false; + } + // Jump + if (npc.ai[0] == 0f) + { if (npc.velocity.Y == 0f) { // Laser fire when head is dead @@ -10145,15 +10153,6 @@ namespace CalamityMod.NPCs } else { - // Fall through - if (!Main.player[npc.target].dead) - { - if ((Main.player[npc.target].position.Y > npc.Bottom.Y && npc.velocity.Y > 0f) || (Main.player[npc.target].position.Y < npc.Bottom.Y && npc.velocity.Y < 0f)) - npc.noTileCollide = true; - else if ((npc.velocity.Y > 0f && npc.Bottom.Y > Main.player[npc.target].Top.Y) || (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height))) - npc.noTileCollide = false; - } - // Velocity when falling if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + npc.width > Main.player[npc.target].position.X + Main.player[npc.target].width) { @@ -10195,9 +10194,9 @@ namespace CalamityMod.NPCs void CustomGravity() { float gravity = turboEnrage ? 0.9f : enrage ? 0.6f : (!flag41 && !flag42) ? 0.45f : 0.3f; - float maxFallSpeed = turboEnrage ? 30f : enrage ? 20f : (!flag41 && !flag42) ? 15f : 10f; + float maxFallSpeed = reduceFallSpeed ? 12f : turboEnrage ? 30f : enrage ? 20f : (!flag41 && !flag42) ? 15f : 10f; - if (calamityGlobalNPC.newAI[0] > 1f) + if (calamityGlobalNPC.newAI[0] > 1f && !reduceFallSpeed) maxFallSpeed *= calamityGlobalNPC.newAI[0]; npc.velocity.Y += gravity; @@ -10221,7 +10220,237 @@ namespace CalamityMod.NPCs return false; } - public static bool BuffedGolemHeadAI(NPC npc, bool enraged, Mod mod) + public static bool BuffedGolemFistAI(NPC npc, bool enraged, Mod mod) + { + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + + // Enrage if the target isn't inside the temple + // Turbo enrage if target isn't inside the temple and it's malice mode + bool enrage = true; + bool turboEnrage = false; + if (Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) + { + int num = (int)Main.player[npc.target].Center.X / 16; + int num2 = (int)Main.player[npc.target].Center.Y / 16; + + Tile tile = Framing.GetTileSafely(num, num2); + if (tile.wall == WallID.LihzahrdBrickUnsafe) + enrage = false; + else + turboEnrage = malice; + } + else + turboEnrage = malice; + + if (malice) + enrage = true; + + if (enraged) + turboEnrage = true; + + float aggression = turboEnrage ? 3f : enrage ? 2f : death ? 1.5f : 1f; + + if (NPC.golemBoss < 0) + { + npc.StrikeNPCNoInteraction(9999, 0f, 0); + return false; + } + + if (npc.alpha > 0) + { + npc.alpha -= 10; + if (npc.alpha < 0) + npc.alpha = 0; + + npc.ai[1] = 0f; + } + + if (npc.ai[0] == 0f) + { + npc.noTileCollide = true; + + float num723 = 25f; + num723 *= (aggression + 3f) / 4f; + + Vector2 vector80 = new Vector2(npc.Center.X, npc.Center.Y); + float num724 = Main.npc[NPC.golemBoss].Center.X - vector80.X; + float num725 = Main.npc[NPC.golemBoss].Center.Y - vector80.Y; + num725 -= 9f; + num724 = (npc.type != NPCID.GolemFistLeft) ? (num724 + 78f) : (num724 - 84f); + float num726 = (float)Math.Sqrt(num724 * num724 + num725 * num725); + if (num726 < 12f + num723) + { + npc.rotation = 0f; + npc.velocity.X = num724; + npc.velocity.Y = num725; + + float num727 = aggression; + npc.ai[1] += num727; + if (npc.life < npc.lifeMax / 2) + npc.ai[1] += num727; + if (npc.life < npc.lifeMax / 4) + npc.ai[1] += num727; + + if (npc.ai[1] >= 40f) + { + npc.TargetClosest(); + + if ((npc.type == NPCID.GolemFistLeft && npc.Center.X + 100f > Main.player[npc.target].Center.X) || (npc.type == NPCID.GolemFistRight && npc.Center.X - 100f < Main.player[npc.target].Center.X)) + { + npc.ai[1] = 0f; + npc.ai[0] = 1f; + } + else + npc.ai[1] = 0f; + } + } + else + { + num726 = num723 / num726; + npc.velocity.X = num724 * num726; + npc.velocity.Y = num725 * num726; + + npc.rotation = (float)Math.Atan2(0f - npc.velocity.Y, 0f - npc.velocity.X); + if (npc.type == NPCID.GolemFistLeft) + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + } + } + else if (npc.ai[0] == 1f) + { + npc.noTileCollide = true; + npc.collideX = false; + npc.collideY = false; + + float num728 = 20f; + num728 *= (aggression + 3f) / 4f; + if (num728 > 48f) + num728 = 48f; + + Vector2 vector81 = new Vector2(npc.Center.X, npc.Center.Y); + float num729 = Main.player[npc.target].Center.X - vector81.X; + float num730 = Main.player[npc.target].Center.Y - vector81.Y; + float num731 = (float)Math.Sqrt(num729 * num729 + num730 * num730); + num731 = num728 / num731; + npc.velocity.X = num729 * num731; + npc.velocity.Y = num730 * num731; + npc.ai[0] = 2f; + + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + if (npc.type == NPCID.GolemFistLeft) + npc.rotation = (float)Math.Atan2(0f - npc.velocity.Y, 0f - npc.velocity.X); + } + else if (npc.ai[0] == 2f) + { + if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) + { + if (npc.velocity.X > 0f && npc.Center.X > Main.player[npc.target].Center.X) + npc.noTileCollide = false; + + if (npc.velocity.X < 0f && npc.Center.X < Main.player[npc.target].Center.X) + npc.noTileCollide = false; + } + else + { + if (npc.velocity.Y > 0f && npc.Center.Y > Main.player[npc.target].Center.Y) + npc.noTileCollide = false; + + if (npc.velocity.Y < 0f && npc.Center.Y < Main.player[npc.target].Center.Y) + npc.noTileCollide = false; + } + + Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y); + float num732 = Main.npc[NPC.golemBoss].Center.X - vector82.X; + float num733 = Main.npc[NPC.golemBoss].Center.Y - vector82.Y; + num732 += Main.npc[NPC.golemBoss].velocity.X; + num733 += Main.npc[NPC.golemBoss].velocity.Y; + num733 -= 9f; + num732 = (npc.type != NPCID.GolemFistLeft) ? (num732 + 78f) : (num732 - 84f); + float num734 = (float)Math.Sqrt(num732 * num732 + num733 * num733); + + if (npc.life < npc.lifeMax / 4) + { + npc.knockBackResist = 0f; + + if (num734 > 700f || npc.collideX || npc.collideY) + { + npc.noTileCollide = true; + npc.ai[0] = 0f; + } + + return false; + } + + bool flag41 = npc.justHit; + if (flag41) + { + if (npc.life < npc.lifeMax / 2) + { + if (npc.knockBackResist == 0f) + flag41 = false; + + npc.knockBackResist = 0f; + } + } + + if ((num734 > 600f || npc.collideX || npc.collideY) | flag41) + { + npc.noTileCollide = true; + npc.ai[0] = 0f; + } + } + else + { + if (npc.ai[0] != 3f) + return false; + + npc.noTileCollide = true; + float num736 = 12f; + float num737 = 0.4f; + Vector2 vector83 = new Vector2(npc.Center.X, npc.Center.Y); + float num738 = Main.player[npc.target].Center.X - vector83.X; + float num739 = Main.player[npc.target].Center.Y - vector83.Y; + float num740 = (float)Math.Sqrt(num738 * num738 + num739 * num739); + num740 = num736 / num740; + num738 *= num740; + num739 *= num740; + + if (npc.velocity.X < num738) + { + npc.velocity.X += num737; + if (npc.velocity.X < 0f && num738 > 0f) + npc.velocity.X += num737 * 2f; + } + else if (npc.velocity.X > num738) + { + npc.velocity.X -= num737; + if (npc.velocity.X > 0f && num738 < 0f) + npc.velocity.X -= num737 * 2f; + } + + if (npc.velocity.Y < num739) + { + npc.velocity.Y += num737; + if (npc.velocity.Y < 0f && num739 > 0f) + npc.velocity.Y += num737 * 2f; + } + else if (npc.velocity.Y > num739) + { + npc.velocity.Y -= num737; + if (npc.velocity.Y > 0f && num739 < 0f) + npc.velocity.Y -= num737 * 2f; + } + + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + if (npc.type == NPCID.GolemFistLeft) + npc.rotation = (float)Math.Atan2(0f - npc.velocity.Y, 0f - npc.velocity.X); + } + + return false; + } + + + public static bool BuffedGolemHeadAI(NPC npc, bool enraged, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); @@ -10524,7 +10753,7 @@ namespace CalamityMod.NPCs if (enraged) turboEnrage = true; - if (turboEnrage) + if (turboEnrage && NPC.golemBoss >= 0) { npc.Calamity().DR = 0.9999f; npc.Calamity().unbreakableDR = true; @@ -11862,7 +12091,7 @@ namespace CalamityMod.NPCs int iceMistAmt = phase3 ? 2 : 1; int fireballFireRate = phase5 ? 10 : 12; float fireballSpeed = (phase6 ? 7.5f : 6f) + (death ? 2f * (1f - lifeRatio) : 0f) - (isCultist ? 0f : 3f); - int lightningOrbPhaseTime = phase2 ? 150 : 180; + int lightningOrbPhaseTime = phase2 ? 90 : 120; int ancientLightSpawnRate = phase4 ? 25 : 30; int ancientLightAmt = phase4 ? 3 : 2; int ancientDoomLimit = 10; @@ -12690,8 +12919,8 @@ namespace CalamityMod.NPCs } int num52 = list8.Count + 1; - if (num52 > 3) - num52 = 3; + if (num52 > 2) + num52 = 2; int num53 = Math.Sign(player.Center.X - center.X); if (num53 != 0) @@ -12988,12 +13217,15 @@ namespace CalamityMod.NPCs kill = true; if (Main.netMode != NetmodeID.MultiplayerClient) { - for (int num1501 = 0; num1501 < 4; num1501++) - { - Vector2 vector255 = new Vector2(0f, -splitProjVelocity).RotatedBy(MathHelper.PiOver2 * num1501); - Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer); - } - } + int totalProjectiles = (Main.npc[(int)npc.ai[0]].type == NPCID.CultistBoss && !phase3) ? 8 : 4; + float radians = MathHelper.TwoPi / totalProjectiles; + Vector2 spinningPoint = new Vector2(0f, -splitProjVelocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer); + } + } } if (kill) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index a1c905f524..11e9b75fda 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -23,6 +23,7 @@ using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.DesertScourge; using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.DraedonLabThings; using CalamityMod.NPCs.ExoMechs.Apollo; using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.ExoMechs.Ares; @@ -45,6 +46,7 @@ using CalamityMod.NPCs.SulphurousSea; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.Yharon; using CalamityMod.Particles; +using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; @@ -52,19 +54,22 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.UI; +using CalamityMod.Walls.DraedonStructures; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using Terraria; using Terraria.GameContent.Events; using Terraria.Graphics.Effects; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Utilities; using static Terraria.ModLoader.ModContent; -using CalamityMod.DataStructures; +using CalamityMod.NPCs.ExoMechs; namespace CalamityMod.NPCs { @@ -76,6 +81,8 @@ namespace CalamityMod.NPCs public int KillTime { get; set; } = 0; + public bool ShouldFallThroughPlatforms; + /// /// If this is set to true, the NPC's DR cannot be reduced via any means. This applies regardless of whether customDR is true or false. /// @@ -139,6 +146,7 @@ namespace CalamityMod.NPCs // Stuff used by the Boss Health UI public bool SplittingWorm = false; + public bool CanHaveBossHealthBar = false; // Timer for how long an NPC is immune to certain debuffs public const int slowingDebuffResistanceMin = 1800; @@ -225,6 +233,7 @@ namespace CalamityMod.NPCs public static int SCalCatastrophe = -1; public static int SCal = -1; public static int SCalWorm = -1; + public static int draedon = -1; public static int draedonExoMechWorm = -1; public static int draedonExoMechTwinRed = -1; public static int draedonExoMechTwinGreen = -1; @@ -242,8 +251,11 @@ namespace CalamityMod.NPCs // 4 - Check if malice is active and Boss Rush isn't. If so, set this to true. public bool CurrentlyEnraged; - // Collections - public static SortedDictionary BossRushHPChanges = new SortedDictionary + // Other Boss Rush stuff + public bool DoesNotDisappearInBossRush; + + // Collections + public static SortedDictionary BossRushHPChanges = new SortedDictionary { // Tier 1 { NPCID.QueenBee, 315000 }, // 30 seconds @@ -420,6 +432,15 @@ namespace CalamityMod.NPCs NPCType() }; + public static List AresIDs = new List + { + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + }; + public static List SkeletronPrimeIDs = new List { NPCID.SkeletronPrime, @@ -729,6 +750,7 @@ namespace CalamityMod.NPCs ResetSavedIndex(ref SCal, NPCType()); ResetSavedIndex(ref SCalWorm, NPCType()); + ResetSavedIndex(ref draedon, NPCType()); ResetSavedIndex(ref draedonExoMechWorm, NPCType()); ResetSavedIndex(ref draedonExoMechTwinRed, NPCType()); ResetSavedIndex(ref draedonExoMechTwinGreen, NPCType()); @@ -740,6 +762,7 @@ namespace CalamityMod.NPCs // Reset the enraged state every frame. The expectation is that bosses will continuously set it back to true if necessary. CurrentlyEnraged = false; + CanHaveBossHealthBar = false; } #endregion @@ -1023,6 +1046,8 @@ namespace CalamityMod.NPCs #region Set Defaults public override void SetDefaults(NPC npc) { + ShouldFallThroughPlatforms = false; + for (int i = 0; i < maxPlayerImmunities; i++) dashImmunityTime[i] = 0; @@ -1890,9 +1915,9 @@ namespace CalamityMod.NPCs damage += yellowCandleDamage; // Calculate extra DR based on kill time, similar to the Hush boss from The Binding of Isaac - if (KillTime > 0 && AITimer < KillTime && !BossRushEvent.BossRushActive) + if (KillTime > 0 && AITimer < KillTime && !BossRushEvent.BossRushActive && (!GetDownedBossVariable(npc.type) || CalamityWorld.malice)) { - float DRScalar = CalamityWorld.malice ? 2f : (!GetDownedBossVariable(npc.type) || CalamityConfig.Instance.FullPowerReactiveBossDR) ? 1.5f : 1f; + float DRScalar = CalamityWorld.malice ? 2f : 1.5f; // Boost Providence timed DR during the night or in Malice Mode if (npc.type == NPCType() && (!Main.dayTime || CalamityWorld.malice)) @@ -1902,8 +1927,7 @@ namespace CalamityMod.NPCs if ((DestroyerIDs.Contains(npc.type) && (!NPC.downedPlantBoss || CalamityWorld.malice)) || (AquaticScourgeIDs.Contains(npc.type) && (!NPC.downedPlantBoss || CalamityWorld.malice)) || (AstrumDeusIDs.Contains(npc.type) && (!NPC.downedMoonlord || CalamityWorld.malice)) || - (StormWeaverIDs.Contains(npc.type) && (!CalamityWorld.downedDoG || CalamityWorld.malice) && (CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2)) || - ThanatosIDs.Contains(npc.type)) + (StormWeaverIDs.Contains(npc.type) && (!CalamityWorld.downedDoG || CalamityWorld.malice) && (CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2))) DRScalar = 5f; // Boost Desert Scourge and Perforator Worm timed DR during Malice Mode to prevent speed killing @@ -1913,6 +1937,9 @@ namespace CalamityMod.NPCs DRScalar = 5f; } + if (ThanatosIDs.Contains(npc.type)) + DRScalar = 2f; + // The limit for how much extra DR the boss can have float extraDRLimit = (1f - DR) * DRScalar; @@ -2048,7 +2075,7 @@ namespace CalamityMod.NPCs maxVelocity = npc.velocity.Length(); } - if (KillTime > 0) + if (KillTime > 0 || npc.type == NPCType()) { // If any boss NPC is active, apply Zen to nearby players to reduce spawn rate if (CalamityConfig.Instance.BossZen) @@ -2060,23 +2087,31 @@ namespace CalamityMod.NPCs } } - if (AITimer < KillTime) - AITimer++; + if (npc.type != NPCType()) + { + if (AITimer < KillTime) + AITimer++; - // Separate timer for aggression to avoid entering later phases too quickly - int aggressionTimerCap = (int)(KillTime * 1.35); - if (AIIncreasedAggressionTimer < aggressionTimerCap) - AIIncreasedAggressionTimer++; + // Separate timer for aggression to avoid entering later phases too quickly + int aggressionTimerCap = (int)(KillTime * 1.35); + if (AIIncreasedAggressionTimer < aggressionTimerCap) + AIIncreasedAggressionTimer++; - // Increases aggression over time if the fight is taking too long - killTimeRatio_IncreasedAggression = 1f - (AIIncreasedAggressionTimer / (float)aggressionTimerCap); + // Increases aggression over time if the fight is taking too long + killTimeRatio_IncreasedAggression = 1f - (AIIncreasedAggressionTimer / (float)aggressionTimerCap); + } } if (npc.type == NPCID.TargetDummy || npc.type == NPCType()) { - npc.chaseable = !CalamityPlayer.areThereAnyDamnBosses; npc.dontTakeDamage = CalamityPlayer.areThereAnyDamnBosses; - } + + if (draedon != -1) + { + if (Main.npc[draedon].active) + npc.dontTakeDamage = true; + } + } // Setting this in SetDefaults will disable expert mode scaling, so put it here instead if (ZeroContactDamageNPCList.Contains(npc.type)) @@ -2089,7 +2124,7 @@ namespace CalamityMod.NPCs if (DestroyerIDs.Contains(npc.type) || EaterofWorldsIDs.Contains(npc.type)) npc.buffImmune[BuffType()] = false; - if (BossRushEvent.BossRushActive && !npc.friendly && !npc.townNPC) + if (BossRushEvent.BossRushActive && !npc.friendly && !npc.townNPC && !npc.Calamity().DoesNotDisappearInBossRush) BossRushForceDespawnOtherNPCs(npc, mod); if (NPC.LunarApocalypseIsUp) @@ -2168,6 +2203,9 @@ namespace CalamityMod.NPCs case NPCID.Golem: return CalamityGlobalAI.BuffedGolemAI(npc, enraged > 0, mod); + case NPCID.GolemFistLeft: + case NPCID.GolemFistRight: + return CalamityGlobalAI.BuffedGolemFistAI(npc, enraged > 0, mod); case NPCID.GolemHead: return CalamityGlobalAI.BuffedGolemHeadAI(npc, enraged > 0, mod); case NPCID.GolemHeadFree: @@ -2837,6 +2875,9 @@ namespace CalamityMod.NPCs #region Boss Rush Force Despawn Other NPCs private void BossRushForceDespawnOtherNPCs(NPC npc, Mod mod) { + if (BossRushEvent.BossRushStage >= BossRushEvent.Bosses.Count) + return; + if (!BossRushEvent.Bosses[BossRushEvent.BossRushStage].HostileNPCsToNotDelete.Contains(npc.type)) { npc.active = false; @@ -2853,14 +2894,13 @@ namespace CalamityMod.NPCs switch (solarTowerShieldStrength) { case 4: - // Possible spawns: Drakanian, Drakomire, Drakomire Rider + // Possible spawns: Drakanian, Drakomire, Drakomire Rider, Sroller switch (npc.type) { case NPCID.SolarCrawltipedeHead: case NPCID.SolarCrawltipedeBody: case NPCID.SolarCrawltipedeTail: case NPCID.SolarSolenian: - case NPCID.SolarSroller: case NPCID.SolarCorite: npc.active = false; npc.netUpdate = true; @@ -2870,13 +2910,13 @@ namespace CalamityMod.NPCs } break; case 3: - // Possible spawns: Drakomire, Drakomire Rider, Sroller + // Possible spawns: Drakanian, Drakomire Rider, Sroller switch (npc.type) { case NPCID.SolarCrawltipedeHead: case NPCID.SolarCrawltipedeBody: case NPCID.SolarCrawltipedeTail: - case NPCID.SolarSpearman: + case NPCID.SolarDrakomire: case NPCID.SolarSolenian: case NPCID.SolarCorite: npc.active = false; @@ -2887,15 +2927,15 @@ namespace CalamityMod.NPCs } break; case 2: - // Possible spawns: Drakomire Rider, Selenian, Sroller + // Possible spawns: Drakanian, Selenian, Sroller switch (npc.type) { case NPCID.SolarDrakomire: case NPCID.SolarCrawltipedeHead: case NPCID.SolarCrawltipedeBody: case NPCID.SolarCrawltipedeTail: - case NPCID.SolarSpearman: case NPCID.SolarCorite: + case NPCID.SolarDrakomireRider: npc.active = false; npc.netUpdate = true; break; @@ -2904,13 +2944,10 @@ namespace CalamityMod.NPCs } break; case 1: - // Possible spawns: Corite, Selenian, Sroller + // Possible spawns: Corite, Selenian, Sroller, Crawltipede switch (npc.type) { case NPCID.SolarDrakomire: - case NPCID.SolarCrawltipedeHead: - case NPCID.SolarCrawltipedeBody: - case NPCID.SolarCrawltipedeTail: case NPCID.SolarSpearman: case NPCID.SolarDrakomireRider: npc.active = false; @@ -3327,10 +3364,11 @@ namespace CalamityMod.NPCs if (DesertScourgeIDs.Contains(npc.type) || EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper || PerforatorIDs.Contains(npc.type) || AquaticScourgeIDs.Contains(npc.type) || DestroyerIDs.Contains(npc.type) || AstrumDeusIDs.Contains(npc.type) || StormWeaverIDs.Contains(npc.type) || ThanatosIDs.Contains(npc.type) || - npc.type == NPCType() || npc.type == NPCType()) + npc.type == NPCType() || npc.type == NPCType() || AresIDs.Contains(npc.type)) { + double damageMult = AresIDs.Contains(npc.type) ? 0.75 : 0.5; if (item.melee && item.type != ItemType() && item.type != ItemType()) - damage = (int)(damage * 0.5); + damage = (int)(damage * damageMult); } else if (npc.type == NPCType()) { @@ -3373,17 +3411,31 @@ namespace CalamityMod.NPCs // Bullseyes are visually larger on bosses, so account for that. float baseBullseyeRadius = npc.IsABoss() ? 116f : 54f; bool hasCollidedWithBullseye; + + // Custom math to determine if a direction would hit a target if the hitbox would not delete the projectile before it can. + // This can be visualized as using the NPC center as an anchor point, determining the direction to the bullseye from that anchor point, + // calculating the maximum amount of angular error there can be before a hit would not happen, and checking if the projectile's direction + // to the bullseye is within that margin of error. if (projectile.penetrate <= 1 && projectile.penetrate != -1) - hasCollidedWithBullseye = projectile.WithinRange(bullseye.Center, bullseye.scale * baseBullseyeRadius); - else { + // Directions to the bullseye relative to the NPC's center and the projectile that hit the NPC. Vector2 directionToBullseye = projectile.SafeDirectionTo(bullseye.Center, Vector2.UnitY); - Vector2 orthogonalEdgeOffset = Vector2.UnitX.RotatedBy(directionToBullseye.ToRotation() + MathHelper.PiOver2) * baseBullseyeRadius; - Vector2 edgeVector = projectile.Center - bullseye.Center + orthogonalEdgeOffset; - float inaccuracyLimit = directionToBullseye.AngleBetween(edgeVector); - float orthogonalityToIdealDirection = directionToBullseye.AngleBetween(projectile.velocity); - hasCollidedWithBullseye = orthogonalityToIdealDirection < inaccuracyLimit && projectile.WithinRange(bullseye.Center, bullseye.scale * baseBullseyeRadius); + Vector2 bullseyeCenterOffsetDirection = npc.SafeDirectionTo(bullseye.Center); + + // Use SOH-CAH-TOA to compute the angle which is needed to reach the edge of the bullseye from the center of the NPC. + // The length of the hypotenuse is the distance from the center of the NPC to the bullseye while the opposite side length is + // the circular hitbox radius of the bullseye. These are sufficient to calculate the angular margin of error. + // If an NPC has a tiny hitbox the arcsine will fail and return NaN, meaning any hit at all will cause a bullseye to be hit. + // In these cases, simply set the "limit" to an extremely large value. + float angularOffsetToEdgeOfBullseye = (float)Math.Asin(baseBullseyeRadius / npc.Distance(bullseye.Center)); + if (float.IsNaN(angularOffsetToEdgeOfBullseye)) + angularOffsetToEdgeOfBullseye = 1000f; + float orthogonalityToBullseye = directionToBullseye.AngleBetween(bullseyeCenterOffsetDirection); + + hasCollidedWithBullseye = orthogonalityToBullseye < angularOffsetToEdgeOfBullseye; } + else + hasCollidedWithBullseye = projectile.WithinRange(bullseye.Center, bullseye.scale * baseBullseyeRadius); // Do a very high amount of damage if hitting a bullseye. if (hasCollidedWithBullseye && bullseye.ai[1] == 0f) @@ -3441,7 +3493,13 @@ namespace CalamityMod.NPCs if (CalamityLists.pierceResistList.Contains(npc.type)) PierceResistGlobal(projectile, npc, ref damage); - if (ThanatosIDs.Contains(npc.type)) + if (AresIDs.Contains(npc.type)) + { + // 25% resist to true melee. + if (projectile.Calamity().trueMelee) + damage = (int)(damage * 0.75); + } + else if (ThanatosIDs.Contains(npc.type)) { // 50% resist to true melee. if (projectile.Calamity().trueMelee) @@ -3455,15 +3513,15 @@ namespace CalamityMod.NPCs } else if (AstrumDeusIDs.Contains(npc.type)) { - // 75% resist to Stardust Dragon Staff and Plaguenades. - if (ProjectileID.Sets.StardustDragon[projectile.type] || projectile.type == ProjectileType() || projectile.type == ProjectileType()) + // 75% resist to Plaguenades. + if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) damage = (int)(damage * 0.25); // 50% resist to true melee. else if (projectile.Calamity().trueMelee) damage = (int)(damage * 0.5); - // 25% resist to Lazhar, Inferno Fork, Cosmic Rainbow, Plague Staff, Resurrection Butterfly, Eidolon Staff and Charged Blaster Cannon. + // 25% resist to Resurrection Butterfly. else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) damage = (int)(damage * 0.75); } @@ -3474,7 +3532,7 @@ namespace CalamityMod.NPCs damage = (int)(damage * 0.7); // 20% resist to Executioner's Blade stealth strikes. - if (projectile.type == ProjectileType()) + else if (projectile.type == ProjectileType()) damage = (int)(damage * 0.8); } else if (DevourerOfGodsIDs.Contains(npc.type)) @@ -3494,30 +3552,18 @@ namespace CalamityMod.NPCs } else if (StormWeaverIDs.Contains(npc.type)) { - // 10% resist to Shattered Sun. - if (projectile.type == ProjectileType()) - damage = (int)(damage * 0.9); - // 25% resist to Molten Amputator blobs. - else if (projectile.type == ProjectileType()) + if (projectile.type == ProjectileType()) damage = (int)(damage * 0.75); // 50% resist to true melee, Elemental Axe, Dazzling Stabber Staff and Pristine Fury. else if (projectile.Calamity().trueMelee || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) damage = (int)(damage * 0.5); - - // 90% resist to Stardust Dragon Staff. - else if (ProjectileID.Sets.StardustDragon[projectile.type]) - damage = (int)(damage * 0.1); } else if (DestroyerIDs.Contains(npc.type)) { - // 25% resist to Spear of Paleolith, Desecrated Water, Kelvin Catalyst and Pearlwood Bow. - if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) - damage = (int)(damage * 0.75); - // 50% resist to true melee and Dormant Brimseekers. - else if (projectile.Calamity().trueMelee || projectile.type == ProjectileType()) + if (projectile.Calamity().trueMelee || projectile.type == ProjectileType()) damage = (int)(damage * 0.5); } else if (AquaticScourgeIDs.Contains(npc.type)) @@ -3552,37 +3598,13 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCType()) { - // 20.5% resist to Time Bolt. + // 20% resist to Time Bolt. if (projectile.type == ProjectileType()) - damage = (int)(damage * 0.795); + damage = (int)(damage * 0.8); - // 61% resist to Last Mourning. + // 60% resist to Last Mourning. else if (projectile.type == ProjectileType() || projectile.type == ProjectileID.FlamingJack) - damage = (int)(damage * 0.39); - } - else if (npc.type == NPCType()) - { - // 5% resist to Celestial Reaper. - if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) - damage = (int)(damage * 0.95); - } - else if (npc.type == NPCType()) - { - // 5% resist to Celestial Reaper. - if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) - damage = (int)(damage * 0.95); - } - else if (npc.type == NPCType()) - { - // 10% resist to Onyxia. - if (projectile.type == ProjectileID.BlackBolt) - damage = (int)(damage * 0.9); - } - else if (npc.type == NPCType() || npc.type == NPCType()) - { - // 10% resist to Phoenix Flame Barrage. - if (projectile.type == ProjectileType()) - damage = (int)(damage * 0.9); + damage = (int)(damage * 0.4); } else if (npc.type == NPCType()) { @@ -3601,6 +3623,14 @@ namespace CalamityMod.NPCs // 10% resist to Surge Driver's alt click comets and Executioner's Blade stealth strikes. else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) damage = (int)(damage * 0.9); + + // 10% resist to Celestus. + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + damage = (int)(damage * 0.9); + + // 15% vulnerability to the Atom Splitter (Yes, this is kinda weird, but it's what Piky asked for). + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + damage = (int)(damage * 1.15); } else if (npc.type == NPCID.CultistBoss) { @@ -3629,13 +3659,17 @@ namespace CalamityMod.NPCs damage = (int)(damage * 0.2); } + // Thanatos segments do not trigger pierce resistance if they are closed + if (ThanatosIDs.Contains(npc.type) && unbreakableDR) + return; + float damageReduction = projectile.Calamity().timesPierced * projectile.Calamity().PierceResistHarshness; if (damageReduction > projectile.Calamity().PierceResistCap) damageReduction = projectile.Calamity().PierceResistCap; damage -= (int)(damage * damageReduction); - if ((projectile.penetrate > 1 || projectile.penetrate == -1) && !projectile.IsSummon() && projectile.aiStyle != 99) + if ((projectile.penetrate > 1 || projectile.penetrate == -1) && !CalamityLists.pierceResistExceptionList.Contains(projectile.type) && !projectile.IsSummon() && projectile.aiStyle != 15 && projectile.aiStyle != 39 && projectile.aiStyle != 99) projectile.Calamity().timesPierced++; } #endregion @@ -3913,9 +3947,55 @@ namespace CalamityMod.NPCs safeRangeX = (int)(1920 / 16 * 0.32); //0.52 } } - #endregion + #endregion + + #region Edit Spawn Pool + + internal static readonly FieldInfo MaxSpawnsField = typeof(NPC).GetField("maxSpawns", BindingFlags.NonPublic | BindingFlags.Static); + public static void AttemptToSpawnLabCritters(Player player) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + return; + + int spawnRate = 400; + int maxSpawnCount = (int)MaxSpawnsField.GetValue(null); + NPCLoader.EditSpawnRate(player, ref spawnRate, ref maxSpawnCount); + for (int i = 0; i < 18; i++) + { + int checkPositionX = (int)(player.Center.X / 16 + Main.rand.Next(30, 54) * Main.rand.NextBool(2).ToDirectionInt()); + int checkPositionY = (int)(player.Center.Y / 16 + Main.rand.Next(24, 45) * Main.rand.NextBool(2).ToDirectionInt()); + Vector2 checkPosition = new Vector2(checkPositionX, checkPositionY); + + Tile aboveSpawnTile = CalamityUtils.ParanoidTileRetrieval(checkPositionX, checkPositionY - 1); + bool nearLab = CalamityUtils.ManhattanDistance(checkPosition, CalamityWorld.SunkenSeaLabCenter / 16f) < 180f; + nearLab |= CalamityUtils.ManhattanDistance(checkPosition, CalamityWorld.PlanetoidLabCenter / 16f) < 180f; + nearLab |= CalamityUtils.ManhattanDistance(checkPosition, CalamityWorld.JungleLabCenter / 16f) < 180f; + nearLab |= CalamityUtils.ManhattanDistance(checkPosition, CalamityWorld.HellLabCenter / 16f) < 180f; + nearLab |= CalamityUtils.ManhattanDistance(checkPosition, CalamityWorld.IceLabCenter / 16f) < 180f; + + bool isLabWall = aboveSpawnTile.wall == WallType() || aboveSpawnTile.wall == WallType() || aboveSpawnTile.wall == WallType(); + isLabWall |= aboveSpawnTile.wall == WallType() || aboveSpawnTile.wall == WallType() || aboveSpawnTile.wall == WallType(); + if (!isLabWall || !nearLab || Collision.SolidCollision((checkPosition - new Vector2(2f, 2f)).ToWorldCoordinates(), 4, 4) || player.activeNPCs >= maxSpawnCount || !Main.rand.NextBool(spawnRate)) + continue; + + WeightedRandom pool = new WeightedRandom(); + pool.Add(NPCID.None, 0f); + pool.Add(NPCType(), 0.5f); + + int typeToSpawn = pool.Get(); + if (typeToSpawn != NPCID.None) + { + int spawnedNPC = NPCLoader.SpawnNPC(typeToSpawn, checkPositionX, checkPositionY - 1); + if (Main.netMode == NetmodeID.Server && spawnedNPC < Main.maxNPCs) + { + Main.npc[spawnedNPC].position.Y -= 8f; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, spawnedNPC); + return; + } + } + } + } - #region Edit Spawn Pool public override void EditSpawnPool(IDictionary pool, NPCSpawnInfo spawnInfo) { bool calamityBiomeZone = spawnInfo.player.Calamity().ZoneAbyss || @@ -4027,8 +4107,10 @@ namespace CalamityMod.NPCs pool[NPCID.VoodooDemon] = SpawnCondition.Underworld.Chance * 0.75f; } - if (spawnInfo.player.Calamity().disableVoodooSpawns && pool.ContainsKey(NPCID.VoodooDemon)) - pool.Remove(NPCID.VoodooDemon); + if (spawnInfo.player.Calamity().disableVoodooSpawns && pool.ContainsKey(NPCID.VoodooDemon)) + { + pool.Remove(NPCID.VoodooDemon); + } } #endregion @@ -4176,7 +4258,7 @@ namespace CalamityMod.NPCs { if (Main.rand.Next(5) < 4) { - int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, (int)CalamityDusts.PurpleCosmolite, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.5f); + int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, (int)CalamityDusts.PurpleCosmilite, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.2f; Main.dust[dust].velocity.Y -= 0.15f; @@ -4214,7 +4296,7 @@ namespace CalamityMod.NPCs { int num3 = Utils.SelectRandom(Main.rand, new int[] { - (int)CalamityDusts.PurpleCosmolite, + (int)CalamityDusts.PurpleCosmilite, 27, 234 }); @@ -4249,7 +4331,7 @@ namespace CalamityMod.NPCs { if (Main.rand.Next(5) < 4) { - int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, (int)CalamityDusts.PurpleCosmolite, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.5f); + int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, (int)CalamityDusts.PurpleCosmilite, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.2f; Main.dust[dust].velocity.Y -= 0.15f; diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 15d6d06753..3bb683a376 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -87,10 +87,11 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.KingSlime) { - // Drop a huge spray of Gel items - int minGel = Main.expertMode ? 90 : 60; - int maxGel = Main.expertMode ? 120 : 80; - DropHelper.DropItemSpray(npc, ItemID.Gel, minGel, maxGel, 2); + // Drop a huge spray of Gel items + // More gel is not dropped on Expert because he has more minions, which increases the amount of gel provided. + int minGel = 72; + int maxGel = 100; + DropHelper.DropItemSpray(npc, ItemID.Gel, minGel, maxGel, 4); // Legendary drop for King Slime DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); @@ -295,9 +296,12 @@ namespace CalamityMod.NPCs }; DropHelper.DropEntireSet(npc, DropHelper.NormalWeaponDropRateFloat, planteraWeapons); DropHelper.BlockDrops(planteraWeapons); - } - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 12, 18); + // Equipment + DropHelper.DropItemChance(npc, ModContent.ItemType(), 5); + } + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 12, 18); DropHelper.DropItemCondition(npc, ItemID.JungleKey, !Main.expertMode, 5, 1, 1); // Legendary drop for Plantera diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 533ef54323..e1a26ac05e 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -610,7 +610,7 @@ namespace CalamityMod.NPCs { if (Main.rand.NextBool(20)) { - chat = "Could you be so kind as to, ah...check hell for me...? I left someone I kind of care about down there."; + chat = "Could you be so kind as to, ah... check hell for me...? I left someone I kind of care about down there."; } if (Main.rand.NextBool(20)) @@ -789,7 +789,7 @@ namespace CalamityMod.NPCs case NPCID.Dryad: if (Main.rand.NextBool(5) && CalamityWorld.downedDoG && Main.eclipse) { - chat = "There's a dark solar energy emanating from the moths that appear during this time. Ah, the moths as you progress further get more powerful...hmm...what power was Yharon holding back?"; + chat = "There's a dark solar energy emanating from the moths that appear during this time. Ah, the moths as you progress further get more powerful... hmm... what power was Yharon holding back?"; } if (Main.rand.NextBool(5) && Main.hardMode) @@ -831,7 +831,7 @@ namespace CalamityMod.NPCs if (Main.rand.NextBool(15)) { - chat = Main.npc[fapsol].GivenName + " is always trying to brighten my mood...even if, deep down, I know she's sad."; + chat = Main.npc[fapsol].GivenName + " is always trying to brighten my mood... even if, deep down, I know she's sad..."; } } if ((npc.GivenName == "Amber" ? Main.rand.NextBool(10) : Main.rand.NextBool(15)) && Main.LocalPlayer.Calamity().pArtifact) @@ -854,7 +854,7 @@ namespace CalamityMod.NPCs } if (Main.rand.NextBool(10) && NPC.downedMoonlord) { - chat = "You know...we haven't had an invasion in a while..."; + chat = "You know... we haven't had an invasion in a while..."; } break; @@ -908,12 +908,12 @@ namespace CalamityMod.NPCs if (Main.rand.NextBool(5) && Main.eclipse) { - chat = "Um...should my nightlight be on?"; + chat = "Um... should my nightlight be on?"; } if (Main.rand.NextBool(5) && fapsol != -1) { - chat = "Well, I like " + Main.npc[fapsol].GivenName + ", but I, ah...I have my eyes on someone else."; + chat = "Well, I like " + Main.npc[fapsol].GivenName + ", but I, ah... I have my eyes on someone else."; } if (Main.rand.NextBool(5) && CalamityWorld.rainingAcid) @@ -976,7 +976,7 @@ namespace CalamityMod.NPCs case NPCID.Cyborg: if (Main.rand.NextBool(10) && Main.raining) { - chat = "All these moments will be lost in time. Like tears...in the rain."; + chat = "All these moments will be lost in time. Like tears... in the rain."; } if (NPC.downedMoonlord) @@ -988,7 +988,7 @@ namespace CalamityMod.NPCs if (Main.rand.NextBool(10)) { - chat = "Draedon? He's...a little 'high octane' if you know what I mean."; + chat = "Draedon? He's... a little 'high octane' if you know what I mean."; } } @@ -1009,12 +1009,12 @@ namespace CalamityMod.NPCs if (Main.rand.NextBool(10)) { - chat = "Those screams...I'm not sure why, but I feel like a nameless fear has awoken in my heart."; + chat = "Those screams... I'm not sure why, but I feel like a nameless fear has awoken in my heart."; } if (Main.rand.NextBool(10)) { - chat = "I can faintly hear ghostly shrieks from the dungeon...and not ones I'm familiar with at all. Just what is going on in there?"; + chat = "I can faintly hear ghostly shrieks from the dungeon... and not ones I'm familiar with at all. Just what is going on in there?"; } } @@ -1237,8 +1237,8 @@ namespace CalamityMod.NPCs { SetShopItem(ref shop, ref nextSlot, ItemType(), Main.LocalPlayer.Calamity().rogueStealthMax > 0f && Main.LocalPlayer.Calamity().wearingRogueArmor); SetShopItem(ref shop, ref nextSlot, ItemType(), Main.LocalPlayer.wingTimeMax > 0); - SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.revenge && CalamityConfig.Instance.Rippers); - SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.revenge && CalamityConfig.Instance.Rippers); + SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.revenge); + SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.revenge); SetShopItem(ref shop, ref nextSlot, ItemID.StylistKilLaKillScissorsIWish, true, Item.buyPrice(0, 15)); } @@ -1356,7 +1356,6 @@ namespace CalamityMod.NPCs SetShopItem(ref shop, ref nextSlot, ItemID.LihzahrdPowerCell, NPC.downedGolemBoss && CalamityConfig.Instance.SellVanillaSummons, Item.buyPrice(0, 30)); SetShopItem(ref shop, ref nextSlot, ItemID.ButterflyDust, NPC.downedGolemBoss, Item.buyPrice(0, 10)); SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedScavenger, Item.buyPrice(0, 50)); - SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedPlaguebringer, Item.buyPrice(0, 50)); SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedBumble, Item.buyPrice(5)); } diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 3ba094cea9..51309e5ddf 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -235,7 +235,7 @@ namespace CalamityMod.NPCs.CeaselessVoid for (int k = 0; k < 5; k++) { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); + int dust = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, hitDirection, -1f, 0, default, 1f); Main.dust[dust].noGravity = true; } @@ -249,7 +249,7 @@ namespace CalamityMod.NPCs.CeaselessVoid npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) @@ -260,10 +260,10 @@ namespace CalamityMod.NPCs.CeaselessVoid } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 2f; } diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index 9412cd31e6..cfb7fcfa8e 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -292,7 +292,7 @@ namespace CalamityMod.NPCs.CeaselessVoid { for (int k = 0; k < 20; k++) { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); + int dust = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, hitDirection, -1f, 0, default, 1f); Main.dust[dust].noGravity = true; } } diff --git a/NPCs/Crabulon/CrabulonIdle.cs b/NPCs/Crabulon/CrabulonIdle.cs index f3847667e7..98f3bea9e3 100644 --- a/NPCs/Crabulon/CrabulonIdle.cs +++ b/NPCs/Crabulon/CrabulonIdle.cs @@ -86,9 +86,12 @@ namespace CalamityMod.NPCs.Crabulon // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } // Phases bool phase2 = lifeRatio < 0.66f && expertMode; @@ -280,41 +283,49 @@ namespace CalamityMod.NPCs.Crabulon npc.velocity.X = (npc.velocity.X * 20f - num823) / 21f; } - int num854 = 80; - int num855 = 20; - Vector2 position2 = new Vector2(npc.Center.X - (num854 / 2), npc.position.Y + npc.height - num855); + if (Collision.CanHit(npc.position, npc.width, npc.height, player.Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height) && player.position.Y <= npc.position.Y + npc.height) + { + npc.noGravity = false; + npc.noTileCollide = false; + } + else + { + npc.noGravity = true; + npc.noTileCollide = true; - bool fallDownOnTopOfTarget = npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width && npc.position.Y + npc.height < player.position.Y + player.height - 16f; - if (fallDownOnTopOfTarget) - { - npc.velocity.Y += 0.5f; - } - else if (Collision.SolidCollision(position2, num854, num855)) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = 0f; + int num854 = 80; + int num855 = 20; + Vector2 position2 = new Vector2(npc.Center.X - (num854 / 2), npc.position.Y + npc.height - num855); - if (npc.velocity.Y > -0.2f) - npc.velocity.Y -= 0.025f; - else - npc.velocity.Y -= 0.2f; + bool fallDownOnTopOfTarget = npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width && npc.position.Y + npc.height < player.position.Y + player.height - 16f; + if (fallDownOnTopOfTarget) + { + npc.velocity.Y += 0.5f; + } + else if (Collision.SolidCollision(position2, num854, num855)) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y = 0f; - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; - } - else - { - if (npc.velocity.Y < 0f) - npc.velocity.Y = 0f; + if (npc.velocity.Y > -0.2f) + npc.velocity.Y -= 0.025f; + else + npc.velocity.Y -= 0.2f; - if (npc.velocity.Y < 0.1f) - npc.velocity.Y += 0.025f; - else - npc.velocity.Y += 0.5f; - } + if (npc.velocity.Y < -4f) + npc.velocity.Y = -4f; + } + else + { + if (npc.velocity.Y < 0f) + npc.velocity.Y = 0f; - if (npc.ai[1] % 25f == 24f) - npc.netUpdate = true; + if (npc.velocity.Y < 0.1f) + npc.velocity.Y += 0.025f; + else + npc.velocity.Y += 0.5f; + } + } npc.ai[1] += 1f; if (npc.ai[1] >= (360f - (death ? 120f * (1f - lifeRatio) : 0f))) diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index b7d487275e..1f89fb60ec 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -128,9 +128,12 @@ namespace CalamityMod.NPCs.Cryogen // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } // Phases bool phase2 = lifeRatio < (revenge ? 0.85f : 0.8f); @@ -1088,7 +1091,7 @@ namespace CalamityMod.NPCs.Cryogen { DropHelper.DropBags(npc); - // Legendar drop for Cryogen + // Legendary drops for Cryogen DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index d476040836..0deb863734 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -118,9 +118,12 @@ namespace CalamityMod.NPCs.DesertScourge // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } if (revenge || lifeRatio < (expertMode ? 0.75f : 0.5f)) npc.Calamity().newAI[0] += 1f; diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index 9e1ee2cefa..d3e305b140 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -232,7 +232,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -242,10 +242,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/DevourerofGods/DevourerofGodsBody2.cs b/NPCs/DevourerofGods/DevourerofGodsBody2.cs index 80fec51e4f..8c77d2a444 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody2.cs @@ -204,7 +204,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -214,10 +214,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/DevourerofGods/DevourerofGodsBodyS.cs b/NPCs/DevourerofGods/DevourerofGodsBodyS.cs index d9d295e2c0..1182e77abd 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBodyS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBodyS.cs @@ -244,7 +244,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -254,10 +254,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index e8f5e17eef..4adfc6b129 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -114,9 +114,12 @@ namespace CalamityMod.NPCs.DevourerofGods // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } bool phase2 = lifeRatio < 0.75f; bool phase3 = lifeRatio < 0.2f; @@ -960,7 +963,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -970,10 +973,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/DevourerofGods/DevourerofGodsHead2.cs b/NPCs/DevourerofGods/DevourerofGodsHead2.cs index ee155a3d42..9c456a39fc 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead2.cs @@ -367,7 +367,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -377,10 +377,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs index 066d4c7bae..34b668db1a 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs @@ -158,10 +158,6 @@ namespace CalamityMod.NPCs.DevourerofGods // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - // Variables Vector2 vector = npc.Center; bool flies = npc.ai[3] == 0f; @@ -170,7 +166,15 @@ namespace CalamityMod.NPCs.DevourerofGods bool expertMode = Main.expertMode || malice; bool revenge = CalamityWorld.revenge || malice; bool death = CalamityWorld.death || malice; - bool phase2 = lifeRatio < 0.8f; + + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } + + bool phase2 = lifeRatio < 0.8f; bool phase3 = lifeRatio < 0.6f; bool phase4 = lifeRatio < 0.3f; bool phase5 = lifeRatio < 0.15f; @@ -1340,7 +1344,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -1350,10 +1354,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index 7d65d93f10..3030d818fd 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -206,7 +206,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -216,10 +216,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/DevourerofGods/DevourerofGodsTail2.cs b/NPCs/DevourerofGods/DevourerofGodsTail2.cs index 123629defe..9b8f8a801b 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail2.cs @@ -191,7 +191,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -201,10 +201,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/DevourerofGods/DevourerofGodsTailS.cs b/NPCs/DevourerofGods/DevourerofGodsTailS.cs index 3e8edc1a42..a5516cbf0a 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTailS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTailS.cs @@ -281,7 +281,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -291,10 +291,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/DraedonLabThings/RepairUnitCritter.cs b/NPCs/DraedonLabThings/RepairUnitCritter.cs new file mode 100644 index 0000000000..c01975ffba --- /dev/null +++ b/NPCs/DraedonLabThings/RepairUnitCritter.cs @@ -0,0 +1,313 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Walls.DraedonStructures; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.DraedonLabThings +{ + public class RepairUnitCritter : ModNPC + { + public enum BehaviorState + { + WalkAround, + WalkOnWalls, + SitAndRecharge + } + + public Vector2 PreviousStuckPosition = Vector2.Zero; + + public BehaviorState CurrentState + { + get => (BehaviorState)(int)npc.ai[0]; + set => npc.ai[0] = (int)value; + } + + public ref float StuckCount => ref npc.ai[1]; + + public bool Initialized + { + get => npc.ai[2] == 1f; + set => npc.ai[2] = value.ToInt(); + } + public bool WantsToClimbOnSomeWall + { + get => npc.ai[3] == 1f; + set => npc.ai[3] = value.ToInt(); + } + + public ref float CurrentFrame => ref npc.localAI[0]; + public ref float Time => ref npc.localAI[1]; + public ref float ClimbTime => ref npc.localAI[2]; + + public const float Gravity = 0.4f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Repair Unit"); + Main.npcFrameCount[npc.type] = 17; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 0; + npc.width = 20; + npc.height = 22; + npc.lifeMax = 80; + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath44; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Time); + writer.Write(ClimbTime); + writer.WriteVector2(PreviousStuckPosition); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + Time = reader.ReadSingle(); + ClimbTime = reader.ReadSingle(); + PreviousStuckPosition = reader.ReadVector2(); + } + + public override void AI() + { + if (!Initialized) + { + npc.velocity = Vector2.UnitX * Main.rand.NextBool(2).ToDirectionInt() * 1.5f; + Initialized = true; + } + + npc.Calamity().ShouldFallThroughPlatforms = false; + switch (CurrentState) + { + case BehaviorState.WalkAround: + WalkAroundOnGround(); + ClimbTime = 0f; + break; + case BehaviorState.WalkOnWalls: + WalkOnWalls(); + ClimbTime++; + break; + } + Time++; + } + + public void WalkAroundOnGround() + { + // Fall onto the ground if mid-air. + npc.frameCounter += npc.velocity.Length() + 0.4f; + + Tile tileBelow = CalamityUtils.ParanoidTileRetrieval((int)(npc.Bottom.X / 16), (int)(npc.Bottom.Y / 16) + 1); + bool onSolidGround = WorldGen.SolidTile(tileBelow) || (tileBelow.active() && Main.tileSolidTop[tileBelow.type]); + float directionSign = Math.Sign(npc.velocity.X); + if (directionSign == 0f) + directionSign = npc.spriteDirection; + if (Math.Abs(npc.velocity.X) > 0.5f && onSolidGround) + npc.velocity.X = MathHelper.Lerp(npc.velocity.X, directionSign * 5f, 0.05f); + + // Enforce gravity. + npc.velocity.Y = MathHelper.Clamp(npc.velocity.Y + Gravity, -15f, 15f); + + // Handle directioning. + if (Math.Abs(npc.velocity.X) > 0.4f) + npc.spriteDirection = (npc.velocity.X > 0f).ToDirectionInt(); + + // Attempt to jump over gaps if they aren't too big. + Vector2 checkPosition = npc.Bottom + new Vector2(Math.Sign(npc.velocity.X) * 24f, 12f); + float? distanceToAheadBelowTile = CalamityUtils.DistanceToTileCollisionHit(checkPosition, Vector2.UnitX * directionSign); + if (onSolidGround && distanceToAheadBelowTile.HasValue && distanceToAheadBelowTile.Value >= 2 && distanceToAheadBelowTile.Value < 9) + { + Vector2 jumpDestination = npc.Center + Vector2.UnitX * npc.spriteDirection * (distanceToAheadBelowTile.Value * 16f + 8f); + npc.velocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(npc.Center, jumpDestination, Gravity, 8.5f); + } + + // Attempt to jump over vertical obstacles. + bool obstacleInWay = !Collision.CanHit(npc.Center - Vector2.UnitX * directionSign * 8f, 2, 2, npc.Center + Vector2.UnitX * directionSign * 80f, 8, 8); + if (onSolidGround && obstacleInWay) + { + Vector2 jumpDestination = npc.Center + Vector2.UnitX * npc.spriteDirection * 132f; + float? distanceToObstacle = CalamityUtils.DistanceToTileCollisionHit(npc.Center, Vector2.UnitX * directionSign); + float obstacleHeight = 0f; + for (int i = 0; i < 15; i++) + { + if (WorldGen.SolidTile((int)(npc.Center.X / 16 + (distanceToObstacle ?? 0) * npc.spriteDirection), (int)(npc.Center.Y / 16) - i)) + obstacleHeight++; + } + npc.velocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(npc.Center, jumpDestination, Gravity, 9f + StuckCount * 0.7f + obstacleHeight * 0.4f); + + if (MathHelper.Distance(npc.position.X, npc.oldPosition.X) < 0.2f) + { + StuckCount++; + if (StuckCount > 1f && !WantsToClimbOnSomeWall) + WantsToClimbOnSomeWall = true; + if (StuckCount > 2f) + { + npc.velocity.X *= -0.56f; + StuckCount = 0f; + } + PreviousStuckPosition = npc.Center; + } + npc.netUpdate = true; + } + + bool closeObstacleInWay = !Collision.CanHit(npc.Center, 2, 2, npc.Center + Vector2.UnitX * directionSign * 34f, 8, 8); + if (onSolidGround && closeObstacleInWay) + { + npc.velocity.X *= -0.7f; + npc.netUpdate = true; + } + + // Reset the stuck counter if the NPC has become sufficiently far away from the previous stuck postion, indicating that + // it is in fact, no longer stuck. + if (!npc.WithinRange(PreviousStuckPosition, 180f) && StuckCount > 0f) + { + StuckCount = 0f; + npc.netUpdate = true; + } + + // Handle walking frames. + if (npc.frameCounter >= 11f && Math.Abs(npc.velocity.Y) < 1f) + { + CurrentFrame = (CurrentFrame + 1f) % 8f; + npc.frameCounter = 0; + } + + if (Time % 300f == 299f && !WantsToClimbOnSomeWall) + { + WantsToClimbOnSomeWall = true; + npc.netUpdate = true; + } + + // If there are walls to clime on and this NPC wants to climb on some, do so. + if (WantsToClimbOnSomeWall && CalamityUtils.ParanoidTileRetrieval((int)npc.Center.X / 16, (int)npc.Center.Y / 16).wall > 0) + { + CurrentState = BehaviorState.WalkOnWalls; + StuckCount = 0f; + WantsToClimbOnSomeWall = false; + npc.position.Y -= 10f; + npc.netUpdate = true; + } + } + + public void WalkOnWalls() + { + StuckCount = 0f; + WantsToClimbOnSomeWall = false; + npc.Calamity().ShouldFallThroughPlatforms = true; + + // Generate unusual movement patterns based on sines. + // When two periodic functions are summed, the resulting function is periodic if the + // ratio of the b/a is rational, given periodic functions f and g: + // f(a * x) + g(b * x). However, if the ratio is irrational, then the result has no period. + // This is desirable for somewhat random wavy fluctuations. + // In this case, pi/1 (or simply pi) is used, which is indeed an irrational number. + float offsetAngle = (float)(Math.Sin(Time / 360f) + Math.Sin(MathHelper.Pi * Time / 360f)) * 0.003f; + + Vector2 currentDirection = npc.velocity.SafeNormalize((npc.rotation - MathHelper.PiOver2).ToRotationVector2()); + + // Turn much more quickly if there's no wall ahead. + Vector2 aheadCheckPosition = npc.Center + currentDirection * 120f; + Tile aheadTile = CalamityUtils.ParanoidTileRetrieval((int)(aheadCheckPosition.X / 16), (int)(aheadCheckPosition.Y / 16)); + bool aboutToCollideWithSomething = CalamityUtils.DistanceToTileCollisionHit(npc.Center - currentDirection * 5f, currentDirection) < 6f; + bool almostReadyToWalkAgain = ClimbTime > 445f; + + if (((aheadTile.wall == WallID.None || WorldGen.SolidTile(aheadTile)) && !almostReadyToWalkAgain) || aboutToCollideWithSomething) + { + float distanceToCollisionLeft = CalamityUtils.DistanceToTileCollisionHit(npc.Center - currentDirection.RotatedBy(MathHelper.PiOver2) * 5f, currentDirection.RotatedBy(MathHelper.PiOver2)) ?? 10000f; + float distanceToCollisionRight = CalamityUtils.DistanceToTileCollisionHit(npc.Center - currentDirection.RotatedBy(-MathHelper.PiOver2) * 5f, currentDirection.RotatedBy(-MathHelper.PiOver2)) ?? 10000f; + float steerRotation = distanceToCollisionLeft > distanceToCollisionRight ? MathHelper.PiOver2 : -MathHelper.PiOver2; + Vector2 idealVelocity = npc.velocity.RotatedBy(steerRotation); + npc.velocity = npc.velocity.MoveTowards(idealVelocity, 0.95f); + } + else + npc.velocity = npc.velocity.RotatedBy(offsetAngle); + npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero) * 1.56f; + + // Rebound on collision. + if (npc.collideX) + { + npc.velocity.X *= -0.8f; + npc.Center += npc.velocity * 2f; + } + if (npc.collideY) + { + npc.velocity.Y *= -0.8f; + npc.Center += npc.velocity * 2f; + } + + if (npc.velocity.Length() > 1.4f) + npc.rotation = npc.rotation.AngleLerp(npc.velocity.ToRotation() + MathHelper.PiOver2, 0.2f); + + if (Collision.SolidCollision(npc.position + Vector2.One * 24f, npc.width - 12, npc.height - 12)) + { + npc.velocity *= -1f; + npc.position.Y -= 5f; + } + + // Handle climbing frames. + npc.frameCounter++; + if (npc.frameCounter >= 4f) + { + if (CurrentFrame < 9) + CurrentFrame = 9f; + CurrentFrame++; + if (CurrentFrame >= Main.npcFrameCount[npc.type]) + CurrentFrame = 9f; + npc.frameCounter = 0; + } + + if (CalamityUtils.ParanoidTileRetrieval((int)(npc.Center.X / 16), (int)(npc.Center.Y / 16)).wall == WallID.None || ClimbTime > 620f) + { + CurrentState = BehaviorState.WalkAround; + npc.velocity = new Vector2(Main.rand.NextBool(2).ToDirectionInt() * 1.2f, 3f); + npc.rotation = 0f; + npc.netUpdate = true; + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int i = 0; i < 6; i++) + Dust.NewDustDirect(npc.position, npc.width, npc.height, 226); + if (npc.life <= 0) + { + for (int i = 1; i <= 3; i++) + Gore.NewGorePerfect(npc.Center, npc.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.7f, 1f), mod.GetGoreSlot($"Gores/DraedonLabCritters/RepairUnit{i}")); + } + } + + public override void NPCLoot() + { + DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 2, 4); + } + + public override void FindFrame(int frameHeight) + { + npc.frame.Y = (int)(CurrentFrame * frameHeight); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Texture2D critterTexture = Main.npcTexture[npc.type]; + Texture2D glowmask = ModContent.GetTexture("CalamityMod/NPCs/DraedonLabThings/RepairUnitCritterGlowmask"); + Vector2 drawPosition = npc.Center - Main.screenPosition + Vector2.UnitY * npc.gfxOffY; + SpriteEffects direction = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + spriteBatch.Draw(critterTexture, drawPosition, npc.frame, npc.GetAlpha(drawColor), npc.rotation, npc.frame.Size() * 0.5f, npc.scale, direction, 0f); + spriteBatch.Draw(glowmask, drawPosition, npc.frame, npc.GetAlpha(Color.White), npc.rotation, npc.frame.Size() * 0.5f, npc.scale, direction, 0f); + return false; + } + } +} diff --git a/NPCs/DraedonLabThings/RepairUnitCritter.png b/NPCs/DraedonLabThings/RepairUnitCritter.png new file mode 100644 index 0000000000..a7ff5c8d1c Binary files /dev/null and b/NPCs/DraedonLabThings/RepairUnitCritter.png differ diff --git a/NPCs/DraedonLabThings/RepairUnitCritterGlowmask.png b/NPCs/DraedonLabThings/RepairUnitCritterGlowmask.png new file mode 100644 index 0000000000..adcc586aa3 Binary files /dev/null and b/NPCs/DraedonLabThings/RepairUnitCritterGlowmask.png differ diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index 59e0d7ea3d..a95fa7c09f 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -1,7 +1,6 @@ using CalamityMod.Events; using CalamityMod.Items.Potions; using CalamityMod.Items.TreasureBags; -using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.Projectiles.Boss; @@ -13,6 +12,10 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using CalamityMod.Items.Placeables.Furniture.Trophies; +using System.Collections.Generic; +using CalamityMod.Skies; namespace CalamityMod.NPCs.ExoMechs.Apollo { @@ -37,8 +40,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo { Normal = 0, RocketBarrage = 1, - ChargeCombo = 2, - PhaseTransition = 3 + LineUpChargeCombo = 2, + ChargeCombo = 3, + PhaseTransition = 4 } public float AIState @@ -83,15 +87,37 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Max distance from the target before they are unable to hear sound telegraphs private const float soundDistance = 2800f; - // Total duration of attack telegraphs - public const float attackTelegraphDuration = 100f; + // Normal animation duration + private const float defaultAnimationDuration = 60f; // Total duration of the phase transition - public const float phaseTransitionDuration = 300f; + private const float phaseTransitionDuration = 180f; + + // Where the timer should be when the lens pops off + private const float lensPopTime = 48f; + + // Variable to pick a different location after each attack + private bool pickNewLocation = false; + + // Charge locations during the charge combo + private const int maxCharges = 4; + public Vector2[] chargeLocations = new Vector2[maxCharges] { default, default, default, default }; + + // Intensity of flash effects during the charge combo + public float ChargeComboFlash; + + // Primitive trail drawers for thrusters when charging + public PrimitiveTrail ChargeFlameTrail = null; + public PrimitiveTrail ChargeFlameTrailBig = null; + + // Primitive trail drawer for the ribbon things + public PrimitiveTrail RibbonTrail = null; public override void SetStaticDefaults() { - DisplayName.SetDefault("XS-01 Artemis"); + DisplayName.SetDefault("XS-03 Apollo"); + NPCID.Sets.TrailingMode[npc.type] = 3; + NPCID.Sets.TrailCacheLength[npc.type] = 15; } public override void SetDefaults() @@ -103,7 +129,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo npc.height = 226; npc.defense = 80; npc.DR_NERD(0.25f); - npc.LifeMaxNERB(1000000, 1150000, 500000); + npc.LifeMaxNERB(1300000, 1495000, 500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; @@ -120,10 +146,12 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; bossBag = ModContent.ItemType(); } - + public override void BossHeadSlot(ref int index) { - if (npc.life / (float)npc.lifeMax < 0.6f) + if (SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune) + index = -1; + else if (npc.life / (float)npc.lifeMax < 0.6f) index = phase2IconIndex; else index = phase1IconIndex; @@ -131,20 +159,36 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); + writer.Write(frameX); + writer.Write(frameY); + writer.Write(pickNewLocation); writer.Write(npc.dontTakeDamage); writer.Write(npc.localAI[0]); + writer.Write(npc.localAI[1]); + writer.Write(npc.localAI[2]); + writer.Write(npc.localAI[3]); for (int i = 0; i < 4; i++) + { writer.Write(npc.Calamity().newAI[i]); + writer.WriteVector2(chargeLocations[i]); + } } public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); + frameX = reader.ReadInt32(); + frameY = reader.ReadInt32(); + pickNewLocation = reader.ReadBoolean(); npc.dontTakeDamage = reader.ReadBoolean(); npc.localAI[0] = reader.ReadSingle(); + npc.localAI[1] = reader.ReadSingle(); + npc.localAI[2] = reader.ReadSingle(); + npc.localAI[3] = reader.ReadSingle(); for (int i = 0; i < 4; i++) + { npc.Calamity().newAI[i] = reader.ReadSingle(); + chargeLocations[i] = reader.ReadVector2(); + } } public override void AI() @@ -153,24 +197,29 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo CalamityGlobalNPC.draedonExoMechTwinGreen = npc.whoAmI; + npc.frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); + // Difficulty modes bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || malice; bool revenge = CalamityWorld.revenge || malice; bool expertMode = Main.expertMode || malice; + // Get a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(); + + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + npc.TargetClosest(); + + // Target variable + Player player = Main.player[npc.target]; + // Check if the other exo mechs are alive int otherExoMechsAlive = 0; bool exoWormAlive = false; bool exoPrimeAlive = false; - if (CalamityGlobalNPC.draedonExoMechWorm != -1) - { - if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) - { - otherExoMechsAlive++; - exoWormAlive = true; - } - } if (CalamityGlobalNPC.draedonExoMechTwinRed != -1) { if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].active) @@ -180,10 +229,24 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo npc.life = Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].life; } } + if (CalamityGlobalNPC.draedonExoMechWorm != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) + { + // Set target to Thanatos' target if Thanatos is alive + player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechWorm].target]; + + otherExoMechsAlive++; + exoWormAlive = true; + } + } if (CalamityGlobalNPC.draedonExoMechPrime != -1) { if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) { + // Set target to Ares' target if Ares is alive + player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; + otherExoMechsAlive++; exoPrimeAlive = true; } @@ -207,29 +270,36 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (exoWormAlive) exoWormPassive = Main.npc[CalamityGlobalNPC.draedonExoMechWorm].Calamity().newAI[1] == (float)ThanatosHead.SecondaryPhase.Passive; if (exoPrimeAlive) - exoPrimePassive = Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].Calamity().newAI[1] == (float)AresBody.SecondaryPhase.Passive; + exoPrimePassive = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Calamity().newAI[1] == (float)AresBody.SecondaryPhase.Passive; bool anyOtherExoMechPassive = exoWormPassive || exoPrimePassive; + // Used to nerf Artemis and Apollo if fighting alongside Ares, because otherwise it's too difficult + bool nerfedAttacks = false; + if (exoPrimeAlive) + nerfedAttacks = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Calamity().newAI[1] != (float)AresBody.SecondaryPhase.PassiveAndImmune; + + // Check if any of the other mechs were spawned first + bool exoWormWasFirst = false; + bool exoPrimeWasFirst = false; + if (exoWormAlive) + exoWormWasFirst = Main.npc[CalamityGlobalNPC.draedonExoMechWorm].ai[3] == 1f; + if (exoPrimeAlive) + exoPrimeWasFirst = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].ai[3] == 1f; + bool otherExoMechWasFirst = exoWormWasFirst || exoPrimeWasFirst; + + // Prevent mechs from being respawned + if (otherExoMechWasFirst) + npc.ai[3] = 1f; + // Phases bool phase2 = lifeRatio < 0.6f; - bool spawnOtherExoMechs = lifeRatio > 0.4f && otherExoMechsAlive == 0 && lifeRatio < 0.7f; + bool spawnOtherExoMechs = lifeRatio < 0.7f && npc.ai[3] == 0f; bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); bool lastMechAlive = berserk && otherExoMechsAlive == 0; // If Artemis and Apollo don't go berserk bool otherMechIsBerserk = exoWormLifeRatio < 0.4f || exoPrimeLifeRatio < 0.4f; - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); - - // Target variable - Player player = Main.player[npc.target]; - // Spawn Artemis if it doesn't exist after the first 10 frames have passed if (npc.ai[0] < 10f) { @@ -237,37 +307,12 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (npc.ai[0] == 10f && !NPC.AnyNPCs(ModContent.NPCType())) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); } - - // Despawn if target is dead - bool targetDead = false; - if (player.dead) + else { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (player.dead) + if (!NPC.AnyNPCs(ModContent.NPCType())) { - targetDead = true; - - AIState = (float)Phase.Normal; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - - npc.velocity.Y -= 2f; - if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 2f; - - if ((double)npc.position.Y < Main.topWorld + 16f) - { - for (int a = 0; a < Main.maxNPCs; a++) - { - if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) - Main.npc[a].active = false; - } - } + npc.active = false; + npc.netUpdate = true; } } @@ -302,7 +347,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Adjust opacity bool invisiblePhase = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune; - npc.dontTakeDamage = invisiblePhase; + npc.dontTakeDamage = invisiblePhase || AIState == (float)Phase.PhaseTransition; if (!invisiblePhase) { npc.Opacity += 0.2f; @@ -318,48 +363,176 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Predictiveness float predictionAmt = malice ? 16f : death ? 12f : revenge ? 10f : expertMode ? 8f : 4f; + if (nerfedAttacks) + predictionAmt *= 0.5f; if (SecondaryAIState == (int)SecondaryPhase.Passive) predictionAmt *= 0.5f; - Vector2 predictionVector = AIState == (int)Phase.RocketBarrage ? Vector2.Zero : player.velocity * predictionAmt; + // Gate values + float attackPhaseGateValue = lastMechAlive ? 300f : 480f; + float timeToLineUpAttack = 30f; + + // Distance where Apollo stops moving + float movementDistanceGateValue = 100f; + float chargeLocationDistanceGateValue = 20f; + + // Velocity and acceleration values + float baseVelocityMult = (berserk ? 0.25f : 0f) + (malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f); + float baseVelocity = 18f * baseVelocityMult; + + // Attack gate values + bool lineUpAttack = calamityGlobalNPC.newAI[3] >= attackPhaseGateValue + 2f; + bool doBigAttack = calamityGlobalNPC.newAI[3] >= attackPhaseGateValue + 2f + timeToLineUpAttack; + + // Charge velocity + float chargeVelocity = malice ? 115f : death ? 100f : revenge ? 95f : expertMode ? 90f : 75f; + + // Charge phase variables + double chargeDistance = Math.Sqrt(500D * 500D + 800D * 800D); + float chargeTime = (float)chargeDistance / chargeVelocity; + + // Plasma and rocket projectile velocities + float projectileVelocity = 14f; + if (lastMechAlive) + projectileVelocity *= 1.2f; + else if (berserk) + projectileVelocity *= 1.1f; + + // Rocket phase variables + float rocketPhaseDuration = lastMechAlive ? 60f : 90f; + int numRockets = lastMechAlive ? 4 : nerfedAttacks ? 2 : 3; + + // Default vector to fly to + float chargeComboXOffset = -500f; + float chargeComboYOffset = npc.ai[2] == 0f ? 400f : -400f; + Vector2 destination = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune ? new Vector2(player.Center.X + 1200f, player.Center.Y) : AIState == (float)Phase.LineUpChargeCombo ? new Vector2(player.Center.X + 750f, player.Center.Y + chargeComboYOffset) : new Vector2(player.Center.X + 750f, player.Center.Y); + + // If Apollo can fire projectiles, cannot fire if too close to the target + bool canFire = Vector2.Distance(npc.Center, player.Center) > 320f; // Rotation + Vector2 predictionVector = player.velocity * predictionAmt; + Vector2 aimedVector = player.Center + predictionVector - npc.Center; + float rateOfRotation = 0.1f; + Vector2 rotateTowards = player.Center - npc.Center; + bool readyToCharge = AIState == (float)Phase.LineUpChargeCombo && (Vector2.Distance(npc.Center, destination) <= chargeLocationDistanceGateValue || calamityGlobalNPC.newAI[2] > 0f); if (AIState == (int)Phase.ChargeCombo) { + rateOfRotation = 0f; npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; } + else if (AIState == (float)Phase.LineUpChargeCombo && chargeLocations[1] != default) + { + float x = chargeLocations[1].X - npc.Center.X; + float y = chargeLocations[1].Y - npc.Center.Y; + rotateTowards = Vector2.Normalize(new Vector2(x, y)) * baseVelocity; + } else { float x = player.Center.X + predictionVector.X - npc.Center.X; float y = player.Center.Y + predictionVector.Y - npc.Center.Y; - npc.rotation = (float)Math.Atan2(y, x) + MathHelper.PiOver2; + rotateTowards = Vector2.Normalize(new Vector2(x, y)) * baseVelocity; } + // Do not set this during charge or deathray phases + if (rateOfRotation != 0f) + npc.rotation = npc.rotation.AngleTowards((float)Math.Atan2(rotateTowards.Y, rotateTowards.X) + MathHelper.PiOver2, rateOfRotation); + // Light - Lighting.AddLight(npc.Center, 0.05f, 0.25f, 0.15f); + Lighting.AddLight(npc.Center, 0.05f * npc.Opacity, 0.25f * npc.Opacity, 0.15f * npc.Opacity); - // Default vector to fly to - Vector2 destination = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune ? new Vector2(player.Center.X + 1200f, player.Center.Y) : AIState == (float)Phase.ChargeCombo ? new Vector2(player.Center.X, player.Center.Y + 500f) : new Vector2(player.Center.X + 750f, player.Center.Y); - - // Velocity and acceleration values - float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; - float baseVelocity = 14f * baseVelocityMult; - float baseAcceleration = 1f; - float decelerationVelocityMult = 0.85f; - if (berserk) + // Despawn if target is dead + if (player.dead) { - baseVelocity *= 1.5f; - baseAcceleration *= 1.5f; + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (player.dead) + { + AIState = (float)Phase.Normal; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + for (int i = 0; i < maxCharges; i++) + chargeLocations[i] = default; + + npc.dontTakeDamage = true; + + npc.velocity.Y -= 1f; + if ((double)npc.position.Y < Main.topWorld + 16f) + npc.velocity.Y -= 1f; + + if ((double)npc.position.Y < Main.topWorld + 16f) + { + for (int a = 0; a < Main.maxNPCs; a++) + { + if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; + } + } + + return; + } } + + // Add some random distance to the destination after certain attacks + if (pickNewLocation) + { + pickNewLocation = false; + + npc.localAI[0] = Main.rand.Next(-50, 51); + npc.localAI[1] = Main.rand.Next(-250, 251); + if (AIState == (float)Phase.RocketBarrage) + { + npc.localAI[0] *= 0.5f; + npc.localAI[1] *= 0.5f; + } + + npc.netUpdate = true; + } + + // Add a bit of randomness to the destination, but only in specific phases where it's necessary + if (AIState == (float)Phase.Normal || AIState == (float)Phase.RocketBarrage || AIState == (float)Phase.PhaseTransition) + { + destination.X += npc.localAI[0]; + destination.Y += npc.localAI[1]; + } + + // Cause the charge visual effects to begin while performing or preparing for a combo + if (AIState == (float)Phase.LineUpChargeCombo || AIState == (float)Phase.ChargeCombo) + ChargeComboFlash = MathHelper.Clamp(ChargeComboFlash + 0.08f, 0f, 1f); + + // And have them go away afterwards + else + ChargeComboFlash = MathHelper.Clamp(ChargeComboFlash - 0.1f, 0f, 1f); + + // Destination variables Vector2 distanceFromDestination = destination - npc.Center; Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination) * baseVelocity; - // Distance where Apollo stops moving - float movementDistanceGateValue = 100f; + // Set to transition to phase 2 if it hasn't happened yet + if (phase2 && npc.localAI[3] == 0f) + { + AIState = (float)Phase.PhaseTransition; + npc.localAI[3] = 1f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; - // Gate values - float chargePhaseGateValue = lastMechAlive ? 300f : 480f; - float deathrayPhaseGateValue = lastMechAlive ? 630f : 900f; + // Set frames to phase transition frames, which begin on frame 30 + // Reset the frame counter + npc.frameCounter = 0D; + + // X = 3 sets to frame 27 + frameX = 3; + + // Y = 3 sets to frame 30 + frameY = 3; + } // Passive and Immune phases switch ((int)SecondaryAIState) @@ -372,12 +545,21 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (spawnOtherExoMechs) { // Reset everything + npc.ai[3] = 1f; SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + for (int i = 0; i < maxCharges; i++) + chargeLocations[i] = default; + npc.TargetClosest(); if (Main.netMode != NetmodeID.MultiplayerClient) { - // Spawn code here + // Spawn the fuckers NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); } @@ -392,6 +574,14 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo { // Tells Apollo to return to the battle in passive state and reset everything SecondaryAIState = (float)SecondaryPhase.Passive; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + for (int i = 0; i < maxCharges; i++) + chargeLocations[i] = default; + npc.TargetClosest(); } @@ -401,6 +591,14 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo { // Reset everything SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + for (int i = 0; i < maxCharges; i++) + chargeLocations[i] = default; + npc.TargetClosest(); } } @@ -410,11 +608,22 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Fire projectiles less often case (int)SecondaryPhase.Passive: + // Fire plasma while passive + AIState = (float)Phase.Normal; + // Enter passive and invincible phase if one of the other exo mechs is berserk if (otherMechIsBerserk) { // Reset everything SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + for (int i = 0; i < maxCharges; i++) + chargeLocations[i] = default; + npc.TargetClosest(); } @@ -422,6 +631,14 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (berserk) { // Reset everything + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + for (int i = 0; i < maxCharges; i++) + chargeLocations[i] = default; + npc.TargetClosest(); // Never be passive if berserk @@ -433,18 +650,37 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Fly above target and become immune case (int)SecondaryPhase.PassiveAndImmune: + // Do nothing while immune + AIState = (float)Phase.Normal; + // Enter the fight again if any of the other exo mechs is below 70% and the other mechs aren't berserk if ((exoWormLifeRatio < 0.7f || exoPrimeLifeRatio < 0.7f) && !otherMechIsBerserk) { // Tells Artemis and Apollo to return to the battle in passive state and reset everything // Return to normal phases if one or more mechs have been downed SecondaryAIState = totalOtherExoMechLifeRatio > 5f ? (float)SecondaryPhase.Nothing : (float)SecondaryPhase.Passive; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + for (int i = 0; i < maxCharges; i++) + chargeLocations[i] = default; + npc.TargetClosest(); } if (berserk) { // Reset everything + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + for (int i = 0; i < maxCharges; i++) + chargeLocations[i] = default; + npc.TargetClosest(); // Never be passive if berserk @@ -454,133 +690,389 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo break; } - // Needs edits // Attacking phases - /*switch ((int)AIState) + switch ((int)AIState) { - // Fly above the target + // Fly to the right of the target case (int)Phase.Normal: - if (!targetDead) - { - // Inverse lerp returns the percentage of progress between A and B - float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - // Min velocity - float minVelocity = distanceFromDestination.Length(); - float minVelocityCap = baseVelocity; - if (minVelocity > minVelocityCap) - minVelocity = minVelocityCap; + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = baseVelocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; + + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); - // Max velocity - Vector2 maxVelocity = distanceFromDestination / 24f; - float maxVelocityCap = minVelocityCap * 3f; - if (maxVelocity.Length() > maxVelocityCap) - maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + // Default animation for 60 frames and then go to telegraph animation + // newAI[3] tells Apollo what animation state it's currently in + bool attacking = calamityGlobalNPC.newAI[3] >= 2f; + bool firingPlasma = attacking && calamityGlobalNPC.newAI[3] + 2f < attackPhaseGateValue; - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); - } - - if (berserk) - { + // Only increase attack timer if not in immune phase + if (SecondaryAIState != (float)SecondaryPhase.PassiveAndImmune) calamityGlobalNPC.newAI[2] += 1f; - if (calamityGlobalNPC.newAI[2] > deathrayPhaseGateValue) + + if (calamityGlobalNPC.newAI[2] >= defaultAnimationDuration || attacking) + { + if (firingPlasma) { + // Fire plasma + int numPlasmaOrbs = lastMechAlive ? 16 : nerfedAttacks ? 8 : 12; + float divisor = attackPhaseGateValue / numPlasmaOrbs; + float plasmaTimer = calamityGlobalNPC.newAI[3] - 2f; + if (plasmaTimer % divisor == 0f && canFire) + { + pickNewLocation = true; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaCasterFire"), npc.Center); + Vector2 plasmaVelocity = Vector2.Normalize(aimedVector) * projectileVelocity; + Vector2 offset = Vector2.Normalize(plasmaVelocity) * 70f; + Projectile.NewProjectile(npc.Center + offset, plasmaVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); + } + } + } + else calamityGlobalNPC.newAI[2] = 0f; - AIState = (float)Phase.Deathrays; + + // Enter rocket phase after a certain time has passed + // Enter charge phase if in phase 2 and the localAI[2] variable is set to do so + calamityGlobalNPC.newAI[3] += 1f; + if (lineUpAttack) + { + // Return to normal plasma phase if in passive state + if (SecondaryAIState == (float)SecondaryPhase.Passive) + { + pickNewLocation = true; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + for (int i = 0; i < maxCharges; i++) + chargeLocations[i] = default; + + npc.TargetClosest(); + } + else if (doBigAttack) + { + pickNewLocation = npc.localAI[2] == 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + + if (phase2) + AIState = npc.localAI[2] == 1f ? (float)Phase.LineUpChargeCombo : (float)Phase.RocketBarrage; + else + AIState = (float)Phase.RocketBarrage; + } } } break; - // Move close to target, reduce velocity when close enough, create telegraph beams, fire deathrays - case (int)Phase.Deathrays: + // Charge + case (int)Phase.RocketBarrage: - if (!targetDead) + // Inverse lerp returns the percentage of progress between A and B + float lerpValue2 = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + + // Min velocity + float minVelocity2 = distanceFromDestination.Length(); + float minVelocityCap2 = baseVelocity; + if (minVelocity2 > minVelocityCap2) + minVelocity2 = minVelocityCap2; + + // Max velocity + Vector2 maxVelocity2 = distanceFromDestination / 24f; + float maxVelocityCap2 = minVelocityCap2 * 3f; + if (maxVelocity2.Length() > maxVelocityCap2) + maxVelocity2 = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap2; + + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity2, maxVelocity2, lerpValue2); + + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] % (rocketPhaseDuration / numRockets) == 0f && canFire) { - if (distanceFromTarget > deathrayDistanceGateValue && calamityGlobalNPC.newAI[3] == 0f) + pickNewLocation = true; + if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 desiredVelocity2 = Vector2.Normalize(distanceFromDestination) * baseVelocity; - npc.SimpleFlyMovement(desiredVelocity2, baseAcceleration); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Main.PlaySound(SoundID.Item36, npc.Center); + Vector2 rocketVelocity = Vector2.Normalize(aimedVector) * projectileVelocity; + Vector2 offset = Vector2.Normalize(rocketVelocity) * 70f; + Projectile.NewProjectile(npc.Center + offset, rocketVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); } - else - { - calamityGlobalNPC.newAI[3] = 1f; - npc.velocity *= decelerationVelocityMult; + } - int totalProjectiles = malice ? 12 : expertMode ? 10 : 8; + // Reset phase and variables + if (calamityGlobalNPC.newAI[2] >= rocketPhaseDuration) + { + // Go back to normal phase + AIState = (float)Phase.Normal; + npc.localAI[2] = berserk ? 1f : 0f; + calamityGlobalNPC.newAI[2] = 0f; + npc.TargetClosest(); + } + + break; + + // Get in position for the charge combo, don't do anything else until in position + // Fill up the charge location array with the positions Apollo will charge from + // Create telegraph beams between the charge location array positions + case (int)Phase.LineUpChargeCombo: + + if (!readyToCharge) + { + // Inverse lerp returns the percentage of progress between A and B + float lerpValue3 = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + + // Min velocity + float minVelocity3 = distanceFromDestination.Length(); + float minVelocityCap3 = baseVelocity; + if (minVelocity3 > minVelocityCap3) + minVelocity3 = minVelocityCap3; + + // Max velocity + Vector2 maxVelocity3 = distanceFromDestination / 24f; + float maxVelocityCap3 = minVelocityCap3 * 3f; + if (maxVelocity3.Length() > maxVelocityCap3) + maxVelocity3 = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap3; + + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity3, maxVelocity3, lerpValue3); + } + else + { + // Save the charge locations and create telegraph beams + int type = ModContent.ProjectileType(); + + for (int i = 0; i < maxCharges; i++) + { + if (chargeLocations[i] == default) + { + switch (i) + { + case 0: + chargeLocations[i] = npc.Center; + break; + case 1: + chargeLocations[i] = chargeLocations[0] + new Vector2(chargeComboXOffset, -chargeComboYOffset * 2f); + break; + case 2: + chargeLocations[i] = chargeLocations[1] + new Vector2(chargeComboXOffset, chargeComboYOffset * 2f); + break; + case 3: + chargeLocations[i] = chargeLocations[2] + new Vector2(chargeComboXOffset, -chargeComboYOffset * 2f); + break; + default: + break; + } + + if (i == 0) + { + // Draw telegraph beams + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int telegraph = Projectile.NewProjectile(chargeLocations[0], Vector2.Zero, type, 0, 0f, Main.myPlayer, 0f, npc.whoAmI); + if (Main.projectile.IndexInRange(telegraph)) + { + Main.projectile[telegraph].ModProjectile().ChargePositions = chargeLocations; + Main.projectile[telegraph].netUpdate = true; + } + } + + // Play a charge sound + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + } + } + } + + // Don't move + npc.velocity = Vector2.Zero; + + // Go to charge phase, create lightning bolts in the sky, and reset + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] >= timeToLineUpAttack) + { + ExoMechsSky.CreateLightningBolt(10); + + AIState = (float)Phase.ChargeCombo; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + } + } + + break; + + // Charge to several locations almost instantly (Apollo doesn't teleport here, he's just moving very fast :D) + case (int)Phase.ChargeCombo: + + // Set charge velocity and fire halos of plasma bolts + if (npc.localAI[2] == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ELRFire"), npc.Center); + npc.velocity = Vector2.Normalize(chargeLocations[(int)calamityGlobalNPC.newAI[2] + 1] - chargeLocations[(int)calamityGlobalNPC.newAI[2]]) * chargeVelocity; + npc.localAI[2] = 1f; + npc.netUpdate = true; + npc.netSpam -= 5; + + // Plasma bolts on charge + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int totalProjectiles = CalamityWorld.malice ? 12 : 8; float radians = MathHelper.TwoPi / totalProjectiles; - Vector2 laserSpawnPoint = new Vector2(npc.Center.X, npc.Center.Y); - bool normalLaserRotation = npc.localAI[0] % 2f == 0f; - float velocity = 6f; + int type = ModContent.ProjectileType(); + int damage = (int)(npc.GetProjectileDamage(ModContent.ProjectileType()) * 0.8); + float velocity = 1f; double angleA = radians * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; float velocityX2 = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-velocityX2, -velocity); - spinningPoint.Normalize(); - - calamityGlobalNPC.newAI[2] += 1f; - if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration) + Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX2, -velocity); + for (int k = 0; k < totalProjectiles; k++) { - // Fire deathray telegraph beams - if (calamityGlobalNPC.newAI[2] == 1f) - { - // Set frames to deathray charge up frames, which begin on frame 12 - // Reset the frame counter - npc.frameCounter = 0D; - - // X = 1 sets to frame 8 - frameX = 1; - - // Y = 4 sets to frame 12 - frameY = 4; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); - int type = ModContent.ProjectileType(); - Vector2 spawnPoint = npc.Center + new Vector2(-1f, 23f); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 laserVelocity = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(spawnPoint + Vector2.Normalize(laserVelocity) * 17f, laserVelocity, type, 0, 0f, Main.myPlayer, 0f, npc.whoAmI); - } - } - } + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.Center, velocity2, type, damage, 0f, Main.myPlayer); } - else + } + + // Dust rings + for (int i = 0; i < 200; i++) + { + float dustVelocity = 16f; + if (i < 150) + dustVelocity = 12f; + if (i < 100) + dustVelocity = 8f; + if (i < 50) + dustVelocity = 4f; + + int dust1 = Dust.NewDust(npc.Center, 6, 6, Main.rand.NextBool(2) ? 107 : 110, 0f, 0f, 100, default, 1f); + float dustVelX = Main.dust[dust1].velocity.X; + float dustVelY = Main.dust[dust1].velocity.Y; + + if (dustVelX == 0f && dustVelY == 0f) + dustVelX = 1f; + + float dustVelocity2 = (float)Math.Sqrt(dustVelX * dustVelX + dustVelY * dustVelY); + dustVelocity2 = dustVelocity / dustVelocity2; + dustVelX *= dustVelocity2; + dustVelY *= dustVelocity2; + + float scale = 1f; + switch ((int)dustVelocity) { - // Fire deathrays - if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TeslaCannonFire"), npc.Center); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 spawnPoint = npc.Center + new Vector2(-1f, 23f); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 laserVelocity = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(spawnPoint + Vector2.Normalize(laserVelocity) * 35f, laserVelocity, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - } - } - } + case 4: + scale = 1.2f; + break; + case 8: + scale = 1.1f; + break; + case 12: + scale = 1f; + break; + case 16: + scale = 0.9f; + break; + default: + break; } - if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration + deathrayDuration) - { - AIState = (float)Phase.Normal; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - npc.localAI[0] += 1f; - npc.TargetClosest(); - } + Dust dust2 = Main.dust[dust1]; + dust2.velocity *= 0.5f; + dust2.velocity.X = dust2.velocity.X + dustVelX; + dust2.velocity.Y = dust2.velocity.Y + dustVelY; + dust2.scale = scale; + dust2.noGravity = true; } } + // Initiate next charge if close enough to next charge location + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] >= chargeTime) + { + // Set Apollo's location to the next charge location + npc.Center = chargeLocations[(int)calamityGlobalNPC.newAI[2] + 1]; + + // Reset velocity to 0 + npc.velocity = Vector2.Zero; + + // Increase newAI[2] whenever a charge ends + calamityGlobalNPC.newAI[2] += 1f; + calamityGlobalNPC.newAI[3] = 0f; + npc.localAI[2] = 0f; + } + + // Reset phase and variables + if (calamityGlobalNPC.newAI[2] >= maxCharges - 1) + { + pickNewLocation = true; + AIState = (float)Phase.Normal; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + for (int i = 0; i < maxCharges; i++) + chargeLocations[i] = default; + ChargeComboFlash = 0f; + + npc.TargetClosest(); + } + break; - }*/ + + // Phase transition animation, that's all this exists for + case (int)Phase.PhaseTransition: + + // Inverse lerp returns the percentage of progress between A and B + float lerpValue4 = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + + // Min velocity + float minVelocity4 = distanceFromDestination.Length(); + float minVelocityCap4 = baseVelocity; + if (minVelocity4 > minVelocityCap4) + minVelocity4 = minVelocityCap4; + + // Max velocity + Vector2 maxVelocity4 = distanceFromDestination / 24f; + float maxVelocityCap4 = minVelocityCap4 * 3f; + if (maxVelocity4.Length() > maxVelocityCap4) + maxVelocity4 = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap4; + + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity4, maxVelocity4, lerpValue4); + + // Shoot lens gore at the target at the proper time + if (calamityGlobalNPC.newAI[2] == lensPopTime) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"), npc.Center); + Vector2 lensDirection = Vector2.Normalize(aimedVector); + Vector2 offset = lensDirection * 70f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.Center + offset, lensDirection * 24f, ModContent.ProjectileType(), 0, 0f); + } + + // Reset phase and variables + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] >= phaseTransitionDuration) + { + pickNewLocation = true; + AIState = (float)Phase.Normal; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + npc.TargetClosest(); + } + + break; + } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -602,7 +1094,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (dist4 < minDist) minDist = dist4; - return minDist <= 100f && npc.Opacity == 1f; + return minDist <= 100f && npc.Opacity == 1f && AIState == (float)Phase.ChargeCombo; } public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) => !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); @@ -613,14 +1105,14 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo return null; } - // Needs edits - /*public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { - // Use telegraph frames when using deathrays + // Use telegraph frames before each attack + bool phase2 = npc.life / (float)npc.lifeMax < 0.6f; npc.frameCounter += 1D; - if (AIState == (float)Phase.Normal || npc.Calamity().newAI[3] == 0f) + if (AIState == (float)Phase.PhaseTransition) { - if (npc.frameCounter >= 10D) + if (npc.frameCounter >= 6D) { // Reset frame counter npc.frameCounter = 0D; @@ -628,70 +1120,200 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Increment the Y frame frameY++; - // Reset the Y frame if greater than 8 + // Reset the Y frame if greater than 9 if (frameY == maxFramesY) { frameX++; frameY = 0; } - - // Reset the frames to frame 0 - if ((frameX * maxFramesY) + frameY > normalFrameLimit) - frameX = frameY = 0; } } else { - if (npc.frameCounter >= 10D) + if (AIState == (float)Phase.Normal) { - // Reset frame counter - npc.frameCounter = 0D; + int frameLimit = phase2 ? (npc.Calamity().newAI[3] == 0f ? normalFrameLimit_Phase2 : npc.Calamity().newAI[3] == 1f ? chargeUpFrameLimit_Phase2 : attackFrameLimit_Phase2) : + (npc.Calamity().newAI[3] == 0f ? normalFrameLimit_Phase1 : npc.Calamity().newAI[3] == 1f ? chargeUpFrameLimit_Phase1 : attackFrameLimit_Phase1); - // Increment the Y frame - frameY++; - - // Reset the Y frame if greater than 8 - if (frameY == maxFramesY) + if (npc.frameCounter >= 6D) { - frameX++; - frameY = 0; - } + // Reset frame counter + npc.frameCounter = 0D; - // Reset the frames to frame 36, the start of the deathray firing animation loop - if ((frameX * maxFramesY) + frameY > finalStageDeathrayChargeFrameLimit) - frameX = frameY = 4; + // Increment the Y frame + frameY++; + + // Reset the Y frame if greater than 9 + if (frameY == maxFramesY) + { + frameX++; + frameY = 0; + } + + // Reset the frames + int currentFrame = (frameX * maxFramesY) + frameY; + if (currentFrame > frameLimit) + frameX = frameY = phase2 ? (npc.Calamity().newAI[3] == 0f ? 6 : npc.Calamity().newAI[3] == 1f ? 7 : 8) : (npc.Calamity().newAI[3] == 0f ? 0 : npc.Calamity().newAI[3] == 1f ? 1 : 2); + } + } + else if (AIState == (float)Phase.RocketBarrage || AIState == (float)Phase.LineUpChargeCombo || AIState == (float)Phase.ChargeCombo) + { + int frameLimit = phase2 ? attackFrameLimit_Phase2 : attackFrameLimit_Phase1; + if (npc.frameCounter >= 6D) + { + // Reset frame counter + npc.frameCounter = 0D; + + // Increment the Y frame + frameY++; + + // Reset the Y frame if greater than 9 + if (frameY == maxFramesY) + { + frameX++; + frameY = 0; + } + + // Reset the frames + int currentFrame = (frameX * maxFramesY) + frameY; + if (currentFrame > frameLimit) + frameX = frameY = phase2 ? 8 : 2; + } } } - }*/ + } + + public float FlameTrailWidthFunction(float completionRatio) => MathHelper.SmoothStep(21f, 8f, completionRatio) * ChargeComboFlash; + + public float FlameTrailWidthFunctionBig(float completionRatio) => MathHelper.SmoothStep(34f, 12f, completionRatio) * ChargeComboFlash; + + public float RibbonTrailWidthFunction(float completionRatio) + { + float baseWidth = Utils.InverseLerp(1f, 0.54f, completionRatio, true) * 5f; + float endTipWidth = CalamityUtils.Convert01To010(Utils.InverseLerp(0.96f, 0.89f, completionRatio, true)) * 2.4f; + return baseWidth + endTipWidth; + } + + public Color FlameTrailColorFunction(float completionRatio) + { + float trailOpacity = Utils.InverseLerp(0.8f, 0.27f, completionRatio, true) * Utils.InverseLerp(0f, 0.067f, completionRatio, true); + Color startingColor = Color.Lerp(Color.White, Color.Cyan, 0.27f); + Color middleColor = Color.Lerp(Color.Orange, Color.ForestGreen, 0.74f); + Color endColor = Color.Lime; + return CalamityUtils.MulticolorLerp(completionRatio, startingColor, middleColor, endColor) * ChargeComboFlash * trailOpacity; + } + + public Color FlameTrailColorFunctionBig(float completionRatio) + { + float trailOpacity = Utils.InverseLerp(0.8f, 0.27f, completionRatio, true) * Utils.InverseLerp(0f, 0.067f, completionRatio, true) * 0.56f; + Color startingColor = Color.Lerp(Color.White, Color.Cyan, 0.25f); + Color middleColor = Color.Lerp(Color.Blue, Color.White, 0.35f); + Color endColor = Color.Lerp(Color.DarkBlue, Color.White, 0.47f); + Color color = CalamityUtils.MulticolorLerp(completionRatio, startingColor, middleColor, endColor) * ChargeComboFlash * trailOpacity; + color.A = 0; + return color; + } + + public Color RibbonTrailColorFunction(float completionRatio) + { + Color startingColor = new Color(34, 40, 48); + Color endColor = new Color(40, 160, 32); + return Color.Lerp(startingColor, endColor, (float)Math.Pow(completionRatio, 1.5D)) * npc.Opacity; + } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { + // Declare the trail drawers if they have yet to be defined. + if (ChargeFlameTrail is null) + ChargeFlameTrail = new PrimitiveTrail(FlameTrailWidthFunction, FlameTrailColorFunction, null, GameShaders.Misc["CalamityMod:ImpFlameTrail"]); + + if (ChargeFlameTrailBig is null) + ChargeFlameTrailBig = new PrimitiveTrail(FlameTrailWidthFunctionBig, FlameTrailColorFunctionBig, null, GameShaders.Misc["CalamityMod:ImpFlameTrail"]); + + if (RibbonTrail is null) + RibbonTrail = new PrimitiveTrail(RibbonTrailWidthFunction, RibbonTrailColorFunction); + + // Prepare the flame trail shader with its map texture. + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/ScarletDevilStreak")); + + int numAfterimages = ChargeComboFlash > 0f ? 0 : 5; Texture2D texture = Main.npcTexture[npc.type]; Rectangle frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); - Vector2 vector = new Vector2(npc.width / 2, npc.height / 2); + Vector2 origin = npc.Size * 0.5f; + Vector2 center = npc.Center - Main.screenPosition; Color afterimageBaseColor = Color.White; - int numAfterimages = 5; - if (CalamityConfig.Instance.Afterimages) + // Draws a single instance of a regular, non-glowmask based Artemis. + // This is created to allow easy duplication of them when drawing the charge. + void drawInstance(Vector2 drawOffset, Color baseColor) { - for (int i = 1; i < numAfterimages; i += 2) + if (CalamityConfig.Instance.Afterimages) { - Color afterimageColor = drawColor; - afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); - afterimageColor = npc.GetAlpha(afterimageColor); - afterimageColor *= (numAfterimages - i) / 15f; - Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + for (int i = 1; i < numAfterimages; i += 2) + { + Color afterimageColor = baseColor; + afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); + afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor *= (numAfterimages - i) / 15f; + Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; + afterimageCenter += origin * npc.scale + new Vector2(0f, npc.gfxOffY); + afterimageCenter += drawOffset; + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, origin, npc.scale, SpriteEffects.None, 0f); + } } + + spriteBatch.Draw(texture, center + drawOffset, frame, npc.GetAlpha(baseColor), npc.rotation, origin, npc.scale, SpriteEffects.None, 0f); } - Vector2 center = npc.Center - Main.screenPosition; - spriteBatch.Draw(texture, center, frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + // Draw ribbons near the main thruster + for (int direction = -1; direction <= 1; direction += 2) + { + Vector2 ribbonOffset = -Vector2.UnitY.RotatedBy(npc.rotation) * 14f; + ribbonOffset += Vector2.UnitX.RotatedBy(npc.rotation) * direction * 26f; + + float currentSegmentRotation = npc.rotation; + List ribbonDrawPositions = new List(); + for (int i = 0; i < 12; i++) + { + float ribbonCompletionRatio = i / 12f; + float wrappedAngularOffset = MathHelper.WrapAngle(npc.oldRot[i + 1] - currentSegmentRotation) * 0.3f; + float segmentRotationOffset = MathHelper.Clamp(wrappedAngularOffset, -0.12f, 0.12f); + + // Add a sinusoidal offset that goes based on time and completion ratio to create a waving-flag-like effect. + // This is dampened for the first few points to prevent weird offsets. It is also dampened by high velocity. + float sinusoidalRotationOffset = (float)Math.Sin(ribbonCompletionRatio * 2.22f + Main.GlobalTime * 3.4f) * 1.36f; + float sinusoidalRotationOffsetFactor = Utils.InverseLerp(0f, 0.37f, ribbonCompletionRatio, true) * direction * 24f; + sinusoidalRotationOffsetFactor *= Utils.InverseLerp(24f, 16f, npc.velocity.Length(), true); + + Vector2 sinusoidalOffset = Vector2.UnitY.RotatedBy(npc.rotation + sinusoidalRotationOffset) * sinusoidalRotationOffsetFactor; + Vector2 ribbonSegmentOffset = Vector2.UnitY.RotatedBy(currentSegmentRotation) * ribbonCompletionRatio * 540f + sinusoidalOffset; + ribbonDrawPositions.Add(npc.Center + ribbonSegmentOffset + ribbonOffset); + + currentSegmentRotation += segmentRotationOffset; + } + RibbonTrail.Draw(ribbonDrawPositions, -Main.screenPosition, 66); + } + + int instanceCount = (int)MathHelper.Lerp(1f, 15f, ChargeComboFlash); + Color baseInstanceColor = Color.Lerp(drawColor, Color.White, ChargeComboFlash); + baseInstanceColor.A = (byte)(int)(255f - ChargeComboFlash * 255f); + + spriteBatch.EnterShaderRegion(); + + drawInstance(Vector2.Zero, baseInstanceColor); + if (instanceCount > 1) + { + baseInstanceColor *= 0.04f; + float backAfterimageOffset = MathHelper.SmoothStep(0f, 2f, ChargeComboFlash); + for (int i = 0; i < instanceCount; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / instanceCount + Main.GlobalTime * 0.8f).ToRotationVector2() * backAfterimageOffset; + drawInstance(drawOffset, baseInstanceColor); + } + } texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Apollo/ApolloGlow"); - if (CalamityConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) @@ -701,13 +1323,45 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo afterimageColor = npc.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; + afterimageCenter += origin * npc.scale + new Vector2(0f, npc.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, origin, npc.scale, SpriteEffects.None, 0f); } } - spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, origin, npc.scale, SpriteEffects.None, 0f); + + spriteBatch.ExitShaderRegion(); + + // Draw a flame trail on the thrusters if needed. This happens during charges. + if (ChargeComboFlash > 0f) + { + for (int direction = -1; direction <= 1; direction++) + { + Vector2 baseDrawOffset = new Vector2(0f, direction == 0f ? 18f : 60f).RotatedBy(npc.rotation); + baseDrawOffset += new Vector2(direction * 64f, 0f).RotatedBy(npc.rotation); + + float backFlameLength = direction == 0f ? 700f : 190f; + Vector2 drawStart = npc.Center + baseDrawOffset; + Vector2 drawEnd = drawStart - (npc.rotation - MathHelper.PiOver2).ToRotationVector2() * ChargeComboFlash * backFlameLength; + Vector2[] drawPositions = new Vector2[] + { + drawStart, + drawEnd + }; + + if (direction == 0) + { + for (int i = 0; i < 4; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 8f; + ChargeFlameTrailBig.Draw(drawPositions, drawOffset - Main.screenPosition, 70); + } + } + else + ChargeFlameTrail.Draw(drawPositions, -Main.screenPosition, 70); + } + } return false; } @@ -728,9 +1382,6 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo public override void NPCLoot() { - // DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - // DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - // Check if the other exo mechs are alive bool otherExoMechsAlive = false; if (CalamityGlobalNPC.draedonExoMechWorm != -1) @@ -745,7 +1396,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo } if (!otherExoMechsAlive) - AresBody.DropExoMechLoot(npc); + AresBody.DropExoMechLoot(npc, (int)AresBody.MechType.ArtemisAndApollo); } // Needs edits @@ -770,16 +1421,31 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo Main.dust[num195].noGravity = true; } - /*Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresBody1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresBody2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresBody3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresBody4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresBody5"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresBody6"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresBody7"), 1f);*/ + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Apollo/Apollo1"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Apollo/Apollo2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Apollo/Apollo3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Apollo/Apollo4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Apollo/Apollo5"), 1f); } } + public override bool CheckDead() + { + // Kill Artemis if he's still alive when Apollo dies + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC nPC = Main.npc[i]; + if (nPC.active && nPC.type == ModContent.NPCType() && nPC.life > 0) + { + nPC.life = 0; + nPC.HitEffect(0, 10.0); + nPC.checkDead(); + nPC.active = false; + } + } + return true; + } + public override bool CheckActive() => false; public override void ScaleExpertStats(int numPlayers, float bossLifeScale) diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index d6df87a6d4..dae7da08f8 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -1,13 +1,18 @@ using CalamityMod.Events; +using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Items.LoreItems; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Mounts; +using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Potions; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.NPCs.ExoMechs.Apollo; -using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; +using CalamityMod.Skies; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -22,6 +27,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares [AutoloadBossHead] public class AresBody : ModNPC { + // Used for loot + public enum MechType + { + Ares = 0, + Thanatos = 1, + ArtemisAndApollo = 2 + } + public enum Phase { Normal = 0, @@ -47,6 +60,23 @@ namespace CalamityMod.NPCs.ExoMechs.Ares set => npc.Calamity().newAI[1] = value; } + public enum Enraged + { + No = 0, + Yes = 1 + } + + public float EnragedState + { + get => npc.localAI[1]; + set => npc.localAI[1] = value; + } + + public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); + + // Spawn rate for enrage steam + public const int ventCloudSpawnRate = 3; + // Number of frames on the X and Y axis private const int maxFramesX = 6; private const int maxFramesY = 8; @@ -73,9 +103,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Total duration of the deathrays public const float deathrayDuration = 600f; + // Max distance from the target before they are unable to hear sound telegraphs + private const float soundDistance = 4800f; + public override void SetStaticDefaults() { DisplayName.SetDefault("XF-09 Ares"); + NPCID.Sets.TrailingMode[npc.type] = 3; + NPCID.Sets.TrailCacheLength[npc.type] = npc.oldPos.Length; } public override void SetDefaults() @@ -86,7 +121,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.height = 252; npc.defense = 100; npc.DR_NERD(0.35f); - npc.LifeMaxNERB(1000000, 1150000, 500000); + npc.LifeMaxNERB(1300000, 1495000, 500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; @@ -104,14 +139,20 @@ namespace CalamityMod.NPCs.ExoMechs.Ares bossBag = ModContent.ItemType(); } - public override void SendExtraAI(BinaryWriter writer) + public override void BossHeadSlot(ref int index) + { + if (SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune) + index = -1; + } + + public override void SendExtraAI(BinaryWriter writer) { writer.Write(frameX); writer.Write(frameY); writer.Write(armsSpawned); - writer.Write(npc.chaseable); writer.Write(npc.dontTakeDamage); writer.Write(npc.localAI[0]); + writer.Write(npc.localAI[1]); for (int i = 0; i < 4; i++) writer.Write(npc.Calamity().newAI[i]); } @@ -121,9 +162,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares frameX = reader.ReadInt32(); frameY = reader.ReadInt32(); armsSpawned = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); npc.dontTakeDamage = reader.ReadBoolean(); npc.localAI[0] = reader.ReadSingle(); + npc.localAI[1] = reader.ReadSingle(); for (int i = 0; i < 4; i++) npc.Calamity().newAI[i] = reader.ReadSingle(); } @@ -134,6 +175,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares CalamityGlobalNPC.draedonExoMechPrime = npc.whoAmI; + npc.frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); + // Difficulty modes bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || malice; @@ -229,8 +272,21 @@ namespace CalamityMod.NPCs.ExoMechs.Ares exoTwinsPassive = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].Calamity().newAI[1] == (float)Apollo.Apollo.SecondaryPhase.Passive; bool anyOtherExoMechPassive = exoWormPassive || exoTwinsPassive; + // Check if any of the other mechs were spawned first + bool exoWormWasFirst = false; + bool exoTwinsWereFirst = false; + if (exoWormAlive) + exoWormWasFirst = Main.npc[CalamityGlobalNPC.draedonExoMechWorm].ai[3] == 1f; + if (exoTwinsAlive) + exoTwinsWereFirst = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].ai[3] == 1f; + bool otherExoMechWasFirst = exoWormWasFirst || exoTwinsWereFirst; + + // Prevent mechs from being respawned + if (otherExoMechWasFirst) + npc.ai[3] = 1f; + // Phases - bool spawnOtherExoMechs = lifeRatio > 0.4f && otherExoMechsAlive == 0 && lifeRatio < 0.7f; + bool spawnOtherExoMechs = lifeRatio < 0.7f && npc.ai[3] == 0f; bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); bool lastMechAlive = berserk && otherExoMechsAlive == 0; @@ -248,39 +304,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Target variable Player player = Main.player[npc.target]; - // Despawn if target is dead - bool targetDead = false; - if (player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (player.dead) - { - targetDead = true; - - AIState = (float)Phase.Normal; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - - npc.velocity.Y -= 2f; - if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 2f; - - if ((double)npc.position.Y < Main.topWorld + 16f) - { - for (int a = 0; a < Main.maxNPCs; a++) - { - if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) - Main.npc[a].active = false; - } - } - } - } - // General AI pattern // 0 - Fly above target // 1 - Fly towards the target, slow down when close enough @@ -330,22 +353,57 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.rotation = npc.velocity.X * 0.003f; // Light - float lightScale = 765f; - Lighting.AddLight(npc.Center, Main.DiscoR / lightScale, Main.DiscoG / lightScale, Main.DiscoB / lightScale); + if (EnragedState == (float)Enraged.Yes) + { + Lighting.AddLight(npc.Center, 0.5f * npc.Opacity, 0f, 0f); + } + else + { + float lightScale = 510f; + Lighting.AddLight(npc.Center, Main.DiscoR / lightScale * npc.Opacity, Main.DiscoG / lightScale * npc.Opacity, Main.DiscoB / lightScale * npc.Opacity); + } + + // Despawn if target is dead + if (player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (player.dead) + { + AIState = (float)Phase.Normal; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + npc.dontTakeDamage = true; + + npc.velocity.Y -= 1f; + if ((double)npc.position.Y < Main.topWorld + 16f) + npc.velocity.Y -= 1f; + + if ((double)npc.position.Y < Main.topWorld + 16f) + { + for (int a = 0; a < Main.maxNPCs; a++) + { + if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; + } + } + + return; + } + } // Default vector to fly to Vector2 destination = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune ? new Vector2(player.Center.X, player.Center.Y - 800f) : AIState != (float)Phase.Deathrays ? new Vector2(player.Center.X, player.Center.Y - 425f) : player.Center; // Velocity and acceleration values - float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; - float baseVelocity = 14f * baseVelocityMult; - float baseAcceleration = 1f; + float baseVelocityMult = (berserk ? 0.25f : 0f) + (malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f); + float baseVelocity = (EnragedState == (float)Enraged.Yes ? 26f : 18f) * baseVelocityMult; + float baseAcceleration = berserk ? 1.25f : 1f; float decelerationVelocityMult = 0.85f; - if (berserk) - { - baseVelocity *= 1.5f; - baseAcceleration *= 1.5f; - } Vector2 distanceFromDestination = destination - npc.Center; Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination) * baseVelocity; @@ -359,6 +417,26 @@ namespace CalamityMod.NPCs.ExoMechs.Ares float deathrayPhaseGateValue = lastMechAlive ? 630f : 900f; float deathrayDistanceGateValue = 480f; + // Enter deathray phase again more quickly if enraged + if (EnragedState == (float)Enraged.Yes) + deathrayPhaseGateValue *= 0.5f; + + // Emit steam while enraged + SmokeDrawer.ParticleSpawnRate = 9999999; + if (EnragedState == (float)Enraged.Yes) + { + SmokeDrawer.ParticleSpawnRate = ventCloudSpawnRate; + SmokeDrawer.BaseMoveRotation = npc.rotation + MathHelper.PiOver2; + SmokeDrawer.SpawnAreaCompactness = 80f; + + // Increase DR during enrage + npc.Calamity().DR = 0.85f; + } + else + npc.Calamity().DR = 0.35f; + + SmokeDrawer.Update(); + // Passive and Immune phases switch ((int)SecondaryAIState) { @@ -370,12 +448,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (spawnOtherExoMechs) { // Reset everything + npc.ai[3] = 1f; SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; npc.TargetClosest(); if (Main.netMode != NetmodeID.MultiplayerClient) { - // Spawn code here + // Spawn the fuckers NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); @@ -459,25 +538,22 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Fly above the target case (int)Phase.Normal: - if (!targetDead) - { - // Inverse lerp returns the percentage of progress between A and B - float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - // Min velocity - float minVelocity = distanceFromDestination.Length(); - float minVelocityCap = baseVelocity; - if (minVelocity > minVelocityCap) - minVelocity = minVelocityCap; + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = baseVelocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; - // Max velocity - Vector2 maxVelocity = distanceFromDestination / 24f; - float maxVelocityCap = minVelocityCap * 3f; - if (maxVelocity.Length() > maxVelocityCap) - maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); - } + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); if (berserk) { @@ -486,6 +562,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { calamityGlobalNPC.newAI[2] = 0f; AIState = (float)Phase.Deathrays; + + // Cancel enrage state if Ares is enraged + if (EnragedState == (float)Enraged.Yes) + EnragedState = (float)Enraged.No; } } @@ -494,86 +574,104 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Move close to target, reduce velocity when close enough, create telegraph beams, fire deathrays case (int)Phase.Deathrays: - if (!targetDead) + if (distanceFromTarget > deathrayDistanceGateValue && calamityGlobalNPC.newAI[3] == 0f) { - if (distanceFromTarget > deathrayDistanceGateValue && calamityGlobalNPC.newAI[3] == 0f) + Vector2 desiredVelocity2 = Vector2.Normalize(distanceFromDestination) * baseVelocity; + npc.SimpleFlyMovement(desiredVelocity2, baseAcceleration); + } + else + { + // Enrage if the target is more than the deathray length away + if (distanceFromTarget > 3600f && EnragedState == (float)Enraged.No) { - Vector2 desiredVelocity2 = Vector2.Normalize(distanceFromDestination) * baseVelocity; - npc.SimpleFlyMovement(desiredVelocity2, baseAcceleration); + // Play enrage sound + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < soundDistance) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AresEnraged"), + (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); + } + + // Draedon comments on how foolish it is to run + if (Main.netMode != NetmodeID.MultiplayerClient) + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonAresEnrageText", new Color(155, 255, 255)); + + // Enrage + EnragedState = (float)Enraged.Yes; + } + + calamityGlobalNPC.newAI[3] = 1f; + npc.velocity *= decelerationVelocityMult; + + int totalProjectiles = malice ? 12 : expertMode ? 10 : 8; + float radians = MathHelper.TwoPi / totalProjectiles; + Vector2 laserSpawnPoint = new Vector2(npc.Center.X, npc.Center.Y); + bool normalLaserRotation = npc.localAI[0] % 2f == 0f; + float velocity = 6f; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX2 = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-velocityX2, -velocity); + spinningPoint.Normalize(); + + calamityGlobalNPC.newAI[2] += (EnragedState == (float)Enraged.Yes && calamityGlobalNPC.newAI[2] % 2f == 0f) ? 2f : 1f; + if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration) + { + // Fire deathray telegraph beams + if (calamityGlobalNPC.newAI[2] == 1f) + { + // Set frames to deathray charge up frames, which begin on frame 12 + // Reset the frame counter + npc.frameCounter = 0D; + + // X = 1 sets to frame 8 + frameX = 1; + + // Y = 4 sets to frame 12 + frameY = 4; + + // Create a bunch of lightning bolts in the sky + ExoMechsSky.CreateLightningBolt(12); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + int type = ModContent.ProjectileType(); + Vector2 spawnPoint = npc.Center + new Vector2(-1f, 23f); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 laserVelocity = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(spawnPoint + Vector2.Normalize(laserVelocity) * 17f, laserVelocity, type, 0, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + } + } } else { - calamityGlobalNPC.newAI[3] = 1f; - npc.velocity *= decelerationVelocityMult; - - int totalProjectiles = malice ? 12 : expertMode ? 10 : 8; - float radians = MathHelper.TwoPi / totalProjectiles; - Vector2 laserSpawnPoint = new Vector2(npc.Center.X, npc.Center.Y); - bool normalLaserRotation = npc.localAI[0] % 2f == 0f; - float velocity = 6f; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX2 = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-velocityX2, -velocity); - spinningPoint.Normalize(); - - calamityGlobalNPC.newAI[2] += 1f; - if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration) + // Fire deathrays + if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration) { - // Fire deathray telegraph beams - if (calamityGlobalNPC.newAI[2] == 1f) + if (Main.netMode != NetmodeID.MultiplayerClient) { - // Set frames to deathray charge up frames, which begin on frame 12 - // Reset the frame counter - npc.frameCounter = 0D; - - // X = 1 sets to frame 8 - frameX = 1; - - // Y = 4 sets to frame 12 - frameY = 4; - - if (Main.netMode != NetmodeID.MultiplayerClient) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TeslaCannonFire"), npc.Center); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Vector2 spawnPoint = npc.Center + new Vector2(-1f, 23f); + for (int k = 0; k < totalProjectiles; k++) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); - int type = ModContent.ProjectileType(); - Vector2 spawnPoint = npc.Center + new Vector2(-1f, 23f); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 laserVelocity = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(spawnPoint + Vector2.Normalize(laserVelocity) * 17f, laserVelocity, type, 0, 0f, Main.myPlayer, 0f, npc.whoAmI); - } - } - } - } - else - { - // Fire deathrays - if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TeslaCannonFire"), npc.Center); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 spawnPoint = npc.Center + new Vector2(-1f, 23f); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 laserVelocity = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(spawnPoint + Vector2.Normalize(laserVelocity) * 35f, laserVelocity, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - } + Vector2 laserVelocity = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(spawnPoint + Vector2.Normalize(laserVelocity) * 35f, laserVelocity, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); } } } + } - if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration + deathrayDuration) - { - AIState = (float)Phase.Normal; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - npc.localAI[0] += 1f; - npc.TargetClosest(); - } + if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration + deathrayDuration) + { + AIState = (float)Phase.Normal; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + npc.localAI[0] += 1f; + npc.TargetClosest(); } } @@ -597,7 +695,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.frameCounter += 1D; if (AIState == (float)Phase.Normal || npc.Calamity().newAI[3] == 0f) { - if (npc.frameCounter >= 10D) + if (npc.frameCounter >= 6D) { // Reset frame counter npc.frameCounter = 0D; @@ -619,7 +717,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } else { - if (npc.frameCounter >= 10D) + if (npc.frameCounter >= 6D) { // Reset frame counter npc.frameCounter = 0D; @@ -643,10 +741,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { + // Draw the enrage smoke behind Ares + SmokeDrawer.DrawSet(npc.Center); + Texture2D texture = Main.npcTexture[npc.type]; Rectangle frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); Vector2 vector = new Vector2(npc.width / 2, npc.height / 2); - Color afterimageBaseColor = Color.White; + Color afterimageBaseColor = EnragedState == (float)Enraged.Yes ? Color.Red : Color.White; int numAfterimages = 5; if (CalamityConfig.Instance.Afterimages) @@ -658,9 +759,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares afterimageColor = npc.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], vector, npc.scale, SpriteEffects.None, 0f); } } @@ -678,13 +779,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares afterimageColor = npc.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], vector, npc.scale, SpriteEffects.None, 0f); } } - spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, center, frame, afterimageBaseColor * npc.Opacity, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); return false; } @@ -696,8 +797,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void NPCLoot() { - // DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - // Check if the other exo mechs are alive bool otherExoMechsAlive = false; if (CalamityGlobalNPC.draedonExoMechWorm != -1) @@ -713,38 +812,101 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Mark Exo Mechs as dead if (!otherExoMechsAlive) - DropExoMechLoot(npc); + DropExoMechLoot(npc, (int)MechType.Ares); } - public static void DropExoMechLoot(NPC npc) + public static void DropExoMechLoot(NPC npc, int mechType) { - DropHelper.DropBags(npc); + // Dropped before the downed variable is set to true + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedExoMechs); - // DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedExoMechs); + switch (mechType) + { + case (int)MechType.Ares: + + DropHelper.DropItem(npc, ModContent.ItemType()); + + CalamityWorld.downedAres = true; + CalamityWorld.downedExoMechs = true; + CalamityNetcode.SyncWorld(); + + break; + + case (int)MechType.Thanatos: + + DropHelper.DropItem(npc, ModContent.ItemType()); + + CalamityWorld.downedThanatos = true; + CalamityWorld.downedExoMechs = true; + CalamityNetcode.SyncWorld(); + + break; + + case (int)MechType.ArtemisAndApollo: + + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + + CalamityWorld.downedArtemisAndApollo = true; + CalamityWorld.downedExoMechs = true; + CalamityNetcode.SyncWorld(); + + break; + } + + DropHelper.DropBags(npc); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) { + // Materials + DropHelper.DropItem(npc, ModContent.ItemType(), true, 24, 32); + // Weapons - float w = DropHelper.NormalWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(npc, - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w) - ); + // Higher chance due to how the drops work + float w = DropHelper.NormalWeaponDropRateFloat * 2f; + if (CalamityWorld.downedAres) + { + DropHelper.DropEntireWeightedSet(npc, + DropHelper.WeightStack(w), + DropHelper.WeightStack(w) + ); + } + if (CalamityWorld.downedThanatos) + { + DropHelper.DropEntireWeightedSet(npc, + DropHelper.WeightStack(w), + DropHelper.WeightStack(w) + ); + } + if (CalamityWorld.downedArtemisAndApollo) + { + DropHelper.DropEntireWeightedSet(npc, + DropHelper.WeightStack(w), + DropHelper.WeightStack(w) + ); + } + + // Equipment + DropHelper.DropItemChance(npc, ModContent.ItemType(), 5); // Vanity - // DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); - // DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); - // DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); - // DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); - } + // Higher chance due to how the drops work + float maskDropRate = 1f / 3.5f; + if (CalamityWorld.downedThanatos) + DropHelper.DropItemChance(npc, ModContent.ItemType(), maskDropRate); - CalamityWorld.downedExoMechs = true; - CalamityNetcode.SyncWorld(); + if (CalamityWorld.downedArtemisAndApollo) + { + DropHelper.DropItemChance(npc, ModContent.ItemType(), maskDropRate); + DropHelper.DropItemChance(npc, ModContent.ItemType(), maskDropRate); + } + + if (CalamityWorld.downedAres) + DropHelper.DropItemChance(npc, ModContent.ItemType(), maskDropRate); + + DropHelper.DropItemChance(npc, ModContent.ItemType(), maskDropRate); + } } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs index 96cda887b1..e4fdc81815 100644 --- a/NPCs/ExoMechs/Ares/AresGaussNuke.cs +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -1,5 +1,6 @@ using CalamityMod.Events; using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -12,7 +13,6 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Ares { - //[AutoloadBossHead] public class AresGaussNuke : ModNPC { public enum Phase @@ -28,6 +28,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares set => npc.Calamity().newAI[0] = value; } + public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); + // Number of frames on the X and Y axis private const int maxFramesX = 9; private const int maxFramesY = 12; @@ -47,14 +49,16 @@ namespace CalamityMod.NPCs.ExoMechs.Ares private const float defaultLifeRatio = 5f; // Total duration of the gauss nuke telegraph - private const float gaussNukeTelegraphDuration = 360f; + private const float gaussNukeTelegraphDuration = 216f; // Total duration of the gauss nuke firing phase - private const float gaussNukeReloadDuration = 600f; + private const float gaussNukeReloadDuration = 360f; public override void SetStaticDefaults() { DisplayName.SetDefault("XF-09 Ares Gauss Nuke"); + NPCID.Sets.TrailingMode[npc.type] = 3; + NPCID.Sets.TrailCacheLength[npc.type] = npc.oldPos.Length; } public override void SetDefaults() @@ -64,14 +68,15 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.width = 170; npc.height = 120; npc.defense = 80; - npc.DR_NERD(0.25f); - npc.LifeMaxNERB(1000000, 1150000, 500000); + npc.DR_NERD(0.35f); + npc.LifeMaxNERB(1300000, 1495000, 500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.Opacity = 0f; npc.knockBackResist = 0f; + npc.canGhostHeal = false; npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; @@ -85,7 +90,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { writer.Write(frameX); writer.Write(frameY); - writer.Write(npc.chaseable); writer.Write(npc.dontTakeDamage); for (int i = 0; i < 4; i++) writer.Write(npc.Calamity().newAI[i]); @@ -95,16 +99,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { frameX = reader.ReadInt32(); frameY = reader.ReadInt32(); - npc.chaseable = reader.ReadBoolean(); npc.dontTakeDamage = reader.ReadBoolean(); for (int i = 0; i < 4; i++) npc.Calamity().newAI[i] = reader.ReadSingle(); } - public override void AI() - { + public override void AI() + { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + npc.frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); + if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) { npc.life = 0; @@ -125,6 +130,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Check if the other exo mechs are alive int otherExoMechsAlive = 0; + bool exoTwinsAlive = false; if (CalamityGlobalNPC.draedonExoMechWorm != -1) { if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) @@ -133,9 +139,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) { if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) + { otherExoMechsAlive++; + exoTwinsAlive = true; + } } + // Used to nerf Ares if fighting alongside Artemis and Apollo, because otherwise it's too difficult + bool nerfedAttacks = false; + if (exoTwinsAlive) + nerfedAttacks = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].Calamity().newAI[1] != (float)Apollo.Apollo.SecondaryPhase.PassiveAndImmune; + // Phases bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); bool lastMechAlive = berserk && otherExoMechsAlive == 0; @@ -149,44 +163,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (npc.life > Main.npc[(int)npc.ai[1]].life) npc.life = Main.npc[(int)npc.ai[1]].life; - // Despawn if target is dead - bool targetDead = false; - if (player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (player.dead) - { - targetDead = true; - - AIState = (float)Phase.Nothing; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - - npc.velocity.Y -= 2f; - if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 2f; - - if ((double)npc.position.Y < Main.topWorld + 16f) - { - for (int a = 0; a < Main.maxNPCs; a++) - { - if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) - Main.npc[a].active = false; - } - } - } - } - CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)npc.ai[2]].Calamity(); // Passive phase check bool passivePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.Passive; + // Enrage check + bool enraged = Main.npc[(int)npc.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes; + // Adjust opacity bool invisiblePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune; npc.dontTakeDamage = invisiblePhase; @@ -205,6 +189,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Predictiveness float predictionAmt = malice ? 20f : death ? 15f : revenge ? 12.5f : expertMode ? 10f : 5f; + if (nerfedAttacks) + predictionAmt *= 0.5f; if (passivePhase) predictionAmt *= 0.5f; @@ -243,16 +229,49 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } // Light - Lighting.AddLight(npc.Center, 0.2f, 0.25f, 0.05f); + if (enraged) + Lighting.AddLight(npc.Center, 0.5f * npc.Opacity, 0f, 0f); + else + Lighting.AddLight(npc.Center, 0.2f * npc.Opacity, 0.25f * npc.Opacity, 0.05f * npc.Opacity); + + // Despawn if target is dead + if (player.dead) + { + player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; + if (player.dead) + { + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + npc.dontTakeDamage = true; + + npc.velocity.Y -= 1f; + if ((double)npc.position.Y < Main.topWorld + 16f) + npc.velocity.Y -= 1f; + + if ((double)npc.position.Y < Main.topWorld + 16f) + { + for (int a = 0; a < Main.maxNPCs; a++) + { + if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; + } + } + + return; + } + } // Default vector to fly to Vector2 destination = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + 540f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + 540f) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + 560f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y); // Velocity and acceleration values - float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; - float baseVelocity = 16f * baseVelocityMult; - if (berserk) - baseVelocity *= 1.5f; + float baseVelocityMult = (berserk ? 0.25f : 0f) + (malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f); + float baseVelocity = (enraged ? 30f : 22f) * baseVelocityMult; Vector2 distanceFromDestination = destination - npc.Center; @@ -260,11 +279,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares float movementDistanceGateValue = 50f; // Gate values - float gaussNukePhaseGateValue = 600f; - if (lastMechAlive) - gaussNukePhaseGateValue *= 0.7f; + float gaussNukePhaseGateValue = 750f; + if (enraged) + gaussNukePhaseGateValue *= 0.05f; + else if (lastMechAlive) + gaussNukePhaseGateValue *= 0.1f; else if (berserk) - gaussNukePhaseGateValue *= 0.85f; + gaussNukePhaseGateValue *= 0.45f; // Variable to disable deathray firing bool doNotFire = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays || calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune; @@ -275,6 +296,22 @@ namespace CalamityMod.NPCs.ExoMechs.Ares calamityGlobalNPC.newAI[2] = 0f; } + // Emit steam while enraged + SmokeDrawer.ParticleSpawnRate = 9999999; + if (enraged) + { + SmokeDrawer.ParticleSpawnRate = AresBody.ventCloudSpawnRate; + SmokeDrawer.BaseMoveRotation = npc.rotation + MathHelper.Pi; + SmokeDrawer.SpawnAreaCompactness = 40f; + + // Increase DR during enrage + npc.Calamity().DR = 0.85f; + } + else + npc.Calamity().DR = 0.35f; + + SmokeDrawer.Update(); + // Attacking phases switch ((int)AIState) { @@ -293,59 +330,57 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Fire gauss nuke that emits a wave pounder stealth strike-size explosion on death case (int)Phase.GaussNuke: - if (!targetDead) + calamityGlobalNPC.newAI[2] += 1f; + float telegraphDuration = enraged ? (gaussNukeTelegraphDuration * 0.5f) : gaussNukeTelegraphDuration; + if (calamityGlobalNPC.newAI[2] < telegraphDuration) { - calamityGlobalNPC.newAI[2] += 1f; - if (calamityGlobalNPC.newAI[2] < gaussNukeTelegraphDuration) + // Set frames to gauss nuke charge up frames, which begin on frame 12 + if (calamityGlobalNPC.newAI[2] == 1f) { - // Set frames to gauss nuke charge up frames, which begin on frame 12 - if (calamityGlobalNPC.newAI[2] == 1f) - { - // Reset the frame counter - npc.frameCounter = 0D; - - // X = 1 sets to frame 12 - frameX = 1; - - // Y = 0 sets to frame 12 - frameY = 0; - } - - // Fire gauss nuke on frame 41 - if ((frameX * maxFramesY) + frameY == 41 && calamityGlobalNPC.newAI[1] == 0f) - { - calamityGlobalNPC.newAI[1] = 1f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"), npc.Center); - Vector2 gaussNukeVelocity = Vector2.Normalize(rotationVector) * projectileVelocity; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float offset = 40f; - Projectile.NewProjectile(npc.Center + Vector2.Normalize(gaussNukeVelocity) * offset, gaussNukeVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); - - // Recoil - npc.velocity -= gaussNukeVelocity; - } - } - } - else - { - // Set frames to gauss nuke reload frames, which begin on frame 48 - AIState = (float)Phase.Reload; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - // Reset the frame counter npc.frameCounter = 0D; - // X = 1 sets to frame 48 - frameX = 4; + // X = 1 sets to frame 12 + frameX = 1; - // Y = 0 sets to frame 48 + // Y = 0 sets to frame 12 frameY = 0; } + + // Fire gauss nuke on frame 41 + if ((frameX * maxFramesY) + frameY == 41 && calamityGlobalNPC.newAI[1] == 0f) + { + calamityGlobalNPC.newAI[1] = 1f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"), npc.Center); + Vector2 gaussNukeVelocity = Vector2.Normalize(rotationVector) * projectileVelocity; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float offset = 40f; + Projectile.NewProjectile(npc.Center + Vector2.Normalize(gaussNukeVelocity) * offset, gaussNukeVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + + // Recoil + npc.velocity -= gaussNukeVelocity; + } + } + } + else + { + // Set frames to gauss nuke reload frames, which begin on frame 48 + AIState = (float)Phase.Reload; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + + // Reset the frame counter + npc.frameCounter = 0D; + + // X = 1 sets to frame 48 + frameX = 4; + + // Y = 0 sets to frame 48 + frameY = 0; } break; @@ -353,36 +388,33 @@ namespace CalamityMod.NPCs.ExoMechs.Ares case (int)Phase.Reload: calamityGlobalNPC.newAI[2] += 1f; - if (calamityGlobalNPC.newAI[2] >= gaussNukeReloadDuration) + float reloadDuration = enraged ? (gaussNukeReloadDuration * 0.5f) : gaussNukeReloadDuration; + if (calamityGlobalNPC.newAI[2] >= reloadDuration) { AIState = (float)Phase.Nothing; calamityGlobalNPC.newAI[2] = 0f; - npc.TargetClosest(); } break; } // Movement - if (!targetDead) - { - // Inverse lerp returns the percentage of progress between A and B - float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - // Min velocity - float minVelocity = distanceFromDestination.Length(); - float minVelocityCap = baseVelocity; - if (minVelocity > minVelocityCap) - minVelocity = minVelocityCap; + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = baseVelocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; - // Max velocity - Vector2 maxVelocity = distanceFromDestination / 24f; - float maxVelocityCap = minVelocityCap * 3f; - if (maxVelocity.Length() > maxVelocityCap) - maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); - } + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; @@ -393,9 +425,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { // Use telegraph frames when using gauss nuke npc.frameCounter += 1D; + double frameTime = Main.npc[(int)npc.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? 3D : 6D; if (AIState == (float)Phase.Nothing) { - if (npc.frameCounter >= 10D) + if (npc.frameCounter >= frameTime) { // Reset frame counter npc.frameCounter = 0D; @@ -417,7 +450,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } else { - if (npc.frameCounter >= 10D) + if (npc.frameCounter >= frameTime) { // Reset frame counter npc.frameCounter = 0D; @@ -441,6 +474,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { + // Draw the enrage smoke behind Ares + SmokeDrawer.DrawSet(npc.Center); + SpriteEffects spriteEffects = SpriteEffects.None; if (npc.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; @@ -448,7 +484,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Texture2D texture = Main.npcTexture[npc.type]; Rectangle frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); Vector2 vector = new Vector2(npc.width / 2, npc.height / 2); - Color afterimageBaseColor = Color.White; + Color afterimageBaseColor = Main.npc[(int)npc.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? Color.Red : Color.White; int numAfterimages = 5; if (CalamityConfig.Instance.Afterimages) @@ -460,9 +496,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares afterimageColor = npc.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], vector, npc.scale, spriteEffects, 0f); } } @@ -480,13 +516,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares afterimageColor = npc.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], vector, npc.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, center, frame, afterimageBaseColor * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index 66c4f40a6d..ffb723e792 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -1,5 +1,6 @@ using CalamityMod.Events; using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -12,7 +13,6 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Ares { - //[AutoloadBossHead] public class AresLaserCannon : ModNPC { public enum Phase @@ -27,6 +27,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares set => npc.Calamity().newAI[0] = value; } + public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); + // Number of frames on the X and Y axis private const int maxFramesX = 6; private const int maxFramesY = 8; @@ -45,7 +47,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares private const float defaultLifeRatio = 5f; // Total duration of the deathray telegraph - private const float deathrayTelegraphDuration = 240f; + private const float deathrayTelegraphDuration = 144f; // Total duration of the deathray private const float deathrayDuration = 60f; @@ -53,6 +55,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void SetStaticDefaults() { DisplayName.SetDefault("XF-09 Ares Laser Cannon"); + NPCID.Sets.TrailingMode[npc.type] = 3; + NPCID.Sets.TrailCacheLength[npc.type] = npc.oldPos.Length; } public override void SetDefaults() @@ -62,15 +66,16 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.width = 154; npc.height = 90; npc.defense = 80; - npc.DR_NERD(0.25f); - npc.LifeMaxNERB(1000000, 1150000, 500000); + npc.DR_NERD(0.35f); + npc.LifeMaxNERB(1300000, 1495000, 500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.Opacity = 0f; npc.knockBackResist = 0f; - npc.noGravity = true; + npc.canGhostHeal = false; + npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; @@ -83,7 +88,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { writer.Write(frameX); writer.Write(frameY); - writer.Write(npc.chaseable); writer.Write(npc.dontTakeDamage); for (int i = 0; i < 4; i++) writer.Write(npc.Calamity().newAI[i]); @@ -93,7 +97,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { frameX = reader.ReadInt32(); frameY = reader.ReadInt32(); - npc.chaseable = reader.ReadBoolean(); npc.dontTakeDamage = reader.ReadBoolean(); for (int i = 0; i < 4; i++) npc.Calamity().newAI[i] = reader.ReadSingle(); @@ -103,6 +106,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + npc.frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); + if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) { npc.life = 0; @@ -123,6 +128,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Check if the other exo mechs are alive int otherExoMechsAlive = 0; + bool exoTwinsAlive = false; if (CalamityGlobalNPC.draedonExoMechWorm != -1) { if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) @@ -131,9 +137,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) { if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) + { otherExoMechsAlive++; + exoTwinsAlive = true; + } } + // Used to nerf Ares if fighting alongside Artemis and Apollo, because otherwise it's too difficult + bool nerfedAttacks = false; + if (exoTwinsAlive) + nerfedAttacks = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].Calamity().newAI[1] != (float)Apollo.Apollo.SecondaryPhase.PassiveAndImmune; + // Phases bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); bool lastMechAlive = berserk && otherExoMechsAlive == 0; @@ -147,44 +161,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (npc.life > Main.npc[(int)npc.ai[1]].life) npc.life = Main.npc[(int)npc.ai[1]].life; - // Despawn if target is dead - bool targetDead = false; - if (player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (player.dead) - { - targetDead = true; - - AIState = (float)Phase.Nothing; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - - npc.velocity.Y -= 2f; - if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 2f; - - if ((double)npc.position.Y < Main.topWorld + 16f) - { - for (int a = 0; a < Main.maxNPCs; a++) - { - if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) - Main.npc[a].active = false; - } - } - } - } - CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)npc.ai[2]].Calamity(); // Passive phase check bool passivePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.Passive; + // Enrage check + bool enraged = Main.npc[(int)npc.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes; + // Adjust opacity bool invisiblePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune; npc.dontTakeDamage = invisiblePhase; @@ -234,20 +218,50 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } // Light - Lighting.AddLight(npc.Center, 0.25f, 0.1f, 0.1f); + if (enraged) + Lighting.AddLight(npc.Center, 0.5f * npc.Opacity, 0f, 0f); + else + Lighting.AddLight(npc.Center, 0.25f * npc.Opacity, 0.1f * npc.Opacity, 0.1f * npc.Opacity); + + // Despawn if target is dead + if (player.dead) + { + player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; + if (player.dead) + { + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + npc.dontTakeDamage = true; + + npc.velocity.Y -= 1f; + if ((double)npc.position.Y < Main.topWorld + 16f) + npc.velocity.Y -= 1f; + + if ((double)npc.position.Y < Main.topWorld + 16f) + { + for (int a = 0; a < Main.maxNPCs; a++) + { + if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; + } + } + + return; + } + } // Default vector to fly to - Vector2 destination = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X - 540f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y - 540f) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X - 560f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y); + Vector2 destination = fireNormalLasers ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X - 540f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y - 540f) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X - 560f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y); // Velocity and acceleration values - float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; - float baseVelocity = 16f * baseVelocityMult; - float baseAcceleration = 1f; - if (berserk) - { - baseVelocity *= 1.5f; - baseAcceleration *= 1.5f; - } + float baseVelocityMult = (berserk ? 0.25f : 0f) + (malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f); + float baseVelocity = (enraged ? 30f : 22f) * baseVelocityMult; + float baseAcceleration = berserk ? 1.25f : 1f; Vector2 distanceFromDestination = destination - npc.Center; Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination) * baseVelocity; @@ -257,18 +271,23 @@ namespace CalamityMod.NPCs.ExoMechs.Ares bool moveToLocation = Vector2.Distance(npc.Center, destination) > movementDistanceGateValue; // Gate values - float deathrayPhaseGateValue = 420f; - if (lastMechAlive) + float deathrayPhaseGateValue = 450f; + if (enraged) + deathrayPhaseGateValue *= 0.1f; + else if (lastMechAlive) deathrayPhaseGateValue *= 0.7f; else if (berserk) deathrayPhaseGateValue *= 0.85f; - float deathrayPhaseVelocity = passivePhase ? 9f : 12f; + float deathrayPhaseVelocity = (nerfedAttacks ? 6f : passivePhase ? 9f : 12f) * baseVelocityMult; if (lastMechAlive) deathrayPhaseVelocity *= 1.2f; else if (berserk) deathrayPhaseVelocity *= 1.1f; + // If Laser Cannon can fire normal lasers, cannot fire if too close to the target and in deathray spiral phase + bool canFire = Vector2.Distance(npc.Center, player.Center) > 320f || !fireNormalLasers; + // Variable to disable deathray firing bool doNotFire = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune || (calamityGlobalNPC_Body.newAI[2] >= AresBody.deathrayTelegraphDuration + AresBody.deathrayDuration - 1 && fireNormalLasers); if (doNotFire) @@ -278,31 +297,44 @@ namespace CalamityMod.NPCs.ExoMechs.Ares calamityGlobalNPC.newAI[2] = 0f; } + // Emit steam while enraged + SmokeDrawer.ParticleSpawnRate = 9999999; + if (enraged) + { + SmokeDrawer.ParticleSpawnRate = AresBody.ventCloudSpawnRate; + SmokeDrawer.BaseMoveRotation = npc.rotation + MathHelper.Pi; + SmokeDrawer.SpawnAreaCompactness = 40f; + + // Increase DR during enrage + npc.Calamity().DR = 0.85f; + } + else + npc.Calamity().DR = 0.35f; + + SmokeDrawer.Update(); + // Attacking phases switch ((int)AIState) { // Do nothing, rotate to aim at the target and fly in place case (int)Phase.Nothing: - if (!targetDead) - { - // Inverse lerp returns the percentage of progress between A and B - float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - // Min velocity - float minVelocity = distanceFromDestination.Length(); - float minVelocityCap = baseVelocity; - if (minVelocity > minVelocityCap) - minVelocity = minVelocityCap; + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = baseVelocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; - // Max velocity - Vector2 maxVelocity = distanceFromDestination / 24f; - float maxVelocityCap = minVelocityCap * 3f; - if (maxVelocity.Length() > maxVelocityCap) - maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); - } + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); calamityGlobalNPC.newAI[1] += 1f; if (calamityGlobalNPC.newAI[1] >= deathrayPhaseGateValue) @@ -316,127 +348,126 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Move close to target, reduce velocity when close enough, create telegraph beams, fire deathrays case (int)Phase.Deathray: - if (!targetDead) + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration) { - calamityGlobalNPC.newAI[2] += 1f; - if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration) + // Play a charge up sound so that the player knows when it's about to fire the deathray + if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration - 100f && !fireNormalLasers) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/CrystylCharge"), npc.Center); + + // Inverse lerp returns the percentage of progress between A and B + float lerpValue2 = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + + // Min velocity + float minVelocity2 = distanceFromDestination.Length(); + float minVelocityCap2 = baseVelocity; + if (minVelocity2 > minVelocityCap2) + minVelocity2 = minVelocityCap2; + + // Max velocity + Vector2 maxVelocity2 = distanceFromDestination / 24f; + float maxVelocityCap2 = minVelocityCap2 * 3f; + if (maxVelocity2.Length() > maxVelocityCap2) + maxVelocity2 = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap2; + + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity2, maxVelocity2, lerpValue2); + + // Set frames to deathray charge up frames, which begin on frame 12 + if (calamityGlobalNPC.newAI[2] == 1f) + { + // Reset the frame counter + npc.frameCounter = 0D; + + // X = 1 sets to frame 8 + frameX = 1; + + // Y = 4 sets to frame 12 + frameY = 4; + } + } + else + { + // Fire regular Thanatos lasers if Ares is in deathray phase, otherwise, fire deathray + if (fireNormalLasers) { // Inverse lerp returns the percentage of progress between A and B - float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + float lerpValue3 = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); // Min velocity - float minVelocity = distanceFromDestination.Length(); - float minVelocityCap = baseVelocity; - if (minVelocity > minVelocityCap) - minVelocity = minVelocityCap; + float minVelocity3 = distanceFromDestination.Length(); + float minVelocityCap3 = baseVelocity; + if (minVelocity3 > minVelocityCap3) + minVelocity3 = minVelocityCap3; // Max velocity - Vector2 maxVelocity = distanceFromDestination / 24f; - float maxVelocityCap = minVelocityCap * 3f; - if (maxVelocity.Length() > maxVelocityCap) - maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + Vector2 maxVelocity3 = distanceFromDestination / 24f; + float maxVelocityCap3 = minVelocityCap3 * 3f; + if (maxVelocity3.Length() > maxVelocityCap3) + maxVelocity3 = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap3; - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity3, maxVelocity3, lerpValue3); - // Set frames to deathray charge up frames, which begin on frame 12 - if (calamityGlobalNPC.newAI[2] == 1f) + // Fire Thanatos lasers + int numLasers = enraged ? 9 : lastMechAlive ? 3 : 2; + float divisor = deathrayDuration / numLasers; + + if (calamityGlobalNPC.newAI[2] % divisor == 0f && canFire) { - // Reset the frame counter - npc.frameCounter = 0D; - - // X = 1 sets to frame 8 - frameX = 1; - - // Y = 4 sets to frame 12 - frameY = 4; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + Vector2 laserVelocity = Vector2.Normalize(player.Center - npc.Center); + Vector2 offset = laserVelocity * 70f + Vector2.UnitY * 16f; + Projectile.NewProjectile(npc.Center + offset, player.Center, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + } } } else { - // Fire regular Thanatos lasers if Ares is in deathray phase, otherwise, fire deathray - if (fireNormalLasers) - { - // Inverse lerp returns the percentage of progress between A and B - float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + // Two possible variants: 1 - Horizontal, 2 - Vertical - // Min velocity - float minVelocity = distanceFromDestination.Length(); - float minVelocityCap = baseVelocity; - if (minVelocity > minVelocityCap) - minVelocity = minVelocityCap; - - // Max velocity - Vector2 maxVelocity = distanceFromDestination / 24f; - float maxVelocityCap = minVelocityCap * 3f; - if (maxVelocity.Length() > maxVelocityCap) - maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; - - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); - - // Fire a Thanatos laser - int numLasers = lastMechAlive ? 3 : 2; - float divisor = deathrayDuration / numLasers; - - if (calamityGlobalNPC.newAI[2] % divisor == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); - Vector2 laserVelocity = Vector2.Normalize(player.Center - npc.Center); - Vector2 offset = laserVelocity * 70f + Vector2.UnitY * 16f; - Projectile.NewProjectile(npc.Center + offset, player.Center, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - } - } - } + // Movement while firing deathray + if (horizontalLaserSweep) + desiredVelocity.X = 0f; else + desiredVelocity.Y = 0f; + + npc.SimpleFlyMovement(desiredVelocity, baseAcceleration); + npc.velocity = horizontalLaserSweep ? new Vector2(deathrayPhaseVelocity, npc.velocity.Y) : new Vector2(npc.velocity.X, deathrayPhaseVelocity * 0.75f); + + // Fire deathray + if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration) { - // Two possible variants: 1 - Horizontal, 2 - Vertical - - // Movement while firing deathray - if (horizontalLaserSweep) - desiredVelocity.X = 0f; - else - desiredVelocity.Y = 0f; - - npc.SimpleFlyMovement(desiredVelocity, baseAcceleration); - npc.velocity = horizontalLaserSweep ? new Vector2(deathrayPhaseVelocity, npc.velocity.Y) : new Vector2(npc.velocity.X, deathrayPhaseVelocity); - - // Fire deathray - if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration) + if (Main.netMode != NetmodeID.MultiplayerClient) { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float offset = 84f; - float offset2 = 16f; - Vector2 source = horizontalLaserSweep ? new Vector2(npc.Center.X - offset2 * npc.direction, npc.Center.Y + offset) : new Vector2(npc.Center.X + offset * npc.direction, npc.Center.Y + offset2); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), source); - Vector2 laserVelocity = Vector2.Normalize(lookAt - source); - if (laserVelocity.HasNaNs()) - laserVelocity = -Vector2.UnitY; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float offset = 84f; + float offset2 = 16f; + Vector2 source = horizontalLaserSweep ? new Vector2(npc.Center.X - offset2 * npc.direction, npc.Center.Y + offset) : new Vector2(npc.Center.X + offset * npc.direction, npc.Center.Y + offset2); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), source); + Vector2 laserVelocity = Vector2.Normalize(lookAt - source); + if (laserVelocity.HasNaNs()) + laserVelocity = -Vector2.UnitY; - Projectile.NewProjectile(source, laserVelocity, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - } + Projectile.NewProjectile(source, laserVelocity, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); } } } + } - if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration + deathrayDuration) - { - // Reset - AIState = (float)Phase.Nothing; - calamityGlobalNPC.newAI[2] = 0f; + if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration + deathrayDuration) + { + // Reset + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[2] = 0f; - // Change deathray sweep type for next deathray phase - calamityGlobalNPC.newAI[3] += 1f; - if (calamityGlobalNPC.newAI[3] > 1f) - calamityGlobalNPC.newAI[3] = 0f; - - npc.TargetClosest(); - } + // Change deathray sweep type for next deathray phase + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] > 1f) + calamityGlobalNPC.newAI[3] = 0f; } break; @@ -453,7 +484,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.frameCounter += 1D; if (AIState == (float)Phase.Nothing) { - if (npc.frameCounter >= 10D) + if (npc.frameCounter >= 6D) { // Reset frame counter npc.frameCounter = 0D; @@ -475,7 +506,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } else { - if (npc.frameCounter >= 10D) + if (npc.frameCounter >= 6D) { // Reset frame counter npc.frameCounter = 0D; @@ -499,6 +530,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { + // Draw the enrage smoke behind Ares + SmokeDrawer.DrawSet(npc.Center); + SpriteEffects spriteEffects = SpriteEffects.None; if (npc.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; @@ -506,7 +540,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Texture2D texture = Main.npcTexture[npc.type]; Rectangle frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); Vector2 vector = new Vector2(npc.width / 2, npc.height / 2); - Color afterimageBaseColor = Color.White; + Color afterimageBaseColor = Main.npc[(int)npc.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? Color.Red : Color.White; int numAfterimages = 5; if (CalamityConfig.Instance.Afterimages) @@ -518,9 +552,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares afterimageColor = npc.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], vector, npc.scale, spriteEffects, 0f); } } @@ -538,13 +572,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares afterimageColor = npc.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], vector, npc.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, center, frame, afterimageBaseColor * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index d992836be5..5799e7e4bb 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -1,5 +1,6 @@ using CalamityMod.Events; using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -12,7 +13,6 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Ares { - //[AutoloadBossHead] public class AresPlasmaFlamethrower : ModNPC { public enum Phase @@ -27,6 +27,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares set => npc.Calamity().newAI[0] = value; } + public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); + // Number of frames on the X and Y axis private const int maxFramesX = 6; private const int maxFramesY = 8; @@ -45,7 +47,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares private const float defaultLifeRatio = 5f; // Total duration of the plasma bolt telegraph - private const float plasmaBoltTelegraphDuration = 240f; + private const float plasmaBoltTelegraphDuration = 144f; // Total duration of the plasma bolt firing phase private const float plasmaBoltDuration = 120f; @@ -53,6 +55,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void SetStaticDefaults() { DisplayName.SetDefault("XF-09 Ares Plasma Cannon"); + NPCID.Sets.TrailingMode[npc.type] = 3; + NPCID.Sets.TrailCacheLength[npc.type] = npc.oldPos.Length; } public override void SetDefaults() @@ -62,15 +66,16 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.width = 152; npc.height = 90; npc.defense = 80; - npc.DR_NERD(0.25f); - npc.LifeMaxNERB(1000000, 1150000, 500000); + npc.DR_NERD(0.35f); + npc.LifeMaxNERB(1300000, 1495000, 500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.Opacity = 0f; npc.knockBackResist = 0f; - npc.noGravity = true; + npc.canGhostHeal = false; + npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; @@ -83,7 +88,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { writer.Write(frameX); writer.Write(frameY); - writer.Write(npc.chaseable); writer.Write(npc.dontTakeDamage); for (int i = 0; i < 4; i++) writer.Write(npc.Calamity().newAI[i]); @@ -93,16 +97,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { frameX = reader.ReadInt32(); frameY = reader.ReadInt32(); - npc.chaseable = reader.ReadBoolean(); npc.dontTakeDamage = reader.ReadBoolean(); for (int i = 0; i < 4; i++) npc.Calamity().newAI[i] = reader.ReadSingle(); } - public override void AI() - { + public override void AI() + { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + npc.frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); + if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) { npc.life = 0; @@ -123,6 +128,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Check if the other exo mechs are alive int otherExoMechsAlive = 0; + bool exoTwinsAlive = false; if (CalamityGlobalNPC.draedonExoMechWorm != -1) { if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) @@ -131,9 +137,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) { if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) + { otherExoMechsAlive++; + exoTwinsAlive = true; + } } + // Used to nerf Ares if fighting alongside Artemis and Apollo, because otherwise it's too difficult + bool nerfedAttacks = false; + if (exoTwinsAlive) + nerfedAttacks = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].Calamity().newAI[1] != (float)Apollo.Apollo.SecondaryPhase.PassiveAndImmune; + // Phases bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); bool lastMechAlive = berserk && otherExoMechsAlive == 0; @@ -147,44 +161,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (npc.life > Main.npc[(int)npc.ai[1]].life) npc.life = Main.npc[(int)npc.ai[1]].life; - // Despawn if target is dead - bool targetDead = false; - if (player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (player.dead) - { - targetDead = true; - - AIState = (float)Phase.Nothing; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - - npc.velocity.Y -= 2f; - if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 2f; - - if ((double)npc.position.Y < Main.topWorld + 16f) - { - for (int a = 0; a < Main.maxNPCs; a++) - { - if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) - Main.npc[a].active = false; - } - } - } - } - CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)npc.ai[2]].Calamity(); // Passive phase check bool passivePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.Passive; + // Enrage check + bool enraged = Main.npc[(int)npc.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes; + // Adjust opacity bool invisiblePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune; npc.dontTakeDamage = invisiblePhase; @@ -203,6 +187,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Predictiveness float predictionAmt = malice ? 20f : death ? 15f : revenge ? 12.5f : expertMode ? 10f : 5f; + if (nerfedAttacks) + predictionAmt *= 0.5f; if (passivePhase) predictionAmt *= 0.5f; @@ -241,16 +227,49 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } // Light - Lighting.AddLight(npc.Center, 0.1f, 0.25f, 0.05f); + if (enraged) + Lighting.AddLight(npc.Center, 0.5f * npc.Opacity, 0f, 0f); + else + Lighting.AddLight(npc.Center, 0.1f * npc.Opacity, 0.25f * npc.Opacity, 0.05f * npc.Opacity); + + // Despawn if target is dead + if (player.dead) + { + player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; + if (player.dead) + { + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + npc.dontTakeDamage = true; + + npc.velocity.Y -= 1f; + if ((double)npc.position.Y < Main.topWorld + 16f) + npc.velocity.Y -= 1f; + + if ((double)npc.position.Y < Main.topWorld + 16f) + { + for (int a = 0; a < Main.maxNPCs; a++) + { + if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; + } + } + + return; + } + } // Default vector to fly to Vector2 destination = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + 540f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y - 540f) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + 375f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + 160f); // Velocity and acceleration values - float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; - float baseVelocity = 16f * baseVelocityMult; - if (berserk) - baseVelocity *= 1.5f; + float baseVelocityMult = (berserk ? 0.25f : 0f) + (malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f); + float baseVelocity = (enraged ? 30f : 22f) * baseVelocityMult; Vector2 distanceFromDestination = destination - npc.Center; @@ -258,13 +277,20 @@ namespace CalamityMod.NPCs.ExoMechs.Ares float movementDistanceGateValue = 50f; // Gate values + // Make plasma bolts split less if in deathray spiral phase and not the last mech alive, but fire more if in deathray spiral phase bool fireMoreBolts = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays; - float plasmaBoltPhaseGateValue = fireMoreBolts ? 90f : 210f; - if (lastMechAlive) + bool boltsSplitLess = fireMoreBolts && !lastMechAlive; + float plasmaBoltPhaseGateValue = fireMoreBolts ? 120f : 270f; + if (enraged) + plasmaBoltPhaseGateValue *= 0.1f; + else if (lastMechAlive) plasmaBoltPhaseGateValue *= 0.7f; else if (berserk) plasmaBoltPhaseGateValue *= 0.85f; + // If Plasma Cannon can fire projectiles, cannot fire if too close to the target and in deathray spiral phase + bool canFire = Vector2.Distance(npc.Center, player.Center) > 320f || calamityGlobalNPC_Body.newAI[0] != (float)AresBody.Phase.Deathrays; + // Variable to cancel plasma bolt firing bool doNotFire = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune || (calamityGlobalNPC_Body.newAI[2] >= AresBody.deathrayTelegraphDuration + AresBody.deathrayDuration - 1 && calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays); if (doNotFire) @@ -274,6 +300,22 @@ namespace CalamityMod.NPCs.ExoMechs.Ares calamityGlobalNPC.newAI[2] = 0f; } + // Emit steam while enraged + SmokeDrawer.ParticleSpawnRate = 9999999; + if (enraged) + { + SmokeDrawer.ParticleSpawnRate = AresBody.ventCloudSpawnRate; + SmokeDrawer.BaseMoveRotation = npc.rotation + MathHelper.Pi; + SmokeDrawer.SpawnAreaCompactness = 40f; + + // Increase DR during enrage + npc.Calamity().DR = 0.85f; + } + else + npc.Calamity().DR = 0.35f; + + SmokeDrawer.Update(); + // Attacking phases switch ((int)AIState) { @@ -292,75 +334,72 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Fire plasma bolts in a double burst that burst into a halo of smaller bolts case (int)Phase.PlasmaBolts: - if (!targetDead) + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] < plasmaBoltTelegraphDuration) { - calamityGlobalNPC.newAI[2] += 1f; - if (calamityGlobalNPC.newAI[2] < plasmaBoltTelegraphDuration) + // Set frames to plasma orb charge up frames, which begin on frame 12 + if (calamityGlobalNPC.newAI[2] == 1f) { - // Set frames to plasma orb charge up frames, which begin on frame 12 - if (calamityGlobalNPC.newAI[2] == 1f) - { - // Reset the frame counter - npc.frameCounter = 0D; + // Reset the frame counter + npc.frameCounter = 0D; - // X = 1 sets to frame 8 - frameX = 1; + // X = 1 sets to frame 8 + frameX = 1; - // Y = 4 sets to frame 12 - frameY = 4; - } + // Y = 4 sets to frame 12 + frameY = 4; } - else - { - // Fire plasma bolts - int numPlasmaBolts = lastMechAlive ? 3 : 2; - float divisor = plasmaBoltDuration / numPlasmaBolts; + } + else + { + // Fire plasma bolts + int numPlasmaBolts = lastMechAlive ? 3 : 2; + float divisor = plasmaBoltDuration / numPlasmaBolts; - if (calamityGlobalNPC.newAI[2] % divisor == 0f) + if (calamityGlobalNPC.newAI[2] % divisor == 0f && canFire) + { + if (Main.netMode != NetmodeID.MultiplayerClient) { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaCasterFire"), npc.Center); - Vector2 plasmaBoltVelocity = Vector2.Normalize(rotationVector) * projectileVelocity; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 offset = Vector2.Normalize(plasmaBoltVelocity) * 40f + Vector2.UnitY * 16f; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaCasterFire"), npc.Center); + Vector2 plasmaBoltVelocity = Vector2.Normalize(rotationVector) * projectileVelocity; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Vector2 offset = Vector2.Normalize(plasmaBoltVelocity) * 40f + Vector2.UnitY * 16f; + + if (boltsSplitLess) + Projectile.NewProjectile(npc.Center + offset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, -1f); + else Projectile.NewProjectile(npc.Center + offset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); - } } } + } - if (calamityGlobalNPC.newAI[2] >= plasmaBoltTelegraphDuration + plasmaBoltDuration) - { - AIState = (float)Phase.Nothing; - calamityGlobalNPC.newAI[2] = 0f; - npc.TargetClosest(); - } + if (calamityGlobalNPC.newAI[2] >= plasmaBoltTelegraphDuration + plasmaBoltDuration) + { + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[2] = 0f; } break; } // Movement - if (!targetDead) - { - // Inverse lerp returns the percentage of progress between A and B - float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - // Min velocity - float minVelocity = distanceFromDestination.Length(); - float minVelocityCap = baseVelocity; - if (minVelocity > minVelocityCap) - minVelocity = minVelocityCap; + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = baseVelocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; - // Max velocity - Vector2 maxVelocity = distanceFromDestination / 24f; - float maxVelocityCap = minVelocityCap * 3f; - if (maxVelocity.Length() > maxVelocityCap) - maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); - } + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; @@ -373,7 +412,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.frameCounter += 1D; if (AIState == (float)Phase.Nothing) { - if (npc.frameCounter >= 10D) + if (npc.frameCounter >= 6D) { // Reset frame counter npc.frameCounter = 0D; @@ -395,7 +434,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } else { - if (npc.frameCounter >= 10D) + if (npc.frameCounter >= 6D) { // Reset frame counter npc.frameCounter = 0D; @@ -419,6 +458,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { + // Draw the enrage smoke behind Ares + SmokeDrawer.DrawSet(npc.Center); + SpriteEffects spriteEffects = SpriteEffects.None; if (npc.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; @@ -426,7 +468,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Texture2D texture = Main.npcTexture[npc.type]; Rectangle frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); Vector2 vector = new Vector2(npc.width / 2, npc.height / 2); - Color afterimageBaseColor = Color.White; + Color afterimageBaseColor = Main.npc[(int)npc.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? Color.Red : Color.White; int numAfterimages = 5; if (CalamityConfig.Instance.Afterimages) @@ -438,9 +480,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares afterimageColor = npc.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], vector, npc.scale, spriteEffects, 0f); } } @@ -458,13 +500,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares afterimageColor = npc.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], vector, npc.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, center, frame, afterimageBaseColor * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index 1f5b34025e..e2480ad939 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -1,5 +1,6 @@ using CalamityMod.Events; using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -12,7 +13,6 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Ares { - //[AutoloadBossHead] public class AresTeslaCannon : ModNPC { public enum Phase @@ -27,6 +27,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares set => npc.Calamity().newAI[0] = value; } + public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); + // Number of frames on the X and Y axis private const int maxFramesX = 6; private const int maxFramesY = 8; @@ -45,7 +47,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares private const float defaultLifeRatio = 5f; // Total duration of the tesla orb telegraph - private const float teslaOrbTelegraphDuration = 240f; + private const float teslaOrbTelegraphDuration = 144f; // Total duration of the tesla orb firing phase private const float teslaOrbDuration = 120f; @@ -53,6 +55,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void SetStaticDefaults() { DisplayName.SetDefault("XF-09 Ares Tesla Cannon"); + NPCID.Sets.TrailingMode[npc.type] = 3; + NPCID.Sets.TrailCacheLength[npc.type] = npc.oldPos.Length; } public override void SetDefaults() @@ -62,15 +66,16 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.width = 172; npc.height = 108; npc.defense = 80; - npc.DR_NERD(0.25f); - npc.LifeMaxNERB(1000000, 1150000, 500000); + npc.DR_NERD(0.35f); + npc.LifeMaxNERB(1300000, 1495000, 500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.Opacity = 0f; npc.knockBackResist = 0f; - npc.noGravity = true; + npc.canGhostHeal = false; + npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; @@ -83,7 +88,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { writer.Write(frameX); writer.Write(frameY); - writer.Write(npc.chaseable); writer.Write(npc.dontTakeDamage); for (int i = 0; i < 4; i++) writer.Write(npc.Calamity().newAI[i]); @@ -93,16 +97,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { frameX = reader.ReadInt32(); frameY = reader.ReadInt32(); - npc.chaseable = reader.ReadBoolean(); npc.dontTakeDamage = reader.ReadBoolean(); for (int i = 0; i < 4; i++) npc.Calamity().newAI[i] = reader.ReadSingle(); } - public override void AI() - { + public override void AI() + { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + npc.frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); + if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) { npc.life = 0; @@ -123,6 +128,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Check if the other exo mechs are alive int otherExoMechsAlive = 0; + bool exoTwinsAlive = false; if (CalamityGlobalNPC.draedonExoMechWorm != -1) { if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) @@ -131,9 +137,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) { if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) + { otherExoMechsAlive++; + exoTwinsAlive = true; + } } + // Used to nerf Ares if fighting alongside Artemis and Apollo, because otherwise it's too difficult + bool nerfedAttacks = false; + if (exoTwinsAlive) + nerfedAttacks = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].Calamity().newAI[1] != (float)Apollo.Apollo.SecondaryPhase.PassiveAndImmune; + // Phases bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); bool lastMechAlive = berserk && otherExoMechsAlive == 0; @@ -147,44 +161,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (npc.life > Main.npc[(int)npc.ai[1]].life) npc.life = Main.npc[(int)npc.ai[1]].life; - // Despawn if target is dead - bool targetDead = false; - if (player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (player.dead) - { - targetDead = true; - - AIState = (float)Phase.Nothing; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - - npc.velocity.Y -= 2f; - if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 2f; - - if ((double)npc.position.Y < Main.topWorld + 16f) - { - for (int a = 0; a < Main.maxNPCs; a++) - { - if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) - Main.npc[a].active = false; - } - } - } - } - CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)npc.ai[2]].Calamity(); // Passive phase check bool passivePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.Passive; + // Enrage check + bool enraged = Main.npc[(int)npc.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes; + // Adjust opacity bool invisiblePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune; npc.dontTakeDamage = invisiblePhase; @@ -203,8 +187,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Predictiveness float predictionAmt = malice ? 40f : death ? 30f : revenge ? 25f : expertMode ? 20f : 10f; + if (nerfedAttacks) + predictionAmt *= 0.5f; if (passivePhase) predictionAmt *= 0.5f; + if (lastMechAlive) + predictionAmt *= 1.5f; Vector2 predictionVector = player.velocity * predictionAmt; Vector2 rotationVector = player.Center + predictionVector - npc.Center; @@ -241,16 +229,49 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } // Light - Lighting.AddLight(npc.Center, 0.1f, 0.25f, 0.25f); + if (enraged) + Lighting.AddLight(npc.Center, 0.5f * npc.Opacity, 0f, 0f); + else + Lighting.AddLight(npc.Center, 0.1f * npc.Opacity, 0.25f * npc.Opacity, 0.25f * npc.Opacity); + + // Despawn if target is dead + if (player.dead) + { + player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; + if (player.dead) + { + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + npc.dontTakeDamage = true; + + npc.velocity.Y -= 1f; + if ((double)npc.position.Y < Main.topWorld + 16f) + npc.velocity.Y -= 1f; + + if ((double)npc.position.Y < Main.topWorld + 16f) + { + for (int a = 0; a < Main.maxNPCs; a++) + { + if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; + } + } + + return; + } + } // Default vector to fly to Vector2 destination = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X - 540f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + 540f) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X - 375f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + 160f); // Velocity and acceleration values - float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; - float baseVelocity = 16f * baseVelocityMult; - if (berserk) - baseVelocity *= 1.5f; + float baseVelocityMult = (berserk ? 0.25f : 0f) + (malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f); + float baseVelocity = (enraged ? 30f : 22f) * baseVelocityMult; Vector2 distanceFromDestination = destination - npc.Center; @@ -259,12 +280,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Gate values bool fireMoreOrbs = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays; - float teslaOrbPhaseGateValue = fireMoreOrbs ? 90f : 210f; - if (lastMechAlive) + float teslaOrbPhaseGateValue = fireMoreOrbs ? 120f : 270f; + if (enraged) + teslaOrbPhaseGateValue *= 0.1f; + else if (lastMechAlive) teslaOrbPhaseGateValue *= 0.7f; else if (berserk) teslaOrbPhaseGateValue *= 0.85f; + // If Tesla Cannon can fire projectiles, cannot fire if too close to the target and in deathray spiral phase + bool canFire = Vector2.Distance(npc.Center, player.Center) > 320f || calamityGlobalNPC_Body.newAI[0] != (float)AresBody.Phase.Deathrays; + // Variable to cancel tesla orb firing bool doNotFire = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune || (calamityGlobalNPC_Body.newAI[2] >= AresBody.deathrayTelegraphDuration + AresBody.deathrayDuration - 1 && calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays); if (doNotFire) @@ -274,6 +300,22 @@ namespace CalamityMod.NPCs.ExoMechs.Ares calamityGlobalNPC.newAI[2] = 0f; } + // Emit steam while enraged + SmokeDrawer.ParticleSpawnRate = 9999999; + if (enraged) + { + SmokeDrawer.ParticleSpawnRate = AresBody.ventCloudSpawnRate; + SmokeDrawer.BaseMoveRotation = npc.rotation + MathHelper.Pi; + SmokeDrawer.SpawnAreaCompactness = 40f; + + // Increase DR during enrage + npc.Calamity().DR = 0.85f; + } + else + npc.Calamity().DR = 0.35f; + + SmokeDrawer.Update(); + // Attacking phases switch ((int)AIState) { @@ -292,76 +334,80 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Fire tesla orbs in a quadruple burst that arc electricity between them case (int)Phase.TeslaOrbs: - if (!targetDead) + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] < teslaOrbTelegraphDuration) { - calamityGlobalNPC.newAI[2] += 1f; - if (calamityGlobalNPC.newAI[2] < teslaOrbTelegraphDuration) + // Set frames to tesla orb charge up frames, which begin on frame 12 + if (calamityGlobalNPC.newAI[2] == 1f) { - // Set frames to tesla orb charge up frames, which begin on frame 12 - if (calamityGlobalNPC.newAI[2] == 1f) - { - // Reset the frame counter - npc.frameCounter = 0D; + // Reset the frame counter + npc.frameCounter = 0D; - // X = 1 sets to frame 8 - frameX = 1; + // X = 1 sets to frame 8 + frameX = 1; - // Y = 4 sets to frame 12 - frameY = 4; - } + // Y = 4 sets to frame 12 + frameY = 4; } - else + } + else + { + // Despawn any active Tesla Orbs + if (calamityGlobalNPC.newAI[2] == teslaOrbTelegraphDuration && !enraged) { - // Fire tesla orbs - int numTeslaOrbs = lastMechAlive ? 6 : berserk ? 5 : 4; - float divisor = teslaOrbDuration / numTeslaOrbs; - - if (calamityGlobalNPC.newAI[2] % divisor == 0f) + for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"), npc.Center); - Vector2 teslaOrbVelocity = Vector2.Normalize(rotationVector) * projectileVelocity; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 offset = Vector2.Normalize(teslaOrbVelocity) * 40f + Vector2.UnitY * 8f; - float identity = (calamityGlobalNPC.newAI[2] - teslaOrbTelegraphDuration) / divisor; - Projectile.NewProjectile(npc.Center + offset, teslaOrbVelocity, type, damage, 0f, Main.myPlayer, identity); - } + Projectile projectile = Main.projectile[i]; + if (projectile.active && projectile.type == ModContent.ProjectileType()) + projectile.Kill(); } } - if (calamityGlobalNPC.newAI[2] >= teslaOrbTelegraphDuration + teslaOrbDuration) + // Fire tesla orbs + int numTeslaOrbs = lastMechAlive ? 6 : berserk ? 5 : nerfedAttacks ? 3 : 4; + float divisor = teslaOrbDuration / numTeslaOrbs; + + if (calamityGlobalNPC.newAI[2] % divisor == 0f && canFire) { - AIState = (float)Phase.Nothing; - calamityGlobalNPC.newAI[2] = 0f; - npc.TargetClosest(); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"), npc.Center); + Vector2 teslaOrbVelocity = Vector2.Normalize(rotationVector) * projectileVelocity; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Vector2 offset = Vector2.Normalize(teslaOrbVelocity) * 40f + Vector2.UnitY * 8f; + float identity = (calamityGlobalNPC.newAI[2] - teslaOrbTelegraphDuration) / divisor; + Projectile.NewProjectile(npc.Center + offset, teslaOrbVelocity, type, damage, 0f, Main.myPlayer, identity); + } } } + if (calamityGlobalNPC.newAI[2] >= teslaOrbTelegraphDuration + teslaOrbDuration) + { + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[2] = 0f; + } + break; } // Movement - if (!targetDead) - { - // Inverse lerp returns the percentage of progress between A and B - float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - // Min velocity - float minVelocity = distanceFromDestination.Length(); - float minVelocityCap = baseVelocity; - if (minVelocity > minVelocityCap) - minVelocity = minVelocityCap; + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = baseVelocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; - // Max velocity - Vector2 maxVelocity = distanceFromDestination / 24f; - float maxVelocityCap = minVelocityCap * 3f; - if (maxVelocity.Length() > maxVelocityCap) - maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); - } + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; @@ -374,7 +420,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.frameCounter += 1D; if (AIState == (float)Phase.Nothing) { - if (npc.frameCounter >= 10D) + if (npc.frameCounter >= 6D) { // Reset frame counter npc.frameCounter = 0D; @@ -396,7 +442,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } else { - if (npc.frameCounter >= 10D) + if (npc.frameCounter >= 6D) { // Reset frame counter npc.frameCounter = 0D; @@ -420,6 +466,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { + // Draw the enrage smoke behind Ares + SmokeDrawer.DrawSet(npc.Center); + SpriteEffects spriteEffects = SpriteEffects.None; if (npc.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; @@ -427,7 +476,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Texture2D texture = Main.npcTexture[npc.type]; Rectangle frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); Vector2 vector = new Vector2(npc.width / 2, npc.height / 2); - Color afterimageBaseColor = Color.White; + Color afterimageBaseColor = Main.npc[(int)npc.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? Color.Red : Color.White; int numAfterimages = 5; if (CalamityConfig.Instance.Afterimages) @@ -439,9 +488,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares afterimageColor = npc.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], vector, npc.scale, spriteEffects, 0f); } } @@ -459,17 +508,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares afterimageColor = npc.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], vector, npc.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, center, frame, afterimageBaseColor * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); return false; } - + public override bool PreNPCLoot() => false; public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index 1a93f54644..ea3d1a5d3b 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -1,15 +1,16 @@ using CalamityMod.Events; -using CalamityMod.Items.Potions; -using CalamityMod.NPCs.ExoMechs.Apollo; using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.Projectiles.Boss; +using CalamityMod.Skies; 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.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -87,16 +88,13 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis private const float soundDistance = 2800f; // Normal animation duration - private const float defaultAnimationDuration = 100f; - - // Total duration of attack telegraphs - private const float attackTelegraphDuration = 100f; + private const float defaultAnimationDuration = 60f; // Total duration of the phase transition - private const float phaseTransitionDuration = 300f; + private const float phaseTransitionDuration = 180f; // Where the timer should be when the lens pops off - private const float lensPopTime = 80f; + private const float lensPopTime = 48f; // Total duration of the deathray telegraph private const float deathrayTelegraphDuration = 60f; @@ -113,9 +111,24 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // The point to spin around private Vector2 spinningPoint = default; + // Velocity for the spin + private Vector2 spinVelocity = default; + + // Intensity of flash effects during the charge combo + public float ChargeFlash; + + // Primitive trail drawers for thrusters when charging + public PrimitiveTrail ChargeFlameTrail = null; + public PrimitiveTrail ChargeFlameTrailBig = null; + + // Primitive trail drawer for the ribbon things + public PrimitiveTrail RibbonTrail = null; + public override void SetStaticDefaults() { DisplayName.SetDefault("XS-01 Artemis"); + NPCID.Sets.TrailingMode[npc.type] = 3; + NPCID.Sets.TrailCacheLength[npc.type] = 15; } public override void SetDefaults() @@ -127,7 +140,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis npc.height = 226; npc.defense = 80; npc.DR_NERD(0.25f); - npc.LifeMaxNERB(1000000, 1150000, 500000); + npc.LifeMaxNERB(1300000, 1495000, 500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; @@ -145,7 +158,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public override void BossHeadSlot(ref int index) { - if (npc.life / (float)npc.lifeMax < 0.6f) + if (SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune) + index = -1; + else if (npc.life / (float)npc.lifeMax < 0.6f) index = phase2IconIndex; else index = phase1IconIndex; @@ -153,7 +168,13 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); + writer.WriteVector2(spinVelocity); + writer.WriteVector2(chargeVelocityNormalized); + writer.Write(frameX); + writer.Write(frameY); + writer.Write(pickNewLocation); + writer.Write(rotationDirection); + writer.WriteVector2(spinningPoint); writer.Write(npc.dontTakeDamage); writer.Write(npc.localAI[0]); writer.Write(npc.localAI[1]); @@ -165,7 +186,13 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); + spinVelocity = reader.ReadVector2(); + chargeVelocityNormalized = reader.ReadVector2(); + frameX = reader.ReadInt32(); + frameY = reader.ReadInt32(); + pickNewLocation = reader.ReadBoolean(); + rotationDirection = reader.ReadInt32(); + spinningPoint = reader.ReadVector2(); npc.dontTakeDamage = reader.ReadBoolean(); npc.localAI[0] = reader.ReadSingle(); npc.localAI[1] = reader.ReadSingle(); @@ -176,11 +203,13 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis } public override void AI() - { + { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); CalamityGlobalNPC.draedonExoMechTwinRed = npc.whoAmI; + npc.frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); + // Difficulty modes bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || malice; @@ -202,14 +231,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis int otherExoMechsAlive = 0; bool exoWormAlive = false; bool exoPrimeAlive = false; - if (CalamityGlobalNPC.draedonExoMechWorm != -1) - { - if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) - { - otherExoMechsAlive++; - exoWormAlive = true; - } - } if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) { if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) @@ -222,10 +243,24 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis npc.life = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life; } } + if (CalamityGlobalNPC.draedonExoMechWorm != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) + { + // Set target to Thanatos' target if Thanatos is alive + player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechWorm].target]; + + otherExoMechsAlive++; + exoWormAlive = true; + } + } if (CalamityGlobalNPC.draedonExoMechPrime != -1) { if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) { + // Set target to Ares' target if Ares is alive + player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; + otherExoMechsAlive++; exoPrimeAlive = true; } @@ -249,12 +284,30 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (exoWormAlive) exoWormPassive = Main.npc[CalamityGlobalNPC.draedonExoMechWorm].Calamity().newAI[1] == (float)ThanatosHead.SecondaryPhase.Passive; if (exoPrimeAlive) - exoPrimePassive = Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].Calamity().newAI[1] == (float)AresBody.SecondaryPhase.Passive; + exoPrimePassive = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Calamity().newAI[1] == (float)AresBody.SecondaryPhase.Passive; bool anyOtherExoMechPassive = exoWormPassive || exoPrimePassive; + // Used to nerf Artemis and Apollo if fighting alongside Ares, because otherwise it's too difficult + bool nerfedAttacks = false; + if (exoPrimeAlive) + nerfedAttacks = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Calamity().newAI[1] != (float)AresBody.SecondaryPhase.PassiveAndImmune; + + // Check if any of the other mechs were spawned first + bool exoWormWasFirst = false; + bool exoPrimeWasFirst = false; + if (exoWormAlive) + exoWormWasFirst = Main.npc[CalamityGlobalNPC.draedonExoMechWorm].ai[3] == 1f; + if (exoPrimeAlive) + exoPrimeWasFirst = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].ai[3] == 1f; + bool otherExoMechWasFirst = exoWormWasFirst || exoPrimeWasFirst; + + // Prevent mechs from being respawned + if (otherExoMechWasFirst) + npc.ai[3] = 1f; + // Phases bool phase2 = lifeRatio < 0.6f; - bool spawnOtherExoMechs = lifeRatio > 0.4f && otherExoMechsAlive == 0 && lifeRatio < 0.7f; + bool spawnOtherExoMechs = lifeRatio < 0.7f && npc.ai[3] == 0f; bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); bool lastMechAlive = berserk && otherExoMechsAlive == 0; @@ -268,41 +321,12 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (npc.ai[0] == 10f && !NPC.AnyNPCs(ModContent.NPCType())) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); } - - // Despawn if target is dead - bool targetDead = false; - if (player.dead) + else { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (player.dead) + if (!NPC.AnyNPCs(ModContent.NPCType())) { - targetDead = true; - - AIState = (float)Phase.Normal; - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; - npc.localAI[2] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - rotationDirection = 0; - - npc.velocity.Y -= 2f; - if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 2f; - - if ((double)npc.position.Y < Main.topWorld + 16f) - { - for (int a = 0; a < Main.maxNPCs; a++) - { - if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) - Main.npc[a].active = false; - } - } + npc.active = false; + npc.netUpdate = true; } } @@ -353,16 +377,14 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Predictiveness float predictionAmt = malice ? 20f : death ? 15f : revenge ? 12.5f : expertMode ? 10f : 5f; + if (nerfedAttacks) + predictionAmt *= 0.5f; if (SecondaryAIState == (float)SecondaryPhase.Passive) predictionAmt *= 0.5f; - Vector2 predictionVector = AIState == (float)Phase.Deathray ? Vector2.Zero : player.velocity * predictionAmt; - Vector2 rotationVector = player.Center + predictionVector - npc.Center; - // Gate values float attackPhaseGateValue = lastMechAlive ? 300f : 480f; - float timeToLineUpAttack = lastMechAlive ? 60f : 90f; - float deathrayPhaseGateValue = lastMechAlive ? 630f : 900f; + float timeToLineUpAttack = 30f; // Spin variables float spinRadius = 500f; @@ -371,24 +393,40 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Distance where Artemis stops moving float movementDistanceGateValue = 100f; - // Charge velocity - float chargeVelocity = malice ? 60f : death ? 50f : revenge ? 45f : expertMode ? 40f : 30f; - float chargeDistance = 1800f; + // Velocity and acceleration values + float baseVelocityMult = (berserk ? 0.25f : 0f) + (malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f); + float baseVelocity = 18f * baseVelocityMult; + float decelerationVelocityMult = 0.85f; + + // Charge variables + float chargeVelocity = nerfedAttacks ? 60f : malice ? 100f : death ? 85f : revenge ? 80f : expertMode ? 75f : 60f; + float chargeDistance = 2000f; float chargeDuration = chargeDistance / chargeVelocity; + bool lineUpAttack = calamityGlobalNPC.newAI[3] >= attackPhaseGateValue + 2f; + bool doBigAttack = calamityGlobalNPC.newAI[3] >= attackPhaseGateValue + 2f + timeToLineUpAttack; // Laser shotgun variables - float laserShotgunDuration = lastMechAlive ? 45f : 60f; + float laserShotgunDuration = 90f; + + // If Artemis can fire projectiles, cannot fire if too close to the target + bool canFire = Vector2.Distance(npc.Center, player.Center) > 320f; // Rotation - bool stopRotatingAndSlowDown = !phase2 && AIState == (float)Phase.Normal && calamityGlobalNPC.newAI[3] >= attackPhaseGateValue + 2f; + Vector2 predictionVector = AIState == (float)Phase.Deathray ? Vector2.Zero : player.velocity * predictionAmt; + Vector2 aimedVector = player.Center + predictionVector - npc.Center; + float rateOfRotation = 0.1f; + Vector2 rotateTowards = player.Center - npc.Center; + bool stopRotatingAndSlowDown = !phase2 && AIState == (float)Phase.Normal && lineUpAttack; if (!stopRotatingAndSlowDown) { if (AIState == (int)Phase.Charge) { + rateOfRotation = 0f; npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; } else if (spinningPoint != default) { + rateOfRotation = 0f; float x = spinningPoint.X - npc.Center.X; float y = spinningPoint.Y - npc.Center.Y; npc.rotation = (float)Math.Atan2(y, x) + MathHelper.PiOver2; @@ -397,12 +435,58 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis { float x = player.Center.X + predictionVector.X - npc.Center.X; float y = player.Center.Y + predictionVector.Y - npc.Center.Y; - npc.rotation = (float)Math.Atan2(y, x) + MathHelper.PiOver2; + rotateTowards = Vector2.Normalize(new Vector2(x, y)) * baseVelocity; } + + // Do not set this during charge or deathray phases + if (rateOfRotation != 0f) + npc.rotation = npc.rotation.AngleTowards((float)Math.Atan2(rotateTowards.Y, rotateTowards.X) + MathHelper.PiOver2, rateOfRotation); } // Light - Lighting.AddLight(npc.Center, 0.25f, 0.15f, 0.05f); + Lighting.AddLight(npc.Center, 0.25f * npc.Opacity, 0.15f * npc.Opacity, 0.05f * npc.Opacity); + + // Despawn if target is dead + if (player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (player.dead) + { + AIState = (float)Phase.Normal; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + rotationDirection = 0; + chargeVelocityNormalized = default; + spinningPoint = default; + spinVelocity = default; + npc.dontTakeDamage = true; + + npc.velocity.Y -= 1f; + if ((double)npc.position.Y < Main.topWorld + 16f) + npc.velocity.Y -= 1f; + + if ((double)npc.position.Y < Main.topWorld + 16f) + { + for (int a = 0; a < Main.maxNPCs; a++) + { + if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; + } + } + + return; + } + } // Add some random distance to the destination after certain attacks if (pickNewLocation) @@ -423,19 +507,13 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis destination.Y += npc.localAI[1]; } - // Velocity and acceleration values - float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; - float baseVelocity = 14f * baseVelocityMult; - float baseAcceleration = 1f; - float decelerationVelocityMult = 0.85f; - if (berserk) - { - baseVelocity *= 1.5f; - baseAcceleration *= 1.5f; - } + // Destination variables Vector2 distanceFromDestination = destination - npc.Center; Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination) * baseVelocity; + // Duration of deathray spin to do a full circle + float spinTime = 180f - baseVelocity * baseVelocityMult; + // Set to transition to phase 2 if it hasn't happened yet if (phase2 && npc.localAI[3] == 0f) { @@ -455,6 +533,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis frameY = 3; } + // Variable for charge flash. Changed in parts of the AI below + bool shouldDoChargeFlash = false; + // Passive and Immune phases switch ((int)SecondaryAIState) { @@ -467,8 +548,19 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (spawnOtherExoMechs) { // Reset everything + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 1f; SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; - npc.TargetClosest(); + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + rotationDirection = 0; + chargeVelocityNormalized = default; + spinningPoint = default; + spinVelocity = default; } } else @@ -480,7 +572,17 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis { // Tells Artemis to return to the battle in passive state and reset everything SecondaryAIState = (float)SecondaryPhase.Passive; - npc.TargetClosest(); + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + rotationDirection = 0; + chargeVelocityNormalized = default; + spinningPoint = default; + spinVelocity = default; } // Go passive and immune if one of the other mechs is berserk @@ -489,7 +591,17 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis { // Reset everything SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; - npc.TargetClosest(); + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + rotationDirection = 0; + chargeVelocityNormalized = default; + spinningPoint = default; + spinVelocity = default; } } @@ -498,19 +610,42 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Fire projectiles less often case (int)SecondaryPhase.Passive: + // Fire lasers while passive + AIState = (float)Phase.Normal; + // Enter passive and invincible phase if one of the other exo mechs is berserk if (otherMechIsBerserk) { // Reset everything SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; - npc.TargetClosest(); + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + rotationDirection = 0; + chargeVelocityNormalized = default; + spinningPoint = default; + spinVelocity = default; } // If Artemis and Apollo are the first mechs to go berserk if (berserk) { // Reset everything - npc.TargetClosest(); + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + rotationDirection = 0; + chargeVelocityNormalized = default; + spinningPoint = default; + spinVelocity = default; // Never be passive if berserk SecondaryAIState = (float)SecondaryPhase.Nothing; @@ -521,19 +656,42 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Fly above target and become immune case (int)SecondaryPhase.PassiveAndImmune: + // Do nothing while immune + AIState = (float)Phase.Normal; + // Enter the fight again if any of the other exo mechs is below 70% and the other mechs aren't berserk if ((exoWormLifeRatio < 0.7f || exoPrimeLifeRatio < 0.7f) && !otherMechIsBerserk) { // Tells Artemis and Apollo to return to the battle in passive state and reset everything // Return to normal phases if one or more mechs have been downed SecondaryAIState = totalOtherExoMechLifeRatio > 5f ? (float)SecondaryPhase.Nothing : (float)SecondaryPhase.Passive; - npc.TargetClosest(); + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + rotationDirection = 0; + chargeVelocityNormalized = default; + spinningPoint = default; + spinVelocity = default; } if (berserk) { // Reset everything - npc.TargetClosest(); + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + rotationDirection = 0; + chargeVelocityNormalized = default; + spinningPoint = default; + spinVelocity = default; // Never be passive if berserk SecondaryAIState = (float)SecondaryPhase.Nothing; @@ -548,59 +706,87 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Fly to the left of the target case (int)Phase.Normal: - if (!targetDead) + if (!stopRotatingAndSlowDown) { - if (!stopRotatingAndSlowDown) + // Inverse lerp returns the percentage of progress between A and B + float lerpValue2 = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + + // Min velocity + float minVelocity2 = distanceFromDestination.Length(); + float minVelocityCap2 = baseVelocity; + if (minVelocity2 > minVelocityCap2) + minVelocity2 = minVelocityCap2; + + // Max velocity + Vector2 maxVelocity2 = distanceFromDestination / 24f; + float maxVelocityCap2 = minVelocityCap2 * 3f; + if (maxVelocity2.Length() > maxVelocityCap2) + maxVelocity2 = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap2; + + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity2, maxVelocity2, lerpValue2); + } + else + { + // Save the normalized charge velocity for use in the charge phase + if (chargeVelocityNormalized == default) { - // Inverse lerp returns the percentage of progress between A and B - float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + chargeVelocityNormalized = Vector2.Normalize(aimedVector); - // Min velocity - float minVelocity = distanceFromDestination.Length(); - float minVelocityCap = baseVelocity; - if (minVelocity > minVelocityCap) - minVelocity = minVelocityCap; + // Fire a spread of projectiles in the direction of the charge + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Vector2 laserVelocity = chargeVelocityNormalized * 10f; + int numLasersPerSpread = 6; + int spread = 21; + float rotation = MathHelper.ToRadians(spread); + float distanceFromTarget = Vector2.Distance(npc.Center, npc.Center + chargeVelocityNormalized * chargeDistance); - // Max velocity - Vector2 maxVelocity = distanceFromDestination / 24f; - float maxVelocityCap = minVelocityCap * 3f; - if (maxVelocity.Length() > maxVelocityCap) - maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + for (int i = 0; i < numLasersPerSpread + 1; i++) + { + Vector2 perturbedSpeed = laserVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numLasersPerSpread - 1))); + Vector2 normalizedPerturbedSpeed = Vector2.Normalize(perturbedSpeed); - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + Vector2 offset = normalizedPerturbedSpeed * 70f; + Vector2 newCenter = npc.Center + offset; + + Projectile.NewProjectile(newCenter, newCenter + normalizedPerturbedSpeed * distanceFromTarget, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + } } - else - { - if (chargeVelocityNormalized == default) - chargeVelocityNormalized = Vector2.Normalize(npc.velocity); - npc.velocity *= decelerationVelocityMult; - } + // Decelerate + npc.velocity *= decelerationVelocityMult; } - // Default animation for 100 frames and then go to telegraph animation + // Default animation for 60 frames and then go to telegraph animation // newAI[3] tells Artemis what animation state it's currently in bool attacking = calamityGlobalNPC.newAI[3] >= 2f; bool firingLasers = attacking && calamityGlobalNPC.newAI[3] + 2f < attackPhaseGateValue; - calamityGlobalNPC.newAI[2] += 1f; + + // Only increase attack timer if not in immune phase + if (SecondaryAIState != (float)SecondaryPhase.PassiveAndImmune) + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] >= defaultAnimationDuration || attacking) { if (firingLasers) { // Fire lasers - int numLasers = lastMechAlive ? 15 : 12; + int numLasers = lastMechAlive ? 16 : nerfedAttacks ? 8 : 12; float divisor = attackPhaseGateValue / numLasers; float laserTimer = calamityGlobalNPC.newAI[3] - 2f; - if (laserTimer % divisor == 0f) + if (laserTimer % divisor == 0f && canFire) { pickNewLocation = true; if (Main.netMode != NetmodeID.MultiplayerClient) { - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); - Vector2 laserVelocity = Vector2.Normalize(rotationVector); - Vector2 projectileDestination = player.Center + player.velocity * predictionAmt; + Vector2 laserVelocity = Vector2.Normalize(aimedVector); + Vector2 projectileDestination = player.Center + predictionVector; Vector2 offset = laserVelocity * 70f; Projectile.NewProjectile(npc.Center + offset, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); } @@ -613,35 +799,51 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // This is replaced by a laser shotgun in phase 2 // Enter deathray phase if in phase 2 and the localAI[2] variable is set to do so calamityGlobalNPC.newAI[3] += 1f; - bool lineUpAttack = calamityGlobalNPC.newAI[3] >= attackPhaseGateValue + 2f; if (lineUpAttack) { - // Draw a large laser telegraph for the charge - if (!phase2 && calamityGlobalNPC.newAI[3] == attackPhaseGateValue + 2f) + // Return to normal laser phase if in passive state + if (SecondaryAIState == (float)SecondaryPhase.Passive) { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - /*int type = ModContent.ProjectileType(); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); - Vector2 laserVelocity = Vector2.Normalize(rotationVector); - Vector2 projectileDestination = player.Center + player.velocity * predictionAmt; - Vector2 offset = laserVelocity * 70f; - Projectile.NewProjectile(npc.Center + offset, projectileDestination, type, 0, 0f, Main.myPlayer, 0f, npc.whoAmI);*/ - } + pickNewLocation = true; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityNormalized = default; } - - bool doAttack = calamityGlobalNPC.newAI[3] >= attackPhaseGateValue + 2f + timeToLineUpAttack; - if (doAttack) + else { - if (phase2) + // Draw a large laser telegraph for the charge + if (!phase2 && calamityGlobalNPC.newAI[3] == attackPhaseGateValue + 5f) { - AIState = npc.localAI[2] == 1f ? (float)Phase.Deathray : (float)Phase.LaserShotgun; + // And allow the charge flash effect + shouldDoChargeFlash = true; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + Vector2 laserVelocity = Vector2.Normalize(aimedVector); + Vector2 offset = laserVelocity * 50f; + Projectile.NewProjectile(npc.Center + offset, laserVelocity, type, 0, 0f, Main.myPlayer, 0f, npc.whoAmI); + } } - else + + if (doBigAttack) { - // Charge until a certain distance is reached and then return to normal phase - AIState = (float)Phase.Charge; - npc.velocity = chargeVelocityNormalized * chargeVelocity; + calamityGlobalNPC.newAI[3] = 0f; + if (phase2) + { + AIState = npc.localAI[2] == 1f ? (float)Phase.Deathray : (float)Phase.LaserShotgun; + } + else + { + // Charge until a certain distance is reached and then return to normal phase + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ELRFire"), npc.Center); + AIState = (float)Phase.Charge; + + // Set charge velocity + npc.velocity = chargeVelocityNormalized * chargeVelocity; + chargeVelocityNormalized = default; + } } } } @@ -652,19 +854,22 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Charge case (int)Phase.Charge: + // Allow the charge flash to happen + shouldDoChargeFlash = true; + // Reset phase and variables calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] >= chargeDuration) { + // Decelerate npc.velocity *= decelerationVelocityMult; - if (calamityGlobalNPC.newAI[2] >= chargeDuration + 20f) + // Go back to normal phase + if (calamityGlobalNPC.newAI[2] >= chargeDuration + 10f) { pickNewLocation = true; AIState = (float)Phase.Normal; calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - npc.TargetClosest(); } } @@ -673,46 +878,56 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Laser shotgun barrage case (int)Phase.LaserShotgun: - if (!targetDead) - { - // Inverse lerp returns the percentage of progress between A and B - float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - // Min velocity - float minVelocity = distanceFromDestination.Length(); - float minVelocityCap = baseVelocity; - if (minVelocity > minVelocityCap) - minVelocity = minVelocityCap; + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = baseVelocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; - // Max velocity - Vector2 maxVelocity = distanceFromDestination / 24f; - float maxVelocityCap = minVelocityCap * 3f; - if (maxVelocity.Length() > maxVelocityCap) - maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); - } + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); // Fire lasers int numSpreads = lastMechAlive ? 3 : 2; - int numLasersPerSpread = lastMechAlive ? 8 : 6; float divisor2 = laserShotgunDuration / numSpreads; - if (calamityGlobalNPC.newAI[2] % divisor2 == 0f) + if (calamityGlobalNPC.newAI[2] % divisor2 == 0f && canFire) { pickNewLocation = true; if (Main.netMode != NetmodeID.MultiplayerClient) { - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); - Vector2 laserVelocity = Vector2.Normalize(rotationVector); - int spread = 3 + (int)(calamityGlobalNPC.newAI[2] / divisor2) * 3; + + Vector2 laserVelocity = Vector2.Normalize(aimedVector) * 10f; + /* Spread: + * lastMechAlive = 20, 25, 30 + * normal = 16, 20, 24 + * nerfedAttacks = 12, 15, 18 + */ + int numLasersPerSpread = lastMechAlive ? 8 : nerfedAttacks ? 4 : 6; + int baseSpread = lastMechAlive ? 20 : nerfedAttacks ? 12 : 16; + int spread = baseSpread + (int)(calamityGlobalNPC.newAI[2] / divisor2) * (baseSpread / 4); float rotation = MathHelper.ToRadians(spread); + float distanceFromTarget = Vector2.Distance(npc.Center, player.Center + predictionVector); + for (int i = 0; i < numLasersPerSpread + 1; i++) { - Vector2 perturbedSpeed = laserVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numLasersPerSpread - 1))); - Vector2 offset = Vector2.Normalize(perturbedSpeed) * 70f; - Projectile.NewProjectile(npc.Center + offset, player.Center + perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + Vector2 perturbedSpeed = laserVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numLasersPerSpread - 1))); + Vector2 normalizedPerturbedSpeed = Vector2.Normalize(perturbedSpeed); + + Vector2 offset = normalizedPerturbedSpeed * 70f; + Vector2 newCenter = npc.Center + offset; + + Projectile.NewProjectile(newCenter, newCenter + normalizedPerturbedSpeed * distanceFromTarget, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); } } } @@ -725,8 +940,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis AIState = (float)Phase.Normal; npc.localAI[2] = berserk ? 1f : 0f; calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - npc.TargetClosest(); } break; @@ -735,92 +948,116 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis case (int)Phase.Deathray: // Fly above, stop doing this if in the proper position - if (!targetDead) + // Stop rotating and spin around a target point + if ((destination - npc.Center).Length() < spinLocationDistance || calamityGlobalNPC.newAI[2] > 0f) { - // Stop rotating and spin around a target point - if ((destination - npc.Center).Length() < spinLocationDistance || calamityGlobalNPC.newAI[2] > 0f) + // Draw telegraph for deathray + if (calamityGlobalNPC.newAI[2] == 0f) { - // Draw telegraph for deathray - if (calamityGlobalNPC.newAI[2] == 0f) + npc.velocity = Vector2.Zero; + spinningPoint = npc.Center + Vector2.UnitY * spinRadius; + npc.ai[1] = spinningPoint.X; + npc.ai[2] = spinningPoint.Y; + if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.velocity = Vector2.Zero; - spinningPoint = npc.Center + Vector2.UnitY * spinRadius; + int type = ModContent.ProjectileType(); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + Vector2 laserVelocity = Vector2.Normalize(spinningPoint - npc.Center); + Vector2 offset = laserVelocity * 70f; + Projectile.NewProjectile(npc.Center + offset, laserVelocity, type, 0, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + npc.netUpdate = true; + } + + // Fire deathray and spin + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration) + { + if (rotationDirection == 0) + { + // Set spin direction + if (Main.player[npc.target].velocity.X > 0f) + rotationDirection = 1; + else if (Main.player[npc.target].velocity.X < 0f) + rotationDirection = -1; + else + rotationDirection = player.direction; + + // Set spin velocity + spinVelocity.X = MathHelper.Pi * spinRadius / spinTime; + spinVelocity *= -rotationDirection; + npc.netUpdate = true; + + // Create a bunch of lightning bolts in the sky + ExoMechsSky.CreateLightningBolt(12); + + // Fire deathray if (Main.netMode != NetmodeID.MultiplayerClient) { - /*int type = ModContent.ProjectileType(); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); - Vector2 laserVelocity = Vector2.Normalize(spinningPoint - npc.Center); - Vector2 offset = laserVelocity * 70f; - Projectile.NewProjectile(npc.Center + offset, spinningPoint, type, 0, 0f, Main.myPlayer, 0f, npc.whoAmI);*/ - } - npc.netUpdate = true; - } - - // Fire deathray and spin - calamityGlobalNPC.newAI[2] += 1f; - if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration) - { - if (rotationDirection == 0) - { - // Set spin direction - if (Main.player[npc.target].velocity.X > 0f) - rotationDirection = 1; - else if (Main.player[npc.target].velocity.X < 0f) - rotationDirection = -1; - else - rotationDirection = player.direction; - - // Set spin velocity - npc.velocity.X = MathHelper.Pi * spinRadius / baseVelocity; - npc.velocity *= -rotationDirection; - npc.netUpdate = true; - - // Fire deathray - if (Main.netMode != NetmodeID.MultiplayerClient) + int type = ModContent.ProjectileType(); + Main.PlaySound(29, (int)npc.Center.X, (int)npc.Center.Y, 104); + int damage = npc.GetProjectileDamage(type); + int laser = Projectile.NewProjectile(npc.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, npc.whoAmI); + if (Main.projectile.IndexInRange(laser)) { - /*int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int laser = Projectile.NewProjectile(npc.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, npc.whoAmI); - if (Main.projectile.IndexInRange(laser)) - Main.projectile[laser].ai[0] = npc.whoAmI;*/ + Main.projectile[laser].ai[0] = npc.whoAmI; + Main.projectile[laser].ai[1] = rotationDirection; } } + } + else + { + // This is used to adjust both the radians and the velocity of the spin moved per frame + float rotationMult = (calamityGlobalNPC.newAI[2] - deathrayTelegraphDuration) / deathrayDuration * 4f; + if (rotationMult > 1f) + { + // The radians moved per frame during the spin + double radiansOfRotation = MathHelper.Pi / spinTime * -rotationDirection; + npc.velocity = npc.velocity.RotatedBy(radiansOfRotation); + } else - npc.velocity = npc.velocity.RotatedBy(MathHelper.Pi / baseVelocity * -rotationDirection); + { + // The radians moved per frame during the spin + // The radians moved are reduced early on to avoid spinning too fucking fast + float decelerationMult = rotationMult * rotationMult; + double radiansOfRotation = MathHelper.Pi / spinTime * -rotationDirection * decelerationMult; + npc.velocity = (spinVelocity * decelerationMult).RotatedBy(radiansOfRotation); + } } } - else - { - // Inverse lerp returns the percentage of progress between A and B - float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + } + else + { + // Inverse lerp returns the percentage of progress between A and B + float lerpValue3 = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - // Min velocity - float minVelocity = distanceFromDestination.Length(); - float minVelocityCap = baseVelocity; - if (minVelocity > minVelocityCap) - minVelocity = minVelocityCap; + // Min velocity + float minVelocity3 = distanceFromDestination.Length(); + float minVelocityCap3 = baseVelocity; + if (minVelocity3 > minVelocityCap3) + minVelocity3 = minVelocityCap3; - // Max velocity - Vector2 maxVelocity = distanceFromDestination / 24f; - float maxVelocityCap = minVelocityCap * 3f; - if (maxVelocity.Length() > maxVelocityCap) - maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + // Max velocity + Vector2 maxVelocity3 = distanceFromDestination / 24f; + float maxVelocityCap3 = minVelocityCap3 * 3f; + if (maxVelocity3.Length() > maxVelocityCap3) + maxVelocity3 = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap3; - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); - } + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity3, maxVelocity3, lerpValue3); } // Reset phase and variables if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration + deathrayDuration) { + spinVelocity = default; rotationDirection = 0; spinningPoint = default; pickNewLocation = true; AIState = (float)Phase.Normal; + npc.ai[1] = 0f; + npc.ai[2] = 0f; npc.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - npc.TargetClosest(); } break; @@ -828,33 +1065,32 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Phase transition animation, that's all this exists for case (int)Phase.PhaseTransition: - if (!targetDead) - { - // Inverse lerp returns the percentage of progress between A and B - float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + // Inverse lerp returns the percentage of progress between A and B + float lerpValue4 = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); - // Min velocity - float minVelocity = distanceFromDestination.Length(); - float minVelocityCap = baseVelocity; - if (minVelocity > minVelocityCap) - minVelocity = minVelocityCap; + // Min velocity + float minVelocity4 = distanceFromDestination.Length(); + float minVelocityCap4 = baseVelocity; + if (minVelocity4 > minVelocityCap4) + minVelocity4 = minVelocityCap4; - // Max velocity - Vector2 maxVelocity = distanceFromDestination / 24f; - float maxVelocityCap = minVelocityCap * 3f; - if (maxVelocity.Length() > maxVelocityCap) - maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + // Max velocity + Vector2 maxVelocity4 = distanceFromDestination / 24f; + float maxVelocityCap4 = minVelocityCap4 * 3f; + if (maxVelocity4.Length() > maxVelocityCap4) + maxVelocity4 = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap4; - npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); - } + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity4, maxVelocity4, lerpValue4); // Shoot lens gore at the target at the proper time if (calamityGlobalNPC.newAI[2] == lensPopTime) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"), npc.Center); - Vector2 goreVelocity = Vector2.Normalize(rotationVector); - Vector2 offset = goreVelocity * 70f; - Gore.NewGore(npc.Center + offset, goreVelocity * 24f, mod.GetGoreSlot("Gores/Artemis/ArtemisTransitionGore"), 1f); + Vector2 lensDirection = Vector2.Normalize(aimedVector); + Vector2 offset = lensDirection * 70f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.Center + offset, lensDirection * 24f, ModContent.ProjectileType(), 0, 0f); } // Reset phase and variables @@ -863,12 +1099,18 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis { pickNewLocation = true; AIState = (float)Phase.Normal; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; - npc.TargetClosest(); + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityNormalized = default; } break; } + + // Update the charge flash variable + ChargeFlash = MathHelper.Clamp(ChargeFlash + shouldDoChargeFlash.ToDirectionInt() * 0.08f, 0f, 1f); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -890,7 +1132,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (dist4 < minDist) minDist = dist4; - return minDist <= 100f && npc.Opacity == 1f; + return minDist <= 100f && npc.Opacity == 1f && AIState == (float)Phase.Charge; } public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) => !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); @@ -908,7 +1150,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis npc.frameCounter += 1D; if (AIState == (float)Phase.PhaseTransition) { - if (npc.frameCounter >= 10D) + if (npc.frameCounter >= 6D) { // Reset frame counter npc.frameCounter = 0D; @@ -931,7 +1173,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis int frameLimit = phase2 ? (npc.Calamity().newAI[3] == 0f ? normalFrameLimit_Phase2 : npc.Calamity().newAI[3] == 1f ? chargeUpFrameLimit_Phase2 : attackFrameLimit_Phase2) : (npc.Calamity().newAI[3] == 0f ? normalFrameLimit_Phase1 : npc.Calamity().newAI[3] == 1f ? chargeUpFrameLimit_Phase1 : attackFrameLimit_Phase1); - if (npc.frameCounter >= 10D) + if (npc.frameCounter >= 6D) { // Reset frame counter npc.frameCounter = 0D; @@ -955,7 +1197,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis else if (AIState == (float)Phase.Charge || AIState == (float)Phase.LaserShotgun || AIState == (float)Phase.Deathray) { int frameLimit = phase2 ? attackFrameLimit_Phase2 : attackFrameLimit_Phase1; - if (npc.frameCounter >= 10D) + if (npc.frameCounter >= 6D) { // Reset frame counter npc.frameCounter = 0D; @@ -979,34 +1221,137 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis } } + public float FlameTrailWidthFunction(float completionRatio) => MathHelper.SmoothStep(21f, 8f, completionRatio) * ChargeFlash; + + public float FlameTrailWidthFunctionBig(float completionRatio) => MathHelper.SmoothStep(34f, 12f, completionRatio) * ChargeFlash; + + public float RibbonTrailWidthFunction(float completionRatio) + { + float baseWidth = Utils.InverseLerp(1f, 0.54f, completionRatio, true) * 5f; + float endTipWidth = CalamityUtils.Convert01To010(Utils.InverseLerp(0.96f, 0.89f, completionRatio, true)) * 2.4f; + return baseWidth + endTipWidth; + } + + public Color FlameTrailColorFunction(float completionRatio) + { + float trailOpacity = Utils.InverseLerp(0.8f, 0.27f, completionRatio, true) * Utils.InverseLerp(0f, 0.067f, completionRatio, true); + Color startingColor = Color.Lerp(Color.White, Color.Cyan, 0.27f); + Color middleColor = Color.Lerp(Color.Orange, Color.Yellow, 0.31f); + Color endColor = Color.OrangeRed; + return CalamityUtils.MulticolorLerp(completionRatio, startingColor, middleColor, endColor) * ChargeFlash * trailOpacity; + } + + public Color FlameTrailColorFunctionBig(float completionRatio) + { + float trailOpacity = Utils.InverseLerp(0.8f, 0.27f, completionRatio, true) * Utils.InverseLerp(0f, 0.067f, completionRatio, true) * 0.56f; + Color startingColor = Color.Lerp(Color.White, Color.Cyan, 0.25f); + Color middleColor = Color.Lerp(Color.Blue, Color.White, 0.35f); + Color endColor = Color.Lerp(Color.DarkBlue, Color.White, 0.47f); + Color color = CalamityUtils.MulticolorLerp(completionRatio, startingColor, middleColor, endColor) * ChargeFlash * trailOpacity; + color.A = 0; + return color; + } + + public Color RibbonTrailColorFunction(float completionRatio) + { + Color startingColor = new Color(34, 40, 48); + Color endColor = new Color(219, 82, 28); + return Color.Lerp(startingColor, endColor, (float)Math.Pow(completionRatio, 1.5D)) * npc.Opacity; + } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { + // Declare the trail drawers if they have yet to be defined. + if (ChargeFlameTrail is null) + ChargeFlameTrail = new PrimitiveTrail(FlameTrailWidthFunction, FlameTrailColorFunction, null, GameShaders.Misc["CalamityMod:ImpFlameTrail"]); + + if (ChargeFlameTrailBig is null) + ChargeFlameTrailBig = new PrimitiveTrail(FlameTrailWidthFunctionBig, FlameTrailColorFunctionBig, null, GameShaders.Misc["CalamityMod:ImpFlameTrail"]); + + if (RibbonTrail is null) + RibbonTrail = new PrimitiveTrail(RibbonTrailWidthFunction, RibbonTrailColorFunction); + + // Prepare the flame trail shader with its map texture. + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/ScarletDevilStreak")); + + int numAfterimages = ChargeFlash > 0f ? 0 : 5; Texture2D texture = Main.npcTexture[npc.type]; Rectangle frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); - Vector2 vector = new Vector2(npc.width / 2, npc.height / 2); + Vector2 origin = npc.Size * 0.5f; + Vector2 center = npc.Center - Main.screenPosition; Color afterimageBaseColor = Color.White; - int numAfterimages = 5; - if (CalamityConfig.Instance.Afterimages) + // Draws a single instance of a regular, non-glowmask based Artemis. + // This is created to allow easy duplication of them when drawing the charge. + void drawInstance(Vector2 drawOffset, Color baseColor) { - for (int i = 1; i < numAfterimages; i += 2) + if (CalamityConfig.Instance.Afterimages) { - Color afterimageColor = drawColor; - afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); - afterimageColor = npc.GetAlpha(afterimageColor); - afterimageColor *= (numAfterimages - i) / 15f; - Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + for (int i = 1; i < numAfterimages; i += 2) + { + Color afterimageColor = baseColor; + afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); + afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor *= (numAfterimages - i) / 15f; + Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; + afterimageCenter += origin * npc.scale + new Vector2(0f, npc.gfxOffY); + afterimageCenter += drawOffset; + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0f); + } } + + spriteBatch.Draw(texture, center + drawOffset, frame, npc.GetAlpha(baseColor), npc.rotation, origin, npc.scale, SpriteEffects.None, 0f); } - Vector2 center = npc.Center - Main.screenPosition; - spriteBatch.Draw(texture, center, frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + // Draw ribbons near the main thruster + for (int direction = -1; direction <= 1; direction += 2) + { + Vector2 ribbonOffset = -Vector2.UnitY.RotatedBy(npc.rotation) * 14f; + ribbonOffset += Vector2.UnitX.RotatedBy(npc.rotation) * direction * 26f; + + float currentSegmentRotation = npc.rotation; + List ribbonDrawPositions = new List(); + for (int i = 0; i < 12; i++) + { + float ribbonCompletionRatio = i / 12f; + float wrappedAngularOffset = MathHelper.WrapAngle(npc.oldRot[i + 1] - currentSegmentRotation) * 0.3f; + float segmentRotationOffset = MathHelper.Clamp(wrappedAngularOffset, -0.12f, 0.12f); + + // Add a sinusoidal offset that goes based on time and completion ratio to create a waving-flag-like effect. + // This is dampened for the first few points to prevent weird offsets. It is also dampened by high velocity. + float sinusoidalRotationOffset = (float)Math.Sin(ribbonCompletionRatio * 2.22f + Main.GlobalTime * 3.4f) * 1.36f; + float sinusoidalRotationOffsetFactor = Utils.InverseLerp(0f, 0.37f, ribbonCompletionRatio, true) * direction * 24f; + sinusoidalRotationOffsetFactor *= Utils.InverseLerp(24f, 16f, npc.velocity.Length(), true); + + Vector2 sinusoidalOffset = Vector2.UnitY.RotatedBy(npc.rotation + sinusoidalRotationOffset) * sinusoidalRotationOffsetFactor; + Vector2 ribbonSegmentOffset = Vector2.UnitY.RotatedBy(currentSegmentRotation) * ribbonCompletionRatio * 540f + sinusoidalOffset; + ribbonDrawPositions.Add(npc.Center + ribbonSegmentOffset + ribbonOffset); + + currentSegmentRotation += segmentRotationOffset; + } + RibbonTrail.Draw(ribbonDrawPositions, -Main.screenPosition, 66); + } + + int instanceCount = (int)MathHelper.Lerp(1f, 15f, ChargeFlash); + Color baseInstanceColor = Color.Lerp(drawColor, Color.White, ChargeFlash); + baseInstanceColor.A = (byte)(int)(255f - ChargeFlash * 255f); + + spriteBatch.EnterShaderRegion(); + + drawInstance(Vector2.Zero, baseInstanceColor); + if (instanceCount > 1) + { + baseInstanceColor *= 0.04f; + float backAfterimageOffset = MathHelper.SmoothStep(0f, 2f, ChargeFlash); + for (int i = 0; i < instanceCount; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / instanceCount + Main.GlobalTime * 0.8f).ToRotationVector2() * backAfterimageOffset; + drawInstance(drawOffset, baseInstanceColor); + } + } texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Artemis/ArtemisGlow"); - if (CalamityConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) @@ -1016,13 +1361,45 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis afterimageColor = npc.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; + afterimageCenter += origin * npc.scale + new Vector2(0f, npc.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0f); } } - spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, origin, npc.scale, SpriteEffects.None, 0f); + + spriteBatch.ExitShaderRegion(); + + // Draw a flame trail on the thrusters if needed. This happens during charges. + if (ChargeFlash > 0f) + { + for (int direction = -1; direction <= 1; direction++) + { + Vector2 baseDrawOffset = new Vector2(0f, direction == 0f ? 18f : 60f).RotatedBy(npc.rotation); + baseDrawOffset += new Vector2(direction * 64f, 0f).RotatedBy(npc.rotation); + + float backFlameLength = direction == 0f ? 700f : 190f; + Vector2 drawStart = npc.Center + baseDrawOffset; + Vector2 drawEnd = drawStart - (npc.rotation - MathHelper.PiOver2).ToRotationVector2() * ChargeFlash * backFlameLength; + Vector2[] drawPositions = new Vector2[] + { + drawStart, + drawEnd + }; + + if (direction == 0) + { + for (int i = 0; i < 4; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 8f; + ChargeFlameTrailBig.Draw(drawPositions, drawOffset - Main.screenPosition, 70); + } + } + else + ChargeFlameTrail.Draw(drawPositions, -Main.screenPosition, 70); + } + } return false; } @@ -1051,16 +1428,31 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis Main.dust[num195].noGravity = true; } - /*Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresBody1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresBody2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresBody3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresBody4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresBody5"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresBody6"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresBody7"), 1f);*/ + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Artemis/Artemis1"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Artemis/Artemis2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Artemis/Artemis3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Artemis/Artemis4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Artemis/Artemis5"), 1f); } } + public override bool CheckDead() + { + // Kill Apollo if he's still alive when Artemis dies + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC nPC = Main.npc[i]; + if (nPC.active && nPC.type == ModContent.NPCType() && nPC.life > 0) + { + nPC.life = 0; + nPC.HitEffect(0, 10.0); + nPC.checkDead(); + nPC.active = false; + } + } + return true; + } + public override bool CheckActive() => false; public override void ScaleExpertStats(int numPlayers, float bossLifeScale) diff --git a/NPCs/ExoMechs/Draedon.cs b/NPCs/ExoMechs/Draedon.cs new file mode 100644 index 0000000000..881a982bab --- /dev/null +++ b/NPCs/ExoMechs/Draedon.cs @@ -0,0 +1,427 @@ +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +using ApolloBoss = CalamityMod.NPCs.ExoMechs.Apollo.Apollo; +using ArtemisBoss = CalamityMod.NPCs.ExoMechs.Artemis.Artemis; + +namespace CalamityMod.NPCs.ExoMechs +{ + public class Draedon : ModNPC + { + public float DefeatTimer; + public bool ShouldStartStandingUp; + public Vector2 HoverDestinationOffset + { + get => new Vector2(npc.ai[1], npc.ai[2]); + set + { + npc.ai[1] = value.X; + npc.ai[2] = value.Y; + } + } + public Player PlayerToFollow => Main.player[npc.target]; + public ref float TalkTimer => ref npc.ai[0]; + public ref float GeneralTimer => ref npc.ai[3]; + public static bool ExoMechIsPresent + { + get + { + if (NPC.AnyNPCs(ModContent.NPCType())) + return true; + + if (NPC.AnyNPCs(ModContent.NPCType())) + return true; + + if (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType())) + return true; + + return false; + } + } + public static readonly Color TextColor = new Color(155, 255, 255); + public static readonly Color TextColorEdgy = new Color(213, 4, 11); + public const int TeleportFadeinTime = 45; + public const int TalkDelay = 150; + public const int DelayPerDialogLine = 130; + public const int ExoMechChooseDelay = TalkDelay + DelayPerDialogLine * 4 + 10; + public const int ExoMechShakeTime = 100; + public const int DelayBeforeDefeatStandup = 30; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Draedon"); + Main.npcFrameCount[npc.type] = 15; + } + + public override void SetDefaults() + { + npc.damage = 0; + npc.width = npc.height = 34; + npc.defense = 100; + npc.lifeMax = 16000; + npc.noGravity = true; + npc.noTileCollide = true; + npc.dontTakeDamage = true; + npc.aiStyle = aiType = -1; + npc.knockBackResist = 0f; + npc.Calamity().DoesNotGenerateRage = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(DefeatTimer); + writer.Write(ShouldStartStandingUp); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + DefeatTimer = reader.ReadSingle(); + ShouldStartStandingUp = reader.ReadBoolean(); + } + + public override void AI() + { + // Set the whoAmI variable. + CalamityGlobalNPC.draedon = npc.whoAmI; + + // Prevent stupid natural despawns. + npc.timeLeft = 3600; + + // Decide an initial target and play a teleport sound on the first frame. + if (TalkTimer == 0f) + { + npc.TargetClosest(false); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DraedonTeleport"), PlayerToFollow.Center); + } + + // Pick someone else to pay attention to if the old target is gone. + if (PlayerToFollow.dead || !PlayerToFollow.active) + { + npc.TargetClosest(false); + + // Fuck off if no living target exists. + if (PlayerToFollow.dead || !PlayerToFollow.active) + { + npc.life = 0; + npc.checkDead(); + npc.active = false; + return; + } + } + + // Stay within the world. + npc.position.Y = MathHelper.Clamp(npc.position.Y, 150f, Main.maxTilesY * 16f - 150f); + + npc.Opacity = Utils.InverseLerp(0f, 8f, TalkTimer, true); + npc.spriteDirection = (PlayerToFollow.Center.X < npc.Center.X).ToDirectionInt(); + + // Play the stand up animation after teleportation. + if (TalkTimer == TeleportFadeinTime + 5f) + ShouldStartStandingUp = true; + + if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == TalkDelay) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonIntroductionText1", TextColor); + npc.netUpdate = true; + } + + if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == TalkDelay + DelayPerDialogLine) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonIntroductionText2", TextColor); + npc.netUpdate = true; + } + + if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == TalkDelay + DelayPerDialogLine * 2f) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonIntroductionText3", TextColor); + npc.netUpdate = true; + } + + if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == TalkDelay + DelayPerDialogLine * 3f) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonIntroductionText4", TextColor); + npc.netUpdate = true; + } + + // Inform the player who summoned draedon they may choose the first mech and cause a selection UI to appear over their head. + if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == TalkDelay + DelayPerDialogLine * 4f) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonIntroductionText5", TextColorEdgy); + npc.netUpdate = true; + } + + // Wait for the player to select an exo mech. + if (TalkTimer >= ExoMechChooseDelay && TalkTimer < ExoMechChooseDelay + 8f && CalamityWorld.DraedonMechToSummon == ExoMech.None) + { + PlayerToFollow.Calamity().AbleToSelectExoMech = true; + TalkTimer = ExoMechChooseDelay; + } + + // Disable music before talking. + if (TalkTimer <= 50f) + Main.LocalPlayer.Calamity().MusicMuffleFactor = 1f; + + // Fly around once the exo mechs have been spawned. + if (ExoMechIsPresent || DefeatTimer > 0f) + { + FlyAroundInGamerChair(); + GeneralTimer++; + } + + // Make the screen rumble and summon the exo mechs. + if (TalkTimer > ExoMechChooseDelay + 8f && TalkTimer < ExoMechChooseDelay + ExoMechShakeTime) + { + Main.LocalPlayer.Calamity().GeneralScreenShakePower = Utils.InverseLerp(4200f, 1400f, Main.LocalPlayer.Distance(PlayerToFollow.Center), true) * 18f; + Main.LocalPlayer.Calamity().GeneralScreenShakePower *= Utils.InverseLerp(ExoMechChooseDelay + 5f, ExoMechChooseDelay + ExoMechShakeTime, TalkTimer, true); + } + + // Summon the selected exo mech. + if (TalkTimer == ExoMechChooseDelay + 10f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + SummonExoMech(); + + if (Main.netMode != NetmodeID.Server) + { + var sound = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/FlareSound"), PlayerToFollow.Center); + + if (sound != null) + sound.Volume = MathHelper.Clamp(sound.Volume * 1.55f, 0f, 1f); + } + } + + if (TalkTimer > ExoMechChooseDelay + 10f && !ExoMechIsPresent) + { + HandleDefeatStuff(); + DefeatTimer++; + } + + if (!ExoMechIsPresent && DefeatTimer <= 0f) + music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/DraedonAmbience"); + if (ExoMechIsPresent) + music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; + + TalkTimer++; + } + + // TODO - Make this work in conjunction with exo mech transitions. This requires that the exo mech AIs be finished. + public void FlyAroundInGamerChair() + { + // Define a hover destination offset if one hasn't been decided yet. + if (Main.netMode != NetmodeID.MultiplayerClient && HoverDestinationOffset == Vector2.Zero) + { + HoverDestinationOffset = -Vector2.UnitY * 700f; + npc.netUpdate = true; + } + + // Switch hover destinations from time to time. + if (Main.netMode != NetmodeID.MultiplayerClient && GeneralTimer % 480f == 479f) + { + Vector2 offsetDirection; + Vector2 directionToTarget = npc.SafeDirectionTo(PlayerToFollow.Center); + + // Reroll the offset direction if its direction noticably contrasts the current direction from the target. + // This is done to prevent Draedon from selecting a position to zoom to that would make him have to move + // close to the player. + do + offsetDirection = Main.rand.NextVector2Unit(); + while (Vector2.Dot(directionToTarget, offsetDirection) > 0.2f); + + HoverDestinationOffset = offsetDirection * Main.rand.NextFloat(750f, 1100f); + npc.netUpdate = true; + } + + // Always hover to the side of the target when defeated. + if (DefeatTimer > 5f) + HoverDestinationOffset = Vector2.UnitX * (PlayerToFollow.Center.X < npc.Center.X).ToDirectionInt() * 325f; + + Vector2 hoverDestination = PlayerToFollow.Center + HoverDestinationOffset; + + // Decide sprite direction based on movement if not close enough to the desination. + // Not deciding this here results in Draedon using the default of looking at the target he's following. + if (npc.WithinRange(hoverDestination, 300f)) + { + npc.velocity *= 0.96f; + + float moveSpeed = MathHelper.Lerp(2f, 8f, Utils.InverseLerp(45f, 275f, npc.Distance(hoverDestination), true)); + npc.Center = npc.Center.MoveTowards(hoverDestination, moveSpeed); + } + else + { + if (DefeatTimer < DelayBeforeDefeatStandup) + npc.spriteDirection = (npc.velocity.X < 0f).ToDirectionInt(); + + float flySpeed = DefeatTimer > 5f ? 14f : 32f; + Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * flySpeed; + npc.SimpleFlyMovement(idealVelocity, flySpeed / 400f); + npc.velocity = Vector2.Lerp(npc.velocity, idealVelocity, 0.045f); + } + } + + public void SummonExoMech() + { + switch (CalamityWorld.DraedonMechToSummon) + { + // Summon Thanatos underground. + case ExoMech.Destroyer: + Vector2 thanatosSpawnPosition = PlayerToFollow.Center + Vector2.UnitY * 2100f; + NPC thanatos = CalamityUtils.SpawnBossBetter(thanatosSpawnPosition, ModContent.NPCType()); + if (thanatos != null) + thanatos.velocity = thanatos.SafeDirectionTo(PlayerToFollow.Center) * 40f; + break; + + // Summon Ares in the sky, directly above the player. + case ExoMech.Prime: + Vector2 aresSpawnPosition = PlayerToFollow.Center - Vector2.UnitY * 1400f; + CalamityUtils.SpawnBossBetter(aresSpawnPosition, ModContent.NPCType()); + break; + + // Summon Apollo and Artemis above the player to their sides. + case ExoMech.Twins: + Vector2 artemisSpawnPosition = PlayerToFollow.Center + new Vector2(-1100f, -1600f); + Vector2 apolloSpawnPosition = PlayerToFollow.Center + new Vector2(1100f, -1600f); + CalamityUtils.SpawnBossBetter(artemisSpawnPosition, ModContent.NPCType()); + CalamityUtils.SpawnBossBetter(apolloSpawnPosition, ModContent.NPCType()); + break; + } + } + + public void HandleDefeatStuff() + { + // Become vulnerable after being defeated after a certain point. + npc.dontTakeDamage = DefeatTimer < 250f; + npc.Calamity().CanHaveBossHealthBar = !npc.dontTakeDamage; + + // Stand up in awe after a small amount of time has passed. + if (DefeatTimer > DelayBeforeDefeatStandup) + ShouldStartStandingUp = true; + + // TODO - This needs to be changed. + if (DefeatTimer == DelayBeforeDefeatStandup + 10f) + Main.NewText("Wait, what? How?", TextColor); + + if (DefeatTimer == DelayBeforeDefeatStandup + 80f) + Main.NewText("No", TextColor); + } + + // Draedon should not manually despawn. + public override bool CheckActive() => false; + + public override Color? GetAlpha(Color drawColor) + { + float teleportFade = Utils.InverseLerp(0f, TeleportFadeinTime, TalkTimer, true); + Color color = Color.Lerp(drawColor, Color.Cyan, 1f - (float)Math.Pow(teleportFade, 3D)); + color.A = (byte)(int)(teleportFade * 255f); + + return color * npc.Opacity; + } + + public override void FindFrame(int frameHeight) + { + npc.frame.Width = 102; + + int xFrame = npc.frame.X / npc.frame.Width; + int yFrame = npc.frame.Y / frameHeight; + int frame = xFrame * Main.npcFrameCount[npc.type] + yFrame; + + // Prepare to stand up if called for and not already doing so. + if (ShouldStartStandingUp && frame < 23) + frame = 23; + + int frameChangeDelay = 7; + bool shouldNotSitDown = DefeatTimer > DelayBeforeDefeatStandup; + + npc.frameCounter++; + if (npc.frameCounter >= frameChangeDelay) + { + frame++; + + if (!ShouldStartStandingUp && frame >= 23) + frame = 0; + + // Do the sit animation infinitely if Draedon should not sit down again. + if (shouldNotSitDown && frame >= 47) + frame = 36; + + if (frame >= 59) + { + frame = 0; + ShouldStartStandingUp = false; + } + + npc.frameCounter = 0; + } + + npc.frame.X = frame / Main.npcFrameCount[npc.type] * npc.frame.Width; + npc.frame.Y = frame % Main.npcFrameCount[npc.type] * frameHeight; + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = 16000; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life > 0) + return; + + for (int i = 1; i <= 4; i++) + { + Vector2 goreSpawnOffset = Main.rand.NextVector2Circular(12f, 12f); + Vector2 draedonPieceVelocity = Main.rand.NextVector2CircularEdge(7f, 7f) - Vector2.UnitY * 8f; + Vector2 chairPieceVelocity = Vector2.UnitY.RotatedByRandom(0.13f) * Main.rand.NextFloat(4.45f, 5.4f); + Gore.NewGoreDirect(npc.Center + goreSpawnOffset, draedonPieceVelocity, mod.GetGoreSlot($"Gores/Draedon/Draedon{i}")); + + goreSpawnOffset = Main.rand.NextVector2Circular(18f, 18f); + Gore.NewGoreDirect(npc.Center + goreSpawnOffset, chairPieceVelocity, mod.GetGoreSlot($"Gores/Draedon/Chair{i}")); + } + } + + // Always instantly kill Draedon when he's vulnerable + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + damage *= 56D; + if (damage < npc.lifeMax) + damage = npc.lifeMax + Main.rand.NextFloat(50f, 750f); + crit = true; + return true; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + spriteBatch.EnterShaderRegion(); + + Texture2D texture = Main.npcTexture[npc.type]; + Texture2D glowmask = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/DraedonGlowmask"); + Rectangle frame = npc.frame; + + Vector2 drawPosition = npc.Center - Main.screenPosition - Vector2.UnitY * 38f; + Vector2 origin = frame.Size() * 0.5f; + Color color = npc.GetAlpha(drawColor); + SpriteEffects direction = npc.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + GameShaders.Misc["CalamityMod:TeleportDisplacement"].UseOpacity(MathHelper.Clamp(1f - TalkTimer / TeleportFadeinTime, 0f, 1f) * 0.38f); + GameShaders.Misc["CalamityMod:TeleportDisplacement"].UseSecondaryColor(color); + GameShaders.Misc["CalamityMod:TeleportDisplacement"].UseSaturation(color.A / 255f); + GameShaders.Misc["CalamityMod:TeleportDisplacement"].Shader.Parameters["frameCount"].SetValue(new Vector2(2f, Main.npcFrameCount[npc.type])); + GameShaders.Misc["CalamityMod:TeleportDisplacement"].Apply(); + + spriteBatch.Draw(texture, drawPosition, frame, drawColor * npc.Opacity, npc.rotation, origin, npc.scale, direction, 0f); + + spriteBatch.ExitShaderRegion(); + + if (TalkTimer > TeleportFadeinTime) + spriteBatch.Draw(glowmask, drawPosition, frame, Color.White * npc.Opacity, npc.rotation, origin, npc.scale, direction, 0f); + + return false; + } + } +} diff --git a/NPCs/ExoMechs/Draedon.png b/NPCs/ExoMechs/Draedon.png new file mode 100644 index 0000000000..c0ec806a42 Binary files /dev/null and b/NPCs/ExoMechs/Draedon.png differ diff --git a/NPCs/ExoMechs/DraedonGlowmask.png b/NPCs/ExoMechs/DraedonGlowmask.png new file mode 100644 index 0000000000..5993dfe9cd Binary files /dev/null and b/NPCs/ExoMechs/DraedonGlowmask.png differ diff --git a/NPCs/ExoMechs/ExoMechs_BossChecklist.png b/NPCs/ExoMechs/ExoMechs_BossChecklist.png new file mode 100644 index 0000000000..f44bba68fd Binary files /dev/null and b/NPCs/ExoMechs/ExoMechs_BossChecklist.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index 78fcbb996f..0cc8c5c37f 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -1,10 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Graphics; using System; using System.IO; @@ -33,8 +32,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Whether the body is venting heat or not, it is vulnerable to damage during venting private bool vulnerable = false; + public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); + // Timer to prevent Thanatos from dealing contact damage for a bit + private int noContactDamageTimer = 0; + + private const float timeToOpenAndFireLasers = 36f; + + private const float segmentCloseTimerDecrement = 0.2f; + public override void SetStaticDefaults() { DisplayName.SetDefault("XM-05 Thanatos"); @@ -58,10 +65,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos aiType = -1; npc.knockBackResist = 0f; npc.Opacity = 0f; - npc.behindTiles = true; + npc.canGhostHeal = false; + npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; npc.dontCountMe = true; @@ -72,7 +79,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void BossHeadSlot(ref int index) { - if (vulnerable) + if (Main.npc[(int)npc.ai[2]].Calamity().newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune) + index = -1; + else if (vulnerable) index = vulnerableIconIndex; else index = normalIconIndex; @@ -87,6 +96,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { writer.Write(npc.chaseable); writer.Write(npc.dontTakeDamage); + writer.Write(noContactDamageTimer); writer.Write(vulnerable); writer.Write(npc.localAI[0]); writer.Write(npc.localAI[1]); @@ -99,6 +109,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { npc.chaseable = reader.ReadBoolean(); npc.dontTakeDamage = reader.ReadBoolean(); + noContactDamageTimer = reader.ReadInt32(); vulnerable = reader.ReadBoolean(); npc.localAI[0] = reader.ReadSingle(); npc.localAI[1] = reader.ReadSingle(); @@ -146,6 +157,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.HitEffect(0, 10.0); npc.checkDead(); npc.active = false; + return; } // Set vulnerable to false by default @@ -154,18 +166,29 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; - npc.dontTakeDamage = invisiblePhase; + npc.dontTakeDamage = Main.npc[(int)npc.ai[2]].dontTakeDamage; if (!invisiblePhase) { if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) { + if (noContactDamageTimer > 0) + noContactDamageTimer--; + npc.Opacity += 0.2f; if (npc.Opacity > 1f) npc.Opacity = 1f; } + else + { + // Deal no contact damage for 3 seconds after becoming visible + noContactDamageTimer = 185; + } } else { + // Deal no contact damage for 3 seconds after becoming visible + noContactDamageTimer = 185; + npc.Opacity -= 0.05f; if (npc.Opacity < 0f) npc.Opacity = 0f; @@ -201,7 +224,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Set the AI to become more aggressive if head is berserk bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); - bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage || berserk) && calamityGlobalNPC_Head.newAI[2] > 0f; + bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; if (shootLasers && !invisiblePhase) { if (Main.netMode != NetmodeID.MultiplayerClient) @@ -210,11 +233,15 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (npc.Calamity().newAI[0] == 0f) npc.ai[3] += 1f; - double numSegmentsAbleToFire = malice ? 30D : death ? 20D : revenge ? 17.5 : expertMode ? 15D : 10D; - if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge && !berserk) + double numSegmentsAbleToFire = malice ? 35D : death ? 30D : revenge ? 28D : expertMode ? 25D : 20D; + if (berserk) + numSegmentsAbleToFire *= 1.5; + + float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); + + if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge) { float divisor = 120f; - float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); if ((npc.ai[3] % divisor == 0f && npc.localAI[2] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) { // Body is vulnerable while firing lasers @@ -223,7 +250,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (npc.Calamity().newAI[1] == 0f) { npc.Calamity().newAI[0] += 1f; - if (npc.Calamity().newAI[0] >= 72f) + if (npc.Calamity().newAI[0] >= timeToOpenAndFireLasers) { npc.ai[3] = 0f; npc.Calamity().newAI[1] = 1f; @@ -253,11 +280,14 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon").WithVolume(0.1f), npc.Center); + SoundEffectInstance sound = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + if (sound != null) + sound.Volume *= 0.1f; + for (int i = 0; i < numProjectiles; i++) { // Normal laser - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); } @@ -266,7 +296,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { - npc.Calamity().newAI[0] -= 1f; + npc.Calamity().newAI[0] -= segmentCloseTimerDecrement; if (npc.Calamity().newAI[0] <= 0f) { npc.Calamity().newAI[0] = 0f; @@ -277,8 +307,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { - // This is only used in deathray phase to prevent laser spam - float segmentDivisor = (float)Math.Round(numSegments / (berserk ? 5D : numSegmentsAbleToFire)); float divisor = npc.localAI[2] * 3f; // Ranges from 3 to 300 if ((npc.ai[3] == divisor && npc.localAI[2] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) { @@ -288,7 +316,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (npc.Calamity().newAI[1] == 0f) { npc.Calamity().newAI[0] += 1f; - if (npc.Calamity().newAI[0] >= 72f) + if (npc.Calamity().newAI[0] >= timeToOpenAndFireLasers) { npc.ai[3] = 0f; npc.Calamity().newAI[1] = 1f; @@ -319,7 +347,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } float predictionAmt = malice ? 30f : death ? 25f : revenge ? 20f : expertMode ? 15f : 5f; - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); for (int i = 0; i < numProjectiles; i++) @@ -350,7 +378,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { - npc.Calamity().newAI[0] -= 1f; + npc.Calamity().newAI[0] -= segmentCloseTimerDecrement; if (npc.Calamity().newAI[0] <= 0f) { npc.Calamity().newAI[0] = 0f; @@ -376,7 +404,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.localAI[2] -= numSegments; } - npc.Calamity().newAI[0] -= 1f; + npc.Calamity().newAI[0] -= segmentCloseTimerDecrement; if (npc.Calamity().newAI[0] <= 0f) { npc.Calamity().newAI[0] = 0f; @@ -389,6 +417,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } + // Do not deal contact damage for 5 seconds after spawning + if (npc.Calamity().newAI[2] == 0f) + noContactDamageTimer = 300; + if (npc.Calamity().newAI[2] < ThanatosHead.immunityTime) npc.Calamity().newAI[2] += 1f; @@ -399,17 +431,24 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.Calamity().DR = vulnerable ? 0f : 0.9999f; npc.Calamity().unbreakableDR = !vulnerable; + // Increase overall damage taken while vulnerable + npc.takenDamageMultiplier = vulnerable ? 1.1f : 1f; + // Vent noise and steam SmokeDrawer.ParticleSpawnRate = 9999999; if (vulnerable) { // Light - Lighting.AddLight(npc.Center, 0.35f, 0.05f, 0.05f); + Lighting.AddLight(npc.Center, 0.35f * npc.Opacity, 0.05f * npc.Opacity, 0.05f * npc.Opacity); // Noise float volume = calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge ? 0.1f : 1f; if (npc.localAI[0] == 0f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent").WithVolume(volume), npc.Center); + { + SoundEffectInstance sound = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent"), npc.Center); + if (sound != null) + sound.Volume *= volume; + } // Steam npc.localAI[0] += 1f; @@ -422,7 +461,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos else { // Light - Lighting.AddLight(npc.Center, 0.05f, 0.2f, 0.2f); + Lighting.AddLight(npc.Center, 0.05f * npc.Opacity, 0.2f * npc.Opacity, 0.2f * npc.Opacity); npc.localAI[0] = 0f; } @@ -431,41 +470,40 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechWorm].target]; - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num191 = player.position.X + (player.width / 2); - float num192 = player.position.Y + (player.height / 2); - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; + Vector2 npcCenter = npc.Center; + float targetCenterX = player.Center.X; + float targetCenterY = player.Center.Y; + targetCenterX = (int)(targetCenterX / 16f) * 16; + targetCenterY = (int)(targetCenterY / 16f) * 16; + npcCenter.X = (int)(npcCenter.X / 16f) * 16; + npcCenter.Y = (int)(npcCenter.Y / 16f) * 16; + targetCenterX -= npcCenter.X; + targetCenterY -= npcCenter.Y; - float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + float distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + npcCenter = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + targetCenterX = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - npcCenter.X; + targetCenterY = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - npcCenter.Y; } catch { } - npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; - num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = npc.width; - num193 = (num193 - num194) / num193; - num191 *= num193; - num192 *= num193; + npc.rotation = (float)Math.Atan2(targetCenterY, targetCenterX) + MathHelper.PiOver2; + distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); + distanceFromTarget = (distanceFromTarget - npc.width) / distanceFromTarget; + targetCenterX *= distanceFromTarget; + targetCenterY *= distanceFromTarget; npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + npc.position.X = npc.position.X + targetCenterX; + npc.position.Y = npc.position.Y + targetCenterY; - if (num191 < 0f) + if (targetCenterX < 0f) npc.spriteDirection = -1; - else if (num191 > 0f) + else if (targetCenterX > 0f) npc.spriteDirection = 1; } } @@ -489,7 +527,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (dist4 < minDist) minDist = dist4; - return minDist <= 50f && npc.Opacity == 1f; + return minDist <= 50f && npc.Opacity == 1f && noContactDamageTimer <= 0; } public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) @@ -507,33 +545,20 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; npc.frameCounter += 1D; - if (shootLasers && !invisiblePhase) + if (npc.Calamity().newAI[0] > 0f) { - if (npc.Calamity().newAI[1] == 0f && npc.Calamity().newAI[0] > 0f) + if (npc.frameCounter >= 6D) { - if (npc.frameCounter >= 10D) - { - npc.frame.Y += frameHeight; - npc.frameCounter = 0D; - } - int finalFrame = Main.npcFrameCount[npc.type] - 1; - if (npc.frame.Y > frameHeight * finalFrame) - npc.frame.Y = frameHeight * finalFrame; - } - else - { - if (npc.frameCounter >= 10D) - { - npc.frame.Y -= frameHeight; - npc.frameCounter = 0D; - } - if (npc.frame.Y < 0) - npc.frame.Y = 0; + npc.frame.Y += frameHeight; + npc.frameCounter = 0D; } + int finalFrame = Main.npcFrameCount[npc.type] - 1; + if (npc.frame.Y > frameHeight * finalFrame) + npc.frame.Y = frameHeight * finalFrame; } else { - if (npc.frameCounter >= 10D) + if (npc.frameCounter >= 6D) { npc.frame.Y -= frameHeight; npc.frameCounter = 0D; @@ -571,6 +596,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void HitEffect(int hitDirection, double damage) { + if (npc.soundDelay == 0) + { + npc.soundDelay = 8; + + if (vulnerable) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/OtherworldlyHit"), npc.Center); + else + Main.PlaySound(SoundID.NPCHit4, npc.Center); + } + int baseDust = vulnerable ? 3 : 1; for (int k = 0; k < baseDust; k++) Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index 1c49259062..f18f7da626 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -1,10 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Graphics; using System; using System.IO; @@ -33,8 +32,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Whether the body is venting heat or not, it is vulnerable to damage during venting private bool vulnerable = false; + public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); + // Timer to prevent Thanatos from dealing contact damage for a bit + private int noContactDamageTimer = 0; + + private const float timeToOpenAndFireLasers = 36f; + + private const float segmentCloseTimerDecrement = 0.2f; + public override void SetStaticDefaults() { DisplayName.SetDefault("XM-05 Thanatos"); @@ -58,10 +65,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos aiType = -1; npc.knockBackResist = 0f; npc.Opacity = 0f; - npc.behindTiles = true; + npc.canGhostHeal = false; + npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; npc.dontCountMe = true; @@ -72,7 +79,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void BossHeadSlot(ref int index) { - if (vulnerable) + if (Main.npc[(int)npc.ai[2]].Calamity().newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune) + index = -1; + else if (vulnerable) index = vulnerableIconIndex; else index = normalIconIndex; @@ -87,6 +96,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { writer.Write(npc.chaseable); writer.Write(npc.dontTakeDamage); + writer.Write(noContactDamageTimer); writer.Write(vulnerable); writer.Write(npc.localAI[0]); writer.Write(npc.localAI[1]); @@ -99,6 +109,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { npc.chaseable = reader.ReadBoolean(); npc.dontTakeDamage = reader.ReadBoolean(); + noContactDamageTimer = reader.ReadInt32(); vulnerable = reader.ReadBoolean(); npc.localAI[0] = reader.ReadSingle(); npc.localAI[1] = reader.ReadSingle(); @@ -146,6 +157,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.HitEffect(0, 10.0); npc.checkDead(); npc.active = false; + return; } // Set vulnerable to false by default @@ -154,18 +166,29 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; - npc.dontTakeDamage = invisiblePhase; + npc.dontTakeDamage = Main.npc[(int)npc.ai[2]].dontTakeDamage; if (!invisiblePhase) { if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) { + if (noContactDamageTimer > 0) + noContactDamageTimer--; + npc.Opacity += 0.2f; if (npc.Opacity > 1f) npc.Opacity = 1f; } + else + { + // Deal no contact damage for 3 seconds after becoming visible + noContactDamageTimer = 185; + } } else { + // Deal no contact damage for 3 seconds after becoming visible + noContactDamageTimer = 185; + npc.Opacity -= 0.05f; if (npc.Opacity < 0f) npc.Opacity = 0f; @@ -201,7 +224,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Set the AI to become more aggressive if head is berserk bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); - bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage || berserk) && calamityGlobalNPC_Head.newAI[2] > 0f; + bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; if (shootLasers && !invisiblePhase) { if (Main.netMode != NetmodeID.MultiplayerClient) @@ -210,11 +233,15 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (npc.Calamity().newAI[0] == 0f) npc.ai[3] += 1f; - double numSegmentsAbleToFire = malice ? 30D : death ? 20D : revenge ? 17.5 : expertMode ? 15D : 10D; - if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge && !berserk) + double numSegmentsAbleToFire = malice ? 35D : death ? 30D : revenge ? 28D : expertMode ? 25D : 20D; + if (berserk) + numSegmentsAbleToFire *= 1.5; + + float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); + + if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge) { float divisor = 120f; - float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); if ((npc.ai[3] % divisor == 0f && npc.localAI[2] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) { // Body is vulnerable while firing lasers @@ -223,7 +250,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (npc.Calamity().newAI[1] == 0f) { npc.Calamity().newAI[0] += 1f; - if (npc.Calamity().newAI[0] >= 72f) + if (npc.Calamity().newAI[0] >= timeToOpenAndFireLasers) { npc.ai[3] = 0f; npc.Calamity().newAI[1] = 1f; @@ -253,11 +280,14 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon").WithVolume(0.1f), npc.Center); + SoundEffectInstance sound = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + if (sound != null) + sound.Volume *= 0.1f; + for (int i = 0; i < numProjectiles; i++) { // Normal laser - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); } @@ -266,7 +296,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { - npc.Calamity().newAI[0] -= 1f; + npc.Calamity().newAI[0] -= segmentCloseTimerDecrement; if (npc.Calamity().newAI[0] <= 0f) { npc.Calamity().newAI[0] = 0f; @@ -277,8 +307,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { - // This is only used in deathray phase to prevent laser spam - float segmentDivisor = (float)Math.Round(numSegments / (berserk ? 5D : numSegmentsAbleToFire)); float divisor = npc.localAI[2] * 3f; // Ranges from 3 to 300 if ((npc.ai[3] == divisor && npc.localAI[2] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) { @@ -288,7 +316,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (npc.Calamity().newAI[1] == 0f) { npc.Calamity().newAI[0] += 1f; - if (npc.Calamity().newAI[0] >= 72f) + if (npc.Calamity().newAI[0] >= timeToOpenAndFireLasers) { npc.ai[3] = 0f; npc.Calamity().newAI[1] = 1f; @@ -319,7 +347,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } float predictionAmt = malice ? 30f : death ? 25f : revenge ? 20f : expertMode ? 15f : 5f; - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); for (int i = 0; i < numProjectiles; i++) @@ -350,7 +378,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { - npc.Calamity().newAI[0] -= 1f; + npc.Calamity().newAI[0] -= segmentCloseTimerDecrement; if (npc.Calamity().newAI[0] <= 0f) { npc.Calamity().newAI[0] = 0f; @@ -376,7 +404,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.localAI[2] -= numSegments; } - npc.Calamity().newAI[0] -= 1f; + npc.Calamity().newAI[0] -= segmentCloseTimerDecrement; if (npc.Calamity().newAI[0] <= 0f) { npc.Calamity().newAI[0] = 0f; @@ -389,6 +417,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } + // Do not deal contact damage for 5 seconds after spawning + if (npc.Calamity().newAI[2] == 0f) + noContactDamageTimer = 300; + if (npc.Calamity().newAI[2] < ThanatosHead.immunityTime) npc.Calamity().newAI[2] += 1f; @@ -399,17 +431,24 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.Calamity().DR = vulnerable ? 0f : 0.9999f; npc.Calamity().unbreakableDR = !vulnerable; + // Increase overall damage taken while vulnerable + npc.takenDamageMultiplier = vulnerable ? 1.1f : 1f; + // Vent noise and steam SmokeDrawer.ParticleSpawnRate = 9999999; if (vulnerable) { // Light - Lighting.AddLight(npc.Center, 0.35f, 0.05f, 0.05f); + Lighting.AddLight(npc.Center, 0.35f * npc.Opacity, 0.05f * npc.Opacity, 0.05f * npc.Opacity); // Noise float volume = calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge ? 0.1f : 1f; if (npc.localAI[0] == 0f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent").WithVolume(volume), npc.Center); + { + SoundEffectInstance sound = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent"), npc.Center); + if (sound != null) + sound.Volume *= volume; + } // Steam npc.localAI[0] += 1f; @@ -422,7 +461,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos else { // Light - Lighting.AddLight(npc.Center, 0.05f, 0.2f, 0.2f); + Lighting.AddLight(npc.Center, 0.05f * npc.Opacity, 0.2f * npc.Opacity, 0.2f * npc.Opacity); npc.localAI[0] = 0f; } @@ -431,44 +470,44 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechWorm].target]; - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num191 = player.position.X + (player.width / 2); - float num192 = player.position.Y + (player.height / 2); - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; + Vector2 npcCenter = npc.Center; + float targetCenterX = player.Center.X; + float targetCenterY = player.Center.Y; + targetCenterX = (int)(targetCenterX / 16f) * 16; + targetCenterY = (int)(targetCenterY / 16f) * 16; + npcCenter.X = (int)(npcCenter.X / 16f) * 16; + npcCenter.Y = (int)(npcCenter.Y / 16f) * 16; + targetCenterX -= npcCenter.X; + targetCenterY -= npcCenter.Y; - float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } catch - { - } + float distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); + if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + { + try + { + npcCenter = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + targetCenterX = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - npcCenter.X; + targetCenterY = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - npcCenter.Y; + } + catch + { + } - npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; - num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = npc.width; - num193 = (num193 - num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + npc.rotation = (float)Math.Atan2(targetCenterY, targetCenterX) + MathHelper.PiOver2; + distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); + distanceFromTarget = (distanceFromTarget - npc.width) / distanceFromTarget; + targetCenterX *= distanceFromTarget; + targetCenterY *= distanceFromTarget; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + targetCenterX; + npc.position.Y = npc.position.Y + targetCenterY; - if (num191 < 0f) - npc.spriteDirection = -1; - else if (num191 > 0f) - npc.spriteDirection = 1; - } - } + if (targetCenterX < 0f) + npc.spriteDirection = -1; + else if (targetCenterX > 0f) + npc.spriteDirection = 1; + } + } public override bool CanHitPlayer(Player target, ref int cooldownSlot) { @@ -489,7 +528,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (dist4 < minDist) minDist = dist4; - return minDist <= 50f && npc.Opacity == 1f; + return minDist <= 50f && npc.Opacity == 1f && noContactDamageTimer <= 0; } public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) @@ -507,33 +546,20 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; npc.frameCounter += 1D; - if (shootLasers && !invisiblePhase) + if (npc.Calamity().newAI[0] > 0f) { - if (npc.Calamity().newAI[1] == 0f && npc.Calamity().newAI[0] > 0f) + if (npc.frameCounter >= 6D) { - if (npc.frameCounter >= 10D) - { - npc.frame.Y += frameHeight; - npc.frameCounter = 0D; - } - int finalFrame = Main.npcFrameCount[npc.type] - 1; - if (npc.frame.Y > frameHeight * finalFrame) - npc.frame.Y = frameHeight * finalFrame; - } - else - { - if (npc.frameCounter >= 10D) - { - npc.frame.Y -= frameHeight; - npc.frameCounter = 0D; - } - if (npc.frame.Y < 0) - npc.frame.Y = 0; + npc.frame.Y += frameHeight; + npc.frameCounter = 0D; } + int finalFrame = Main.npcFrameCount[npc.type] - 1; + if (npc.frame.Y > frameHeight * finalFrame) + npc.frame.Y = frameHeight * finalFrame; } else { - if (npc.frameCounter >= 10D) + if (npc.frameCounter >= 6D) { npc.frame.Y -= frameHeight; npc.frameCounter = 0D; @@ -571,6 +597,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void HitEffect(int hitDirection, double damage) { + if (npc.soundDelay == 0) + { + npc.soundDelay = 8; + + if (vulnerable) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/OtherworldlyHit"), npc.Center); + else + Main.PlaySound(SoundID.NPCHit4, npc.Center); + } + int baseDust = vulnerable ? 3 : 1; for (int k = 0; k < baseDust; k++) Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index 6d0dccb86f..7d9bdea86a 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -1,8 +1,6 @@ using CalamityMod.Events; using CalamityMod.Items.Potions; using CalamityMod.Items.TreasureBags; -using CalamityMod.NPCs.ExoMechs.Apollo; -using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; @@ -14,6 +12,8 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Skies; namespace CalamityMod.NPCs.ExoMechs.Thanatos { @@ -62,6 +62,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); + // Timer to prevent Thanatos from dealing contact damage for a bit + private int noContactDamageTimer = 0; + // Invincibility time for the first 10 seconds public const float immunityTime = 600f; @@ -78,7 +81,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos private const float defaultLifeRatio = 5f; // Base distance from the target for most attacks - private const float baseDistance = 800f; + private const float baseDistance = 400f; // Base distance from target location in order to continue turning private const float baseTurnDistance = 160f; @@ -129,7 +132,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; npc.boss = true; @@ -140,7 +142,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void BossHeadSlot(ref int index) { - if (vulnerable) + if (SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune) + index = -1; + else if (vulnerable) index = vulnerableIconIndex; else index = normalIconIndex; @@ -155,6 +159,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { writer.Write(npc.chaseable); writer.Write(npc.dontTakeDamage); + writer.Write(noContactDamageTimer); writer.Write(chargeVelocityScalar); writer.Write(vulnerable); writer.Write(npc.localAI[0]); @@ -169,6 +174,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { npc.chaseable = reader.ReadBoolean(); npc.dontTakeDamage = reader.ReadBoolean(); + noContactDamageTimer = reader.ReadInt32(); chargeVelocityScalar = reader.ReadSingle(); vulnerable = reader.ReadBoolean(); npc.localAI[0] = reader.ReadSingle(); @@ -194,6 +200,17 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; + // Get a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(); + + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + npc.TargetClosest(); + + // Target variable + Player player = Main.player[npc.target]; + // Check if the other exo mechs are alive int otherExoMechsAlive = 0; bool exoPrimeAlive = false; @@ -202,6 +219,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) { + // Set target to Ares' target if Ares is alive + player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; + otherExoMechsAlive++; exoPrimeAlive = true; } @@ -235,8 +255,21 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos exoTwinsPassive = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].Calamity().newAI[1] == (float)Apollo.Apollo.SecondaryPhase.Passive; bool anyOtherExoMechPassive = exoPrimePassive || exoTwinsPassive; + // Check if any of the other mechs were spawned first + bool exoPrimeWasFirst = false; + bool exoTwinsWereFirst = false; + if (exoPrimeAlive) + exoPrimeWasFirst = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].ai[3] == 1f; + if (exoTwinsAlive) + exoTwinsWereFirst = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].ai[3] == 1f; + bool otherExoMechWasFirst = exoPrimeWasFirst || exoTwinsWereFirst; + + // Prevent mechs from being respawned + if (otherExoMechWasFirst) + npc.ai[3] = 1f; + // Phases - bool spawnOtherExoMechs = lifeRatio > 0.4f && otherExoMechsAlive == 0 && lifeRatio < 0.7f; + bool spawnOtherExoMechs = lifeRatio < 0.7f && npc.ai[3] == 0f; bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); bool lastMechAlive = berserk && otherExoMechsAlive == 0; @@ -246,17 +279,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // If Thanatos doesn't go berserk bool otherMechIsBerserk = exoPrimeLifeRatio < 0.4f || exoTwinsLifeRatio < 0.4f; - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); - - // Target variable - Player player = Main.player[npc.target]; - if (npc.ai[2] > 0f) npc.realLife = (int)npc.ai[2]; @@ -293,40 +315,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (npc.life > Main.npc[(int)npc.ai[0]].life) npc.life = Main.npc[(int)npc.ai[0]].life; - // Despawn if target is dead - bool targetDead = false; - if (player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (player.dead) - { - targetDead = true; - npc.localAI[0] = 0f; - npc.localAI[2] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - chargeVelocityScalar = 0f; - - npc.velocity.Y -= 2f; - if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 2f; - - if ((double)npc.position.Y < Main.topWorld + 16f) - { - for (int a = 0; a < Main.maxNPCs; a++) - { - if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) - Main.npc[a].active = false; - } - } - } - } - // General AI pattern // 0 - Fly towards the target for 7 seconds, gradually speeding up for the first 5 seconds and slowing down for the last 2 seconds, fire lasers from segments that are venting // 1 - Fly underneath the target and fire barrages of lasers @@ -368,17 +356,59 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.dontTakeDamage = invisiblePhase; if (!invisiblePhase) { + if (noContactDamageTimer > 0) + noContactDamageTimer--; + npc.Opacity += 0.2f; if (npc.Opacity > 1f) npc.Opacity = 1f; } else { + // Deal no contact damage for 3 seconds after becoming visible + noContactDamageTimer = 185; + npc.Opacity -= 0.05f; if (npc.Opacity < 0f) npc.Opacity = 0f; } + // Despawn if target is dead + bool targetDead = false; + if (player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (player.dead) + { + targetDead = true; + AIState = (float)Phase.Charge; + npc.localAI[0] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + npc.dontTakeDamage = true; + + npc.velocity.Y -= 1f; + if ((double)npc.position.Y < Main.topWorld + 16f) + npc.velocity.Y -= 1f; + + if ((double)npc.position.Y < Main.topWorld + 16f) + { + for (int a = 0; a < Main.maxNPCs; a++) + { + if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; + } + } + } + } + // Rotation and direction npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; int direction = npc.direction; @@ -389,29 +419,33 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Default vector to fly to Vector2 destination = player.Center; + // Move destination to somewhere far below the target for the first 3 seconds so that Thanatos can fully uncoil quickly + bool speedUp = false; + if (npc.localAI[3] < 180f) + { + speedUp = true; + destination += new Vector2(0f, 2400f); + } + // Charge variables float turnDistance = baseTurnDistance; float chargeLocationDistance = turnDistance * 0.2f; // Laser Barrage variables - float laserBarrageLocationBaseDistance = SecondaryAIState == (int)SecondaryPhase.PassiveAndImmune ? baseDistance * 1.5f : baseDistance; + float laserBarrageLocationBaseDistance = SecondaryAIState == (int)SecondaryPhase.PassiveAndImmune ? baseDistance * 2f : baseDistance; Vector2 laserBarrageLocation = new Vector2(0f, laserBarrageLocationBaseDistance); float laserBarrageLocationDistance = turnDistance * 3f; // Velocity and turn speed values - float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; - float baseVelocity = 7f * baseVelocityMult; - float turnDegrees = baseVelocity * 0.11f; - if (berserk) - { - baseVelocity *= 1.5f; - turnDegrees *= 1.5f; - } + float baseVelocityMult = (berserk ? 0.25f : 0f) + (malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f); + float baseVelocity = 10f * baseVelocityMult; - // Increase top velocity if target is dead - if (targetDead) + // Increase top velocity if target is dead or if Thanatos is uncoiling + if (targetDead || speedUp) baseVelocity *= 4f; + float turnDegrees = baseVelocity * 0.11f * (berserk ? 1.25f : 1f); + float turnSpeed = MathHelper.ToRadians(turnDegrees); float chargeVelocityMult = MathHelper.Lerp(1f, 1.5f, chargeVelocityScalar); float chargeTurnSpeedMult = MathHelper.Lerp(1f, 1.5f, chargeVelocityScalar); @@ -432,7 +466,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos float laserBarrageVelocityScalarDecrement = 1f / velocityAdjustTime; // Distance from target - float distanceFromTarget = Vector2.Distance(npc.Center, player.Center); + float distanceFromTarget = Vector2.Distance(npc.Center, destination); // Passive and Immune phases switch ((int)SecondaryAIState) @@ -445,6 +479,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (spawnOtherExoMechs) { // Reset everything + npc.ai[3] = 1f; SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; npc.localAI[0] = 0f; npc.localAI[2] = 0f; @@ -455,7 +490,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (Main.netMode != NetmodeID.MultiplayerClient) { - // Spawn code here + // Spawn the fuckers NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); @@ -536,7 +571,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Fly underneath target and become immune case (int)SecondaryPhase.PassiveAndImmune: - // Fire lasers while passive + // Do nothing while immune AIState = (float)Phase.UndergroundLaserBarrage; // Enter the fight again if any of the other exo mechs is below 70% and the other mechs aren't berserk @@ -722,9 +757,12 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); } + // Create a bunch of lightning bolts in the sky + ExoMechsSky.CreateLightningBolt(12); + if (Main.netMode != NetmodeID.MultiplayerClient) { - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); for (int b = 0; b < 6; b++) { int beam = Projectile.NewProjectile(npc.Center, Vector2.Zero, type, 0, 0f, 255, npc.whoAmI); @@ -751,7 +789,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { if (Main.netMode != NetmodeID.MultiplayerClient) { - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); int laser = Projectile.NewProjectile(npc.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, npc.whoAmI); if (Main.projectile.IndexInRange(laser)) @@ -775,6 +813,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos break; } + // Do not deal contact damage for 5 seconds after spawning + if (npc.localAI[3] == 0f) + noContactDamageTimer = 300; + if (npc.localAI[3] < immunityTime) npc.localAI[3] += 1f; @@ -785,12 +827,15 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.Calamity().DR = vulnerable ? 0f : 0.9999f; npc.Calamity().unbreakableDR = !vulnerable; + // Increase overall damage taken while vulnerable + npc.takenDamageMultiplier = vulnerable ? 1.1f : 1f; + // Vent noise and steam SmokeDrawer.ParticleSpawnRate = 9999999; if (vulnerable) { // Light - Lighting.AddLight(npc.Center, 0.35f, 0.05f, 0.05f); + Lighting.AddLight(npc.Center, 0.35f * npc.Opacity, 0.05f * npc.Opacity, 0.05f * npc.Opacity); // Noise if (npc.localAI[1] == 0f) @@ -807,7 +852,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos else { // Light - Lighting.AddLight(npc.Center, 0.05f, 0.2f, 0.2f); + Lighting.AddLight(npc.Center, 0.05f * npc.Opacity, 0.2f * npc.Opacity, 0.2f * npc.Opacity); npc.localAI[1] = 0f; } @@ -853,7 +898,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (dist4 < minDist) minDist = dist4; - return minDist <= 50f && npc.Opacity == 1f; + return minDist <= 50f && npc.Opacity == 1f && noContactDamageTimer <= 0; } public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) @@ -876,7 +921,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.frameCounter += 1D; if (AIState == (float)Phase.Charge || AIState == (float)Phase.UndergroundLaserBarrage) { - if (npc.frameCounter >= 10D) + if (npc.frameCounter >= 6D) { npc.frame.Y -= frameHeight; npc.frameCounter = 0D; @@ -886,7 +931,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { - if (npc.frameCounter >= 10D) + if (npc.frameCounter >= 6D) { npc.frame.Y += frameHeight; npc.frameCounter = 0D; @@ -937,8 +982,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void NPCLoot() { - // DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - // Check if the other exo mechs are alive bool otherExoMechsAlive = false; if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) @@ -953,11 +996,21 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } if (!otherExoMechsAlive) - AresBody.DropExoMechLoot(npc); + AresBody.DropExoMechLoot(npc, (int)AresBody.MechType.Thanatos); } public override void HitEffect(int hitDirection, double damage) { + if (npc.soundDelay == 0) + { + npc.soundDelay = 8; + + if (vulnerable) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/OtherworldlyHit"), npc.Center); + else + Main.PlaySound(SoundID.NPCHit4, npc.Center); + } + for (int k = 0; k < 3; k++) Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); diff --git a/NPCs/ExoMechs/Thanatos/ThanatosNormalBody.png b/NPCs/ExoMechs/Thanatos/ThanatosNormalBody.png index 9c496d1e77..40ebcdb5ea 100644 Binary files a/NPCs/ExoMechs/Thanatos/ThanatosNormalBody.png and b/NPCs/ExoMechs/Thanatos/ThanatosNormalBody.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosNormalHead.png b/NPCs/ExoMechs/Thanatos/ThanatosNormalHead.png index 1c485fcc41..a5503e05e0 100644 Binary files a/NPCs/ExoMechs/Thanatos/ThanatosNormalHead.png and b/NPCs/ExoMechs/Thanatos/ThanatosNormalHead.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosNormalTail.png b/NPCs/ExoMechs/Thanatos/ThanatosNormalTail.png index 45a93ddc59..1a087a283e 100644 Binary files a/NPCs/ExoMechs/Thanatos/ThanatosNormalTail.png and b/NPCs/ExoMechs/Thanatos/ThanatosNormalTail.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index f590452b41..5d7ad513cb 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Graphics; using System; using System.IO; @@ -32,8 +32,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Whether the tail is venting heat or not, it is vulnerable to damage during venting private bool vulnerable = false; + public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); + // Timer to prevent Thanatos from dealing contact damage for a bit + private int noContactDamageTimer = 0; + + private const float timeToOpenAndFireLasers = 36f; + + private const float segmentCloseTimerDecrement = 0.2f; + public override void SetStaticDefaults() { DisplayName.SetDefault("XM-05 Thanatos"); @@ -57,10 +65,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos aiType = -1; npc.knockBackResist = 0f; npc.Opacity = 0f; - npc.behindTiles = true; + npc.canGhostHeal = false; + npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; npc.dontCountMe = true; @@ -71,7 +79,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void BossHeadSlot(ref int index) { - if (vulnerable) + if (Main.npc[(int)npc.ai[2]].Calamity().newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune) + index = -1; + else if (vulnerable) index = vulnerableIconIndex; else index = normalIconIndex; @@ -86,6 +96,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { writer.Write(npc.chaseable); writer.Write(npc.dontTakeDamage); + writer.Write(noContactDamageTimer); writer.Write(vulnerable); writer.Write(npc.localAI[0]); writer.Write(npc.localAI[1]); @@ -98,6 +109,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { npc.chaseable = reader.ReadBoolean(); npc.dontTakeDamage = reader.ReadBoolean(); + noContactDamageTimer = reader.ReadInt32(); vulnerable = reader.ReadBoolean(); npc.localAI[0] = reader.ReadSingle(); npc.localAI[1] = reader.ReadSingle(); @@ -145,6 +157,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.HitEffect(0, 10.0); npc.checkDead(); npc.active = false; + return; } // Set vulnerable to false by default @@ -153,18 +166,29 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; - npc.dontTakeDamage = invisiblePhase; + npc.dontTakeDamage = Main.npc[(int)npc.ai[2]].dontTakeDamage; if (!invisiblePhase) { if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) { + if (noContactDamageTimer > 0) + noContactDamageTimer--; + npc.Opacity += 0.2f; if (npc.Opacity > 1f) npc.Opacity = 1f; } + else + { + // Deal no contact damage for 3 seconds after becoming visible + noContactDamageTimer = 185; + } } else { + // Deal no contact damage for 3 seconds after becoming visible + noContactDamageTimer = 185; + npc.Opacity -= 0.05f; if (npc.Opacity < 0f) npc.Opacity = 0f; @@ -200,7 +224,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Set the AI to become more aggressive if head is berserk bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); - bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage || berserk) && calamityGlobalNPC_Head.newAI[2] > 0f; + bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; if (shootLasers && !invisiblePhase) { if (Main.netMode != NetmodeID.MultiplayerClient) @@ -209,11 +233,15 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (npc.Calamity().newAI[0] == 0f) npc.ai[3] += 1f; - double numSegmentsAbleToFire = malice ? 30D : death ? 20D : revenge ? 17.5 : expertMode ? 15D : 10D; - if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge && !berserk) + double numSegmentsAbleToFire = malice ? 35D : death ? 30D : revenge ? 28D : expertMode ? 25D : 20D; + if (berserk) + numSegmentsAbleToFire *= 1.5; + + float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); + + if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge) { float divisor = 120f; - float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); if ((npc.ai[3] % divisor == 0f && npc.localAI[2] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) { // Body is vulnerable while firing lasers @@ -222,7 +250,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (npc.Calamity().newAI[1] == 0f) { npc.Calamity().newAI[0] += 1f; - if (npc.Calamity().newAI[0] >= 72f) + if (npc.Calamity().newAI[0] >= timeToOpenAndFireLasers) { npc.ai[3] = 0f; npc.Calamity().newAI[1] = 1f; @@ -252,11 +280,14 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon").WithVolume(0.1f), npc.Center); + SoundEffectInstance sound = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + if (sound != null) + sound.Volume *= 0.1f; + for (int i = 0; i < numProjectiles; i++) { // Normal laser - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); } @@ -265,7 +296,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { - npc.Calamity().newAI[0] -= 1f; + npc.Calamity().newAI[0] -= segmentCloseTimerDecrement; if (npc.Calamity().newAI[0] <= 0f) { npc.Calamity().newAI[0] = 0f; @@ -276,8 +307,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { - // This is only used in deathray phase to prevent laser spam - float segmentDivisor = (float)Math.Round(numSegments / (berserk ? 5D : numSegmentsAbleToFire)); float divisor = npc.localAI[2] * 3f; // Ranges from 3 to 300 if ((npc.ai[3] == divisor && npc.localAI[2] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) { @@ -287,7 +316,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (npc.Calamity().newAI[1] == 0f) { npc.Calamity().newAI[0] += 1f; - if (npc.Calamity().newAI[0] >= 72f) + if (npc.Calamity().newAI[0] >= timeToOpenAndFireLasers) { npc.ai[3] = 0f; npc.Calamity().newAI[1] = 1f; @@ -318,7 +347,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } float predictionAmt = malice ? 30f : death ? 25f : revenge ? 20f : expertMode ? 15f : 5f; - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); for (int i = 0; i < numProjectiles; i++) @@ -349,7 +378,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { - npc.Calamity().newAI[0] -= 1f; + npc.Calamity().newAI[0] -= segmentCloseTimerDecrement; if (npc.Calamity().newAI[0] <= 0f) { npc.Calamity().newAI[0] = 0f; @@ -375,7 +404,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.localAI[2] -= numSegments; } - npc.Calamity().newAI[0] -= 1f; + npc.Calamity().newAI[0] -= segmentCloseTimerDecrement; if (npc.Calamity().newAI[0] <= 0f) { npc.Calamity().newAI[0] = 0f; @@ -388,6 +417,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } + // Do not deal contact damage for 5 seconds after spawning + if (npc.Calamity().newAI[2] == 0f) + noContactDamageTimer = 300; + if (npc.Calamity().newAI[2] < ThanatosHead.immunityTime) npc.Calamity().newAI[2] += 1f; @@ -398,17 +431,24 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.Calamity().DR = vulnerable ? 0f : 0.9999f; npc.Calamity().unbreakableDR = !vulnerable; + // Increase overall damage taken while vulnerable + npc.takenDamageMultiplier = vulnerable ? 1.1f : 1f; + // Vent noise and steam SmokeDrawer.ParticleSpawnRate = 9999999; if (vulnerable) { // Light - Lighting.AddLight(npc.Center, 0.35f, 0.05f, 0.05f); + Lighting.AddLight(npc.Center, 0.35f * npc.Opacity, 0.05f * npc.Opacity, 0.05f * npc.Opacity); // Noise float volume = calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge ? 0.1f : 1f; if (npc.localAI[0] == 0f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent").WithVolume(volume), npc.Center); + { + SoundEffectInstance sound = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent"), npc.Center); + if (sound != null) + sound.Volume *= volume; + } // Steam npc.localAI[0] += 1f; @@ -421,7 +461,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos else { // Light - Lighting.AddLight(npc.Center, 0.05f, 0.2f, 0.2f); + Lighting.AddLight(npc.Center, 0.05f * npc.Opacity, 0.2f * npc.Opacity, 0.2f * npc.Opacity); npc.localAI[0] = 0f; } @@ -430,44 +470,44 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechWorm].target]; - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num191 = player.position.X + (player.width / 2); - float num192 = player.position.Y + (player.height / 2); - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; + Vector2 npcCenter = npc.Center; + float targetCenterX = player.Center.X; + float targetCenterY = player.Center.Y; + targetCenterX = (int)(targetCenterX / 16f) * 16; + targetCenterY = (int)(targetCenterY / 16f) * 16; + npcCenter.X = (int)(npcCenter.X / 16f) * 16; + npcCenter.Y = (int)(npcCenter.Y / 16f) * 16; + targetCenterX -= npcCenter.X; + targetCenterY -= npcCenter.Y; - float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } catch - { - } + float distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); + if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + { + try + { + npcCenter = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + targetCenterX = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - npcCenter.X; + targetCenterY = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - npcCenter.Y; + } + catch + { + } - npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; - num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = npc.width; - num193 = (num193 - num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + npc.rotation = (float)Math.Atan2(targetCenterY, targetCenterX) + MathHelper.PiOver2; + distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); + distanceFromTarget = (distanceFromTarget - npc.width) / distanceFromTarget; + targetCenterX *= distanceFromTarget; + targetCenterY *= distanceFromTarget; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + targetCenterX; + npc.position.Y = npc.position.Y + targetCenterY; - if (num191 < 0f) - npc.spriteDirection = -1; - else if (num191 > 0f) - npc.spriteDirection = 1; - } - } + if (targetCenterX < 0f) + npc.spriteDirection = -1; + else if (targetCenterX > 0f) + npc.spriteDirection = 1; + } + } public override bool CanHitPlayer(Player target, ref int cooldownSlot) { @@ -488,7 +528,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (dist4 < minDist) minDist = dist4; - return minDist <= 45f && npc.Opacity == 1f; + return minDist <= 45f && npc.Opacity == 1f && noContactDamageTimer <= 0; } public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) @@ -506,33 +546,20 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; npc.frameCounter += 1D; - if (shootLasers && !invisiblePhase) + if (npc.Calamity().newAI[0] > 0f) { - if (npc.Calamity().newAI[1] == 0f && npc.Calamity().newAI[0] > 0f) + if (npc.frameCounter >= 6D) { - if (npc.frameCounter >= 10D) - { - npc.frame.Y += frameHeight; - npc.frameCounter = 0D; - } - int finalFrame = Main.npcFrameCount[npc.type] - 1; - if (npc.frame.Y > frameHeight * finalFrame) - npc.frame.Y = frameHeight * finalFrame; - } - else - { - if (npc.frameCounter >= 10D) - { - npc.frame.Y -= frameHeight; - npc.frameCounter = 0D; - } - if (npc.frame.Y < 0) - npc.frame.Y = 0; + npc.frame.Y += frameHeight; + npc.frameCounter = 0D; } + int finalFrame = Main.npcFrameCount[npc.type] - 1; + if (npc.frame.Y > frameHeight * finalFrame) + npc.frame.Y = frameHeight * finalFrame; } else { - if (npc.frameCounter >= 10D) + if (npc.frameCounter >= 6D) { npc.frame.Y -= frameHeight; npc.frameCounter = 0D; @@ -570,6 +597,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void HitEffect(int hitDirection, double damage) { + if (npc.soundDelay == 0) + { + npc.soundDelay = 8; + + if (vulnerable) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/OtherworldlyHit"), npc.Center); + else + Main.PlaySound(SoundID.NPCHit4, npc.Center); + } + int baseDust = vulnerable ? 3 : 1; for (int k = 0; k < baseDust; k++) Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); diff --git a/NPCs/ExoMechs/Thanatos/ThanatosVulnerableBody.png b/NPCs/ExoMechs/Thanatos/ThanatosVulnerableBody.png index c45262044c..ff48f58356 100644 Binary files a/NPCs/ExoMechs/Thanatos/ThanatosVulnerableBody.png and b/NPCs/ExoMechs/Thanatos/ThanatosVulnerableBody.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosVulnerableHead.png b/NPCs/ExoMechs/Thanatos/ThanatosVulnerableHead.png index f6394a48ae..782e608c43 100644 Binary files a/NPCs/ExoMechs/Thanatos/ThanatosVulnerableHead.png and b/NPCs/ExoMechs/Thanatos/ThanatosVulnerableHead.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosVulnerableTail.png b/NPCs/ExoMechs/Thanatos/ThanatosVulnerableTail.png index be37ce6997..e34313db93 100644 Binary files a/NPCs/ExoMechs/Thanatos/ThanatosVulnerableTail.png and b/NPCs/ExoMechs/Thanatos/ThanatosVulnerableTail.png differ diff --git a/NPCs/HiveMind/HiveMindP2.cs b/NPCs/HiveMind/HiveMindP2.cs index 2906b42abf..4b824a1762 100644 --- a/NPCs/HiveMind/HiveMindP2.cs +++ b/NPCs/HiveMind/HiveMindP2.cs @@ -312,9 +312,12 @@ namespace CalamityMod.NPCs.HiveMind // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (CalamityWorld.malice || CalamityWorld.revenge || BossRushEvent.BossRushActive) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } bool enraged = calamityGlobalNPC.enraged > 0; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; @@ -770,11 +773,11 @@ namespace CalamityMod.NPCs.HiveMind if (!Main.expertMode) { // Materials - DropHelper.DropItemSpray(npc, ModContent.ItemType(), 25, 30); - DropHelper.DropItemSpray(npc, ItemID.DemoniteBar, 7, 10); - DropHelper.DropItemSpray(npc, ItemID.RottenChunk, 9, 15); + DropHelper.DropItemSpray(npc, ModContent.ItemType(), 25, 30, 5); + DropHelper.DropItemSpray(npc, ItemID.DemoniteBar, 8, 12, 2); + DropHelper.DropItemSpray(npc, ItemID.RottenChunk, 9, 15, 3); if (Main.hardMode) - DropHelper.DropItemSpray(npc, ItemID.CursedFlame, 10, 20); + DropHelper.DropItemSpray(npc, ItemID.CursedFlame, 10, 20, 2); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index e7a7dae482..fa1c08064a 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -105,9 +105,12 @@ namespace CalamityMod.NPCs.Leviathan // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } // Phases bool phase2 = lifeRatio < 0.7f && expertMode; diff --git a/NPCs/Leviathan/Leviathan.png b/NPCs/Leviathan/Leviathan.png index 6bd923b971..b2d7fa51a5 100644 Binary files a/NPCs/Leviathan/Leviathan.png and b/NPCs/Leviathan/Leviathan.png differ diff --git a/NPCs/Leviathan/LeviathanAttack.png b/NPCs/Leviathan/LeviathanAttack.png index 650e015b7a..5847a571f8 100644 Binary files a/NPCs/Leviathan/LeviathanAttack.png and b/NPCs/Leviathan/LeviathanAttack.png differ diff --git a/NPCs/Leviathan/Siren.cs b/NPCs/Leviathan/Siren.cs index 46b6f581b5..4da4020b83 100644 --- a/NPCs/Leviathan/Siren.cs +++ b/NPCs/Leviathan/Siren.cs @@ -74,6 +74,7 @@ namespace CalamityMod.NPCs.Leviathan writer.Write(frameUsed); writer.Write(npc.dontTakeDamage); writer.Write(npc.Calamity().newAI[0]); + writer.Write(HasBegunSummoningLeviathan); } public override void ReceiveExtraAI(BinaryReader reader) @@ -86,6 +87,7 @@ namespace CalamityMod.NPCs.Leviathan frameUsed = reader.ReadInt32(); npc.dontTakeDamage = reader.ReadBoolean(); npc.Calamity().newAI[0] = reader.ReadSingle(); + HasBegunSummoningLeviathan = reader.ReadBoolean(); } public override void AI() @@ -139,9 +141,12 @@ namespace CalamityMod.NPCs.Leviathan float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } float bubbleVelocity = death ? 9f : revenge ? 7f : expertMode ? 6f : 5f; bubbleVelocity += 4f * enrageScale; diff --git a/NPCs/NormalNPCs/WulfrumPylon.cs b/NPCs/NormalNPCs/WulfrumPylon.cs index d680d7905f..e08fee281b 100644 --- a/NPCs/NormalNPCs/WulfrumPylon.cs +++ b/NPCs/NormalNPCs/WulfrumPylon.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.NormalNPCs { aiType = -1; npc.aiStyle = -1; - npc.damage = 16; + npc.damage = 0; npc.width = 44; npc.height = 44; npc.defense = 4; diff --git a/NPCs/Other/BrimstoneOrb.cs b/NPCs/Other/BrimstoneOrb.cs index bca33658e8..1938c4dac5 100644 --- a/NPCs/Other/BrimstoneOrb.cs +++ b/NPCs/Other/BrimstoneOrb.cs @@ -33,7 +33,9 @@ namespace CalamityMod.NPCs.Other npc.knockBackResist = 0f; npc.netAlways = true; npc.aiStyle = -1; + npc.canGhostHeal = false; npc.Calamity().DoesNotGenerateRage = true; + npc.Calamity().DoesNotDisappearInBossRush = true; } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 181445; diff --git a/NPCs/Other/CalamitasEnchantDemon.cs b/NPCs/Other/CalamitasEnchantDemon.cs index c07ec611f2..5329685195 100644 --- a/NPCs/Other/CalamitasEnchantDemon.cs +++ b/NPCs/Other/CalamitasEnchantDemon.cs @@ -34,6 +34,7 @@ namespace CalamityMod.NPCs.Other npc.knockBackResist = 0f; npc.netAlways = true; npc.aiStyle = 0; + npc.Calamity().DoesNotDisappearInBossRush = true; } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 101010; diff --git a/NPCs/Other/DemonPortal.cs b/NPCs/Other/DemonPortal.cs index 5eba0752ed..449d20441b 100644 --- a/NPCs/Other/DemonPortal.cs +++ b/NPCs/Other/DemonPortal.cs @@ -24,6 +24,8 @@ namespace CalamityMod.NPCs.Other npc.knockBackResist = 0f; npc.netAlways = true; npc.aiStyle = -1; + npc.Calamity().DoesNotGenerateRage = true; + npc.Calamity().DoesNotDisappearInBossRush = true; } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 24660; diff --git a/NPCs/Other/ExhumedHeart.cs b/NPCs/Other/ExhumedHeart.cs index bfde229cb5..5b75574529 100644 --- a/NPCs/Other/ExhumedHeart.cs +++ b/NPCs/Other/ExhumedHeart.cs @@ -38,6 +38,7 @@ namespace CalamityMod.NPCs.Other npc.netAlways = true; npc.aiStyle = -1; npc.Calamity().DoesNotGenerateRage = true; + npc.Calamity().DoesNotDisappearInBossRush = true; } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 51740; diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index 9c06df575b..742cb16347 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -87,9 +87,12 @@ namespace CalamityMod.NPCs.Perforator // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } if (revenge || lifeRatio < (expertMode ? 0.75f : 0.5f)) npc.Calamity().newAI[0] += 1f; diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index bae751179d..c2b46ad11c 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -75,9 +75,12 @@ namespace CalamityMod.NPCs.Perforator // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } float speed = 8f; float turnSpeed = 0.06f; diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index 22421499bb..76b957f403 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -74,9 +74,12 @@ namespace CalamityMod.NPCs.Perforator // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } float speed = 0.15f; float turnSpeed = 0.1f; diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 07a2bd0f20..999291e97e 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -108,9 +108,12 @@ namespace CalamityMod.NPCs.Perforator // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } // Phases based on life percentage bool phase2 = lifeRatio < 0.7f; @@ -461,11 +464,11 @@ namespace CalamityMod.NPCs.Perforator if (!Main.expertMode) { // Materials - DropHelper.DropItemSpray(npc, ModContent.ItemType(), 7, 14); + DropHelper.DropItemSpray(npc, ModContent.ItemType(), 25, 30); DropHelper.DropItemSpray(npc, ItemID.CrimtaneBar, 2, 5); DropHelper.DropItemSpray(npc, ItemID.Vertebrae, 3, 9); if (Main.hardMode) - DropHelper.DropItemSpray(npc, ItemID.Ichor, 10, 20); + DropHelper.DropItemSpray(npc, ItemID.Ichor, 10, 20, 2); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index afaaf34705..ea64fd0eba 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -107,12 +107,22 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.width = npc.frame.Width / 2; npc.height = (int)(npc.frame.Height * (charging ? 1.5f : 1.8f)); + // Mode variables + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } // Phases bool phase2 = lifeRatio < 0.75f; @@ -120,13 +130,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath bool phase4 = lifeRatio < 0.25f; bool phase5 = lifeRatio < 0.1f; - // Mode variables - bool enraged = calamityGlobalNPC.enraged > 0; - bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || malice; - bool revenge = CalamityWorld.revenge || malice; - bool expertMode = Main.expertMode || malice; - // Adjust slowing debuff immunity bool immuneToSlowingDebuffs = npc.ai[0] == 0f || npc.ai[0] == 4f; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; @@ -1246,9 +1249,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath DropHelper.WeightStack(w) ); - // Equipment - DropHelper.DropItemChance(npc, ModContent.ItemType(), 5); - // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index a892138319..b2ecdcde54 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -138,10 +138,6 @@ namespace CalamityMod.NPCs.Polterghast // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - // Variables Vector2 vector = npc.Center; bool enraged = calamityGlobalNPC.enraged > 0; @@ -151,7 +147,15 @@ namespace CalamityMod.NPCs.Polterghast bool death = CalamityWorld.death || malice; bool revenge = CalamityWorld.revenge || malice; bool expertMode = Main.expertMode || malice; - bool phase2 = lifeRatio < (death ? 0.9f : revenge ? 0.8f : expertMode ? 0.65f : 0.5f); + + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } + + bool phase2 = lifeRatio < (death ? 0.9f : revenge ? 0.8f : expertMode ? 0.65f : 0.5f); bool phase3 = lifeRatio < (death ? 0.6f : revenge ? 0.5f : expertMode ? 0.35f : 0.2f); bool phase4 = lifeRatio < (death ? 0.45f : revenge ? 0.35f : expertMode ? 0.2f : 0.1f); bool phase5 = lifeRatio < (death ? 0.2f : revenge ? 0.15f : expertMode ? 0.1f : 0.05f); @@ -1104,16 +1108,21 @@ namespace CalamityMod.NPCs.Polterghast // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > npc.Calamity().killTimeRatio_IncreasedAggression) - lifeRatio = npc.Calamity().killTimeRatio_IncreasedAggression; - bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || malice; bool revenge = CalamityWorld.revenge || malice; bool death = CalamityWorld.death || malice; + + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > npc.Calamity().killTimeRatio_IncreasedAggression) + lifeRatio = npc.Calamity().killTimeRatio_IncreasedAggression; + } + bool phase2 = lifeRatio < (death ? 0.9f : revenge ? 0.8f : expertMode ? 0.65f : 0.5f); bool phase3 = lifeRatio < (death ? 0.6f : revenge ? 0.5f : expertMode ? 0.35f : 0.2f); + npc.frameCounter += 1D; if (npc.frameCounter > 6D) { diff --git a/NPCs/Polterghast/PolterghastHook.cs b/NPCs/Polterghast/PolterghastHook.cs index 4acb4bfdac..a4704b170e 100644 --- a/NPCs/Polterghast/PolterghastHook.cs +++ b/NPCs/Polterghast/PolterghastHook.cs @@ -87,9 +87,12 @@ namespace CalamityMod.NPCs.Polterghast // Percent life remaining, Polter float lifeRatio = Main.npc[CalamityGlobalNPC.ghostBoss].life / (float)Main.npc[CalamityGlobalNPC.ghostBoss].lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().killTimeRatio_IncreasedAggression) - lifeRatio = Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().killTimeRatio_IncreasedAggression) + lifeRatio = Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().killTimeRatio_IncreasedAggression; + } // Scale multiplier based on nearby active tiles float tileEnrageMult = Main.npc[CalamityGlobalNPC.ghostBoss].ai[3]; diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs index e9d3f7166b..ad3f0d6531 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs @@ -87,12 +87,21 @@ namespace CalamityMod.NPCs.ProfanedGuardians CalamityGlobalNPC.doughnutBoss = npc.whoAmI; - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } Vector2 vectorCenter = npc.Center; if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[1] == 0f) @@ -141,16 +150,10 @@ namespace CalamityMod.NPCs.ProfanedGuardians else if (npc.timeLeft < 1800) npc.timeLeft = 1800; + // Become immune over time if target isn't in hell or hallow bool isHoly = player.ZoneHoly; bool isHell = player.ZoneUnderworldHeight; - bool enraged = calamityGlobalNPC.enraged > 0; - bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || malice; - bool revenge = CalamityWorld.revenge || malice; - bool death = CalamityWorld.death || malice; - - // Become immune over time if target isn't in hell or hallow - if (!isHoly && !isHell && !BossRushEvent.BossRushActive) + if (!isHoly && !isHell && !BossRushEvent.BossRushActive) { if (immuneTimer > 0) immuneTimer--; diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index edcd99f867..7677a9bb9f 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -166,8 +166,18 @@ namespace CalamityMod.NPCs.Providence // Target variable and boss center Player player = Main.player[npc.target]; - // Target's current biome - bool isHoly = player.ZoneHoly; + // Night bool + bool malice = CalamityWorld.malice; + bool nightTime = !Main.dayTime || malice; + + // Difficulty bools + bool death = CalamityWorld.death || BossRushEvent.BossRushActive || nightTime; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || nightTime; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive || nightTime; + bool enraged = npc.Calamity().enraged > 0; + + // Target's current biome + bool isHoly = player.ZoneHoly; bool isHell = player.ZoneUnderworldHeight; // Fire projectiles at normal rate or not @@ -180,13 +190,12 @@ namespace CalamityMod.NPCs.Providence // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - - // Night bool - bool malice = CalamityWorld.malice; - bool nightTime = !Main.dayTime || malice; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } // Play enrage animation if night starts if (nightTime && calamityGlobalNPC.newAI[3] == spawnAnimationTime) @@ -201,12 +210,6 @@ namespace CalamityMod.NPCs.Providence npc.netUpdate = true; } - // Difficulty bools - bool death = CalamityWorld.death || BossRushEvent.BossRushActive || nightTime; - bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || nightTime; - bool expertMode = Main.expertMode || BossRushEvent.BossRushActive || nightTime; - bool enraged = npc.Calamity().enraged > 0; - // Increase all projectile damage at night int projectileDamageMult = 1; if (nightTime) diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index ca552a0409..8d39a3bcfb 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -106,9 +106,12 @@ namespace CalamityMod.NPCs.Ravager // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } // Large fire light Lighting.AddLight((int)(npc.Center.X - 110f) / 16, (int)(npc.Center.Y - 30f) / 16, 0f, 0.5f, 2f); @@ -170,6 +173,8 @@ namespace CalamityMod.NPCs.Ravager bool immunePhase = headActive || rightClawActive || leftClawActive || rightLegActive || leftLegActive; bool finalPhase = !leftClawActive && !rightClawActive && !headActive && !leftLegActive && !rightLegActive && expertMode; + bool phase2 = npc.ai[0] == 2f; + bool reduceFallSpeed = npc.velocity.Y > 0f && npc.Bottom.Y > player.Top.Y; if (immunePhase) { @@ -306,10 +311,16 @@ namespace CalamityMod.NPCs.Ravager } } - if (npc.ai[0] == 0f) - { - npc.noTileCollide = false; + if (npc.noTileCollide && !player.dead) + { + if (npc.velocity.Y > 0f && npc.Bottom.Y > player.Top.Y) + npc.noTileCollide = false; + else if (Collision.CanHit(npc.position, npc.width, npc.height, player.Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.noTileCollide = false; + } + if (npc.ai[0] == 0f) + { if (npc.velocity.Y == 0f) { npc.velocity.X *= 0.8f; @@ -335,10 +346,14 @@ namespace CalamityMod.NPCs.Ravager float jumpGateValue = 180f; if (npc.ai[1] >= jumpGateValue) - npc.ai[1] = -20f; - else if (npc.ai[1] == -1f) - { - npc.TargetClosest(); + { + npc.ai[1] = -20f; + } + else if (npc.ai[1] == -1f) + { + npc.noTileCollide = true; + + npc.TargetClosest(); bool shouldFall = player.position.Y >= npc.Bottom.Y; float velocityXBoost = death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); @@ -353,7 +368,7 @@ namespace CalamityMod.NPCs.Ravager if (distanceBelowTarget > 0f) calamityGlobalNPC.newAI[1] += 1f + distanceBelowTarget * multiplier; - float speedMultLimit = malice ? 4f : 3f; + float speedMultLimit = malice ? 3f : 2f; if (calamityGlobalNPC.newAI[1] > speedMultLimit) calamityGlobalNPC.newAI[1] = speedMultLimit; @@ -363,7 +378,6 @@ namespace CalamityMod.NPCs.Ravager if (expertMode && !finalPhase) { - npc.noTileCollide = true; if (shouldFall) velocityY = 1f; @@ -382,19 +396,16 @@ namespace CalamityMod.NPCs.Ravager } if (finalPhase) - { - npc.noTileCollide = true; calamityGlobalNPC.newAI[2] = player.direction; - } float playerLocation = npc.Center.X - player.Center.X; npc.direction = playerLocation < 0 ? 1 : -1; npc.velocity.X = velocityX * npc.direction; - npc.velocity.Y = velocityY; + npc.velocity.Y = velocityY; - npc.ai[0] = finalPhase ? 2f : 1f; - npc.ai[1] = 0f; + npc.ai[0] = finalPhase ? 2f : 1f; + npc.ai[1] = 0f; } } @@ -460,26 +471,15 @@ namespace CalamityMod.NPCs.Ravager } else { - // Fall through - if (!player.dead && expertMode) - { - if ((player.position.Y > npc.Bottom.Y && npc.velocity.Y > 0f) || (player.position.Y < npc.Bottom.Y && npc.velocity.Y < 0f)) - npc.noTileCollide = true; - else if ((npc.velocity.Y > 0f && npc.Bottom.Y > Main.player[npc.target].Top.Y) || (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height))) - npc.noTileCollide = false; - - // Prevent falling forever in second phase - if (npc.ai[0] == 2f && npc.velocity.Y > 0f && npc.Top.Y > Main.player[npc.target].Bottom.Y + 16f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.noTileCollide = false; - } - Vector2 targetVector = player.position; float aimY = targetVector.Y - 640f; float distanceFromTargetPos = Math.Abs(npc.Top.Y - aimY); bool inRange = npc.Top.Y <= aimY + 160f && npc.Top.Y >= aimY - 16f; - if (npc.ai[0] == 2f && npc.ai[1] == 0f) + if (phase2 && npc.ai[1] == 0f) { + npc.noTileCollide = true; + calamityGlobalNPC.newAI[3] += 1f; if (inRange) @@ -496,7 +496,7 @@ namespace CalamityMod.NPCs.Ravager } float maxOffset = death ? 320f * (1f - lifeRatio) : 240f * (1f - lifeRatio); - float offset = npc.ai[0] == 2f ? maxOffset * calamityGlobalNPC.newAI[2] : 0f; + float offset = phase2 ? maxOffset * calamityGlobalNPC.newAI[2] : 0f; // Set offset to 0 if the target stops moving if (Math.Abs(player.velocity.X) < 0.5f) @@ -508,7 +508,7 @@ namespace CalamityMod.NPCs.Ravager { npc.damage = npc.defDamage; - if (npc.ai[0] == 2f) + if (phase2) { float stopBeforeFallTime = malice ? 25f : 30f; if (expertMode) @@ -569,7 +569,7 @@ namespace CalamityMod.NPCs.Ravager if (!leftLegActive) velocityX += 1f; - if (npc.ai[0] == 2f) + if (phase2) { npc.damage = 0; velocityXChange *= velocityMult; @@ -593,15 +593,15 @@ namespace CalamityMod.NPCs.Ravager void CustomGravity() { - float gravity = npc.ai[0] == 2f ? 0f : 0.45f; - float maxFallSpeed = npc.ai[0] == 2f ? 24f : 15f; - if (malice) + float gravity = phase2 ? 0f : 0.45f; + float maxFallSpeed = reduceFallSpeed ? 12f : phase2 ? 24f : 15f; + if (malice && !reduceFallSpeed) { gravity *= 1.25f; maxFallSpeed *= 1.25f; } - if (calamityGlobalNPC.newAI[1] > 1f) + if (calamityGlobalNPC.newAI[1] > 1f && !reduceFallSpeed) maxFallSpeed *= calamityGlobalNPC.newAI[1]; npc.velocity.Y += gravity; @@ -612,14 +612,14 @@ namespace CalamityMod.NPCs.Ravager player = Main.player[npc.target]; if (npc.target <= 0 || npc.target == 255 || player.dead || !player.active) { - npc.TargetClosest(true); + npc.TargetClosest(); player = Main.player[npc.target]; } int distanceFromTarget = 5600; if (Vector2.Distance(npc.Center, player.Center) > distanceFromTarget) { - npc.TargetClosest(true); + npc.TargetClosest(); player = Main.player[npc.target]; if (Vector2.Distance(npc.Center, player.Center) > distanceFromTarget) diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index c2734c6dd4..9c5fe321e7 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -104,9 +104,12 @@ namespace CalamityMod.NPCs.Signus double lifeRatio = npc.life / (double)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } lifeToAlpha = (int)(100.0 * (1.0 - lifeRatio)); int maxCharges = death ? 1 : revenge ? 2 : expertMode ? 3 : 4; @@ -183,7 +186,7 @@ namespace CalamityMod.NPCs.Signus { if (Main.rand.Next(3) < 1) { - int num1012 = Dust.NewDust(vectorCenter - new Vector2(70f), 70 * 2, 70 * 2, (int)CalamityDusts.PurpleCosmolite, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); + int num1012 = Dust.NewDust(vectorCenter - new Vector2(70f), 70 * 2, 70 * 2, (int)CalamityDusts.PurpleCosmilite, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); Main.dust[num1012].noGravity = true; Main.dust[num1012].velocity *= 0.2f; Main.dust[num1012].fadeIn = 1f; @@ -293,7 +296,7 @@ namespace CalamityMod.NPCs.Signus Vector2 position = new Vector2(npc.ai[1] * 16f - (npc.width / 2), npc.ai[2] * 16f - (npc.height / 2)); for (int m = 0; m < 5; m++) { - int dust = Dust.NewDust(position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 90, default, 2f); + int dust = Dust.NewDust(position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 90, default, 2f); Main.dust[dust].noGravity = true; Main.dust[dust].fadeIn = 1f; } @@ -312,7 +315,7 @@ namespace CalamityMod.NPCs.Signus for (int n = 0; n < 15; n++) { - int num39 = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 90, default, 3f); + int num39 = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 90, default, 3f); Main.dust[num39].noGravity = true; } @@ -340,7 +343,7 @@ namespace CalamityMod.NPCs.Signus for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) @@ -348,7 +351,7 @@ namespace CalamityMod.NPCs.Signus Main.dust[num622].scale = 0.5f; Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } - int num623 = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num623 = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num623].velocity *= 3f; Main.dust[num623].noGravity = true; if (Main.rand.NextBool(2)) @@ -360,15 +363,15 @@ namespace CalamityMod.NPCs.Signus for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; - int num625 = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); + int num625 = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num625].noGravity = true; Main.dust[num625].velocity *= 5f; - num625 = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + num625 = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num625].velocity *= 2f; } } @@ -830,7 +833,7 @@ namespace CalamityMod.NPCs.Signus { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { @@ -842,7 +845,7 @@ namespace CalamityMod.NPCs.Signus npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -852,10 +855,10 @@ namespace CalamityMod.NPCs.Signus } for (int num623 = 0; num623 < 60; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } float randomSpread = Main.rand.Next(-200, 200) / 100; diff --git a/NPCs/Signus/SignusBomb.cs b/NPCs/Signus/SignusBomb.cs index fcb17a0a24..2afb0cffe5 100644 --- a/NPCs/Signus/SignusBomb.cs +++ b/NPCs/Signus/SignusBomb.cs @@ -209,7 +209,7 @@ namespace CalamityMod.NPCs.Signus npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -220,10 +220,10 @@ namespace CalamityMod.NPCs.Signus } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; Main.dust[num624].noGravity = true; } diff --git a/NPCs/SlimeGod/SlimeGod.cs b/NPCs/SlimeGod/SlimeGod.cs index 357538eb2a..a9b3963bc3 100644 --- a/NPCs/SlimeGod/SlimeGod.cs +++ b/NPCs/SlimeGod/SlimeGod.cs @@ -71,9 +71,12 @@ namespace CalamityMod.NPCs.SlimeGod float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } npc.defense = npc.defDefense; npc.damage = npc.defDamage; @@ -399,9 +402,9 @@ namespace CalamityMod.NPCs.SlimeGod else if (npc.ai[2] == 0f) { npc.noTileCollide = true; - npc.noGravity = true; } - npc.velocity.Y += 0.25f; + npc.noGravity = true; + npc.velocity.Y += 0.5f; float velocityLimit = malice ? 20f : death ? 15f : revenge ? 14f : expertMode ? 13f : 12f; if (npc.velocity.Y > velocityLimit) { diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index 3de06f1d4a..e1aa80fef9 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -99,9 +99,12 @@ namespace CalamityMod.NPCs.SlimeGod // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } Vector2 vectorCenter = npc.Center; @@ -315,6 +318,12 @@ namespace CalamityMod.NPCs.SlimeGod buffedSlime = 0; } + else if (npc.ai[1] < ai1) + { + npc.Opacity += 0.2f; + if (npc.Opacity > 0.8f) + npc.Opacity = 0.8f; + } // Spin and shoot orbs if (phase2) @@ -664,13 +673,13 @@ namespace CalamityMod.NPCs.SlimeGod } // Gel always drops directly, even on Expert - DropHelper.DropItemSpray(npc, ItemID.Gel, 180, 250); + DropHelper.DropItemSpray(npc, ItemID.Gel, 180, 250, 10); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) { // Materials - DropHelper.DropItemSpray(npc, ModContent.ItemType(), 30, 45); + DropHelper.DropItemSpray(npc, ModContent.ItemType(), 30, 45, 3); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; diff --git a/NPCs/SlimeGod/SlimeGodRun.cs b/NPCs/SlimeGod/SlimeGodRun.cs index cc18939b24..ae6f5a6d58 100644 --- a/NPCs/SlimeGod/SlimeGodRun.cs +++ b/NPCs/SlimeGod/SlimeGodRun.cs @@ -74,9 +74,12 @@ namespace CalamityMod.NPCs.SlimeGod float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } npc.defense = npc.defDefense; npc.damage = npc.defDamage; @@ -409,9 +412,9 @@ namespace CalamityMod.NPCs.SlimeGod else if (npc.ai[2] == 0f) { npc.noTileCollide = true; - npc.noGravity = true; } - npc.velocity.Y += 0.3f; + npc.noGravity = true; + npc.velocity.Y += 0.5f; float velocityLimit = malice ? 20f : death ? 15f : revenge ? 14f : expertMode ? 13f : 12f; if (npc.velocity.Y > velocityLimit) { diff --git a/NPCs/SlimeGod/SlimeGodRunSplit.cs b/NPCs/SlimeGod/SlimeGodRunSplit.cs index 6030f25e74..34c01edd23 100644 --- a/NPCs/SlimeGod/SlimeGodRunSplit.cs +++ b/NPCs/SlimeGod/SlimeGodRunSplit.cs @@ -76,9 +76,12 @@ namespace CalamityMod.NPCs.SlimeGod float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } npc.defense = npc.defDefense; npc.damage = npc.defDamage; @@ -383,9 +386,9 @@ namespace CalamityMod.NPCs.SlimeGod else if (npc.ai[2] == 0f) { npc.noTileCollide = true; - npc.noGravity = true; } - npc.velocity.Y += 0.3f; + npc.noGravity = true; + npc.velocity.Y += 0.5f; float velocityLimit = malice ? 22f : death ? 16f : revenge ? 15f : expertMode ? 14f : 13f; if (npc.velocity.Y > velocityLimit) { diff --git a/NPCs/SlimeGod/SlimeGodSplit.cs b/NPCs/SlimeGod/SlimeGodSplit.cs index c5d14625fe..ae3b4984a4 100644 --- a/NPCs/SlimeGod/SlimeGodSplit.cs +++ b/NPCs/SlimeGod/SlimeGodSplit.cs @@ -76,9 +76,12 @@ namespace CalamityMod.NPCs.SlimeGod float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } npc.defense = npc.defDefense; npc.damage = npc.defDamage; @@ -380,9 +383,9 @@ namespace CalamityMod.NPCs.SlimeGod else if (npc.ai[2] == 0f) { npc.noTileCollide = true; - npc.noGravity = true; } - npc.velocity.Y += 0.25f; + npc.noGravity = true; + npc.velocity.Y += 0.5f; float velocityLimit = malice ? 20f : death ? 15f : revenge ? 14f : expertMode ? 13f : 12f; if (npc.velocity.Y > velocityLimit) { diff --git a/NPCs/StormWeaver/StormWeaverBodyNaked.cs b/NPCs/StormWeaver/StormWeaverBodyNaked.cs index 32e0d3414f..97006260ab 100644 --- a/NPCs/StormWeaver/StormWeaverBodyNaked.cs +++ b/NPCs/StormWeaver/StormWeaverBodyNaked.cs @@ -247,7 +247,7 @@ namespace CalamityMod.NPCs.StormWeaver public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, hitDirection, -1f, 0, default, 1f); if (npc.life <= 0) { @@ -264,7 +264,7 @@ namespace CalamityMod.NPCs.StormWeaver for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -275,10 +275,10 @@ namespace CalamityMod.NPCs.StormWeaver for (int num623 = 0; num623 < 40; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index b075dab50f..b2e79ec7ef 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -477,7 +477,7 @@ namespace CalamityMod.NPCs.StormWeaver { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { @@ -490,7 +490,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -500,10 +500,10 @@ namespace CalamityMod.NPCs.StormWeaver } for (int num623 = 0; num623 < 40; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index cb96a3bbab..aef2f2945c 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -132,9 +132,12 @@ namespace CalamityMod.NPCs.StormWeaver float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } // Start charging at the target bool phase2 = lifeRatio < 0.7f; @@ -616,7 +619,7 @@ namespace CalamityMod.NPCs.StormWeaver public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, hitDirection, -1f, 0, default, 1f); if (npc.life <= 0) { @@ -632,7 +635,7 @@ namespace CalamityMod.NPCs.StormWeaver for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -643,10 +646,10 @@ namespace CalamityMod.NPCs.StormWeaver for (int num623 = 0; num623 < 40; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index be93b89de6..5b5fd26d44 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -170,7 +170,7 @@ namespace CalamityMod.NPCs.StormWeaver { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { @@ -184,7 +184,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -194,10 +194,10 @@ namespace CalamityMod.NPCs.StormWeaver } for (int num623 = 0; num623 < 40; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/StormWeaver/StormWeaverTailNaked.cs b/NPCs/StormWeaver/StormWeaverTailNaked.cs index 9cd942593f..4716088ed3 100644 --- a/NPCs/StormWeaver/StormWeaverTailNaked.cs +++ b/NPCs/StormWeaver/StormWeaverTailNaked.cs @@ -237,7 +237,7 @@ namespace CalamityMod.NPCs.StormWeaver public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, hitDirection, -1f, 0, default, 1f); if (npc.life <= 0) { @@ -253,7 +253,7 @@ namespace CalamityMod.NPCs.StormWeaver for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -264,10 +264,10 @@ namespace CalamityMod.NPCs.StormWeaver for (int num623 = 0; num623 < 40; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index dd15af36ff..d9d481021c 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -1,14 +1,12 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; -using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Potions; -using CalamityMod.Items.Tools; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; @@ -31,7 +29,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.SupremeCalamitas { - public class SupremeCalamitas : ModNPC + public class SupremeCalamitas : ModNPC { internal enum FrameAnimationType { @@ -846,8 +844,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (CalamityWorld.downedSCal) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); - if (CalamityWorld.downedSCal) - CalamityUtils.DisplayLocalizedText(key + "2", textColor); } startThirdAttack = true; return; @@ -1369,7 +1365,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num824 *= 0.5f; } @@ -1621,7 +1617,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num413 *= 0.5f; } @@ -1737,7 +1733,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.HeldItem; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num833 *= 0.5f; } @@ -2023,7 +2019,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num824 *= 0.5f; } @@ -2268,7 +2264,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num413 *= 0.5f; } @@ -2385,7 +2381,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num833 *= 0.5f; } @@ -2650,10 +2646,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas string key = "Mods.CalamityMod.SCalBrothersText"; if (CalamityWorld.downedSCal) key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, textColor); - if (CalamityWorld.downedSCal) - CalamityUtils.DisplayLocalizedText(key + "2", textColor); } if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -2741,37 +2734,34 @@ namespace CalamityMod.NPCs.SupremeCalamitas Dust.QuickDustLine(npc.Center, initialRitualPosition, 500f, Color.Red); npc.Center = initialRitualPosition; - // Make the town NPC spawn. - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y + 12, ModContent.NPCType()); - DropHelper.DropBags(npc); - // Increase the player's SCal kill count - if (Main.player[npc.target].Calamity().sCalKillCount < 5) - Main.player[npc.target].Calamity().sCalKillCount++; - // Legendary drop for SCal DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); - // Materials - int essenceMin = Main.expertMode ? 30 : 20; - int essenceMax = Main.expertMode ? 40 : 30; - DropHelper.DropItem(npc, ModContent.ItemType(), true, essenceMin, essenceMax); + // Levi drops directly from the boss so that you cannot obtain it by difficulty swapping bags + // It is one of extremely few Deathmode exclusive drops in the game + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.death); + // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) { - // Weapons. + // Materials + DropHelper.DropItem(npc, ModContent.ItemType(), true, 18, 27); + + // Weapons float w = DropHelper.NormalWeaponDropRateFloat; DropHelper.DropEntireWeightedSet(npc, - DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), DropHelper.WeightStack(w), + DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w) + DropHelper.WeightStack(w) ); - // Vanity. + // SCal vanity set (This drops all at once, or not at all) if (Main.rand.NextBool(7)) { DropHelper.DropItem(npc, ModContent.ItemType()); @@ -2781,14 +2771,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - // Vanity - DropHelper.DropItem(npc, ModContent.ItemType(), Main.expertMode); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.death); - // Other DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedSCal); + // Increase the player's SCal kill count + if (Main.player[npc.target].Calamity().sCalKillCount < 5) + Main.player[npc.target].Calamity().sCalKillCount++; + + // Spawn the SCal NPC directly where the boss was + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y + 12, ModContent.NPCType()); + // Mark Supreme Calamitas as defeated CalamityWorld.downedSCal = true; CalamityNetcode.SyncWorld(); diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index af55c1e4bf..d0e44b7c2f 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -97,7 +97,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num677 *= 0.5f; } diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index 3f626975e3..c7e8334fa4 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -97,7 +97,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num677 *= 0.5f; } diff --git a/NPCs/TownNPCs/DILF.cs b/NPCs/TownNPCs/DILF.cs index 9f787d9d47..7f10c46580 100644 --- a/NPCs/TownNPCs/DILF.cs +++ b/NPCs/TownNPCs/DILF.cs @@ -69,62 +69,44 @@ namespace CalamityMod.NPCs.TownNPCs if (npc.homeless && !CalamityWorld.foundHomePermafrost) { if (Main.rand.NextBool(2)) - return "I deeply appreciate you rescuing me from being trapped within my frozen castle... It's been many, many years..."; + return "I have not seen such a sky in decades. Who are you, to so brazenly march against that Tyrant?"; else - return "Thank you for saving me...though now I admit I am without a home since mine got destroyed."; + return "I... deeply appreciate you rescuing me from being trapped within my frozen castle. It's been many, many years."; } IList dialogue = new List(); - if (Main.dayTime) + if (Main.dayTime && !Main.player[Main.myPlayer].ZoneSnow) { - dialogue.Add("I must admit...I am not quite used to this weather. It's too warm for my taste..."); - dialogue.Add("My dear! What is it you would like to talk about today?"); - dialogue.Add("Why...I don't have to worry about any time of the day! If it is hot...then I can use my ice magic to cool down!"); - dialogue.Add("I do usually prefer a spot of humidity for my ice magic. It likes to come out as steam when it's too hot and dry..."); - dialogue.Add("Magic is a skill that must be learned and practiced! You seem to have an inherent talent for it at your age. I have spent all of my life honing it..."); - dialogue.Add("Why ice magic, you ask? Well, my parents were both pyromaniacs..."); + dialogue.Add("The sun beats down harshly upon my creations here. If you would allow me to conjure a blizzard every now and then..."); + dialogue.Add("I must admit, I’m not quite used to this weather. It's far too warm for my tastes..."); } else { - dialogue.Add("There be monsters lurking in the darkness. Most...unnatural monsters."); - dialogue.Add("You could break the icy stillness in the air tonight."); - dialogue.Add("Hmm...some would say that an unforeseen outside force is the root of the blood moon..."); - dialogue.Add("I was once the greatest Archmage of ice that ever hailed the lands. Whether or not that is still applicable, I am not sure..."); - dialogue.Add("There used to be other Archmages of other elements. I wonder where they are now...if they are also alive..."); - dialogue.Add("Oh...I wish I could tell you all about my life and the lessons I have learned, but it appears you have a great many things to do..."); + dialogue.Add("Nightfall is a good time for practicing magic. We mages often rely on celestial bodies and their fragments to enhance our mana."); + dialogue.Add("Necromancy was never a field I found interesting. Why utilize the rotting corpses of people, when you could form far more elegant servants of ice?"); } - dialogue.Add("I assure you, I will do my best to act as the cool grandfather figure you always wanted."); + dialogue.Add("The tundra’s unnatural state is not all my doing. Decades ago, I came across it and amplified the climate with my magic."); + dialogue.Add("If you have a request, make it quick. I am in the process of weaving a spell, which requires great focus."); + dialogue.Add("You have the makings of a gifted mage. Tell me, what do you think of ice magic?"); + dialogue.Add("Flowers and the like don’t hold a candle to the beauty of intricately formed ice."); if (BirthdayParty.PartyIsUp) - dialogue.Add("Sometimes...I feel like all I'm good for during these events is making ice cubes and slushies."); + dialogue.Add("Sometimes... I feel like all I'm good for during these events is making ice cubes and slushies."); + + if (Main.bloodMoon) + { + dialogue.Add("If your blood were to thoroughly freeze, it would be quite fatal."); + dialogue.Add("The undead which roam tonight are still monsters of blood and guts, but they seem... fresher."); + } if (NPC.downedMoonlord) { - dialogue.Add("Tread carefully, my friend... Now that the Moon Lord has been defeated, many powerful creatures will crawl out to challenge you..."); - dialogue.Add("I feel the balance of nature tilting farther than ever before. Is it due to you, or because of the events leading to now...?"); + dialogue.Add("It is shocking, to see you have come so far. I wish you the best of luck on your future endeavours."); + dialogue.Add("You, having bested so many beings, even deities, I wonder if I have anything left to offer you."); } - if (CalamityWorld.downedPolterghast) - dialogue.Add("I felt a sudden chill down my spine. I sense something dangerous stirring in the Abyss..."); - - if (CalamityWorld.downedYharon) - dialogue.Add("...Where is Lord Yharim? He must be up to something..."); - - int dryad = NPC.FindFirstNPC(NPCID.Dryad); - if (dryad != -1) - dialogue.Add("Yes, I am older than " + Main.npc[dryad].GivenName + ". You can stop asking now..."); - - if (Main.player[Main.myPlayer].Calamity().chibii) - dialogue.Add("What an adorable tiny companion you have! Where in the world did you find such a...creature...? Actually, I'd rather not know."); - - if (Main.player[Main.myPlayer].Calamity().cryogenSoul) - dialogue.Add(Main.player[Main.myPlayer].name + "...just between us, I think I forgot my soul in the ice castle. If you see it, please do let me know."); - - if (Main.hardMode) - dialogue.Add("It wouldn't be the first time something unknown and powerful dropped from the heavens...I would tread carefully if I were you..."); - return dialogue[Main.rand.Next(dialogue.Count)]; } diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index f874d3d9cc..b800edb7d9 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/FAP.cs @@ -1,8 +1,7 @@ -using CalamityMod.Events; +using CalamityMod.Items.Mounts; using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Typeless; using CalamityMod.World; using System.Collections.Generic; using Terraria; @@ -11,6 +10,7 @@ using Terraria.GameContent.Events; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; + namespace CalamityMod.NPCs.TownNPCs { [AutoloadHead] @@ -75,127 +75,141 @@ namespace CalamityMod.NPCs.TownNPCs public override string GetChat() { - if (BossRushEvent.BossRushActive) - return "Why are you talking to me right now? Either way, I expect you to turn in a perfect performance!"; + if (CalamityUtils.AnyBossNPCS()) + return "Why are you talking to me right now? Shouldn't you be bumbling around and dying for my amusement?"; if (npc.homeless) { if (Main.rand.NextBool(2)) return "I could smell my vodka from MILES away!"; else - return "Have any spare rooms available? Preferably candle-lit with a hefty supply of booze."; + return "Have any spare rooms available? Preferably candle-lit with a hefty supply of booze?"; } - if (Main.bloodMoon) + int wife = NPC.FindFirstNPC(NPCID.Stylist); + bool wifeIsAround = wife != -1; + bool beLessDrunk = wifeIsAround && NPC.downedMoonlord; + + if (Main.bloodMoon) { int random = Main.rand.Next(4); if (random == 0) { - return "Hey, nice night! I'm gonna make some Bloody Marys, celery included. Want one?"; + return "I'm gonna make some Bloody Marys to relax, celery included. Want one?"; } else if (random == 1) { - return "More blood for the blood gods!"; + return "If you're too lazy to craft potions normally, try Blood Orbs. Blood is fuel, dumbass."; } else if (random == 2) { - return "Everyone else is so rude tonight. If they don't get over it soon, I'll break down their doors and make them!"; + return "I'm trying to not be bitchy tonight, but it's hard when everyone else won't shut up."; } else { Main.player[Main.myPlayer].Hurt(PlayerDeathReason.ByCustomReason(Main.player[Main.myPlayer].name + " was slapped too hard."), Main.player[Main.myPlayer].statLife / 2, -Main.player[Main.myPlayer].direction, false, false, false, -1); - return "Being drunk, I have no moral compass atm."; + return "Sorry, I have no moral compass at the moment."; } } - if (CalamityUtils.AnyBossNPCS()) - return "Nothard/10, if I fight bosses I wanna feel like screaming 'OH YES DADDY!' while I die repeatedly."; - IList dialogue = new List(); - if (Main.dayTime) + if (wifeIsAround) + { + dialogue.Add("You can't stop me from trying to move in with " + Main.npc[wife].GivenName + "."); + dialogue.Add("I love it when " + Main.npc[wife].GivenName + "'s hands get sticky from all that... wax."); + dialogue.Add(Main.npc[wife].GivenName + " works wonders for my hair... among other things."); + dialogue.Add("Ever since " + Main.npc[wife].GivenName + " moved in I haven't been drinking as much... a strange but not unwelcome feeling."); + } + + if (Main.dayTime) { - dialogue.Add("Like I always say, when you're drunk you can tolerate annoying people a lot easier..."); - dialogue.Add("I'm literally balls drunk off my sass right now."); - dialogue.Add("I'm either laughing because I'm drunk or because I've lost my mind. Probably both."); - dialogue.Add("When I'm drunk I'm way happier...at least until the talking worms start to appear."); - dialogue.Add("I should reprogram the whole game, while drunk, and send it back to the testers."); - dialogue.Add("What a great day, might just drink so much that I get poisoned again."); - } + if (beLessDrunk) + dialogue.Add(Main.npc[wife].GivenName + " helped me learn to accept my past. It's been rough, but I think I'm on the right track now."); + else + dialogue.Add("I drink to forget certain... things. What things, you might ask? Well, the point is to forget them, isn't it?"); + + dialogue.Add("I'm literally balls drunk off my sass right now, what do you want?"); + dialogue.Add("I'm either laughing because I'm drunk or because I've lost my mind, probably both."); + dialogue.Add("When I'm drunk I'm way happier... at least until the talking worms start to appear."); + dialogue.Add("I should reprogram the whole mod, while drunk, then send it back to the testers."); + + if (beLessDrunk) + dialogue.Add("Might go out for a jog later with " + Main.npc[wife].GivenName + ". Nice day for it."); + else + dialogue.Add("What a great day! Might just drink so much that I get poisoned again."); + } else { - dialogue.Add("A perfect night...for alcohol! First drinks are on me!"); - dialogue.Add("Here's a challenge...take a drink whenever you get hit. Oh wait, you'd die."); - dialogue.Add("Well I was planning to light some candles in order to relax...ah well, time to code while drunk."); - dialogue.Add("Yes, everyone knows the mechworm is buggy. Well, not so much anymore, but still."); - dialogue.Add("That's west, " + Main.player[Main.myPlayer].name + ". You're fired again."); - dialogue.Add("Are you sure you're 21? ...alright, fine, but don't tell anyone I sold you this."); - } + dialogue.Add("A perfect night to light some candles, drink some wine and relax."); + dialogue.Add("Here's a challenge... take a shot for every time you've had to look at the wiki. Oh wait, you'd die."); + dialogue.Add("Yes, everyone knows the mechworm is buggy. Well, not anymore, but still."); + dialogue.Add("You lost or something? I don't mind company, but I'd rather be left alone at night."); + dialogue.Add("Are you sure you're 21? ...Alright, fine, but don't tell anyone I sold you these."); - dialogue.Add("Drink something that turns you into a magical flying unicorn so you can be super gay."); + if (wifeIsAround) + dialogue.Add("I should watch some movies with " + Main.npc[wife].GivenName + " tonight. You could come too, but only if you bring snacks for us."); + } + + dialogue.Add("I HATE WALMART! ...Anyway, what do you want this time?"); + dialogue.Add("Drink something that turns you into a magical flying unicorn so you can be just like me."); dialogue.Add("Did anyone ever tell you that large assets cause back pain? Well, they were right."); + dialogue.Add("Deals so good I'll [$$!$] myself! ...Sorry, just had a minor stroke!"); - if (BirthdayParty.PartyIsUp) - dialogue.Add("You'll always find me at parties where booze is involved...well, you'll always find booze where I'm involved."); + if (BirthdayParty.PartyIsUp) + dialogue.Add("You'll always find me at parties where booze is involved... well, you'll always find BOOZE where I'M involved!"); if (Main.invasionType == InvasionID.MartianMadness) - dialogue.Add("Shoot down the space invaders! Sexy time will be postponed if we are invaded by UFOs!"); + dialogue.Add("You should probably deal with those ayy lmaos before anything else, but whatever."); if (CalamityWorld.downedCryogen) - dialogue.Add("God I can't wait to beat on some ice again!"); + dialogue.Add("God I can't wait to smash some ice again! ...For drinks, of course."); if (CalamityWorld.downedLeviathan) - dialogue.Add("The only things I'm attracted to are fish women, women, men who look like women and that's it."); + dialogue.Add("How could you murder such a beautiful creature!? ...The blue sexy one, not the obese cucumber."); if (NPC.downedMoonlord) - { - dialogue.Add("I'll always be watching."); - dialogue.Add("Why did that weird monster need that many tentacles? ...actually, don't answer that."); - } + dialogue.Add("Ever wondered why the Moon Lord needed so many tentacles? Uh... on second thought, I won't answer that."); if (CalamityWorld.rainingAcid) - dialogue.Add("There's chemicals in the water...and they're turning the frogs gay!"); + dialogue.Add("I'm melting! Put a stop to this inclement weather this instant before it ruins my hair!"); if (CalamityWorld.downedPolterghast) - dialogue.Add("I saw a ghost down by the old train tracks once, flailing wildly at the lily pads, those were the days."); + dialogue.Add("I saw a ghost down by the old train tracks back at my homeland once, flailing wildly at the lily pads... frightening times those were."); if (CalamityWorld.downedDoG) - dialogue.Add("I hear it's amazing when the famous purple-stuffed worm out in flap-jaw space, with the tuning fork, does a raw blink on Hara-kiri rock. I need scissors! 61!"); + dialogue.Add("I hear it's amazing when the famous Devourer of Gods out in flap-jaw space, with the tuning fork, does a raw blink on Hara-kiri rock. I need scissors! 61!"); - int tavernKeep = NPC.FindFirstNPC(NPCID.DD2Bartender); + int tavernKeep = NPC.FindFirstNPC(NPCID.DD2Bartender); if (tavernKeep != -1) { - dialogue.Add("Tell " + Main.npc[tavernKeep].GivenName + " to stop calling me. He's not wanted."); + dialogue.Add("I've had to tell baldie where my eyes are so many times that I've lost count."); + dialogue.Add("Tell " + Main.npc[tavernKeep].GivenName + " to stop calling me. He's not wanted."); dialogue.Add("My booze will always be better than " + Main.npc[tavernKeep].GivenName + "'s, and nobody can convince me otherwise."); } int permadong = NPC.FindFirstNPC(ModContent.NPCType()); if (permadong != -1) - dialogue.Add("I never realized how well-endowed " + Main.npc[permadong].GivenName + " was. It had to be the largest icicle I had ever seen."); + dialogue.Add("I never realized how well-endowed " + Main.npc[permadong].GivenName + " was. It had to be the largest icicle I'd ever seen."); - int waifu = NPC.FindFirstNPC(NPCID.Stylist); - if (waifu != -1) - { - dialogue.Add("You still can't stop me from trying to move in with " + Main.npc[waifu].GivenName + "."); - dialogue.Add("I love it when " + Main.npc[waifu].GivenName + "'s hands get sticky from all that...wax."); - dialogue.Add(Main.npc[waifu].GivenName + " works wonders for my hair...among other things."); - dialogue.Add("Ever since " + Main.npc[waifu].GivenName + " moved in I haven't been drinking as much...it's a weird feeling."); - } + int witch = NPC.FindFirstNPC(ModContent.NPCType()); + if (witch != -1) + dialogue.Add("The abuse " + Main.npc[witch].GivenName + " went through is something I can hardly comprehend. I'd offer her a drink, but I don't think she'd enjoy it."); - if (Main.player[Main.myPlayer].Calamity().chibii) - dialogue.Add("Is that a toy? Looks like something I'd carry around if I was 5 years old."); + if (Main.player[Main.myPlayer].Calamity().chibii) + dialogue.Add("The hell is that? Looks like something I'd carry around if I was 5 years old."); if (Main.player[Main.myPlayer].Calamity().sirenBoobs && !Main.player[Main.myPlayer].Calamity().sirenBoobsHide) - dialogue.Add("Nice scales...did it get hot in here?"); + dialogue.Add("Nice scales... is it hot in here or is it just me?"); if (Main.player[Main.myPlayer].Calamity().fabsolVodka) - dialogue.Add("Oh yeah, now you're drinking the good stuff! Do you like it? I created the recipe by mixing fairy dust, crystals and other magical crap."); + dialogue.Add("Do you like my vodka? I created it by mixing fairy dust, crystallized cave sweat and other magical crap."); - if (Main.player[Main.myPlayer].Calamity().fab) + if (Main.player[Main.myPlayer].HasItem(ModContent.ItemType())) { - dialogue.Add("So...you're riding me, huh? That's not weird at all."); - dialogue.Add("Are you coming on to me?"); - dialogue.Add("If I was a magical horse, I'd be out in space, swirling cocktails, as I watch space worms battle for my enjoyment."); + dialogue.Add("So... you found my special bottle. Hope you enjoy it, I know I will."); + dialogue.Add("Be sure to dismount me once in a while, I get tired. And besides, I can't rip you off-I mean offer you excellent deals you won't find anywhere else if you're riding me 24/7."); + dialogue.Add("Before you ask, no, I do NOT have a heart on my butt while in human form. Don't question my transformation preferences!"); } IList donorList = new List(CalamityLists.donatorList); @@ -214,11 +228,30 @@ namespace CalamityMod.NPCs.TownNPCs return dialogue[Main.rand.Next(dialogue.Count)]; } - public string Death() - { - return "You have failed " + Main.player[Main.myPlayer].Calamity().deathCount + - (Main.player[Main.myPlayer].Calamity().deathCount == 1 ? " time." : " times."); - } + public string Death() + { + int deaths = Main.player[Main.myPlayer].Calamity().deathCount; + + string text = "You have failed " + Main.player[Main.myPlayer].Calamity().deathCount + + (Main.player[Main.myPlayer].Calamity().deathCount == 1 ? " time." : " times."); + + if (deaths > 10000) + text += " Congratulations! You are now, officially, the biggest loser in Terraria's history! Who was number two? Hell if I know."; + else if (deaths > 5000) + text += " I'm not sure what to say this time. That you're bad and should feel bad? That much was known already."; + else if (deaths > 2500) + text += " Bless your heart. I could dodge better than you even if I were drunk high."; + else if (deaths > 1000) + text += " It is said the average Terrarian has a lifespan of 2 minutes or less. ...Well, not really, but I feel like you'd be part of that statistic."; + else if (deaths > 500) + text += " Your inability to avoid dying to even the most basic of attacks is astonishing to me."; + else if (deaths > 250) + text += " I admire your tenacity. Keep it up, your enemies are racking up quite the kill count!"; + else if (deaths > 100) + text += " Consider lowering the difficulty. If you found that statement irritating, good."; + + return text; + } public override void SetChatButtons(ref string button, ref string button2) { diff --git a/NPCs/TownNPCs/SEAHOE.cs b/NPCs/TownNPCs/SEAHOE.cs index 31044def25..14748d79a4 100644 --- a/NPCs/TownNPCs/SEAHOE.cs +++ b/NPCs/TownNPCs/SEAHOE.cs @@ -71,22 +71,22 @@ namespace CalamityMod.NPCs.TownNPCs if (npc.homeless) { if (Main.rand.NextBool(2)) - return "Is this...what the world is like now? It seems so much more lifeless than when I saw it before I disappeared."; + return "How much more has the world fallen to ruin? Even the Tyrant’s empire..."; else return "Thank you for your service, my child, but I am afraid I am without a home now."; } if (Main.dayTime) { - dialogue.Add("My homeland may have dried up but the memories of my people still remain. I will not let them be in vain."); - dialogue.Add("There is a lot that you do not know about this world, specifically regarding the past. Much of it has been lost to history due to the many wars that plagued it."); - dialogue.Add("How can I survive on land? Ah, that is a secret. No, actually...I can breathe air like you!"); - dialogue.Add("Why do you ask if it's the males that carry the young? Don't your males carry their young?"); + dialogue.Add("My home may have been destroyed and my people lost... But I will assist you to honor their memory."); + dialogue.Add("How odd it is, that your people leave the care of those yet to be born to the females. Our males carry the eggs until they hatch."); + dialogue.Add("How can I survive on land? Ah, that is a secret. No, actually... I can breathe air like you!"); + dialogue.Add("Ah, if only you could have seen the beauty of a kingdom submerged in water. The way the light refracted and shone over our coral homes..."); } else { - dialogue.Add("There be monsters lurking in the darkness. Most...unnatural monsters."); - dialogue.Add("Most creatures look up at the moon and admire it. I look up and fear it."); - dialogue.Add("Oh, me? I don't sleep, it's part of my nature."); + dialogue.Add("There lurk horrifying creatures beyond the light of our homes. You should take care."); + dialogue.Add("My eyes are not well suited to bright lights after so many years of darkness. The peace of the night is welcome."); + dialogue.Add("Oh, me? I do not sleep, it is part of my nature."); } int partyGirl = NPC.FindFirstNPC(NPCID.PartyGirl); @@ -98,59 +98,46 @@ namespace CalamityMod.NPCs.TownNPCs int lilBitch = NPC.FindFirstNPC(NPCID.Angler); if (lilBitch != -1) { - dialogue.Add("Meet me at " + Main.npc[lilBitch].GivenName + "'s house at night. We're going to throw him to the Trashers."); + dialogue.Add("Meet me at " + Main.npc[lilBitch].GivenName + "'s house at night. We will throw him to the Trashers."); dialogue.Add("Not sure how " + Main.npc[lilBitch].GivenName + " has not been roasted and digested by now, hanging around the sulphuric seas for so long. Perhaps it got to his head."); } + int cirrus = NPC.FindFirstNPC(ModContent.NPCType()); if (cirrus != -1) + { dialogue.Add("Rumor has it " + Main.npc[cirrus].GivenName + " drinks to forget her troubled past."); + } + + int witch = NPC.FindFirstNPC(ModContent.NPCType()); + if (witch != -1) + { + dialogue.Add("I must admit, the Witch's presence is unsettling to me. But so many years have passed, and she too has suffered much."); + } if (Main.bloodMoon) { - dialogue.Add("I'm never keen on these nights. They're so violent."); - } - - /* - int yharim = NPC.FindFirstNPC(NPCID.Yharim); - if (yharim != -1) - { - dialogue.Add("Oh, Yharim... did he ever realize what he was doing? He seems so...calm, as if his rage had been satiated."); - }*/ - - if (Main.player[Main.myPlayer].Calamity().sirenPet) - { - dialogue.Add("Ah, nice duds, my child!"); - } - - if (Main.player[Main.myPlayer].Calamity().sirenBoobs && !Main.player[Main.myPlayer].Calamity().sirenBoobsHide) - { - dialogue.Add("Shouldn't you be wearing a clam bra?"); + dialogue.Add("Since ancient times people have said that deities cause celestial events. Which one then, is the cause for these?"); + dialogue.Add("I've never been keen on these nights. Such violence."); } if (Main.hardMode) { - dialogue.Add("The balance between light and dark is tipping. Stay strong, my child."); - dialogue.Add("Ah, you are starting to realize just how complicated this world is now. You are learning the story of what became of him."); + dialogue.Add("Your presence is now known to a great many things. It is unlikely that they will be as friendly towards you as I have been."); + dialogue.Add("Hm... The veil has fallen, and the world begins to show its true colors. I hope you will trek a righteous path, though even I am not sure what that may be."); } if (NPC.downedMoonlord) { - dialogue.Add("Do you ever get the feeling that something out there is watching you very carefully? Whatever it is, it's very small and sly, I think."); - dialogue.Add("I must admit, I am quite shaken up now. Never would I have imagined that I would see one of the dark gods again. Not in this lifetime anyhow."); - dialogue.Add("Times like this I wish my home was still in one piece instead of evaporated away. I don't blame the witch for anything, it's just...oh, never mind."); + dialogue.Add("These days, the night sky feels... just a little less oppressive now."); + dialogue.Add("Some of these beings I had thought previously to be only legends. To see them in all their glory... what a macabre privilege."); } if (CalamityWorld.downedDoG) { - dialogue.Add("I suppose that witch was mistaken. Defeating the Ceaseless Void and the Devourer has not caused our world to collapse... but I would not lower my guard if I were you."); + dialogue.Add("To see that Tyrant’s serpent free of its shackles. It gave me chills."); } - /*if (CalamityWorld.downedYharon) - { - dialogue.Add("I'm worried for Lord Yharim. He was not in a particular good mood once we found out you defeated his close friend."); - }*/ - return dialogue[Main.rand.Next(dialogue.Count)]; } @@ -171,7 +158,7 @@ namespace CalamityMod.NPCs.TownNPCs displayThisText = "Lord Yharim possesses god-like strength. He may not even fight you at full power which is fortunate for you. His attacks may just kill you in one hit, so be careful."; break; case 2f: - displayThisText = "Draedon's style of confrontation is very...alien and hands-off. You may be more likely to fight any one of his mechs before taking him down."; + displayThisText = "Draedon's style of confrontation is very... alien and hands-off. You may be more likely to fight any one of his mechs before taking him down."; break; } } @@ -201,7 +188,7 @@ namespace CalamityMod.NPCs.TownNPCs displayThisText = "The Abyss holds many secrets revealed with time. Checking it out again may not be a bad idea."; break; case 1f: - displayThisText = "Ah...I can sense a powerful change in the weather. You may want to venture to the Sulphurous Seas once more during the rain to experience it."; + displayThisText = "Ah... I can sense a powerful change in the weather. You may want to venture to the Sulphurous Seas once more during the rain to experience it."; break; } } @@ -210,13 +197,13 @@ namespace CalamityMod.NPCs.TownNPCs switch (npc.Calamity().newAI[0] % 3f) { case 0f: - displayThisText = "The Rune of Kos holds a significant portion of Providence's brand of magic, easily distinguishable from all others. Activating it in certain places would have some...risky consequences."; + displayThisText = "The Rune of Kos holds a significant portion of Providence's brand of magic, easily distinguishable from all others. Activating it in certain places would have some... risky consequences."; break; case 1f: displayThisText = "Ironic, is it not, that Statis was defeated by the very Sentinel his people fashioned their art of stealth from. Fate so often weaves cruel tales."; break; case 2f: - displayThisText = "The Dungeon seems to be more active now. You may hear the faint whisperings of angry spirits who have not left to the Void...I would recommend searching there before taking on the Sentinels."; + displayThisText = "The Dungeon seems to be more active now. You may hear the faint whisperings of angry spirits who have not left to the Void... I would recommend searching there before taking on the Sentinels."; break; } } @@ -276,7 +263,7 @@ namespace CalamityMod.NPCs.TownNPCs displayThisText = "If you take an idol down to the Brimstone Crags you might be able to see just what is lurking in the shadows."; break; case 4f: - displayThisText = "The Brimstone Crags...Yharim despised that place, and did everything he could to raze it to the ground. It might explain a few things about him."; + displayThisText = "The Brimstone Crags... Yharim despised that place, and did everything he could to raze it to the ground. It might explain a few things about him."; break; case 5f: displayThisText = "If you've gathered the souls used to power those automatons head once more to the jungle. You will find a powerful enemy to fight, which will unleash the full fervor of the jungle once defeated. Do not underestimate it!"; diff --git a/NPCs/TownNPCs/THIEF.cs b/NPCs/TownNPCs/THIEF.cs index 5beceda8f1..a64d92ad51 100644 --- a/NPCs/TownNPCs/THIEF.cs +++ b/NPCs/TownNPCs/THIEF.cs @@ -103,9 +103,8 @@ namespace CalamityMod.NPCs.TownNPCs } else if (!Main.dayTime && !Main.bloodMoon) { - PossibleDialogs.Add("You know what's really cool? Watching the glint of throwing stars as they reflect the moon."); + PossibleDialogs.Add("Hm, the stars are too bright tonight. Makes sneaking around a little more difficult."); PossibleDialogs.Add("You think those stars that fall occasionally would make good throwing weapons?"); - PossibleDialogs.Add("Statis' clan's got nothing on me. Mostly cause they're all dead."); } if (BirthdayParty.PartyIsUp) @@ -132,38 +131,32 @@ namespace CalamityMod.NPCs.TownNPCs PossibleDialogs.Add("Anything is a weapon if you throw it hard enough."); PossibleDialogs.Add("That's your chucking arm? You need to work out more."); PossibleDialogs.Add("Listen here. It's all in the wrist, the wrist! Oh, forget it."); - PossibleDialogs.Add("I don't think Mom and Dad are proud of the job I have right now."); - PossibleDialogs.Add("Eh you know how it goes; steal from the rich, give to the poor. Of course, for a price."); - PossibleDialogs.Add("Want to hear about this one time I was stuck in a room with a rabid dog and a dead guy?"); - PossibleDialogs.Add("Argh snakes. For some reason it's always snakes."); - PossibleDialogs.Add("Maybe I'm bitter. It's been a long time, so whatever. Just do a good job out there."); + PossibleDialogs.Add("Eh you know how it goes; steal from the rich, give to the poor, but I do take a cut of the profit."); + PossibleDialogs.Add("Snakes! Why does it always have to be snakes!"); + PossibleDialogs.Add("It's super nice you know, to just have everything you want. Some people never got that luxury."); PossibleDialogs.Add("It's not stealing! I'm just borrowing it until I die!"); if (Main.LocalPlayer.InventoryHas(ItemID.BoneGlove)) { - PossibleDialogs.Add("Wouldn't be the first time I used my friends' remains as weapons."); + PossibleDialogs.Add("Wouldn't be the first time I used remains as weapons."); } if (Main.hardMode) { - PossibleDialogs.Add("With all of this new stuff cropping up, looks like we got some easy loot and new items to craft up, eh? Well, YOU craft them, I'll steal em."); - PossibleDialogs.Add("Draedon thinks he can build awesome machines, but he doesn't know how much crap I've stolen from him and sold by dismantling his drones."); - PossibleDialogs.Add("Gramma always said never to invade ancient temples or you'll be cursed and die. Let's say both of us attest that is untrue. We're still alive. Somewhat."); + PossibleDialogs.Add("All sorts of new weapons to be found and looted. Get to that, and I'll share some of my collection too!"); + PossibleDialogs.Add("There's so much scrap around this land with valuable parts to them. Makes you wonder who could afford to leave em all around."); + PossibleDialogs.Add("Crypts, tombs, dungeons, those're all just treasure troves to me. The dead are dead, they've got nothing to do with it."); } if (NPC.downedMoonlord) { - PossibleDialogs.Add("I heard that there's some really neat and awesome rogue items you can get. Show em to me if you ever get the time."); - PossibleDialogs.Add("Providence HATES it when you take her stuff. I learned that the hard way."); - PossibleDialogs.Add("You think I can get away with looting from ghosts? It ain't like they can pick things up."); + PossibleDialogs.Add("If you find anything cool, make sure to drop by and show it to me, I promise I’ll keep my hands off it."); + PossibleDialogs.Add("So many new things to steal, I can’t think of where to start!"); + PossibleDialogs.Add("If I end up angering some deities or whatever, would you mind taking the blame for me?"); } if (Main.LocalPlayer.InventoryHas(ModContent.ItemType()) || Main.LocalPlayer.InventoryHas(ModContent.ItemType())) { PossibleDialogs.Add("Oh man, did you rip that off a shark!? Now that's a weapon!"); } - if (CalamityWorld.downedDoG) - { - PossibleDialogs.Add("I tried looting Storm Weaver's armor once. Before I could get a chunk of the stuff... well let's just say the bigger, fatter cosmic worm arrived and it didn't end well."); - } if (Main.LocalPlayer.ZoneJungle) { PossibleDialogs.Add("I'd rather not be here. This place has bad vibes, y'know? It brings back some unpleasant memories."); @@ -176,6 +169,12 @@ namespace CalamityMod.NPCs.TownNPCs PossibleDialogs.Add($"Don't tell {nerd.GivenName}, but I took some of his stuff and replaced it with Angel Statues."); } + int witch = NPC.FindFirstNPC(ModContent.NPCType()); + if(witch != -1) + { + PossibleDialogs.Add("Hey, hey, has Calamitas seriously moved in here with us? Why???"); + } + int cirrusIndex = NPC.FindFirstNPC(ModContent.NPCType()); if (cirrusIndex != -1) { diff --git a/NPCs/TownNPCs/WITCH.cs b/NPCs/TownNPCs/WITCH.cs index 219026ada2..88e2c4673e 100644 --- a/NPCs/TownNPCs/WITCH.cs +++ b/NPCs/TownNPCs/WITCH.cs @@ -5,9 +5,10 @@ using CalamityMod.Projectiles.Magic; using CalamityMod.UI.CalamitasEnchants; using CalamityMod.World; using Terraria; +using Terraria.GameContent.Events; using Terraria.ID; using Terraria.ModLoader; - +using Terraria.Utilities; using static Terraria.ModLoader.ModContent; using SCalBoss = CalamityMod.NPCs.SupremeCalamitas.SupremeCalamitas; @@ -53,7 +54,81 @@ namespace CalamityMod.NPCs.TownNPCs public override string TownNPCName() => "Calamitas"; - public override string GetChat() => "Mrrp is cringe."; + // The way this works is by having an RNG based on weights. + // With certain conditions (such as if a blood moon is happening) you can add possibilities + // to the RNG via textSelector.Add("text", weight); + // Text can always appear assuming the weight is greater than 0 and there's no if condition deciding whether it can. + // The higher the weight is, the more likely it is to be selected from all the choices. + // To give an example of this, assume you have two possibilities: + // "a" with a weight of 1, and "b" with a weight of 5. The chance of "a" being displayed would be + // 1/6, while "b" wold have a 5/6 chance of being displayed. + // If only one possibility exists it will be the only thing that is displayed, regardless of weight. + public override string GetChat() + { + WeightedRandom textSelector = new WeightedRandom(Main.rand); + + if (npc.homeless) + { + textSelector.Add("I'm considering moving back to that old cave of mine."); + textSelector.Add("I certainly can't return to the Tyrant's old dwellings now, have you got any places to stay?"); + } + else + { + textSelector.Add("I can't pay rent, but if you've got any dead relative you want me to try and... what? You don't?"); + textSelector.Add("One of these days, I was thinking of starting a garden with the flowers from the old capitol of hell." + + " I love the smell of brimstone in the morning."); + textSelector.Add("I think I've settled comfortably, thank you very much."); + textSelector.Add("Many seasons have gone by since I first met with the Tyrant, and only now did I break free." + + " I wish I'd been stronger..."); + textSelector.Add("If you've got any curses you want dispelled... well I'm not your person."); + + if (!Main.dayTime) + { + if (Main.bloodMoon) + { + textSelector.Add("Such an unnatural shade of red. Nothing like my brimstone flames.", 5.15); + textSelector.Add("I can't work with nights like these. The stars seem to have shrunk away in fear.", 5.15); + } + else + { + textSelector.Add("These undead are horrific, I can't stand to look at them. How could anyone be satisfied" + + " with such amateur work?", 2.8); + textSelector.Add("I don't think it's a stretch to say that astrology is utter nonsense... but it was a hobby" + + " of mine once.", 2.8); + } + } + + if (BirthdayParty.PartyIsUp) + textSelector.Add("If another person asks me if I can dance or not, I will light their hat on fire.", 5.5); + + if (NPC.AnyNPCs(NPCType())) + { + textSelector.Add("I cannot understand the Sea King. He does not seem to want me dead. That amount of compassion" + + " I just can't understand.", 1.45); + } + if (NPC.AnyNPCs(NPCType())) + { + textSelector.Add("That frosty old man... even if you ignore our brands of magic and our old alliances, I doubt I'd ever" + + " get along with him.", 1.45); + } + + int fab = NPC.FindFirstNPC(NPCType()); + if (fab != -1) + { + textSelector.Add("I wonder if " + Main.npc[fab].GivenName + " ever feels cold given how revealing her dress is." + + " Perhaps she should cover up a bit more.", 1.45); + } + } + + // Select a possibility from the RNG and choose it as the thing that should be said. + string thingToSay = textSelector.Get(); + + // Have a flat chance (1/4444) to simply ignore the above selection and say something humorous instead. + if (Main.rand.NextBool(4444)) + thingToSay = "Mrrp is cringe."; + + return thingToSay; + } public override void SetChatButtons(ref string button, ref string button2) => button = "Enchant"; @@ -104,7 +179,7 @@ namespace CalamityMod.NPCs.TownNPCs return true; } - //public override void TownNPCAttackMagic(ref float auraLightMultiplier) + //public override void TownNPCAttackMagic(ref float auraLightMultiplier) public override void TownNPCAttackProj(ref int projType, ref int attackDelay) { diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index be93674baa..205f510b30 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -145,10 +145,6 @@ namespace CalamityMod.NPCs.Yharon // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - // Stop rain CalamityMod.StopRain(); @@ -157,6 +153,14 @@ namespace CalamityMod.NPCs.Yharon bool expertMode = Main.expertMode || malice; bool revenge = CalamityWorld.revenge || malice; bool death = CalamityWorld.death || malice; + + if (revenge) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + } + float pie = (float)Math.PI; Vector2 vectorCenter = npc.Center; @@ -2998,9 +3002,12 @@ namespace CalamityMod.NPCs.Yharon // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > npc.Calamity().killTimeRatio_IncreasedAggression) - lifeRatio = npc.Calamity().killTimeRatio_IncreasedAggression; + if (CalamityWorld.revenge || CalamityWorld.malice || BossRushEvent.BossRushActive) + { + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > npc.Calamity().killTimeRatio_IncreasedAggression) + lifeRatio = npc.Calamity().killTimeRatio_IncreasedAggression; + } bool doTelegraphFlightAnimation = npc.localAI[1] < fastChargeTelegraphTime * 0.5f || npc.localAI[1] > fastChargeTelegraphTime - (fastChargeTelegraphTime / 6f); bool doTelegraphRoarAnimation = npc.localAI[1] > fastChargeTelegraphTime - fastChargeTelegraphTime * 0.4f && npc.localAI[1] < fastChargeTelegraphTime - fastChargeTelegraphTime * 0.2f; diff --git a/Particles/ThanatosSmokeParticleSet.cs b/Particles/ThanatosSmokeParticleSet.cs index 8da8106441..abff9d70c8 100644 --- a/Particles/ThanatosSmokeParticleSet.cs +++ b/Particles/ThanatosSmokeParticleSet.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Particles public float RelativePower; public float BaseMoveRotation; public float MoveRotationOffset; - public override int ParticleLifetime => 50; + public override int ParticleLifetime => 30; public override int ParticleFrameVariants => 3; public override Texture2D ParticleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/ThanatosVentParticle"); public ThanatosSmokeParticleSet(int setLifetime, int particleSpawnRate, float baseMoveRotation, float spawnAreaCompactness, float relativePower) : diff --git a/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs b/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs index 78fe1d662a..c5209bf8ce 100644 --- a/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs @@ -114,12 +114,16 @@ namespace CalamityMod.Projectiles.BaseProjectiles return laserLengthSamplePoints.Average(); } - protected internal void DrawBeamWithColor(SpriteBatch spriteBatch, Color beamColor, float scale) + protected internal void DrawBeamWithColor(SpriteBatch spriteBatch, Color beamColor, float scale, int startFrame = 0, int middleFrame = 0, int endFrame = 0) { + Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[projectile.type], 0, startFrame); + Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[projectile.type], 0, middleFrame); + Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[projectile.type], 0, endFrame); + // Start texture drawing. spriteBatch.Draw(LaserBeginTexture, projectile.Center - Main.screenPosition, - null, + startFrameArea, beamColor, projectile.rotation, LaserBeginTexture.Size() / 2f, @@ -129,20 +133,20 @@ namespace CalamityMod.Projectiles.BaseProjectiles // Prepare things for body drawing. float laserBodyLength = LaserLength; - laserBodyLength -= (LaserBeginTexture.Height / 2 + LaserEndTexture.Height) * scale; + laserBodyLength -= (startFrameArea.Height / 2 + endFrameArea.Height) * scale; Vector2 centerOnLaser = projectile.Center; - centerOnLaser += projectile.velocity * scale * LaserBeginTexture.Height / 2f; + centerOnLaser += projectile.velocity * scale * startFrameArea.Height / 2f; // Body drawing. if (laserBodyLength > 0f) { - float laserOffset = LaserMiddleTexture.Height * scale; + float laserOffset = middleFrameArea.Height * scale; float incrementalBodyLength = 0f; while (incrementalBodyLength + 1f < laserBodyLength) { spriteBatch.Draw(LaserMiddleTexture, centerOnLaser - Main.screenPosition, - null, + middleFrameArea, beamColor, projectile.rotation, LaserMiddleTexture.Width * 0.5f * Vector2.UnitX, @@ -160,7 +164,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles Vector2 laserEndCenter = centerOnLaser - Main.screenPosition; spriteBatch.Draw(LaserEndTexture, laserEndCenter, - null, + endFrameArea, beamColor, projectile.rotation, LaserEndTexture.Frame(1, 1, 0, 0).Top(), diff --git a/Projectiles/Boss/ApolloChargeTelegraph.cs b/Projectiles/Boss/ApolloChargeTelegraph.cs new file mode 100644 index 0000000000..3087d39aa8 --- /dev/null +++ b/Projectiles/Boss/ApolloChargeTelegraph.cs @@ -0,0 +1,118 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class ApolloChargeTelegraph : ModProjectile + { + public Vector2[] ChargePositions = new Vector2[1]; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[1]) ? Main.npc[(int)projectile.ai[1]] : null; + + public PrimitiveTrail TelegraphDrawer = null; + public const float TelegraphTotalTime = 30f; + public const float TelegraphFadeTime = 15f; + public const float TelegraphWidth = 943.39811f; // a squared plus b squared equals c squared, dumbass + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Apollo Charge Telegraph"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 30; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(ChargePositions.Length); + for (int i = 0; i < ChargePositions.Length; i++) + writer.WriteVector2(ChargePositions[i]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + ChargePositions = new Vector2[reader.ReadInt32()]; + for (int i = 0; i < ChargePositions.Length; i++) + ChargePositions[i] = reader.ReadVector2(); + } + + public override void AI() + { + // Determine the relative opacities for each player based on their distance. + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + projectile.netUpdate = true; + } + + // Die if the thing to attach to disappears. + if (ThingToAttachTo is null || !ThingToAttachTo.active) + { + projectile.Kill(); + return; + } + + // Determine opacity + projectile.Opacity = Utils.InverseLerp(0f, 6f, projectile.timeLeft, true) * Utils.InverseLerp(30f, 24f, projectile.timeLeft, true); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255, projectile.alpha); + } + + public Color TelegraphPrimitiveColor(float completionRatio) + { + float opacity = MathHelper.Lerp(0.38f, 1.2f, projectile.Opacity); + opacity *= CalamityUtils.Convert01To010(completionRatio); + opacity *= MathHelper.Lerp(0.9f, 0.2f, projectile.ai[0] / (ChargePositions.Length - 1f)); + if (completionRatio > 0.95f) + opacity = 0.0000001f; + return Color.Green * opacity; + } + + public float TelegraphPrimitiveWidth(float completionRatio) + { + return projectile.Opacity * 15f; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (TelegraphDrawer is null) + TelegraphDrawer = new PrimitiveTrail(TelegraphPrimitiveWidth, TelegraphPrimitiveColor, PrimitiveTrail.RigidPointRetreivalFunction, GameShaders.Misc["CalamityMod:Flame"]); + + GameShaders.Misc["CalamityMod:Flame"].UseImage("Images/Misc/Perlin"); + GameShaders.Misc["CalamityMod:Flame"].UseSaturation(0.41f); + + for (int i = ChargePositions.Length - 2; i >= 0; i--) + { + Vector2[] positions = new Vector2[2] + { + ChargePositions[i], + ChargePositions[i + 1] + }; + + // Stand-in variable used to differentiate between the beams. + // It is not used anywhere else. + projectile.ai[0] = i; + + TelegraphDrawer.Draw(positions, projectile.Size * 0.5f - Main.screenPosition, 55); + } + return false; + } + } +} diff --git a/Projectiles/Boss/ApolloFireball.cs b/Projectiles/Boss/ApolloFireball.cs new file mode 100644 index 0000000000..924aeaf3dc --- /dev/null +++ b/Projectiles/Boss/ApolloFireball.cs @@ -0,0 +1,229 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class ApolloFireball : ModProjectile + { + private const int timeLeft = 60; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Volatile Plasma Blast"); + Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 48; + projectile.height = 48; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.Opacity = 0f; + cooldownSlot = 1; + projectile.timeLeft = timeLeft; + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + Vector2 targetLocation = new Vector2(projectile.ai[0], projectile.ai[1]); + if (Vector2.Distance(targetLocation, projectile.Center) < 80f) + projectile.tileCollide = true; + + int fadeInTime = 3; + projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - (timeLeft - fadeInTime)) / (float)fadeInTime), 0f, 1f); + + Lighting.AddLight(projectile.Center, 0f, 0.6f * projectile.Opacity, 0f); + + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + projectile.frame = 0; + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; + + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + + float speed1 = 1.8f; + float speed2 = 2.8f; + float angleRandom = 0.35f; + + for (int num53 = 0; num53 < 40; num53++) + { + float dustSpeed = Main.rand.NextFloat(speed1, speed2); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + int randomDustType = Main.rand.NextBool(2) ? 107 : 110; + + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + Main.dust[num54].noGravity = true; + + Dust dust = Main.dust[num54]; + dust.velocity *= 3f; + dust = Main.dust[num54]; + + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + + dust = Main.dust[num54]; + dust.velocity *= 2f; + + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Green * 0.5f; + + dust = Main.dust[num54]; + } + for (int num55 = 0; num55 < 20; num55++) + { + float dustSpeed = Main.rand.NextFloat(speed1, speed2); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + int randomDustType = Main.rand.NextBool(2) ? 107 : 110; + + int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); + Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(projectile.velocity.ToRotation()) * projectile.width / 3f; + Main.dust[num56].noGravity = true; + + Dust dust = Main.dust[num56]; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + } + } + } + + public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (projectile.Opacity != 1f) + return; + + target.AddBuff(BuffID.OnFire, 360); + target.AddBuff(BuffID.CursedInferno, 180); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + lightColor.R = (byte)(255 * projectile.Opacity); + lightColor.G = (byte)(255 * projectile.Opacity); + lightColor.B = (byte)(255 * projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + return false; + } + + public override void Kill(int timeLeft) + { + int height = 90; + projectile.position = projectile.Center; + projectile.width = projectile.height = height; + projectile.Center = projectile.position; + projectile.Damage(); + + Main.PlaySound(SoundID.Item93, projectile.Center); + + if (Main.myPlayer == projectile.owner) + { + // Plasma bolts + int totalProjectiles = CalamityWorld.malice ? 6 : 4; + float radians = MathHelper.TwoPi / totalProjectiles; + int type = ModContent.ProjectileType(); + float velocity = 0.5f; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX2 = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX2, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(projectile.Center, velocity2, type, (int)(projectile.damage * 0.8), 0f, Main.myPlayer); + } + } + + for (int num640 = 0; num640 < 200; num640++) + { + float num641 = 16f; + if (num640 < 150) + num641 = 12f; + if (num640 < 100) + num641 = 8f; + if (num640 < 50) + num641 = 4f; + + int num643 = Dust.NewDust(projectile.Center, 6, 6, Main.rand.NextBool(2) ? 107 : 110, 0f, 0f, 100, default, 1f); + float num644 = Main.dust[num643].velocity.X; + float num645 = Main.dust[num643].velocity.Y; + + if (num644 == 0f && num645 == 0f) + num644 = 1f; + + float num646 = (float)Math.Sqrt(num644 * num644 + num645 * num645); + num646 = num641 / num646; + num644 *= num646; + num645 *= num646; + + float scale = 1f; + switch ((int)num641) + { + case 4: + scale = 1.2f; + break; + case 8: + scale = 1.1f; + break; + case 12: + scale = 1f; + break; + case 16: + scale = 0.9f; + break; + default: + break; + } + + Dust dust = Main.dust[num643]; + dust.velocity *= 0.5f; + dust.velocity.X = dust.velocity.X + num644; + dust.velocity.Y = dust.velocity.Y + num645; + dust.scale = scale; + dust.noGravity = true; + } + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + target.Calamity().lastProjectileHit = projectile; + } + } +} diff --git a/Projectiles/Boss/ApolloFireball.png b/Projectiles/Boss/ApolloFireball.png new file mode 100644 index 0000000000..93fcb25435 Binary files /dev/null and b/Projectiles/Boss/ApolloFireball.png differ diff --git a/Projectiles/Boss/ApolloRocket.cs b/Projectiles/Boss/ApolloRocket.cs new file mode 100644 index 0000000000..1eb1be92e8 --- /dev/null +++ b/Projectiles/Boss/ApolloRocket.cs @@ -0,0 +1,214 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class ApolloRocket : ModProjectile + { + private const int timeLeft = 180; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("High Explosive Plasma Rocket"); + Main.projFrames[projectile.type] = 5; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 28; + projectile.height = 28; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + cooldownSlot = 1; + projectile.timeLeft = timeLeft; + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + if (projectile.position.Y > projectile.ai[1]) + projectile.tileCollide = true; + + // Animation + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 4) + projectile.frame = 0; + + // Rotation + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + + // Spawn effects + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + + float speed1 = 1.8f; + float speed2 = 2.8f; + float angleRandom = 0.35f; + + for (int num53 = 0; num53 < 20; num53++) + { + float dustSpeed = Main.rand.NextFloat(speed1, speed2); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + int randomDustType = Main.rand.NextBool(2) ? 107 : 110; + + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + Main.dust[num54].noGravity = true; + + Dust dust = Main.dust[num54]; + dust.velocity *= 3f; + dust = Main.dust[num54]; + + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + + dust = Main.dust[num54]; + dust.velocity *= 2f; + + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Green * 0.5f; + + dust = Main.dust[num54]; + } + for (int num55 = 0; num55 < 10; num55++) + { + float dustSpeed = Main.rand.NextFloat(speed1, speed2); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + int randomDustType = Main.rand.NextBool(2) ? 107 : 110; + + int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); + Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(projectile.velocity.ToRotation()) * projectile.width / 3f; + Main.dust[num56].noGravity = true; + + Dust dust = Main.dust[num56]; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + } + } + + // Light + Lighting.AddLight(projectile.Center, 0f, 0.6f, 0f); + + // Get a target and calculate distance from it + int target = Player.FindClosest(projectile.Center, 1, 1); + Vector2 distanceFromTarget = Main.player[target].Center - projectile.Center; + + // Set AI to stop homing, start accelerating + float stopHomingDistance = 200f; + if (distanceFromTarget.Length() < stopHomingDistance || projectile.ai[0] == 1f) + { + projectile.ai[0] = 1f; + + if (projectile.velocity.Length() < 24f) + projectile.velocity *= 1.05f; + + return; + } + + // Home in on target + float scaleFactor = projectile.velocity.Length(); + float inertia = 10f; + distanceFromTarget.Normalize(); + distanceFromTarget *= scaleFactor; + projectile.velocity = (projectile.velocity * inertia + distanceFromTarget) / (inertia + 1f); + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.OnFire, 360); + target.AddBuff(BuffID.CursedInferno, 180); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + return false; + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + int height = texture.Height / Main.projFrames[projectile.type]; + int drawStart = height * projectile.frame; + Vector2 origin = projectile.Size / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/ApolloRocketGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + } + + public override void Kill(int timeLeft) + { + // Rocket explosion + int height = 90; + projectile.position = projectile.Center; + projectile.width = projectile.height = height; + projectile.Center = projectile.position; + projectile.Damage(); + + Main.PlaySound(SoundID.Item14, projectile.Center); + + for (int num621 = 0; num621 < 12; num621++) + { + int randomDustType = Main.rand.NextBool(2) ? 107 : 110; + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, randomDustType, 0f, 0f, 100, default, 2f); + Main.dust[dust].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 15; num623++) + { + int randomDustType = Main.rand.NextBool(2) ? 107 : 110; + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, randomDustType, 0f, 0f, 100, default, 3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 5f; + dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, randomDustType, 0f, 0f, 100, default, 2f); + Main.dust[dust].velocity *= 2f; + } + CalamityUtils.ExplosionGores(projectile.Center, 3); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + target.Calamity().lastProjectileHit = projectile; + } + } +} diff --git a/Projectiles/Boss/AresDeathBeamStart.cs b/Projectiles/Boss/AresDeathBeamStart.cs index 06d2972a3d..65e202770b 100644 --- a/Projectiles/Boss/AresDeathBeamStart.cs +++ b/Projectiles/Boss/AresDeathBeamStart.cs @@ -1,230 +1,220 @@ using CalamityMod.Events; using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using System.IO; +using System.Linq; using Terraria; using Terraria.Enums; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class AresDeathBeamStart : ModProjectile + public class AresDeathBeamStart : BaseLaserbeamProjectile { - private const int maxFrames = 5; - private int frameDrawn = 0; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public int OwnerIndex + { + get => (int)projectile.ai[1]; + set => projectile.ai[1] = value; + } + public override float MaxScale => 1f; + public override float MaxLaserLength => 3600f; + public override float Lifetime => AresBody.deathrayDuration; + public override Color LaserOverlayColor => new Color(250, 250, 250, 100); + public override Color LightCastColor => Color.White; + public override Texture2D LaserBeginTexture => ModContent.GetTexture("CalamityMod/Projectiles/Boss/AresDeathBeamStart"); + public override Texture2D LaserMiddleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AresDeathBeamMiddle"); + public override Texture2D LaserEndTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AresDeathBeamEnd"); public override void SetStaticDefaults() { - DisplayName.SetDefault("Death Beam"); - } + // Ares' eight-pointed-star laser beams + DisplayName.SetDefault("Exo Overload Beam"); + Main.projFrames[projectile.type] = 5; + } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 30; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 30; projectile.height = 30; projectile.hostile = true; projectile.alpha = 255; projectile.penetrate = -1; projectile.tileCollide = false; projectile.timeLeft = 600; - cooldownSlot = 1; + cooldownSlot = 1; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(frameDrawn); writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } + writer.Write(projectile.localAI[1]); + } public override void ReceiveExtraAI(BinaryReader reader) { - frameDrawn = reader.ReadInt32(); projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } + projectile.localAI[1] = reader.ReadSingle(); + } - public override void AI() + public override void AttachToSomething() { - // Difficulty modes - bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || malice; - bool revenge = CalamityWorld.revenge || malice; - bool expertMode = Main.expertMode || malice; - - Vector2? vector78 = null; - - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - projectile.velocity = -Vector2.UnitY; - - if (Main.npc[(int)projectile.ai[1]].active && Main.npc[(int)projectile.ai[1]].type == ModContent.NPCType()) + if (Main.npc[OwnerIndex].active && Main.npc[OwnerIndex].type == ModContent.NPCType()) { - Vector2 fireFrom = new Vector2(Main.npc[(int)projectile.ai[1]].Center.X - 1f, Main.npc[(int)projectile.ai[1]].Center.Y + 23f) + Vector2.Normalize(projectile.velocity) * 35f; - projectile.position = fireFrom - new Vector2(projectile.width, projectile.height) / 2f; + Vector2 fireFrom = new Vector2(Main.npc[OwnerIndex].Center.X - 1f, Main.npc[OwnerIndex].Center.Y + 23f); + fireFrom += projectile.velocity.SafeNormalize(Vector2.UnitY) * MathHelper.Lerp(35f, 127f, projectile.scale * projectile.scale); + projectile.Center = fireFrom; } - else - projectile.Kill(); - float num801 = 1f; - float duration = 600f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= duration) + // Die of the owner is invalid in some way.. + else { projectile.Kill(); return; } - projectile.scale = (float)Math.Sin(projectile.localAI[0] * (float)Math.PI / duration) * 10f * num801; - if (projectile.scale > num801) - projectile.scale = num801; + // Die if the owner is not performing Ares' deathray attack. + if (Main.npc[OwnerIndex].Calamity().newAI[0] != (float)AresBody.Phase.Deathrays) + { + projectile.Kill(); + return; + } - float num804 = projectile.velocity.ToRotation(); - float divisor = malice ? 300f : death ? 320f : revenge ? 330f : expertMode ? 340f : 360f; - float rotationAmt = MathHelper.Lerp(0f, MathHelper.TwoPi / divisor, projectile.localAI[0] / duration); - num804 += rotationAmt; - projectile.rotation = num804 - MathHelper.PiOver2; - projectile.velocity = num804.ToRotationVector2(); - - float num805 = 3f; //3f - float num806 = projectile.width; - - Vector2 samplingPoint = projectile.Center; - if (vector78.HasValue) - samplingPoint = vector78.Value; - - float[] array3 = new float[(int)num805]; - Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 2400f, array3); - float num807 = 0f; - for (int num808 = 0; num808 < array3.Length; num808++) - { - num807 += array3[num808]; - } - num807 /= num805; - - // Fire laser through walls at max length if target cannot be seen - if (!Collision.CanHitLine(Main.npc[(int)projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)projectile.ai[1]].target].Center, 1, 1)) - { - num807 = 2400f; - } - - float amount = 0.5f; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); // Length of laser, linear interpolation - - // Spawn dust at the end of the beam - int dustType = 107; - Vector2 dustPos = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); - for (int i = 0; i < 2; i++) - { - float dustRot = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; - float dustVelMult = (float)Main.rand.NextDouble() * 2f + 2f; - Vector2 dustVel = new Vector2((float)Math.Cos(dustRot) * dustVelMult, (float)Math.Sin(dustRot) * dustVelMult); - int dust = Dust.NewDust(dustPos, 0, 0, dustType, dustVel.X, dustVel.Y, 0, new Color(0, 255, 255), 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].scale = 1.7f; - } - - if (Main.rand.NextBool(5)) - { - Vector2 dustRot = projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; - int dust = Dust.NewDust(dustPos + dustRot - Vector2.One * 4f, 8, 8, dustType, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[dust].velocity *= 0.5f; - Main.dust[dust].velocity.Y = -Math.Abs(Main.dust[dust].velocity.Y); - } - - DelegateMethods.v3_1 = new Vector3(0.9f, 0.3f, 0.3f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + Time = Main.npc[OwnerIndex].Calamity().newAI[2] - AresBody.deathrayTelegraphDuration; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - if (projectile.velocity == Vector2.Zero) - return false; - - Texture2D beamStart = Main.projectileTexture[projectile.type]; - Texture2D beamMiddle = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AresDeathBeamMiddle"); - Texture2D beamEnd = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AresDeathBeamEnd"); - - float drawLength = projectile.localAI[1]; - Color color = new Color(250, 250, 250, 100); - - if (projectile.localAI[0] % 5f == 0f) - { - frameDrawn++; - if (frameDrawn >= maxFrames) - frameDrawn = 0; - } - - // Draw start of beam - Vector2 vector = projectile.Center - Main.screenPosition; - Rectangle? sourceRectangle = new Rectangle(0, beamStart.Height / maxFrames * frameDrawn, beamStart.Width, beamStart.Height / maxFrames); - spriteBatch.Draw(beamStart, vector, sourceRectangle, color, projectile.rotation, new Vector2(beamStart.Width, beamStart.Height / maxFrames) / 2f, projectile.scale, SpriteEffects.None, 0f); - - // Draw middle of beam - drawLength -= (beamStart.Height / maxFrames / 2 + beamEnd.Height / maxFrames) * projectile.scale; - Vector2 center = projectile.Center; - center += projectile.velocity * projectile.scale * beamStart.Height / maxFrames / 2f; - if (drawLength > 0f) - { - float i = 0f; - int middleFrameDrawn = frameDrawn; - while (i + 1f < drawLength) - { - Rectangle rectangle = new Rectangle(0, beamMiddle.Height / maxFrames * middleFrameDrawn, beamMiddle.Width, beamMiddle.Height / maxFrames); - - if (drawLength - i < rectangle.Height) - rectangle.Height = (int)(drawLength - i); - - spriteBatch.Draw(beamMiddle, center - Main.screenPosition, rectangle, color, projectile.rotation, new Vector2(rectangle.Width / 2f, 0f), projectile.scale, SpriteEffects.None, 0f); - - middleFrameDrawn++; - if (middleFrameDrawn >= maxFrames) - middleFrameDrawn = 0; - - i += rectangle.Height * projectile.scale; - center += projectile.velocity * rectangle.Height * projectile.scale; - - rectangle.Y += beamMiddle.Height / maxFrames; - if (rectangle.Y + rectangle.Height > beamMiddle.Height / maxFrames) - rectangle.Y = 0; - } - } - - // Draw end of beam - Vector2 vector2 = center - Main.screenPosition; - sourceRectangle = new Rectangle(0, beamEnd.Height / maxFrames * frameDrawn, beamEnd.Width, beamEnd.Height / maxFrames); - spriteBatch.Draw(beamEnd, vector2, sourceRectangle, color, projectile.rotation, new Vector2(beamEnd.Width, beamEnd.Height / maxFrames) / 2f, projectile.scale, SpriteEffects.None, 0f); - - return false; - } - - public override void CutTiles() + public override void UpdateLaserMotion() { - DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + // Declare difficulty modes. + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + float angularSlowdownDivisor = malice ? 300f : death ? 320f : revenge ? 330f : expertMode ? 340f : 360f; + float angularVelocity = MathHelper.TwoPi * Time / Lifetime / angularSlowdownDivisor; + + // Update the direction and rotation of the laser. + projectile.velocity = projectile.velocity.RotatedBy(angularVelocity); + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + public override float DetermineLaserLength() { - if (projHitbox.Intersects(targetHitbox)) + float[] sampledLengths = new float[10]; + Collision.LaserScan(projectile.Center, projectile.velocity, projectile.width * projectile.scale, MaxLaserLength, sampledLengths); + + float newLaserLength = sampledLengths.Average(); + + // Fire laser through walls at max length if target is behind tiles. + if (!Collision.CanHitLine(Main.npc[OwnerIndex].Center, 1, 1, Main.player[Main.npc[OwnerIndex].target].Center, 1, 1)) + newLaserLength = 3600f; + + return newLaserLength; + } + + public override void PostAI() + { + // Spawn dust at the end of the beam. + int dustType = 107; + Vector2 dustCreationPosition = projectile.Center + projectile.velocity * (LaserLength - 14f); + for (int i = 0; i < 2; i++) { - return true; + float dustRot = projectile.velocity.ToRotation() + Main.rand.NextBool().ToDirectionInt() * MathHelper.PiOver2; + Vector2 dustVelocity = dustRot.ToRotationVector2() * Main.rand.NextFloat(2f, 4f); + Dust exoEnergy = Dust.NewDustDirect(dustCreationPosition, 0, 0, dustType, dustVelocity.X, dustVelocity.Y, 0, new Color(0, 255, 255), 1f); + exoEnergy.noGravity = true; + exoEnergy.scale = 1.7f; } - float num6 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 30f * projectile.scale, ref num6)) + + if (Main.rand.NextBool(5)) { - return true; + Vector2 dustSpawnOffset = projectile.velocity.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloatDirection() * projectile.width * 0.5f; + Dust exoEnergy = Dust.NewDustDirect(dustCreationPosition + dustSpawnOffset - Vector2.One * 4f, 8, 8, dustType, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + exoEnergy.velocity *= 0.5f; + + // Ensure that the dust always moves up. + exoEnergy.velocity.Y = -Math.Abs(exoEnergy.velocity.Y); } + + // Determine frames. + projectile.frameCounter++; + if (projectile.frameCounter % 5f == 0f) + projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + // This should never happen, but just in case- + if (projectile.velocity == Vector2.Zero) + return false; + + Color beamColor = LaserOverlayColor; + Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + + // Start texture drawing. + spriteBatch.Draw(LaserBeginTexture, + projectile.Center - Main.screenPosition, + startFrameArea, + beamColor, + projectile.rotation, + LaserBeginTexture.Size() / 2f, + projectile.scale, + SpriteEffects.None, + 0f); + + // Prepare things for body drawing. + float laserBodyLength = LaserLength + middleFrameArea.Height; + Vector2 centerOnLaser = projectile.Center; + + // Body drawing. + if (laserBodyLength > 0f) + { + float laserOffset = middleFrameArea.Height * projectile.scale; + float incrementalBodyLength = 0f; + while (incrementalBodyLength + 1f < laserBodyLength) + { + spriteBatch.Draw(LaserMiddleTexture, + centerOnLaser - Main.screenPosition, + middleFrameArea, + beamColor, + projectile.rotation, + LaserMiddleTexture.Size() * 0.5f, + projectile.scale, + SpriteEffects.None, + 0f); + incrementalBodyLength += laserOffset; + centerOnLaser += projectile.velocity * laserOffset; + middleFrameArea.Y += LaserMiddleTexture.Height / Main.projFrames[projectile.type]; + if (middleFrameArea.Y + middleFrameArea.Height > LaserMiddleTexture.Height) + middleFrameArea.Y = 0; + } + } + + Vector2 laserEndCenter = centerOnLaser - Main.screenPosition; + spriteBatch.Draw(LaserEndTexture, + laserEndCenter, + endFrameArea, + beamColor, + projectile.rotation, + LaserEndTexture.Size() * 0.5f, + projectile.scale, + SpriteEffects.None, + 0f); return false; } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { - target.Calamity().lastProjectileHit = projectile; - } + target.Calamity().lastProjectileHit = projectile; + } } } diff --git a/Projectiles/Boss/AresDeathBeamTelegraph.cs b/Projectiles/Boss/AresDeathBeamTelegraph.cs index b2d582d96c..fd85f70d19 100644 --- a/Projectiles/Boss/AresDeathBeamTelegraph.cs +++ b/Projectiles/Boss/AresDeathBeamTelegraph.cs @@ -8,29 +8,30 @@ namespace CalamityMod.Projectiles.Boss { public class AresDeathBeamTelegraph : ModProjectile { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public float TelegraphDelay + public float TelegraphDelay { get => projectile.ai[0]; set => projectile.ai[0] = value; } - public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[1]) ? Main.npc[(int)projectile.ai[1]] : null; + public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[1]) ? Main.npc[(int)projectile.ai[1]] : null; - public Vector2 OldVelocity; + public Vector2 OldVelocity; public const float TelegraphTotalTime = 240f; public const float TelegraphFadeTime = 15f; - public const float TelegraphWidth = 4200f; + public const float TelegraphWidth = 3600f; public override void SetStaticDefaults() { - DisplayName.SetDefault("Death Beam Telegraph"); + // Telegraph for Ares' eight-pointed-star laser beams + DisplayName.SetDefault("Exo Overload Telegraph"); } public override void SetDefaults() { - projectile.width = 10; + projectile.width = 10; projectile.height = 10; projectile.hostile = true; projectile.ignoreWater = true; @@ -38,19 +39,19 @@ namespace CalamityMod.Projectiles.Boss projectile.alpha = 255; projectile.penetrate = -1; projectile.timeLeft = 240; - } + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(OldVelocity); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.WriteVector2(OldVelocity); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - OldVelocity = reader.ReadVector2(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + OldVelocity = reader.ReadVector2(); + } - public override void AI() + public override void AI() { // Determine the relative opacities for each player based on their distance. if (projectile.localAI[0] == 0f) @@ -59,18 +60,18 @@ namespace CalamityMod.Projectiles.Boss projectile.netUpdate = true; } - // Die if the thing to attach to disappears. - if (ThingToAttachTo is null || !ThingToAttachTo.active) - { - projectile.Kill(); - return; - } + // Die if the thing to attach to disappears. + if (ThingToAttachTo is null || !ThingToAttachTo.active) + { + projectile.Kill(); + return; + } - // Set start of telegraph to the npc center. - projectile.Center = ThingToAttachTo.Center + new Vector2(-1f, 23f) + (Vector2.Normalize(OldVelocity) * 17f); + // Set start of telegraph to the npc center. + projectile.Center = ThingToAttachTo.Center + new Vector2(-1f, 23f) + (Vector2.Normalize(OldVelocity) * 17f); - // Be sure to save the velocity the projectile started with. It will be set again when the telegraph is over. - if (OldVelocity == Vector2.Zero) + // Be sure to save the velocity the projectile started with. It will be set again when the telegraph is over. + if (OldVelocity == Vector2.Zero) { OldVelocity = projectile.velocity; projectile.velocity = Vector2.Zero; @@ -92,11 +93,11 @@ namespace CalamityMod.Projectiles.Boss return true; Texture2D laserTelegraph = ModContent.GetTexture("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); - float yScale = 4f; + float yScale = 2f; if (TelegraphDelay < TelegraphFadeTime) - yScale = MathHelper.Lerp(0f, 4f, TelegraphDelay / 15f); + yScale = MathHelper.Lerp(0f, 2f, TelegraphDelay / 15f); if (TelegraphDelay > TelegraphTotalTime - TelegraphFadeTime) - yScale = MathHelper.Lerp(4f, 0f, (TelegraphDelay - (TelegraphTotalTime - TelegraphFadeTime)) / 15f); + yScale = MathHelper.Lerp(2f, 0f, (TelegraphDelay - (TelegraphTotalTime - TelegraphFadeTime)) / 15f); Vector2 scaleInner = new Vector2(TelegraphWidth / laserTelegraph.Width, yScale); Vector2 origin = laserTelegraph.Size() * new Vector2(0f, 0.5f); diff --git a/Projectiles/Boss/AresGaussNukeProjectile.cs b/Projectiles/Boss/AresGaussNukeProjectile.cs index c38302bcb0..f29c203c30 100644 --- a/Projectiles/Boss/AresGaussNukeProjectile.cs +++ b/Projectiles/Boss/AresGaussNukeProjectile.cs @@ -1,3 +1,4 @@ +using CalamityMod.Skies; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -52,7 +53,7 @@ namespace CalamityMod.Projectiles.Boss // Animation projectile.frameCounter++; - if (projectile.frameCounter >= 10) + if (projectile.frameCounter >= 6) { projectile.frame++; projectile.frameCounter = 0; @@ -180,16 +181,19 @@ namespace CalamityMod.Projectiles.Boss Gore.NewGore(projectile.position, projectile.velocity, mod.GetGoreSlot("Gores/Ares/AresGaussNuke1"), 1f); Gore.NewGore(projectile.position, projectile.velocity, mod.GetGoreSlot("Gores/Ares/AresGaussNuke3"), 1f); + // Create a bunch of lightning bolts in the sky + ExoMechsSky.CreateLightningBolt(12); + if (Main.myPlayer == projectile.owner) { // Explosion waves - for (int i = 0; i < 5; i++) + for (int i = 0; i < 3; i++) { Projectile explosion = Projectile.NewProjectileDirect(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 0f, Main.myPlayer); if (explosion.whoAmI.WithinBounds(Main.maxProjectiles)) { // Make the max explosion radius decrease over time, creating a ring effect. - explosion.ai[1] = 800f + i * 45f; + explosion.ai[1] = 800f + i * 90f; explosion.localAI[1] = 0.25f; explosion.Opacity = MathHelper.Lerp(0.18f, 0.6f, i / 7f) + Main.rand.NextFloat(-0.08f, 0.08f); explosion.netUpdate = true; diff --git a/Projectiles/Boss/AresGaussNukeProjectileBoom.cs b/Projectiles/Boss/AresGaussNukeProjectileBoom.cs index 4423b22a84..d7f65af01a 100644 --- a/Projectiles/Boss/AresGaussNukeProjectileBoom.cs +++ b/Projectiles/Boss/AresGaussNukeProjectileBoom.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Boss public override void PostAI() => Lighting.AddLight(projectile.Center, 0.2f, 0.1f, 0f); - public override bool CanHitPlayer(Player target) => CalamityUtils.CircularHitboxCollision(projectile.Center, CurrentRadius * projectile.scale * 0.5f, target.Hitbox); + public override bool CanHitPlayer(Player target) => CalamityUtils.CircularHitboxCollision(projectile.Center, CurrentRadius * projectile.scale * 0.4f, target.Hitbox) && projectile.timeLeft > 6; public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) => target.Calamity().lastProjectileHit = projectile; diff --git a/Projectiles/Boss/AresLaserBeamStart.cs b/Projectiles/Boss/AresLaserBeamStart.cs index 2592d4d098..011028c1a6 100644 --- a/Projectiles/Boss/AresLaserBeamStart.cs +++ b/Projectiles/Boss/AresLaserBeamStart.cs @@ -12,70 +12,70 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class AresLaserBeamStart : ModProjectile - { + { private const int maxFrames = 5; private int frameDrawn = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laser Beam"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exothermal Laser"); } - public override void SetDefaults() - { + public override void SetDefaults() + { projectile.Calamity().canBreakPlayerDefense = true; projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 600; + projectile.height = 30; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = 600; cooldownSlot = 1; - } + } - public override void SendExtraAI(BinaryWriter writer) - { + public override void SendExtraAI(BinaryWriter writer) + { writer.Write(frameDrawn); - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { + public override void ReceiveExtraAI(BinaryReader reader) + { frameDrawn = reader.ReadInt32(); - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } - public override void AI() - { + public override void AI() + { Vector2? vector78 = null; if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - projectile.velocity = -Vector2.UnitY; + projectile.velocity = -Vector2.UnitY; - if (Main.npc[(int)projectile.ai[1]].active && Main.npc[(int)projectile.ai[1]].type == ModContent.NPCType()) - { + if (Main.npc[(int)projectile.ai[1]].active && Main.npc[(int)projectile.ai[1]].type == ModContent.NPCType()) + { float offset = 84f; float offset2 = 16f; Vector2 fireFrom = Main.npc[(int)projectile.ai[1]].Calamity().newAI[3] == 0f ? new Vector2(Main.npc[(int)projectile.ai[1]].Center.X - offset2 * Main.npc[(int)projectile.ai[1]].direction, Main.npc[(int)projectile.ai[1]].Center.Y + offset) : new Vector2(Main.npc[(int)projectile.ai[1]].Center.X + offset * Main.npc[(int)projectile.ai[1]].direction, Main.npc[(int)projectile.ai[1]].Center.Y + offset2); - projectile.position = fireFrom - new Vector2(projectile.width, projectile.height) / 2f; - } + projectile.position = fireFrom - new Vector2(projectile.width, projectile.height) / 2f; + } else projectile.Kill(); float num801 = 1f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 60f) - { - projectile.Kill(); - return; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 60f) + { + projectile.Kill(); + return; + } projectile.scale = (float)Math.Sin(projectile.localAI[0] * (float)Math.PI / 60f) * 10f * num801; - if (projectile.scale > num801) - projectile.scale = num801; + if (projectile.scale > num801) + projectile.scale = num801; float num804 = projectile.velocity.ToRotation(); projectile.rotation = num804 - MathHelper.PiOver2; @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Boss } float amount = 0.5f; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); //length of laser, linear interpolation + projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); //length of laser, linear interpolation // Spawn dust at the end of the beam int dustType = (int)CalamityDusts.Brimstone; @@ -128,8 +128,8 @@ namespace CalamityMod.Projectiles.Boss } DelegateMethods.v3_1 = new Vector3(0.9f, 0.3f, 0.3f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); - } + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -141,7 +141,7 @@ namespace CalamityMod.Projectiles.Boss Texture2D beamEnd = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AresLaserBeamEnd"); float drawLength = projectile.localAI[1]; - Color color = new Color(250, 100, 100, 0); + Color color = new Color(250, 250, 250, 100); if (projectile.localAI[0] % 5f == 0f) { @@ -194,34 +194,34 @@ namespace CalamityMod.Projectiles.Boss } public override void CutTiles() - { - DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); - } + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (projHitbox.Intersects(targetHitbox)) - { - return true; - } - float num6 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 30f * projectile.scale, ref num6)) - { - return true; - } - return false; - } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + return true; + } + float num6 = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 30f * projectile.scale, ref num6)) + { + return true; + } + return false; + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 300); - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { target.Calamity().lastProjectileHit = projectile; } - } + } } diff --git a/Projectiles/Boss/AresPlasmaBolt.cs b/Projectiles/Boss/AresPlasmaBolt.cs index c3c6fea203..ec39b0d058 100644 --- a/Projectiles/Boss/AresPlasmaBolt.cs +++ b/Projectiles/Boss/AresPlasmaBolt.cs @@ -7,35 +7,50 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class AresPlasmaBolt : ModProjectile - { + public class AresPlasmaBolt : ModProjectile + { private const int timeLeft = 360; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plasma Bolt"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + private const float maxVelocity = 12f; - public override void SetDefaults() - { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exoplasma Bolt"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { projectile.Calamity().canBreakPlayerDefense = true; projectile.width = 18; - projectile.height = 18; - projectile.hostile = true; - projectile.ignoreWater = true; + projectile.height = 18; + projectile.hostile = true; + projectile.ignoreWater = true; projectile.tileCollide = false; projectile.Opacity = 0f; cooldownSlot = 1; projectile.penetrate = -1; - projectile.timeLeft = timeLeft; + projectile.extraUpdates = 1; + projectile.timeLeft = timeLeft; projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } - public override void AI() - { + public override void AI() + { + // 23 frames starting at 0.5 + // 18 frames starting at 1 + if (projectile.velocity.Length() < maxVelocity) + { + projectile.velocity *= 1.15f; + if (projectile.velocity.Length() > maxVelocity) + { + projectile.velocity.Normalize(); + projectile.velocity *= maxVelocity; + } + } + int fadeOutTime = 15; int fadeInTime = 3; if (projectile.timeLeft < fadeOutTime) @@ -46,16 +61,16 @@ namespace CalamityMod.Projectiles.Boss Lighting.AddLight(projectile.Center, 0f, 0.4f * projectile.Opacity, 0f); projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - projectile.frame = 0; + if (projectile.frameCounter > 8) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + projectile.frame = 0; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; - } + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; + } public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; @@ -68,14 +83,14 @@ namespace CalamityMod.Projectiles.Boss target.AddBuff(BuffID.CursedInferno, 90); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { lightColor.R = (byte)(255 * projectile.Opacity); lightColor.G = (byte)(255 * projectile.Opacity); lightColor.B = (byte)(255 * projectile.Opacity); CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); - return false; - } + return false; + } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { diff --git a/Projectiles/Boss/AresPlasmaFireball.cs b/Projectiles/Boss/AresPlasmaFireball.cs index ea79f1db14..ef10bccb8f 100644 --- a/Projectiles/Boss/AresPlasmaFireball.cs +++ b/Projectiles/Boss/AresPlasmaFireball.cs @@ -9,27 +9,27 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class AresPlasmaFireball : ModProjectile - { - private const int timeLeft = 180; + public class AresPlasmaFireball : ModProjectile + { + private const int timeLeft = 120; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plasma Fireball"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Volatile Plasma Blast"); + Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { + public override void SetDefaults() + { projectile.Calamity().canBreakPlayerDefense = true; projectile.width = 36; - projectile.height = 36; - projectile.hostile = true; - projectile.ignoreWater = true; + projectile.height = 36; + projectile.hostile = true; + projectile.ignoreWater = true; projectile.tileCollide = false; - projectile.penetrate = -1; + projectile.penetrate = -1; projectile.Opacity = 0f; cooldownSlot = 1; projectile.timeLeft = timeLeft; @@ -47,10 +47,13 @@ namespace CalamityMod.Projectiles.Boss } public override void AI() - { - Vector2 targetLocation = new Vector2(projectile.ai[0], projectile.ai[1]); - if (Vector2.Distance(targetLocation, projectile.Center) < 80f) - projectile.tileCollide = true; + { + if (projectile.ai[0] != -1f) + { + Vector2 targetLocation = new Vector2(projectile.ai[0], projectile.ai[1]); + if (Vector2.Distance(targetLocation, projectile.Center) < 80f) + projectile.tileCollide = true; + } int fadeInTime = 3; projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - (timeLeft - fadeInTime)) / (float)fadeInTime), 0f, 1f); @@ -58,15 +61,15 @@ namespace CalamityMod.Projectiles.Boss Lighting.AddLight(projectile.Center, 0f, 0.6f * projectile.Opacity, 0f); projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 5) - projectile.frame = 0; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + projectile.frame = 0; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; if (projectile.localAI[0] == 0f) { @@ -121,7 +124,7 @@ namespace CalamityMod.Projectiles.Boss dust = Main.dust[num56]; } } - } + } public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; @@ -134,14 +137,14 @@ namespace CalamityMod.Projectiles.Boss target.AddBuff(BuffID.CursedInferno, 180); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { lightColor.R = (byte)(255 * projectile.Opacity); lightColor.G = (byte)(255 * projectile.Opacity); lightColor.B = (byte)(255 * projectile.Opacity); CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); - return false; - } + return false; + } public override void Kill(int timeLeft) { @@ -157,9 +160,14 @@ namespace CalamityMod.Projectiles.Boss { // Plasma bolts int totalProjectiles = CalamityWorld.malice ? 12 : 8; + + // Reduce the total amount of projectiles by half if Ares Plasma Arm is shooting them and in deathray phase and not the last mech + if (projectile.ai[0] == -1f) + totalProjectiles /= 2; + float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - float velocity = projectile.velocity.Length(); + float velocity = 0.5f; double angleA = radians * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; float velocityX2 = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); diff --git a/Projectiles/Boss/AresTeslaOrb.cs b/Projectiles/Boss/AresTeslaOrb.cs index 8103fff1b5..4e15d1898e 100644 --- a/Projectiles/Boss/AresTeslaOrb.cs +++ b/Projectiles/Boss/AresTeslaOrb.cs @@ -1,3 +1,7 @@ +using CalamityMod.Events; +using CalamityMod.NPCs; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -18,7 +22,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - DisplayName.SetDefault("Tesla Orb"); + DisplayName.SetDefault("Tesla Sphere"); Main.projFrames[projectile.type] = 4; ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; ProjectileID.Sets.TrailingMode[projectile.type] = 0; @@ -50,6 +54,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + if (projectile.velocity.Length() < 24f) + projectile.velocity *= 1.01f; + int fadeOutTime = 15; int fadeInTime = 3; if (projectile.timeLeft < fadeOutTime) @@ -137,13 +144,27 @@ namespace CalamityMod.Projectiles.Boss public Projectile GetOrbToAttachTo() { + if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) + return null; + + // Difficulty modes + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + float detachDistance = malice ? 1600f : death ? 1360f : revenge ? 1280f : expertMode ? 1200f : 960f; for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.projectile[i].type != projectile.type || Main.projectile[i].ai[0] != Identity + 1f || !Main.projectile[i].active) + if (Main.projectile[i].type != projectile.type || Main.projectile[i].ai[0] != Identity + 1f || !Main.projectile[i].active || Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Calamity().newAI[0] == (float)AresBody.Phase.Deathrays) + continue; + + if (Vector2.Distance(projectile.Center, Main.projectile[i].Center) > detachDistance) continue; return Main.projectile[i]; } + return null; } @@ -223,8 +244,8 @@ namespace CalamityMod.Projectiles.Boss return false; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { if (projHitbox.Intersects(targetHitbox)) return true; @@ -234,9 +255,9 @@ namespace CalamityMod.Projectiles.Boss return true; return false; - } + } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; } diff --git a/Projectiles/Boss/ArtemisChargeTelegraph.cs b/Projectiles/Boss/ArtemisChargeTelegraph.cs new file mode 100644 index 0000000000..ec5479a874 --- /dev/null +++ b/Projectiles/Boss/ArtemisChargeTelegraph.cs @@ -0,0 +1,107 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class ArtemisChargeTelegraph : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[1]) ? Main.npc[(int)projectile.ai[1]] : null; + + public Vector2 OldVelocity; + public PrimitiveTrail TelegraphDrawer = null; + public const float TelegraphWidth = 2000f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Artemis Charge Telegraph"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 30; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.WriteVector2(OldVelocity); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + OldVelocity = reader.ReadVector2(); + } + + public override void AI() + { + // Determine the relative opacities for each player based on their distance. + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + projectile.netUpdate = true; + } + + // Die if the thing to attach to disappears. + if (ThingToAttachTo is null || !ThingToAttachTo.active) + { + projectile.Kill(); + return; + } + + // Set start of telegraph to the npc center. + projectile.Center = ThingToAttachTo.Center + projectile.velocity * 50f; + + // Determine opacity + projectile.Opacity = Utils.InverseLerp(0f, 8f, projectile.timeLeft, true); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255, projectile.alpha); + } + + public Color TelegraphPrimitiveColor(float completionRatio) + { + float colorInterpolant = (completionRatio * 1.2f + Main.GlobalTime * 0.26f) % 1f; + float opacity = MathHelper.Lerp(0.2f, 0.425f, projectile.Opacity) * Utils.InverseLerp(30f, 24f, projectile.timeLeft, true); + return CalamityUtils.MulticolorLerp(colorInterpolant, Color.Orange, Color.Red, Color.Crimson, Color.Red) * opacity; + } + + public float TelegraphPrimitiveWidth(float completionRatio) + { + // Used to determine the degree to which the ends of the telegraph should smoothen away. + float endSmoothenFactor = Utils.InverseLerp(1f, 0.995f, completionRatio, true); + return endSmoothenFactor * projectile.Opacity * 22f; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (TelegraphDrawer is null) + TelegraphDrawer = new PrimitiveTrail(TelegraphPrimitiveWidth, TelegraphPrimitiveColor, specialShader: GameShaders.Misc["CalamityMod:Flame"]); + + GameShaders.Misc["CalamityMod:Flame"].UseImage("Images/Misc/Perlin"); + GameShaders.Misc["CalamityMod:Flame"].UseSaturation(0.28f); + Vector2[] drawPositions = new Vector2[] + { + projectile.Center, + projectile.Center + projectile.velocity.SafeNormalize(Vector2.UnitY) * TelegraphWidth + }; + + TelegraphDrawer.Draw(drawPositions, projectile.Size * 0.5f - Main.screenPosition, 87); + return false; + } + } +} diff --git a/Projectiles/Boss/ArtemisDeathrayTelegraph.cs b/Projectiles/Boss/ArtemisDeathrayTelegraph.cs new file mode 100644 index 0000000000..323293a018 --- /dev/null +++ b/Projectiles/Boss/ArtemisDeathrayTelegraph.cs @@ -0,0 +1,117 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class ArtemisDeathrayTelegraph : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public float TelegraphDelay + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + + public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[1]) ? Main.npc[(int)projectile.ai[1]] : null; + + public Vector2 OldVelocity; + public const float TelegraphTotalTime = 60f; + public const float TelegraphFadeTime = 15f; + public const float TelegraphWidth = 4800f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exothermal Artemis Beam Telegraph"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 60; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.WriteVector2(OldVelocity); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + OldVelocity = reader.ReadVector2(); + } + + public override void AI() + { + // Determine the relative opacities for each player based on their distance. + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + projectile.netUpdate = true; + } + + // Die if the thing to attach to disappears. + if (ThingToAttachTo is null || !ThingToAttachTo.active) + { + projectile.Kill(); + return; + } + + // Set start of telegraph to the npc center. + projectile.Center = ThingToAttachTo.Center + Vector2.Normalize(OldVelocity) * 70f; + + // Be sure to save the velocity the projectile started with. It will be set again when the telegraph is over. + if (OldVelocity == Vector2.Zero) + { + OldVelocity = projectile.velocity; + projectile.velocity = Vector2.Zero; + projectile.netUpdate = true; + projectile.rotation = OldVelocity.ToRotation() + MathHelper.PiOver2; + } + + TelegraphDelay++; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (TelegraphDelay >= TelegraphTotalTime) + return true; + + Texture2D laserTelegraph = ModContent.GetTexture("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); + float yScale = 2f; + if (TelegraphDelay < TelegraphFadeTime) + yScale = MathHelper.Lerp(0f, 2f, TelegraphDelay / 15f); + if (TelegraphDelay > TelegraphTotalTime - TelegraphFadeTime) + yScale = MathHelper.Lerp(2f, 0f, (TelegraphDelay - (TelegraphTotalTime - TelegraphFadeTime)) / 15f); + + Vector2 scaleInner = new Vector2(TelegraphWidth / laserTelegraph.Width, yScale); + Vector2 origin = laserTelegraph.Size() * new Vector2(0f, 0.5f); + Vector2 scaleOuter = scaleInner * new Vector2(1f, 1.6f); + + Color colorOuter = Color.Lerp(Color.Red, Color.Crimson, TelegraphDelay / TelegraphTotalTime * 2f % 1f); // Iterate through crimson and red once and then flash. + Color colorInner = Color.Lerp(colorOuter, Color.White, 0.75f); + + colorOuter *= 0.7f; + colorInner *= 0.7f; + + spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorInner, OldVelocity.ToRotation(), origin, scaleInner, SpriteEffects.None, 0f); + spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorOuter, OldVelocity.ToRotation(), origin, scaleOuter, SpriteEffects.None, 0f); + + return false; + } + } +} diff --git a/Projectiles/Boss/ArtemisLaser.cs b/Projectiles/Boss/ArtemisLaser.cs new file mode 100644 index 0000000000..32db73032a --- /dev/null +++ b/Projectiles/Boss/ArtemisLaser.cs @@ -0,0 +1,226 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Artemis; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class ArtemisLaser : ModProjectile + { + public float TelegraphDelay + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + + public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[1]) ? Main.npc[(int)projectile.ai[1]] : null; + + public Vector2 Destination; + public Vector2 Velocity; + public const float TelegraphTotalTime = 30f; + public const float TelegraphFadeTime = 15f; + public const float TelegraphWidth = 4200f; + public const float LaserVelocity = 10f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exo Pulse Laser"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 22; + projectile.height = 22; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.extraUpdates = 1; + projectile.timeLeft = 600; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.WriteVector2(Destination); + writer.WriteVector2(Velocity); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + Destination = reader.ReadVector2(); + Velocity = reader.ReadVector2(); + } + + public override void AI() + { + // Determine the relative opacities for each player based on their distance. + // This has a lower bound of 0.35 to prevent the laser from going completely invisible and players getting hit by cheap shots. + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + projectile.netUpdate = true; + } + + projectile.frameCounter++; + if (projectile.frameCounter > 12) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + projectile.frame = 0; + + Lighting.AddLight(projectile.Center, 0.6f, 0f, 0f); + + // Die if the thing to attach to disappears. + if (ThingToAttachTo is null || !ThingToAttachTo.active) + { + projectile.Kill(); + return; + } + + // Fade in after telegraphs have faded. + if (TelegraphDelay > TelegraphTotalTime) + { + if (projectile.alpha > 0) + projectile.alpha -= 25; + if (projectile.alpha < 0) + projectile.alpha = 0; + + // If a velocity is in reserve, set the true velocity to it and make it as "taken" by setting it to <0,0> + if (Velocity != Vector2.Zero) + { + projectile.extraUpdates = 3; + projectile.velocity = Velocity * (CalamityWorld.malice ? 1.25f : 1f); + Velocity = Vector2.Zero; + projectile.netUpdate = true; + } + + // Direction and rotation. + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + } + else if (Destination == Vector2.Zero) + { + // Set start of telegraph to the npc center. + projectile.Center = ThingToAttachTo.Center; + + // Set destination of the laser, the target's center. + Destination = projectile.velocity; + + projectile.Center += Vector2.Normalize(Destination - ThingToAttachTo.Center) * 70f; + + // Calculate and store the velocity that will be used for laser telegraph rotation and beam firing. + Vector2 projectileDestination = Destination - ThingToAttachTo.Center; + Velocity = Vector2.Normalize(projectileDestination) * LaserVelocity; + + // Set velocity to zero. + projectile.velocity = Vector2.Zero; + projectile.netUpdate = true; + + // Direction and rotation. + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)-(double)Velocity.Y, (double)-(double)Velocity.X); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)Velocity.Y, (double)Velocity.X); + } + } + else + { + // Set start of telegraph to the npc center. + projectile.Center = ThingToAttachTo.Center; + + projectile.Center += Vector2.Normalize(Destination - ThingToAttachTo.Center) * 70f; + + // Calculate and store the velocity that will be used for laser telegraph rotation and beam firing. + Vector2 projectileDestination = Destination - ThingToAttachTo.Center; + Velocity = Vector2.Normalize(projectileDestination) * LaserVelocity; + + // Direction and rotation. + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)-(double)Velocity.Y, (double)-(double)Velocity.X); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)Velocity.Y, (double)Velocity.X); + } + } + + TelegraphDelay++; + } + + public override bool CanHitPlayer(Player target) => TelegraphDelay > TelegraphTotalTime; + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (TelegraphDelay > TelegraphTotalTime) + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + target.Calamity().lastProjectileHit = projectile; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (TelegraphDelay >= TelegraphTotalTime) + { + lightColor.R = (byte)(255 * projectile.Opacity); + lightColor.G = (byte)(255 * projectile.Opacity); + lightColor.B = (byte)(255 * projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + return false; + } + + Texture2D laserTelegraph = ModContent.GetTexture("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); + + float yScale = 2f; + if (TelegraphDelay < TelegraphFadeTime) + yScale = MathHelper.Lerp(0f, 2f, TelegraphDelay / 15f); + if (TelegraphDelay > TelegraphTotalTime - TelegraphFadeTime) + yScale = MathHelper.Lerp(2f, 0f, (TelegraphDelay - (TelegraphTotalTime - TelegraphFadeTime)) / 15f); + + Vector2 scaleInner = new Vector2(TelegraphWidth / laserTelegraph.Width, yScale); + Vector2 origin = laserTelegraph.Size() * new Vector2(0f, 0.5f); + Vector2 scaleOuter = scaleInner * new Vector2(1f, 2.2f); + + Color colorOuter = Color.Lerp(Color.Orange, Color.OrangeRed, TelegraphDelay / TelegraphTotalTime * 2f % 1f); // Iterate through orange and dark orange once and then flash. + Color colorInner = Color.Lerp(colorOuter, Color.White, 0.75f); + + colorOuter *= 0.6f; + colorInner *= 0.6f; + + spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorInner, Velocity.ToRotation(), origin, scaleInner, SpriteEffects.None, 0f); + spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorOuter, Velocity.ToRotation(), origin, scaleOuter, SpriteEffects.None, 0f); + return false; + } + } +} diff --git a/Projectiles/Boss/ArtemisLaser.png b/Projectiles/Boss/ArtemisLaser.png new file mode 100644 index 0000000000..8c5f8b4299 Binary files /dev/null and b/Projectiles/Boss/ArtemisLaser.png differ diff --git a/Projectiles/Boss/ArtemisLaserBeamStart.cs b/Projectiles/Boss/ArtemisLaserBeamStart.cs new file mode 100644 index 0000000000..a402a5cd62 --- /dev/null +++ b/Projectiles/Boss/ArtemisLaserBeamStart.cs @@ -0,0 +1,234 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.Enums; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class ArtemisLaserBeamStart : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Boss/AresLaserBeamStart"; + + public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[0]) ? Main.npc[(int)projectile.ai[0]] : null; + public ref float RotationDirection => ref projectile.ai[1]; + public ref float Time => ref projectile.localAI[0]; + public ref float LengthOfLaser => ref projectile.localAI[1]; + public const int Lifetime = 180; + public const float BeamPosOffset = 16f; + private const int maxFrames = 5; + private int frameDrawn = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exothermal Artemis Beam"); + } + + public override void SetDefaults() + { + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = 600; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(frameDrawn); + writer.Write(Time); + writer.Write(LengthOfLaser); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + frameDrawn = reader.ReadInt32(); + Time = reader.ReadSingle(); + LengthOfLaser = reader.ReadSingle(); + } + + public override void AI() + { + // Difficulty modes + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + // Die if the thing to attach to disappears. + if (ThingToAttachTo is null || !ThingToAttachTo.active || ThingToAttachTo.Calamity().newAI[0] != 3f) + { + projectile.Kill(); + return; + } + + projectile.rotation = ThingToAttachTo.rotation; + projectile.velocity = (projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); + + // Offset to move the beam forward so that it starts in Artemis' focus jewel thing. + float beamStartForwardsOffset = 80f; + + // Set the starting location of the beam to the center of the NPC. + projectile.Center = ThingToAttachTo.Center; + // Add a fixed offset to align with the NPC's spritesheet (?) + projectile.position += projectile.velocity * BeamPosOffset + new Vector2(0f, -ThingToAttachTo.gfxOffY); + // Add the forwards offset, measured in pixels. + projectile.position += projectile.velocity * beamStartForwardsOffset; + + Time++; + if (Time >= Lifetime) + { + projectile.Kill(); + return; + } + + float scale = 1f; + projectile.scale = (float)Math.Sin(Time * MathHelper.Pi / Lifetime) * 10f * scale; + if (projectile.scale > scale) + projectile.scale = scale; + + float arraySize = 3f; + Vector2 samplingPoint = projectile.Center; + float[] samples = new float[(int)arraySize]; + Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, 4800f, samples); + float laserLength = 0f; + for (int i = 0; i < samples.Length; i++) + { + laserLength += samples[i]; + } + laserLength /= arraySize; + + // Fire laser through walls at max length if target cannot be seen + if (!Collision.CanHitLine(ThingToAttachTo.Center, 1, 1, Main.player[ThingToAttachTo.target].Center, 1, 1)) + laserLength = 4800f; + + float amount = 0.5f; + LengthOfLaser = MathHelper.Lerp(LengthOfLaser, laserLength, amount); + + // Spawn dust at the end of the beam + int dustType = (int)CalamityDusts.Brimstone; + Vector2 dustPos = projectile.Center + projectile.velocity * (LengthOfLaser - 14f); + for (int i = 0; i < 2; i++) + { + float dustRot = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float dustVelMult = (float)Main.rand.NextDouble() * 2f + 2f; + Vector2 dustVel = new Vector2((float)Math.Cos(dustRot) * dustVelMult, (float)Math.Sin(dustRot) * dustVelMult); + int dust = Dust.NewDust(dustPos, 0, 0, dustType, dustVel.X, dustVel.Y, 0, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 1.7f; + } + + if (Main.rand.NextBool(5)) + { + Vector2 dustRot = projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; + int dust = Dust.NewDust(dustPos + dustRot - Vector2.One * 4f, 8, 8, dustType, 0f, 0f, 100, default, 1.5f); + Main.dust[dust].velocity *= 0.5f; + Main.dust[dust].velocity.Y = -Math.Abs(Main.dust[dust].velocity.Y); + } + + DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * LengthOfLaser, projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.velocity == Vector2.Zero) + return false; + + Texture2D beamStart = Main.projectileTexture[projectile.type]; + Texture2D beamMiddle = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AresLaserBeamMiddle"); + Texture2D beamEnd = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AresLaserBeamEnd"); + + float drawLength = LengthOfLaser; + Color color = new Color(250, 180, 100, 0); + + if (Time % 5 == 0) + { + frameDrawn++; + if (frameDrawn >= maxFrames) + frameDrawn = 0; + } + + // Draw start of beam + Vector2 vector = projectile.Center - Main.screenPosition; + Rectangle? sourceRectangle = new Rectangle(0, beamStart.Height / maxFrames * frameDrawn, beamStart.Width, beamStart.Height / maxFrames); + spriteBatch.Draw(beamStart, vector, sourceRectangle, color, projectile.rotation, new Vector2(beamStart.Width, beamStart.Height / maxFrames) / 2f, projectile.scale, SpriteEffects.None, 0f); + + // Draw middle of beam + drawLength -= (beamStart.Height / maxFrames / 2 + beamEnd.Height / maxFrames) * projectile.scale; + Vector2 center = projectile.Center; + center += projectile.velocity * projectile.scale * beamStart.Height / maxFrames / 2f; + if (drawLength > 0f) + { + float i = 0f; + int middleFrameDrawn = frameDrawn; + while (i + 1f < drawLength) + { + Rectangle rectangle = new Rectangle(0, beamMiddle.Height / maxFrames * middleFrameDrawn, beamMiddle.Width, beamMiddle.Height / maxFrames); + + if (drawLength - i < rectangle.Height) + rectangle.Height = (int)(drawLength - i); + + spriteBatch.Draw(beamMiddle, center - Main.screenPosition, rectangle, color, projectile.rotation, new Vector2(rectangle.Width / 2f, 0f), projectile.scale, SpriteEffects.None, 0f); + + middleFrameDrawn++; + if (middleFrameDrawn >= maxFrames) + middleFrameDrawn = 0; + + i += rectangle.Height * projectile.scale; + center += projectile.velocity * rectangle.Height * projectile.scale; + + rectangle.Y += beamMiddle.Height / maxFrames; + if (rectangle.Y + rectangle.Height > beamMiddle.Height / maxFrames) + rectangle.Y = 0; + } + } + + // Draw end of beam + Vector2 vector2 = center - Main.screenPosition; + sourceRectangle = new Rectangle(0, beamEnd.Height / maxFrames * frameDrawn, beamEnd.Width, beamEnd.Height / maxFrames); + spriteBatch.Draw(beamEnd, vector2, sourceRectangle, color, projectile.rotation, new Vector2(beamEnd.Width, beamEnd.Height / maxFrames) / 2f, projectile.scale, SpriteEffects.None, 0f); + + return false; + } + + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * LengthOfLaser, projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + return true; + + float collisionPoint = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * LengthOfLaser, 30f * projectile.scale, ref collisionPoint)) + return true; + + return false; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + target.Calamity().lastProjectileHit = projectile; + } + } +} diff --git a/Projectiles/Boss/BrokenApolloLens.cs b/Projectiles/Boss/BrokenApolloLens.cs new file mode 100644 index 0000000000..58a545036e --- /dev/null +++ b/Projectiles/Boss/BrokenApolloLens.cs @@ -0,0 +1,54 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class BrokenApolloLens : ModProjectile + { + public ref float Time => ref projectile.ai[0]; + public override void SetStaticDefaults() => DisplayName.SetDefault("Lens"); + + public override void SetDefaults() + { + projectile.width = projectile.height = 30; + projectile.ignoreWater = true; + projectile.tileCollide = true; + projectile.penetrate = -1; + projectile.timeLeft = 480; + } + + public override void AI() + { + if (Time < 5f) + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + else + projectile.rotation += (projectile.velocity.X > 0f).ToDirectionInt() * projectile.velocity.Length() * 0.018f; + + if (projectile.timeLeft < 90) + projectile.Opacity = projectile.timeLeft / 90f; + projectile.velocity.Y = MathHelper.Clamp(projectile.velocity.Y + 0.325f, -25f, 25f); + + Time++; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + // Stop bouncing after a certain degree of slowness has been reached. + if (projectile.velocity.Length() < 3f) + { + projectile.velocity = Vector2.Zero; + return false; + } + + if (projectile.velocity.X != oldVelocity.X) + projectile.velocity.X = -oldVelocity.X; + + if (projectile.velocity.Y != oldVelocity.Y) + projectile.velocity.Y = -oldVelocity.Y * 0.75f; + projectile.velocity *= 0.8f; + + return false; + } + } +} diff --git a/Gores/Apollo/ApolloTransitionGore.png b/Projectiles/Boss/BrokenApolloLens.png similarity index 100% rename from Gores/Apollo/ApolloTransitionGore.png rename to Projectiles/Boss/BrokenApolloLens.png diff --git a/Projectiles/Boss/BrokenArtemisLens.cs b/Projectiles/Boss/BrokenArtemisLens.cs new file mode 100644 index 0000000000..02c98e0f2a --- /dev/null +++ b/Projectiles/Boss/BrokenArtemisLens.cs @@ -0,0 +1,54 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class BrokenArtemisLens : ModProjectile + { + public ref float Time => ref projectile.ai[0]; + public override void SetStaticDefaults() => DisplayName.SetDefault("Lens"); + + public override void SetDefaults() + { + projectile.width = projectile.height = 30; + projectile.ignoreWater = true; + projectile.tileCollide = true; + projectile.penetrate = -1; + projectile.timeLeft = 480; + } + + public override void AI() + { + if (Time < 5f) + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + else + projectile.rotation += (projectile.velocity.X > 0f).ToDirectionInt() * projectile.velocity.Length() * 0.018f; + + if (projectile.timeLeft < 90) + projectile.Opacity = projectile.timeLeft / 90f; + projectile.velocity.Y = MathHelper.Clamp(projectile.velocity.Y + 0.325f, -25f, 25f); + + Time++; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + // Stop bouncing after a certain degree of slowness has been reached. + if (projectile.velocity.Length() < 3f) + { + projectile.velocity = Vector2.Zero; + return false; + } + + if (projectile.velocity.X != oldVelocity.X) + projectile.velocity.X = -oldVelocity.X; + + if (projectile.velocity.Y != oldVelocity.Y) + projectile.velocity.Y = -oldVelocity.Y * 0.75f; + projectile.velocity *= 0.8f; + + return false; + } + } +} diff --git a/Gores/Artemis/ArtemisTransitionGore.png b/Projectiles/Boss/BrokenArtemisLens.png similarity index 100% rename from Gores/Artemis/ArtemisTransitionGore.png rename to Projectiles/Boss/BrokenArtemisLens.png diff --git a/Projectiles/Boss/DarkEnergyBall.cs b/Projectiles/Boss/DarkEnergyBall.cs index f545c4ed4e..a270cbb957 100644 --- a/Projectiles/Boss/DarkEnergyBall.cs +++ b/Projectiles/Boss/DarkEnergyBall.cs @@ -33,6 +33,13 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + if (CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) + { + projectile.active = false; + projectile.netUpdate = true; + return; + } + if (Vector2.Distance(projectile.Center, Main.npc[CalamityGlobalNPC.voidBoss].Center) < 80f) projectile.Kill(); @@ -109,7 +116,7 @@ namespace CalamityMod.Projectiles.Boss { for (int num621 = 0; num621 < 3; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) @@ -120,10 +127,10 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 5; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 2f; } diff --git a/Projectiles/Boss/DarkEnergyBall2.cs b/Projectiles/Boss/DarkEnergyBall2.cs index 0e9dd95693..5ff7987d43 100644 --- a/Projectiles/Boss/DarkEnergyBall2.cs +++ b/Projectiles/Boss/DarkEnergyBall2.cs @@ -35,6 +35,13 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + if (CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) + { + projectile.active = false; + projectile.netUpdate = true; + return; + } + if (Vector2.Distance(projectile.Center, Main.npc[CalamityGlobalNPC.voidBoss].Center) < 80f) projectile.Kill(); @@ -111,7 +118,7 @@ namespace CalamityMod.Projectiles.Boss { for (int num621 = 0; num621 < 3; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) @@ -122,10 +129,10 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 5; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 2f; } diff --git a/Projectiles/Boss/DoGBeamPortal.cs b/Projectiles/Boss/DoGBeamPortal.cs index b77e467f51..58a5eeed39 100644 --- a/Projectiles/Boss/DoGBeamPortal.cs +++ b/Projectiles/Boss/DoGBeamPortal.cs @@ -45,6 +45,13 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + if (CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) + { + projectile.active = false; + projectile.netUpdate = true; + return; + } + Player player = Main.player[projectile.owner]; if (start) diff --git a/Projectiles/Boss/DoGTeleportRift.cs b/Projectiles/Boss/DoGTeleportRift.cs index 23b9e7e0af..080e574b50 100644 --- a/Projectiles/Boss/DoGTeleportRift.cs +++ b/Projectiles/Boss/DoGTeleportRift.cs @@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.Boss dustVelocity = dustVelocityScalar / dustVelocity; dustVelocityX *= dustVelocity; dustVelocityY *= dustVelocity; - int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 5f); + int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 5f); Main.dust[dust].noGravity = true; Main.dust[dust].position.X = projectile.Center.X; Main.dust[dust].position.Y = projectile.Center.Y; diff --git a/Projectiles/Boss/DraedonSummonLaser.cs b/Projectiles/Boss/DraedonSummonLaser.cs new file mode 100644 index 0000000000..5cd53e6515 --- /dev/null +++ b/Projectiles/Boss/DraedonSummonLaser.cs @@ -0,0 +1,101 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class DraedonSummonLaser : ModProjectile + { + public const float LaserLength = 3800f; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public PrimitiveTrail RayDrawer = null; + private const int Lifetime = CalamityWorld.DraedonSummonCountdownMax - 60; + + public override void SetStaticDefaults() => DisplayName.SetDefault("Giant Fuck-off Deathray of Doom"); + + public override void SetDefaults() + { + projectile.width = projectile.height = 24; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.hide = true; + projectile.timeLeft = Lifetime; + } + + public override bool CanDamage() => projectile.timeLeft < Lifetime - 30; + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TeslaCannonFire"), projectile.Center); + for (int i = 0; i < 36; i++) + { + Dust exoDust = Dust.NewDustPerfect(projectile.BottomRight, 267); + exoDust.color = CalamityUtils.MulticolorLerp(i / 36f, CalamityUtils.ExoPalette); + exoDust.velocity = (MathHelper.TwoPi * i / 36f).ToRotationVector2() * new Vector2(3f, 1.45f) - Vector2.UnitY * 2f; + exoDust.scale = 2.8f; + exoDust.fadeIn = Main.rand.NextFloat(0.8f, 1.85f); + exoDust.noGravity = true; + } + + for (int i = 0; i < 10; i++) + { + Dust exoDust = Dust.NewDustPerfect(projectile.BottomRight, 267); + exoDust.color = CalamityUtils.MulticolorLerp(Main.rand.NextFloat(), CalamityUtils.ExoPalette); + exoDust.velocity = Main.rand.NextVector2Circular(2f, 2f); + exoDust.scale = 4f; + exoDust.fadeIn = 2f; + exoDust.noGravity = true; + } + projectile.localAI[0] = 1f; + } + + Lighting.AddLight(projectile.Center, Color.White.ToVector3()); + projectile.scale = Utils.InverseLerp(-1f, 15f, projectile.timeLeft, true) * Utils.InverseLerp(Lifetime + 1f, Lifetime - 15f, projectile.timeLeft, true); + } + + private float PrimitiveWidthFunction(float completionRatio) + { + return Utils.InverseLerp(1f, 0.96f, completionRatio, true) * Utils.InverseLerp(0f, 0.016f, completionRatio, true) * projectile.scale * 20f; + } + + private Color PrimitiveColorFunction(float completionRatio) + { + return CalamityUtils.MulticolorLerp((Main.GlobalTime * 0.67f - completionRatio * 3f) % 1f, CalamityUtils.ExoPalette) * 1.2f; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (RayDrawer is null) + RayDrawer = new PrimitiveTrail(PrimitiveWidthFunction, PrimitiveColorFunction, specialShader: GameShaders.Misc["CalamityMod:Flame"]); + + GameShaders.Misc["CalamityMod:Flame"].UseImage("Images/Misc/Perlin"); + + Vector2[] basePoints = new Vector2[8]; + for (int i = 0; i < basePoints.Length; i++) + basePoints[i] = projectile.Center - Vector2.UnitY * i / basePoints.Length * LaserLength; + + Vector2 overallOffset = projectile.Size * 0.5f - Main.screenPosition; + RayDrawer.Draw(basePoints, overallOffset, 92); + return false; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center - Vector2.UnitY * LaserLength); + } + + public override void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, List drawCacheProjsBehindNPCs, List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) + { + drawCacheProjsBehindNPCsAndTiles.Add(index); + } + } +} diff --git a/Projectiles/Boss/ExoDestroyerBeamStart.png b/Projectiles/Boss/ExoDestroyerBeamStart.png deleted file mode 100644 index a0c3da9735..0000000000 Binary files a/Projectiles/Boss/ExoDestroyerBeamStart.png and /dev/null differ diff --git a/Projectiles/Boss/SCalRitualDrama.cs b/Projectiles/Boss/SCalRitualDrama.cs index eb6ca69f86..d83f316ede 100644 --- a/Projectiles/Boss/SCalRitualDrama.cs +++ b/Projectiles/Boss/SCalRitualDrama.cs @@ -12,7 +12,6 @@ namespace CalamityMod.Projectiles.Boss { public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public ref float Time => ref projectile.ai[0]; - public const int PulseTime = 45; public const int TotalRitualTime = 270; public override void SetStaticDefaults() => DisplayName.SetDefault("Calamitous Ritual Drama"); @@ -21,18 +20,32 @@ namespace CalamityMod.Projectiles.Boss projectile.width = projectile.height = 2; projectile.tileCollide = false; projectile.ignoreWater = true; - projectile.timeLeft = TotalRitualTime; + projectile.timeLeft = TotalRitualTime + 420; } - public override void AI() - { - SCalSky.OverridingIntensity = Utils.InverseLerp(90f, TotalRitualTime - 25f, Time, true); - Main.LocalPlayer.Calamity().GeneralScreenShakePower = Utils.InverseLerp(90f, TotalRitualTime - 25f, Time, true); - Main.LocalPlayer.Calamity().GeneralScreenShakePower *= Utils.InverseLerp(3400f, 1560f, Main.LocalPlayer.Distance(projectile.Center), true) * 4f; + public override void AI() + { + // If needed, these effects may continue after the ritual timer, to ensure that there are no awkward + // background changes between the time it takes for SCal to appear after this projectile is gone. + // If SCal is already present, this does not happen. + if (!NPC.AnyNPCs(ModContent.NPCType())) + { + SCalSky.OverridingIntensity = Utils.InverseLerp(90f, TotalRitualTime - 25f, Time, true); + Main.LocalPlayer.Calamity().GeneralScreenShakePower = Utils.InverseLerp(90f, TotalRitualTime - 25f, Time, true); + Main.LocalPlayer.Calamity().GeneralScreenShakePower *= Utils.InverseLerp(3400f, 1560f, Main.LocalPlayer.Distance(projectile.Center), true) * 4f; + } + + // Summon SCal right before the ritual effect ends. + // The projectile lingers a little longer, however, to ensure that desync delays in MP do not interfere with the background transition. + if (Time == TotalRitualTime - 1f) + SummonSCal(); + + if (Time >= TotalRitualTime) + return; int fireReleaseRate = Time > 150f ? 2 : 1; for (int i = 0; i < fireReleaseRate; i++) - { + { if (Main.rand.NextBool(4)) { Dust brimstone = Dust.NewDustPerfect(projectile.Center + new Vector2(Main.rand.NextFloat(-20f, 24f), Main.rand.NextFloat(10f, 18f)), 267); @@ -45,19 +58,22 @@ namespace CalamityMod.Projectiles.Boss } Time++; - } + } - public override void Kill(int timeLeft) - { + public void SummonSCal() + { + // Summon SCal serverside. + // All the other acoustic and visual effects can happen client-side. if (Main.netMode != NetmodeID.MultiplayerClient) CalamityUtils.SpawnBossBetter(projectile.Center - new Vector2(60f), ModContent.NPCType()); // Make a laugh sound and create a burst of brimstone dust. Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SupremeCalamitasSpawn"), projectile.Center); + // Make a sudden screen shake. Main.LocalPlayer.Calamity().GeneralScreenShakePower = Utils.InverseLerp(3400f, 1560f, Main.LocalPlayer.Distance(projectile.Center), true) * 16f; - // Generate a dust explosion + // Generate a dust explosion at the ritual's position. float burstDirectionVariance = 3; float burstSpeed = 14f; for (int j = 0; j < 16; j++) @@ -74,5 +90,5 @@ namespace CalamityMod.Projectiles.Boss burstSpeed += 1.8f; } } - } + } } diff --git a/Projectiles/Boss/ExoDestroyerBeamStart.cs b/Projectiles/Boss/ThanatosBeamStart.cs similarity index 51% rename from Projectiles/Boss/ExoDestroyerBeamStart.cs rename to Projectiles/Boss/ThanatosBeamStart.cs index eed1a3bc8f..ef76aa9a51 100644 --- a/Projectiles/Boss/ExoDestroyerBeamStart.cs +++ b/Projectiles/Boss/ThanatosBeamStart.cs @@ -13,8 +13,8 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class ExoDestroyerBeamStart : ModProjectile - { + public class ThanatosBeamStart : ModProjectile + { public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[0]) ? Main.npc[(int)projectile.ai[0]] : null; public ref float Time => ref projectile.localAI[0]; public ref float LengthOfLaser => ref projectile.localAI[1]; @@ -24,39 +24,40 @@ namespace CalamityMod.Projectiles.Boss private int frameDrawn = 0; public override void SetStaticDefaults() - { - DisplayName.SetDefault("T Hanos Deathray"); + { + // Thanatos' mouth laser + DisplayName.SetDefault("Gamma Disintegration Beam"); } - public override void SetDefaults() - { + public override void SetDefaults() + { projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 600; - cooldownSlot = 1; - } + projectile.width = 40; + projectile.height = 40; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = 600; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { + public override void SendExtraAI(BinaryWriter writer) + { writer.Write(frameDrawn); writer.Write(Time); writer.Write(LengthOfLaser); - } + } - public override void ReceiveExtraAI(BinaryReader reader) - { + public override void ReceiveExtraAI(BinaryReader reader) + { frameDrawn = reader.ReadInt32(); Time = reader.ReadSingle(); LengthOfLaser = reader.ReadSingle(); - } + } - public override void AI() - { + public override void AI() + { // Difficulty modes bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || malice; @@ -83,17 +84,17 @@ namespace CalamityMod.Projectiles.Boss // Add the forwards offset, measured in pixels. projectile.position += hostNPCDirection * beamStartForwardsOffset; - Time++; - if (Time >= Lifetime) - { - projectile.Kill(); - return; - } + Time++; + if (Time >= Lifetime) + { + projectile.Kill(); + return; + } float scale = 1f; projectile.scale = (float)Math.Sin(Time * MathHelper.Pi / Lifetime) * 10f * scale; - if (projectile.scale > scale) - projectile.scale = scale; + if (projectile.scale > scale) + projectile.scale = scale; projectile.rotation = ThingToAttachTo.velocity.ToRotation(); projectile.velocity = projectile.rotation.ToRotationVector2(); @@ -101,19 +102,19 @@ namespace CalamityMod.Projectiles.Boss projectile.rotation = ThingToAttachTo.velocity.ToRotation() - MathHelper.PiOver2; float arraySize = 3f; - Vector2 samplingPoint = projectile.Center; - float[] samples = new float[(int)arraySize]; - Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, 2400f, samples); - float laserLength = 0f; - for (int i = 0; i < samples.Length; i++) - { - laserLength += samples[i]; - } - laserLength /= arraySize; + Vector2 samplingPoint = projectile.Center; + float[] samples = new float[(int)arraySize]; + Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, 3600f, samples); + float laserLength = 0f; + for (int i = 0; i < samples.Length; i++) + { + laserLength += samples[i]; + } + laserLength /= arraySize; - // Fire laser through walls at max length if target cannot be seen - if (!Collision.CanHitLine(ThingToAttachTo.Center, 1, 1, Main.player[ThingToAttachTo.target].Center, 1, 1)) - laserLength = 2400f; + // Fire laser through walls at max length if target cannot be seen + if (!Collision.CanHitLine(ThingToAttachTo.Center, 1, 1, Main.player[ThingToAttachTo.target].Center, 1, 1)) + laserLength = 3600f; float amount = 0.5f; LengthOfLaser = MathHelper.Lerp(LengthOfLaser, laserLength, amount); @@ -128,7 +129,7 @@ namespace CalamityMod.Projectiles.Boss float distanceBetweenProjectiles = malice ? 160f : death ? 256f : revenge ? 288f : 320f; Vector2 fireFrom = ThingToAttachTo.Center + velocity * distanceBetweenProjectiles; int projectileAmt = (int)(LengthOfLaser / distanceBetweenProjectiles); - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = projectile.GetProjectileDamage(ThingToAttachTo.type); for (int i = 0; i < projectileAmt; i++) { @@ -147,38 +148,38 @@ namespace CalamityMod.Projectiles.Boss int dustType = (int)CalamityDusts.Brimstone; Vector2 dustPos = projectile.Center + projectile.velocity * (LengthOfLaser - 14f); for (int i = 0; i < 2; i++) - { - float dustRot = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; - float dustVelMult = (float)Main.rand.NextDouble() * 2f + 2f; - Vector2 dustVel = new Vector2((float)Math.Cos(dustRot) * dustVelMult, (float)Math.Sin(dustRot) * dustVelMult); - int dust = Dust.NewDust(dustPos, 0, 0, dustType, dustVel.X, dustVel.Y, 0, default, 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].scale = 1.7f; - } + { + float dustRot = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float dustVelMult = (float)Main.rand.NextDouble() * 2f + 2f; + Vector2 dustVel = new Vector2((float)Math.Cos(dustRot) * dustVelMult, (float)Math.Sin(dustRot) * dustVelMult); + int dust = Dust.NewDust(dustPos, 0, 0, dustType, dustVel.X, dustVel.Y, 0, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 1.7f; + } - if (Main.rand.NextBool(5)) - { - Vector2 dustRot = projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; - int dust = Dust.NewDust(dustPos + dustRot - Vector2.One * 4f, 8, 8, dustType, 0f, 0f, 100, default, 1.5f); + if (Main.rand.NextBool(5)) + { + Vector2 dustRot = projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; + int dust = Dust.NewDust(dustPos + dustRot - Vector2.One * 4f, 8, 8, dustType, 0f, 0f, 100, default, 1.5f); Main.dust[dust].velocity *= 0.5f; - Main.dust[dust].velocity.Y = -Math.Abs(Main.dust[dust].velocity.Y); - } + Main.dust[dust].velocity.Y = -Math.Abs(Main.dust[dust].velocity.Y); + } - DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * LengthOfLaser, projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); - } + DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * LengthOfLaser, projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - if (projectile.velocity == Vector2.Zero) - return false; + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.velocity == Vector2.Zero) + return false; Texture2D beamStart = Main.projectileTexture[projectile.type]; - Texture2D beamMiddle = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ExoDestroyerBeamMiddle"); - Texture2D beamEnd = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ExoDestroyerBeamEnd"); + Texture2D beamMiddle = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ThanatosBeamMiddle"); + Texture2D beamEnd = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ThanatosBeamEnd"); float drawLength = LengthOfLaser; - Color color = new Color(250, 100, 100, 0); + Color color = new Color(250, 250, 250, 100); if (Time % 5 == 0) { @@ -189,25 +190,25 @@ namespace CalamityMod.Projectiles.Boss // Draw start of beam Vector2 vector = projectile.Center - Main.screenPosition; - Rectangle? sourceRectangle = new Rectangle(0, beamStart.Height / maxFrames * frameDrawn, beamStart.Width, beamStart.Height / maxFrames); + Rectangle? sourceRectangle = new Rectangle(0, beamStart.Height / maxFrames * frameDrawn, beamStart.Width, beamStart.Height / maxFrames); spriteBatch.Draw(beamStart, vector, sourceRectangle, color, projectile.rotation, new Vector2(beamStart.Width, beamStart.Height / maxFrames) / 2f, projectile.scale, SpriteEffects.None, 0f); // Draw middle of beam drawLength -= (beamStart.Height / maxFrames / 2 + beamEnd.Height / maxFrames) * projectile.scale; - Vector2 center = projectile.Center; + Vector2 center = projectile.Center; center += projectile.velocity * projectile.scale * beamStart.Height / maxFrames / 2f; - if (drawLength > 0f) - { - float i = 0f; + if (drawLength > 0f) + { + float i = 0f; int middleFrameDrawn = frameDrawn; while (i + 1f < drawLength) - { + { Rectangle rectangle = new Rectangle(0, beamMiddle.Height / maxFrames * middleFrameDrawn, beamMiddle.Width, beamMiddle.Height / maxFrames); if (drawLength - i < rectangle.Height) - rectangle.Height = (int)(drawLength - i); + rectangle.Height = (int)(drawLength - i); - spriteBatch.Draw(beamMiddle, center - Main.screenPosition, rectangle, color, projectile.rotation, new Vector2(rectangle.Width / 2f, 0f), projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(beamMiddle, center - Main.screenPosition, rectangle, color, projectile.rotation, new Vector2(rectangle.Width / 2f, 0f), projectile.scale, SpriteEffects.None, 0f); middleFrameDrawn++; if (middleFrameDrawn >= maxFrames) @@ -216,47 +217,47 @@ namespace CalamityMod.Projectiles.Boss i += rectangle.Height * projectile.scale; center += projectile.velocity * rectangle.Height * projectile.scale; - rectangle.Y += beamMiddle.Height / maxFrames; - if (rectangle.Y + rectangle.Height > beamMiddle.Height / maxFrames) - rectangle.Y = 0; - } - } + rectangle.Y += beamMiddle.Height / maxFrames; + if (rectangle.Y + rectangle.Height > beamMiddle.Height / maxFrames) + rectangle.Y = 0; + } + } // Draw end of beam - Vector2 vector2 = center - Main.screenPosition; + Vector2 vector2 = center - Main.screenPosition; sourceRectangle = new Rectangle(0, beamEnd.Height / maxFrames * frameDrawn, beamEnd.Width, beamEnd.Height / maxFrames); spriteBatch.Draw(beamEnd, vector2, sourceRectangle, color, projectile.rotation, new Vector2(beamEnd.Width, beamEnd.Height / maxFrames) / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } + return false; + } - public override void CutTiles() - { - DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * LengthOfLaser, projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); - } + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * LengthOfLaser, projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (projHitbox.Intersects(targetHitbox)) - return true; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + return true; - float collisionPoint = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * LengthOfLaser, 30f * projectile.scale, ref collisionPoint)) - return true; + float collisionPoint = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * LengthOfLaser, 40f * projectile.scale, ref collisionPoint)) + return true; - return false; - } + return false; + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { + public override void OnHitPlayer(Player target, int damage, bool crit) + { target.AddBuff(ModContent.BuffType(), 360); } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { target.Calamity().lastProjectileHit = projectile; } - } + } } diff --git a/Projectiles/Boss/ThanatosBeamStart.png b/Projectiles/Boss/ThanatosBeamStart.png new file mode 100644 index 0000000000..e565bcab1e Binary files /dev/null and b/Projectiles/Boss/ThanatosBeamStart.png differ diff --git a/Projectiles/Boss/ExoDestroyerBeamTelegraph.cs b/Projectiles/Boss/ThanatosBeamTelegraph.cs similarity index 97% rename from Projectiles/Boss/ExoDestroyerBeamTelegraph.cs rename to Projectiles/Boss/ThanatosBeamTelegraph.cs index 1a120d317a..8740b4e632 100644 --- a/Projectiles/Boss/ExoDestroyerBeamTelegraph.cs +++ b/Projectiles/Boss/ThanatosBeamTelegraph.cs @@ -6,7 +6,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class ExoDestroyerBeamTelegraph : ModProjectile + public class ThanatosBeamTelegraph : ModProjectile { public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Boss public const int Lifetime = 180; public const float TelegraphWidth = 3600f; public const float BeamPosOffset = 16f; - public override void SetStaticDefaults() => DisplayName.SetDefault("Telegraph"); + public override void SetStaticDefaults() => DisplayName.SetDefault("Gamma Disintegration Beam Telegraph"); public override void SetDefaults() { diff --git a/Projectiles/Boss/ExoDestroyerLaser.cs b/Projectiles/Boss/ThanatosLaser.cs similarity index 63% rename from Projectiles/Boss/ExoDestroyerLaser.cs rename to Projectiles/Boss/ThanatosLaser.cs index 13ea28b98b..393479f0d6 100644 --- a/Projectiles/Boss/ExoDestroyerLaser.cs +++ b/Projectiles/Boss/ThanatosLaser.cs @@ -11,58 +11,58 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class ExoDestroyerLaser : ModProjectile - { - public float TelegraphDelay - { - get => projectile.ai[0]; - set => projectile.ai[0] = value; - } + public class ThanatosLaser : ModProjectile + { + public float TelegraphDelay + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[1]) ? Main.npc[(int)projectile.ai[1]] : null; public Vector2 Destination; public Vector2 Velocity; - public const float TelegraphTotalTime = 30f; - public const float TelegraphFadeTime = 15f; - public const float TelegraphWidth = 4200f; - public const float LaserVelocity = 12f; + public const float TelegraphTotalTime = 30f; + public const float TelegraphFadeTime = 15f; + public const float TelegraphWidth = 4200f; + public const float LaserVelocity = 10f; public override void SetStaticDefaults() - { - DisplayName.SetDefault("T Hanos Beam"); + { + DisplayName.SetDefault("Exo Pulse Laser"); Main.projFrames[projectile.type] = 4; } - public override void SetDefaults() - { + public override void SetDefaults() + { projectile.Calamity().canBreakPlayerDefense = true; projectile.width = 22; - projectile.height = 22; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; - cooldownSlot = 1; + projectile.height = 22; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.extraUpdates = 1; + projectile.timeLeft = 600; + cooldownSlot = 1; } - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(Destination); + public override void SendExtraAI(BinaryWriter writer) + { + writer.WriteVector2(Destination); writer.WriteVector2(Velocity); } - public override void ReceiveExtraAI(BinaryReader reader) - { + public override void ReceiveExtraAI(BinaryReader reader) + { Destination = reader.ReadVector2(); Velocity = reader.ReadVector2(); } - public override void AI() - { + public override void AI() + { // Determine the relative opacities for each player based on their distance. // This has a lower bound of 0.35 to prevent the laser from going completely invisible and players getting hit by cheap shots. if (projectile.localAI[0] == 0f) @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Boss } projectile.frameCounter++; - if (projectile.frameCounter > 8) + if (projectile.frameCounter > 12) { projectile.frame++; projectile.frameCounter = 0; @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Boss // If a velocity is in reserve, set the true velocity to it and make it as "taken" by setting it to <0,0> if (Velocity != Vector2.Zero) { - projectile.extraUpdates = 2; + projectile.extraUpdates = 3; projectile.velocity = Velocity * (CalamityWorld.malice ? 1.25f : 1f); Velocity = Vector2.Zero; projectile.netUpdate = true; @@ -145,25 +145,25 @@ namespace CalamityMod.Projectiles.Boss return; } - // If the Ares Laser Cannon is the owner + // If the Ares Laser Cannon is the owner. bool aresLaserIsOwner = ThingToAttachTo.type == ModContent.NPCType(); // Fade in after telegraphs have faded. if (TelegraphDelay > TelegraphTotalTime) - { - if (projectile.alpha > 0) - projectile.alpha -= 25; - if (projectile.alpha < 0) - projectile.alpha = 0; + { + if (projectile.alpha > 0) + projectile.alpha -= 25; + if (projectile.alpha < 0) + projectile.alpha = 0; - // If a velocity is in reserve, set the true velocity to it and make it as "taken" by setting it to <0,0> - if (Velocity != Vector2.Zero) - { - projectile.extraUpdates = 2; + // If a velocity is in reserve, set the true velocity to it and make it as "taken" by setting it to <0,0> + if (Velocity != Vector2.Zero) + { + projectile.extraUpdates = 3; projectile.velocity = Velocity * (CalamityWorld.malice ? 1.25f : 1f); Velocity = Vector2.Zero; - projectile.netUpdate = true; - } + projectile.netUpdate = true; + } // Direction and rotation. if (projectile.velocity.X < 0f) @@ -177,8 +177,8 @@ namespace CalamityMod.Projectiles.Boss projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); } } - else if (Destination == Vector2.Zero) - { + else if (Destination == Vector2.Zero) + { // Set start of telegraph to the npc center. projectile.Center = ThingToAttachTo.Center; @@ -194,7 +194,7 @@ namespace CalamityMod.Projectiles.Boss // Set velocity to zero. projectile.velocity = Vector2.Zero; - projectile.netUpdate = true; + projectile.netUpdate = true; // Direction and rotation. if (projectile.velocity.X < 0f) @@ -233,24 +233,24 @@ namespace CalamityMod.Projectiles.Boss } } - TelegraphDelay++; - } + TelegraphDelay++; + } - public override bool CanHitPlayer(Player target) => TelegraphDelay > TelegraphTotalTime; + public override bool CanHitPlayer(Player target) => TelegraphDelay > TelegraphTotalTime; - public override void OnHitPlayer(Player target, int damage, bool crit) - { + public override void OnHitPlayer(Player target, int damage, bool crit) + { if (TelegraphDelay > TelegraphTotalTime) target.AddBuff(ModContent.BuffType(), 180); - } + } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { target.Calamity().lastProjectileHit = projectile; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { if (TelegraphDelay >= TelegraphTotalTime) { lightColor.R = (byte)(255 * projectile.Opacity); @@ -260,27 +260,27 @@ namespace CalamityMod.Projectiles.Boss return false; } - Texture2D laserTelegraph = ModContent.GetTexture("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); + Texture2D laserTelegraph = ModContent.GetTexture("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); - float yScale = 2f; - if (TelegraphDelay < TelegraphFadeTime) - yScale = MathHelper.Lerp(0f, 2f, TelegraphDelay / 15f); - if (TelegraphDelay > TelegraphTotalTime - TelegraphFadeTime) - yScale = MathHelper.Lerp(2f, 0f, (TelegraphDelay - (TelegraphTotalTime - TelegraphFadeTime)) / 15f); + float yScale = 2f; + if (TelegraphDelay < TelegraphFadeTime) + yScale = MathHelper.Lerp(0f, 2f, TelegraphDelay / 15f); + if (TelegraphDelay > TelegraphTotalTime - TelegraphFadeTime) + yScale = MathHelper.Lerp(2f, 0f, (TelegraphDelay - (TelegraphTotalTime - TelegraphFadeTime)) / 15f); - Vector2 scaleInner = new Vector2(TelegraphWidth / laserTelegraph.Width, yScale); - Vector2 origin = laserTelegraph.Size() * new Vector2(0f, 0.5f); - Vector2 scaleOuter = scaleInner * new Vector2(1f, 2.2f); + Vector2 scaleInner = new Vector2(TelegraphWidth / laserTelegraph.Width, yScale); + Vector2 origin = laserTelegraph.Size() * new Vector2(0f, 0.5f); + Vector2 scaleOuter = scaleInner * new Vector2(1f, 2.2f); - Color colorOuter = Color.Lerp(Color.Red, Color.Crimson, TelegraphDelay / TelegraphTotalTime * 2f % 1f); // Iterate through crimson and red once and then flash. - Color colorInner = Color.Lerp(colorOuter, Color.White, 0.75f); + Color colorOuter = Color.Lerp(Color.Red, Color.Crimson, TelegraphDelay / TelegraphTotalTime * 2f % 1f); // Iterate through crimson and red once and then flash. + Color colorInner = Color.Lerp(colorOuter, Color.White, 0.75f); - colorOuter *= 0.6f; - colorInner *= 0.6f; + colorOuter *= 0.6f; + colorInner *= 0.6f; - spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorInner, Velocity.ToRotation(), origin, scaleInner, SpriteEffects.None, 0f); - spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorOuter, Velocity.ToRotation(), origin, scaleOuter, SpriteEffects.None, 0f); - return false; - } - } + spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorInner, Velocity.ToRotation(), origin, scaleInner, SpriteEffects.None, 0f); + spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorOuter, Velocity.ToRotation(), origin, scaleOuter, SpriteEffects.None, 0f); + return false; + } + } } diff --git a/Projectiles/Boss/ExoDestroyerLaser.png b/Projectiles/Boss/ThanatosLaser.png similarity index 100% rename from Projectiles/Boss/ExoDestroyerLaser.png rename to Projectiles/Boss/ThanatosLaser.png diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index a6b5708cd6..5736414aa1 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -128,11 +128,50 @@ namespace CalamityMod.Projectiles #region SetDefaults public override void SetDefaults(Projectile projectile) { - if (CalamityLists.trueMeleeProjectileList.Contains(projectile.type)) - trueMelee = true; - switch (projectile.type) { + case ProjectileID.Spear: + case ProjectileID.Trident: + case ProjectileID.TheRottedFork: + case ProjectileID.Swordfish: + case ProjectileID.DarkLance: + case ProjectileID.CobaltNaginata: + case ProjectileID.PalladiumPike: + case ProjectileID.MythrilHalberd: + case ProjectileID.OrichalcumHalberd: + case ProjectileID.AdamantiteGlaive: + case ProjectileID.TitaniumTrident: + case ProjectileID.MushroomSpear: + case ProjectileID.Gungnir: + case ProjectileID.ObsidianSwordfish: + case ProjectileID.CobaltDrill: + case ProjectileID.MythrilDrill: + case ProjectileID.AdamantiteDrill: + case ProjectileID.PalladiumDrill: + case ProjectileID.OrichalcumDrill: + case ProjectileID.TitaniumDrill: + case ProjectileID.ChlorophyteDrill: + case ProjectileID.CobaltChainsaw: + case ProjectileID.MythrilChainsaw: + case ProjectileID.AdamantiteChainsaw: + case ProjectileID.PalladiumChainsaw: + case ProjectileID.OrichalcumChainsaw: + case ProjectileID.TitaniumChainsaw: + case ProjectileID.ChlorophyteChainsaw: + case ProjectileID.VortexDrill: + case ProjectileID.VortexChainsaw: + case ProjectileID.NebulaDrill: + case ProjectileID.NebulaChainsaw: + case ProjectileID.SolarFlareDrill: + case ProjectileID.SolarFlareChainsaw: + case ProjectileID.StardustDrill: + case ProjectileID.StardustChainsaw: + case ProjectileID.Hamdrax: + case ProjectileID.ChlorophyteJackhammer: + case ProjectileID.SawtoothShark: + trueMelee = true; + break; + case ProjectileID.Bullet: case ProjectileID.MeteorShot: case ProjectileID.BulletHighVelocity: @@ -203,10 +242,12 @@ namespace CalamityMod.Projectiles case ProjectileID.Arkhalis: case ProjectileID.ButchersChainsaw: + trueMelee = true; projectile.scale = 1.5f; break; case ProjectileID.MonkStaffT1: + trueMelee = true; projectile.scale = 3f; break; @@ -227,6 +268,7 @@ namespace CalamityMod.Projectiles break; case ProjectileID.MonkStaffT2: + trueMelee = true; projectile.idStaticNPCHitCooldown = 18; break; @@ -810,8 +852,11 @@ namespace CalamityMod.Projectiles if (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice) { - if (projectile.type == ProjectileID.DemonSickle && CalamityPlayer.areThereAnyDamnBosses) + if (projectile.type == ProjectileID.DemonSickle) { + if (Main.wof < 0 || !Main.npc[Main.wof].active || Main.npc[Main.wof].life <= 0) + return true; + if (projectile.ai[0] == 0f) Main.PlaySound(SoundID.Item8, projectile.position); @@ -1124,7 +1169,13 @@ namespace CalamityMod.Projectiles return false; } - else if (projectile.type == ProjectileID.CultistBossLightningOrb) + else if (projectile.type == ProjectileID.AncientDoomProjectile) + { + if (projectile.velocity.Length() < 12f) + projectile.velocity *= 1.02f; + } + + else if (projectile.type == ProjectileID.CultistBossLightningOrb && (CalamityWorld.malice || BossRushEvent.BossRushActive)) { if (NPC.AnyNPCs(NPCID.CultistBoss)) { @@ -1271,7 +1322,7 @@ namespace CalamityMod.Projectiles float scaleFactor2 = projectile.velocity.Length(); vector11.Normalize(); vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 15f + vector11) / 16f; + projectile.velocity = (projectile.velocity * 20f + vector11) / 21f; projectile.velocity.Normalize(); projectile.velocity *= scaleFactor2; @@ -2204,7 +2255,7 @@ namespace CalamityMod.Projectiles } } - if (modPlayer.flamingItemEnchant && !projectile.minion) + if (modPlayer.flamingItemEnchant && !projectile.minion && !projectile.npcProj) target.AddBuff(BuffType(), 420); if (modPlayer.farProximityRewardEnchant) diff --git a/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs index 02b81cda59..16b2386702 100644 --- a/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs +++ b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs @@ -29,6 +29,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.ownerHitCheck = true; projectile.melee = true; projectile.scale = 1.75f; + projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs index 165fcecad2..cca960c8ab 100644 --- a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs +++ b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 7; + projectile.localNPCHitCooldown = 13; } // Vanilla Terraria doesn't sync projectile rotation, but it does sync velocity. diff --git a/Projectiles/Magic/ClimaxBeam.cs b/Projectiles/Magic/ClimaxBeam.cs index 61bf9854be..35522d47d9 100644 --- a/Projectiles/Magic/ClimaxBeam.cs +++ b/Projectiles/Magic/ClimaxBeam.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - DisplayName.SetDefault("Beam"); + DisplayName.SetDefault("Voltaic Bolt"); } public override void SetDefaults() @@ -21,6 +21,7 @@ namespace CalamityMod.Projectiles.Magic projectile.timeLeft = 90; projectile.magic = true; projectile.ignoreWater = true; + projectile.tileCollide = false; } public override void AI() diff --git a/Projectiles/Magic/ClimaxProj.cs b/Projectiles/Magic/ClimaxProj.cs index 58a5ab7cac..3c9a8e8308 100644 --- a/Projectiles/Magic/ClimaxProj.cs +++ b/Projectiles/Magic/ClimaxProj.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Magic { public override void SetStaticDefaults() { - DisplayName.SetDefault("Climax"); + DisplayName.SetDefault("Voltaic Orb"); Main.projFrames[projectile.type] = 5; } @@ -21,10 +21,10 @@ namespace CalamityMod.Projectiles.Magic projectile.light = 0.5f; projectile.tileCollide = false; projectile.penetrate = -1; - projectile.timeLeft = 150; + projectile.timeLeft = 96; projectile.magic = true; - projectile.ignoreWater = true; - } + projectile.ignoreWater = true; + } public override void AI() { @@ -50,8 +50,8 @@ namespace CalamityMod.Projectiles.Magic } } - if (projectile.timeLeft % 4 == projectile.ai[0]) - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 8f, 4f, 2, ModContent.ProjectileType(), 1D, true); + if (projectile.timeLeft % 4 == projectile.ai[0]) + CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 8f, 4f, 2, ModContent.ProjectileType(), 1D, true); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Magic/Climax2.cs b/Projectiles/Magic/VoidVortexProj.cs similarity index 90% rename from Projectiles/Magic/Climax2.cs rename to Projectiles/Magic/VoidVortexProj.cs index 8832edf931..eb4b9da4c8 100644 --- a/Projectiles/Magic/Climax2.cs +++ b/Projectiles/Magic/VoidVortexProj.cs @@ -5,7 +5,7 @@ using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class Climax2 : ModProjectile + public class VoidVortexProj : ModProjectile { private double timeElapsed = 0.0; private double circleSize = 1.0; @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - DisplayName.SetDefault("Climax"); + DisplayName.SetDefault("Void Vortex"); Main.projFrames[projectile.type] = 5; } @@ -22,8 +22,8 @@ namespace CalamityMod.Projectiles.Magic projectile.width = 38; projectile.height = 38; projectile.friendly = true; - projectile.ignoreWater = true; - projectile.light = 0.5f; + projectile.ignoreWater = true; + projectile.light = 0.5f; projectile.tileCollide = false; projectile.penetrate = -1; projectile.timeLeft = 420; @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Magic } } - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 8f, 8f, 2, ModContent.ProjectileType(), 1D, true); + CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 8f, 8f, 2, ModContent.ProjectileType(), 1D, true); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Magic/Climax2.png b/Projectiles/Magic/VoidVortexProj.png similarity index 100% rename from Projectiles/Magic/Climax2.png rename to Projectiles/Magic/VoidVortexProj.png diff --git a/Projectiles/Magic/VolatileStarcore.cs b/Projectiles/Magic/VolatileStarcore.cs index 552a9992d3..6929e11f78 100644 --- a/Projectiles/Magic/VolatileStarcore.cs +++ b/Projectiles/Magic/VolatileStarcore.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -99,8 +100,9 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitPvp(Player target, int damage, bool crit) { + target.AddBuff(BuffID.Daybreak, 900); target.AddBuff(ModContent.BuffType(), 900); - } + } public override void Kill(int timeLeft) { @@ -109,7 +111,7 @@ namespace CalamityMod.Projectiles.Magic // Spawn a Helium Flash on impact int type = ModContent.ProjectileType(); - int damage = projectile.damage / 2; + int damage = (int)(HeliumFlash.ExplosionDamageMultiplier * projectile.damage); float kb = 9.5f; Projectile.NewProjectile(projectile.Center, Vector2.Zero, type, damage, kb, projectile.owner, 0f, 0f); } diff --git a/Projectiles/Melee/CosmicShivBall.cs b/Projectiles/Melee/CosmicShivBall.cs index 5c69f79a4d..3263436039 100644 --- a/Projectiles/Melee/CosmicShivBall.cs +++ b/Projectiles/Melee/CosmicShivBall.cs @@ -10,10 +10,11 @@ namespace CalamityMod.Projectiles.Melee { public class CosmicShivBall : ModProjectile { + // TODO - Please for the love of god refactor this at some point. It is ancient. public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public NPC target = null; - public const float maxDistanceToTarget = 300f; + public const float maxDistanceToTarget = 540f; public bool initialized = false; public float startingVelocityY = 0f; public float randomAngleDelta = 0f; @@ -61,15 +62,15 @@ namespace CalamityMod.Projectiles.Melee } if (target != null) { - const float turnSpeed = 20f; - const float speedMult = 48f; - Vector2 distNorm = (target.Center - projectile.Center).SafeNormalize(Vector2.UnitX); - projectile.velocity = (projectile.velocity * (turnSpeed - 1f) + distNorm * speedMult) / turnSpeed; + float inertia = 35f; + float homingSpeed = 33.5f; + Vector2 idealVelocity = projectile.SafeDirectionTo(target.Center, Vector2.UnitX) * homingSpeed; + projectile.velocity = (projectile.velocity * (inertia - 1f) + idealVelocity) / inertia; } else { projectile.ai[0]++; - projectile.velocity.Y = startingVelocityY + (float)(16.0 * Math.Cos((double)projectile.ai[0] / 12.0 + (double)randomAngleDelta)); + projectile.velocity.Y = startingVelocityY + (float)(Math.Cos(projectile.ai[0] / 12D + randomAngleDelta) * 7D); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/DevilsSunriseProj.cs b/Projectiles/Melee/DevilsSunriseProj.cs index 6f943b40c1..36b7919c34 100644 --- a/Projectiles/Melee/DevilsSunriseProj.cs +++ b/Projectiles/Melee/DevilsSunriseProj.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/Melee/DragonRageStaff.cs b/Projectiles/Melee/DragonRageStaff.cs index 57c21c93f0..8fa94959c9 100644 --- a/Projectiles/Melee/DragonRageStaff.cs +++ b/Projectiles/Melee/DragonRageStaff.cs @@ -31,6 +31,7 @@ namespace CalamityMod.Projectiles.Melee projectile.hide = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; + projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/Melee/MarniteObliteratorProj.cs b/Projectiles/Melee/MarniteObliteratorProj.cs index ae875ee8fc..f685f7f62a 100644 --- a/Projectiles/Melee/MarniteObliteratorProj.cs +++ b/Projectiles/Melee/MarniteObliteratorProj.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee projectile.hide = true; projectile.ownerHitCheck = true; projectile.melee = true; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } } } diff --git a/Projectiles/Melee/MurasamaSlash.cs b/Projectiles/Melee/MurasamaSlash.cs index 80058e9f6c..ef161d7879 100644 --- a/Projectiles/Melee/MurasamaSlash.cs +++ b/Projectiles/Melee/MurasamaSlash.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Melee projectile.usesIDStaticNPCImmunity = true; projectile.idStaticNPCHitCooldown = 21; projectile.frameCounter = 0; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Melee/PrismRay.cs b/Projectiles/Melee/PrismRay.cs index 7d3b81c3bd..7633d8682d 100644 --- a/Projectiles/Melee/PrismRay.cs +++ b/Projectiles/Melee/PrismRay.cs @@ -1,15 +1,15 @@ -using CalamityMod.Items; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class PrismRay : ModProjectile { public Vector2 StartingPosition; - public Color RayColor => CalamityUtils.MulticolorLerp(RayHue, CalamityGlobalItem.ExoPalette); + public Color RayColor => CalamityUtils.MulticolorLerp(RayHue, CalamityUtils.ExoPalette); public Color HueDownscaledRayColor => RayColor * 0.66f; public ref float RayHue => ref projectile.ai[0]; public ref float Time => ref projectile.localAI[1]; diff --git a/Projectiles/Melee/Spears/AmidiasTridentProj.cs b/Projectiles/Melee/Spears/AmidiasTridentProj.cs index e6ed3edefe..3beca2fd09 100644 --- a/Projectiles/Melee/Spears/AmidiasTridentProj.cs +++ b/Projectiles/Melee/Spears/AmidiasTridentProj.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/AstralPikeProj.cs b/Projectiles/Melee/Spears/AstralPikeProj.cs index 4a9f04712d..94ca091c53 100644 --- a/Projectiles/Melee/Spears/AstralPikeProj.cs +++ b/Projectiles/Melee/Spears/AstralPikeProj.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/BansheeHookProj.cs b/Projectiles/Melee/Spears/BansheeHookProj.cs index 90d4974778..3b95119831 100644 --- a/Projectiles/Melee/Spears/BansheeHookProj.cs +++ b/Projectiles/Melee/Spears/BansheeHookProj.cs @@ -30,7 +30,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; projectile.alpha = 255; - //projectile.Calamity().trueMelee = true; } public override SpearType SpearAiType => SpearType.GhastlyGlaiveSpear; diff --git a/Projectiles/Melee/Spears/BrimlanceProj.cs b/Projectiles/Melee/Spears/BrimlanceProj.cs index 4d75f0be6e..e256a4389d 100644 --- a/Projectiles/Melee/Spears/BrimlanceProj.cs +++ b/Projectiles/Melee/Spears/BrimlanceProj.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs b/Projectiles/Melee/Spears/DiseasedPikeSpear.cs index c320e0737f..5dad1b6d03 100644 --- a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs +++ b/Projectiles/Melee/Spears/DiseasedPikeSpear.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/EarthenPikeSpear.cs b/Projectiles/Melee/Spears/EarthenPikeSpear.cs index 6f70ba1bbd..7bb7360f06 100644 --- a/Projectiles/Melee/Spears/EarthenPikeSpear.cs +++ b/Projectiles/Melee/Spears/EarthenPikeSpear.cs @@ -26,7 +26,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs b/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs index ad14606432..52303501c0 100644 --- a/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs +++ b/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; diff --git a/Projectiles/Melee/Spears/FulgurationHalberdProj.cs b/Projectiles/Melee/Spears/FulgurationHalberdProj.cs index 91551c48ee..67a26ee483 100644 --- a/Projectiles/Melee/Spears/FulgurationHalberdProj.cs +++ b/Projectiles/Melee/Spears/FulgurationHalberdProj.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/GildedProboscisProj.cs b/Projectiles/Melee/Spears/GildedProboscisProj.cs index 4526ffab88..a32f26c39c 100644 --- a/Projectiles/Melee/Spears/GildedProboscisProj.cs +++ b/Projectiles/Melee/Spears/GildedProboscisProj.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 4; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } // These numbers sure are common, huh? yeah, they are diff --git a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs index 49bd3f8949..784facd3d5 100644 --- a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs +++ b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs @@ -23,7 +23,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs index 2405eb9ebe..b7080ec2c9 100644 --- a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs +++ b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/InsidiousImpalerProj.cs b/Projectiles/Melee/Spears/InsidiousImpalerProj.cs index ebca48c63d..dfec53513a 100644 --- a/Projectiles/Melee/Spears/InsidiousImpalerProj.cs +++ b/Projectiles/Melee/Spears/InsidiousImpalerProj.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; - //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/MarniteSpearProjectile.cs b/Projectiles/Melee/Spears/MarniteSpearProjectile.cs index 6cbde975c3..4f8192da22 100644 --- a/Projectiles/Melee/Spears/MarniteSpearProjectile.cs +++ b/Projectiles/Melee/Spears/MarniteSpearProjectile.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/NadirSpear.cs b/Projectiles/Melee/Spears/NadirSpear.cs index 61e4138a06..2c3ba98ec3 100644 --- a/Projectiles/Melee/Spears/NadirSpear.cs +++ b/Projectiles/Melee/Spears/NadirSpear.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 4; - //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 5.5f; diff --git a/Projectiles/Melee/Spears/SausageMakerSpear.cs b/Projectiles/Melee/Spears/SausageMakerSpear.cs index c375b431af..d2f7c8499f 100644 --- a/Projectiles/Melee/Spears/SausageMakerSpear.cs +++ b/Projectiles/Melee/Spears/SausageMakerSpear.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/SpatialLanceProjectile.cs b/Projectiles/Melee/Spears/SpatialLanceProjectile.cs index bd0454caaa..37cae1e3fa 100644 --- a/Projectiles/Melee/Spears/SpatialLanceProjectile.cs +++ b/Projectiles/Melee/Spears/SpatialLanceProjectile.cs @@ -30,7 +30,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 7; - //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs index 2ffb51c4fb..083414ef43 100644 --- a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs +++ b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/StreamGougeProj.cs b/Projectiles/Melee/Spears/StreamGougeProj.cs index 9096c3e3ee..c4a0b6fd58 100644 --- a/Projectiles/Melee/Spears/StreamGougeProj.cs +++ b/Projectiles/Melee/Spears/StreamGougeProj.cs @@ -30,7 +30,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.hide = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; - //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs b/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs index 755b3b173d..1713ccaee7 100644 --- a/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs +++ b/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; projectile.usesIDStaticNPCImmunity = true; projectile.idStaticNPCHitCooldown = 15; } diff --git a/Projectiles/Melee/Spears/TerraLanceProjectile.cs b/Projectiles/Melee/Spears/TerraLanceProjectile.cs index 1353d9b72c..7172dcf6ab 100644 --- a/Projectiles/Melee/Spears/TerraLanceProjectile.cs +++ b/Projectiles/Melee/Spears/TerraLanceProjectile.cs @@ -24,7 +24,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/UrchinSpearProjectile.cs b/Projectiles/Melee/Spears/UrchinSpearProjectile.cs index 0157170e2b..9401b5637c 100644 --- a/Projectiles/Melee/Spears/UrchinSpearProjectile.cs +++ b/Projectiles/Melee/Spears/UrchinSpearProjectile.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/YateveoBloomSpear.cs b/Projectiles/Melee/Spears/YateveoBloomSpear.cs index 5220848d6b..9da2f9ca74 100644 --- a/Projectiles/Melee/Spears/YateveoBloomSpear.cs +++ b/Projectiles/Melee/Spears/YateveoBloomSpear.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/TaintedBladeSlasher.cs b/Projectiles/Melee/TaintedBladeSlasher.cs index 30b8eace4f..e09d257afe 100644 --- a/Projectiles/Melee/TaintedBladeSlasher.cs +++ b/Projectiles/Melee/TaintedBladeSlasher.cs @@ -118,6 +118,7 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 90000; projectile.usesLocalNPCImmunity = true; projectile.noEnchantments = true; + projectile.Calamity().trueMelee = true; } public override void SendExtraAI(BinaryWriter writer) => writer.Write(VerticalOffset); @@ -189,7 +190,8 @@ namespace CalamityMod.Projectiles.Melee projectile.Center += (destination - projectile.Center).SafeNormalize(Vector2.Zero) * MathHelper.Min(projectile.Distance(destination), 12f + Owner.velocity.Length()); // Ensure that the position is never too far from the destination. - CalamityUtils.DistanceClamp(ref projectile.position, ref destination, 50f); + if (!projectile.WithinRange(destination, 300f)) + projectile.Center = destination; Time++; } diff --git a/Projectiles/Ranged/Aquashard.cs b/Projectiles/Ranged/Aquashard.cs index 0901bbb88b..b0b763a4c5 100644 --- a/Projectiles/Ranged/Aquashard.cs +++ b/Projectiles/Ranged/Aquashard.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { projectile.width = 10; - projectile.height = 16; + projectile.height = 10; projectile.friendly = true; projectile.ranged = true; projectile.penetrate = 1; @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - int projAmt = Main.rand.Next(2, 4); + int projAmt = Main.rand.Next(1, 3); if (projectile.owner == Main.myPlayer) { for (int i = 0; i < projAmt; i++) diff --git a/Projectiles/Ranged/AquashardSplit.cs b/Projectiles/Ranged/AquashardSplit.cs index 9b0f5db1f6..0ce0ef2bad 100644 --- a/Projectiles/Ranged/AquashardSplit.cs +++ b/Projectiles/Ranged/AquashardSplit.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { projectile.width = 10; - projectile.height = 16; + projectile.height = 10; projectile.friendly = true; projectile.ranged = true; projectile.penetrate = 1; diff --git a/Projectiles/Ranged/EssenceFire.cs b/Projectiles/Ranged/EssenceFire.cs index b8ec097d7b..b434b45346 100644 --- a/Projectiles/Ranged/EssenceFire.cs +++ b/Projectiles/Ranged/EssenceFire.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Ranged num296 = 0.75f; } projectile.ai[0] += 1f; - int dustType = (int)CalamityDusts.PurpleCosmolite; + int dustType = (int)CalamityDusts.PurpleCosmilite; if (Main.rand.NextBool(2)) { for (int num298 = 0; num298 < 1; num298++) diff --git a/Projectiles/Ranged/GodSlayerSlugProj.cs b/Projectiles/Ranged/GodSlayerSlugProj.cs index 029616278d..dbbafe9be0 100644 --- a/Projectiles/Ranged/GodSlayerSlugProj.cs +++ b/Projectiles/Ranged/GodSlayerSlugProj.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.IO; using Terraria; @@ -13,6 +14,9 @@ namespace CalamityMod.Projectiles.Ranged private const int NoDrawFrames = 2; private const int BlueNoCollideFrames = 9; private const int TurnBlueFrameDelay = 7; + // Radius of the "circle of inaccuracy" surrounding the mouse. Blue bullets will aim at this circle. + private const float MouseAimDeviation = 13f; + private const int TextureHeight = 136; private bool BlueMode => projectile.ai[0] != 0f; public override string Texture => "CalamityMod/Projectiles/Ranged/GodSlayerSlugPurple"; @@ -43,8 +47,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = -1; projectile.timeLeft = Lifetime; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void SendExtraAI(BinaryWriter writer) => writer.Write(projectile.tileCollide); public override void ReceiveExtraAI(BinaryReader reader) => projectile.tileCollide = reader.ReadBoolean(); @@ -69,8 +73,9 @@ namespace CalamityMod.Projectiles.Ranged if (projectile.numHits > 0 && CalamityUtils.FinalExtraUpdate(projectile) && !BlueMode) ++projectile.ai[1]; - // If the bullet has struck at least one target but hasn't hit anything for ten frames, turn blue and warp. - if (projectile.ai[1] >= TurnBlueFrameDelay) + // If the bullet has struck at least one target but hasn't hit anything for several frames, turn blue and warp. + // Obviously if the bullet is already blue, it can't turn blue again. + if (!BlueMode && projectile.ai[1] >= TurnBlueFrameDelay) TurnBlue(true); // When blue, ignore walls for the first several updates. @@ -91,10 +96,11 @@ namespace CalamityMod.Projectiles.Ranged projectile.ai[1] = BlueNoCollideFrames; projectile.tileCollide = false; - // Reduce damage, but remove piercing + // Reduce damage, but remove piercing. Reset local iframes so the bullet, turned blue, may always strike again. projectile.damage = (int)(0.3f * projectile.damage); projectile.penetrate = 1; - projectile.usesLocalNPCImmunity = false; + for (int i = 0; i < Main.maxNPCs; i++) + projectile.localNPCImmunity[i] = 0; // Reset projectile lifetime so it can fly again for its full possible range projectile.timeLeft = Lifetime - NoDrawFrames * projectile.MaxUpdates; @@ -102,24 +108,38 @@ namespace CalamityMod.Projectiles.Ranged if (!setPosition || Main.myPlayer != projectile.owner) return; + // The bullet disappears in a puff of dust. + ProduceWarpCrossDust(projectile.Center, (int)CalamityDusts.PurpleCosmilite); + // The warp must be performed client side because it requires knowledge of the player's mouse position. projectile.netUpdate = true; projectile.tileCollide = false; - Vector2 mouseVec = CalamityUtils.SafeDirectionTo(Main.LocalPlayer, Main.MouseWorld, -Vector2.UnitY); + + // Step 1 of the warp: Place the bullet behind the player, opposite the mouse cursor. + Vector2 playerToMouseVec = CalamityUtils.SafeDirectionTo(Main.LocalPlayer, Main.MouseWorld, -Vector2.UnitY); float warpDist = Main.rand.NextFloat(70f, 96f); float warpAngle = Main.rand.NextFloat(-MathHelper.Pi / 3f, MathHelper.Pi / 3f); - Vector2 warpOffset = -warpDist * mouseVec.RotatedBy(warpAngle); + Vector2 warpOffset = -warpDist * playerToMouseVec.RotatedBy(warpAngle); projectile.position = Main.LocalPlayer.MountedCenter + warpOffset; - // Set all old positions to the bullet's warp position so that there aren't weird afterimages + // Step 2 of the warp: Angle the bullet so that it is pointing at the mouse cursor. + // This intentionally has a slight inaccuracy. + Vector2 mouseTargetVec = Main.MouseWorld + Main.rand.NextVector2Circular(MouseAimDeviation, MouseAimDeviation); + Vector2 bulletToMouseVec = CalamityUtils.SafeDirectionTo(projectile, mouseTargetVec, -Vector2.UnitY); + projectile.velocity = bulletToMouseVec * projectile.localAI[0]; + + // Set all old positions to the bullet's warp position so that there aren't weird afterimages. + // If an old position is uninitialized (0,0 aka never used), then don't change it. for (int i = 0; i < ProjectileID.Sets.TrailCacheLength[projectile.type]; ++i) - projectile.oldPos[i] = projectile.position; + { + Vector2 oldPosElem = projectile.oldPos[i]; + if (!(oldPosElem == Vector2.Zero)) + projectile.oldPos[i] = projectile.position; + } - // TODO -- when the bullet warps it should produce a tiny puff of dust - // this may require vector math so that the puff of dust is at the back of the bullet - - // TODO -- the bullet should aim itself towards the mouse with about 26px square deviation - projectile.velocity = mouseVec * projectile.localAI[0]; + // Now that the bullet has warped, produce a tiny puff of dust at its back for effect. + Vector2 warpInDustPos = projectile.Center - bulletToMouseVec * TextureHeight; + ProduceWarpCrossDust(warpInDustPos, (int)CalamityDusts.BlueCosmilite); } public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, 140); @@ -143,12 +163,13 @@ namespace CalamityMod.Projectiles.Ranged projectile.Damage(); // Create a fancy triangle of dust. - // TODO: This is too loose, it needs to be a tight triangular pattern. - int dustID = 180; - for (int i = 0; i < 9; ++i) + int dustID = (int)CalamityDusts.BlueCosmilite; + int numDust = 9; + float triangleAngle = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < numDust; ++i) { - float speed = Main.rand.NextFloat(3f, 11.2f); - Vector2 dustVel = new Vector2(speed, 0f).RotatedByRandom(MathHelper.TwoPi); + float speed = MathHelper.Lerp(0.2f, 3.6f, i / (float)(numDust - 1)); + Vector2 dustVel = Vector2.UnitX.RotatedBy(triangleAngle) * speed; Dust d = Dust.NewDustDirect(projectile.Center, 0, 0, dustID); d.position = projectile.Center; d.velocity = dustVel; @@ -172,5 +193,22 @@ namespace CalamityMod.Projectiles.Ranged Main.PlaySound(SoundID.Dig, projectile.Center, 1); return true; } + + private void ProduceWarpCrossDust(Vector2 dustPos, int dustID) + { + for (int i = 0; i < 4; ++i) + { + float speed = Main.rand.NextFloat(2.0f, 4.1f); + Vector2 dustVel = Vector2.UnitX * speed; + Dust d = Dust.NewDustDirect(projectile.Center, 0, 0, dustID); + d.position = dustPos; + d.velocity = dustVel; + d.noGravity = true; + d.scale *= Main.rand.NextFloat(1.1f, 1.4f); + Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.PiOver2); + Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi); + Dust.CloneDust(d).velocity = dustVel.RotatedBy(-MathHelper.PiOver2); + } + } } } diff --git a/Projectiles/Ranged/PrismExplosionLarge.cs b/Projectiles/Ranged/PrismExplosionLarge.cs index c79abef3d0..0ba7cb62bd 100644 --- a/Projectiles/Ranged/PrismExplosionLarge.cs +++ b/Projectiles/Ranged/PrismExplosionLarge.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 36; i++) { Vector2 lightDrawPosition = drawPosition + (MathHelper.TwoPi * i / 36f + Main.GlobalTime * 5f).ToRotationVector2() * projectile.scale * 20f; - Color lightBurstColor = CalamityUtils.MulticolorLerp(projectile.timeLeft / 144f, Items.CalamityGlobalItem.ExoPalette); + Color lightBurstColor = CalamityUtils.MulticolorLerp(projectile.timeLeft / 144f, CalamityUtils.ExoPalette); lightBurstColor = Color.Lerp(lightBurstColor, Color.White, 0.4f) * projectile.Opacity * 0.04f; lightBurstColor.A = 0; spriteBatch.Draw(lightTexture, lightDrawPosition, null, lightBurstColor, 0f, lightTexture.Size() * 0.5f, projectile.scale * 4.5f, SpriteEffects.None, 0f); diff --git a/Projectiles/Rogue/BurningStrifeProj.cs b/Projectiles/Rogue/BurningStrifeProj.cs index 316094df18..ab9272292e 100644 --- a/Projectiles/Rogue/BurningStrifeProj.cs +++ b/Projectiles/Rogue/BurningStrifeProj.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.Calamity().stealthStrike && projectile.penetrate != 1) { Main.PlaySound(SoundID.Item, projectile.Center, 103); - int proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), projectile.knockBack, projectile.owner); + int proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.33), projectile.knockBack, projectile.owner); Main.projectile[proj].Center = projectile.Center; Main.projectile[proj].Calamity().rogue = true; } @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.Calamity().stealthStrike && projectile.penetrate != 1) { Main.PlaySound(SoundID.Item, projectile.Center, 103); - int proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), projectile.knockBack, projectile.owner); + int proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.33), projectile.knockBack, projectile.owner); Main.projectile[proj].Center = projectile.Center; Main.projectile[proj].Calamity().rogue = true; } @@ -82,9 +82,9 @@ namespace CalamityMod.Projectiles.Rogue int proj; Main.PlaySound(SoundID.Item, projectile.Center, 103); if(projectile.Calamity().stealthStrike) - proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), projectile.knockBack, projectile.owner); + proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.33), projectile.knockBack, projectile.owner); else - proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), projectile.knockBack, projectile.owner); + proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.33), projectile.knockBack, projectile.owner); Main.projectile[proj].Center = projectile.Center; Main.projectile[proj].Calamity().rogue = true; } diff --git a/Projectiles/Rogue/EradicatorProjectile.cs b/Projectiles/Rogue/EradicatorProjectile.cs index 38403d84a8..ce62d4384f 100644 --- a/Projectiles/Rogue/EradicatorProjectile.cs +++ b/Projectiles/Rogue/EradicatorProjectile.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Rogue { public override string Texture => "CalamityMod/Items/Weapons/Rogue/Eradicator"; private const float RotationIncrement = 0.09f; - private const int Lifetime = 170; + private const int Lifetime = 230; private const float ReboundTime = 40f; private float randomLaserCharge = 0f; diff --git a/Projectiles/Rogue/FinalDawnProjectile.cs b/Projectiles/Rogue/FinalDawnProjectile.cs index ce177acb2a..ab88411ad9 100644 --- a/Projectiles/Rogue/FinalDawnProjectile.cs +++ b/Projectiles/Rogue/FinalDawnProjectile.cs @@ -127,7 +127,7 @@ namespace CalamityMod.Projectiles.Rogue int stealth = Projectile.NewProjectile(projectile.Center, projectile.velocity, ModContent.ProjectileType(), - (int)(projectile.damage * 1.5f), + (int)(projectile.damage * 1.275f), projectile.knockBack, projectile.owner); Main.projectile[stealth].Calamity().stealthStrike = true; diff --git a/Projectiles/Rogue/RefractionRotorProjectile.cs b/Projectiles/Rogue/RefractionRotorProjectile.cs index 24cdfaf854..54eba6c84e 100644 --- a/Projectiles/Rogue/RefractionRotorProjectile.cs +++ b/Projectiles/Rogue/RefractionRotorProjectile.cs @@ -84,18 +84,19 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.Calamity().stealthStrike) { int bladeType = ModContent.ProjectileType(); + int rocketDamage = (int)(projectile.damage * 0.8); for (int i = 0; i < 6; i++) { Vector2 shootDirection = (MathHelper.TwoPi * i / 6f + projectile.rotation + MathHelper.PiOver2).ToRotationVector2(); Vector2 spawnPosition = projectile.Center + projectile.Size * 0.5f * projectile.scale * shootDirection * 0.85f; - Projectile.NewProjectile(spawnPosition, projectile.velocity * 0.5f + shootDirection * 7f, bladeType, projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(spawnPosition, projectile.velocity * 0.5f + shootDirection * 7f, bladeType, rocketDamage, projectile.knockBack, projectile.owner); } } if (CalamityUtils.CountProjectiles(shootType) > 24) return; - int energyDamage = (int)(projectile.damage * 0.66); + int energyDamage = (int)(projectile.damage * 0.495); float baseDirectionRotation = Main.rand.NextFloat(MathHelper.TwoPi); for (int i = 0; i < EnergyShotCount; i++) { diff --git a/Projectiles/Rogue/SacrificeProjectile.cs b/Projectiles/Rogue/SacrificeProjectile.cs index f091712f59..f936abd54b 100644 --- a/Projectiles/Rogue/SacrificeProjectile.cs +++ b/Projectiles/Rogue/SacrificeProjectile.cs @@ -23,15 +23,15 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 62; - projectile.height = 18; + projectile.width = projectile.height = 62; projectile.friendly = true; projectile.ignoreWater = true; + projectile.tileCollide = false; projectile.penetrate = -1; projectile.timeLeft = 600; projectile.Calamity().rogue = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + projectile.localNPCHitCooldown = 9; } public override void SendExtraAI(BinaryWriter writer) => writer.Write(AbleToHealOwner); @@ -79,6 +79,7 @@ namespace CalamityMod.Projectiles.Rogue if (StickingToAnything && projectile.timeLeft > 90) projectile.timeLeft = 90; + projectile.StickyProjAI(50); } @@ -94,16 +95,6 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); - projectile.Kill(); - return false; - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); - public override void Kill(int timeLeft) { for (int i = 0; i < 5; i++) diff --git a/Projectiles/Rogue/SupernovaBomb.cs b/Projectiles/Rogue/SupernovaBomb.cs index d303ea6680..65ac1883c8 100644 --- a/Projectiles/Rogue/SupernovaBomb.cs +++ b/Projectiles/Rogue/SupernovaBomb.cs @@ -64,16 +64,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.rotation += projectile.velocity.X * 0.1f; //stealth strike - if (projectile.Calamity().stealthStrike == true) - { - if (projectile.timeLeft % 8 == 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, 2f, ModContent.ProjectileType(), (int)(projectile.damage * 0.8), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } + if (projectile.Calamity().stealthStrike && projectile.timeLeft % 8 == 0 && projectile.owner == Main.myPlayer) + Projectile.NewProjectile(projectile.Center, Vector2.UnitY * 2f, ModContent.ProjectileType(), (int)(projectile.damage * 0.48), projectile.knockBack, projectile.owner, 0f, 0f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/TheAtomSplitterDuplicate.cs b/Projectiles/Rogue/TheAtomSplitterDuplicate.cs index aad20f8398..4f5042ac4a 100644 --- a/Projectiles/Rogue/TheAtomSplitterDuplicate.cs +++ b/Projectiles/Rogue/TheAtomSplitterDuplicate.cs @@ -1,4 +1,3 @@ -using CalamityMod.Items; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -54,7 +53,7 @@ namespace CalamityMod.Projectiles.Rogue if (Time <= 1f) return false; - Color drawColor = CalamityUtils.MulticolorLerp((Time / 35f + projectile.identity / 4f) % 1f, CalamityGlobalItem.ExoPalette); + Color drawColor = CalamityUtils.MulticolorLerp((Time / 35f + projectile.identity / 4f) % 1f, CalamityUtils.ExoPalette); drawColor.A = 0; CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], drawColor); return false; diff --git a/Projectiles/Rogue/TheAtomSplitterProjectile.cs b/Projectiles/Rogue/TheAtomSplitterProjectile.cs index 530230a8b7..7798a1947a 100644 --- a/Projectiles/Rogue/TheAtomSplitterProjectile.cs +++ b/Projectiles/Rogue/TheAtomSplitterProjectile.cs @@ -1,4 +1,3 @@ -using CalamityMod.Items; using Microsoft.Xna.Framework; using System; using System.IO; @@ -12,7 +11,7 @@ namespace CalamityMod.Projectiles.Rogue // Atom splitting is cool and all, but actual thermonuclear meltdown levels of DPS is unacceptable. // DO NOT increase this unless you are ABSOLUTELY SURE you know what will happen. private const float NormalSplitMultiplier = 0.7f; - private const float StealthSplitMultiplier = 0.12f; + private const float StealthSplitMultiplier = 0.144f; public ref float HitTargetIndex => ref projectile.ai[0]; public ref float Time => ref projectile.ai[1]; @@ -87,7 +86,7 @@ namespace CalamityMod.Projectiles.Rogue float dustVelocityArcOffset = 1.5f + (float)Math.Sin(MathHelper.TwoPi * projectile.timeLeft / 35f) * 0.25f; float colorInterpolant = (float)Math.Cos(MathHelper.TwoPi * projectile.timeLeft / 75f) * 0.5f + 0.5f; - Color dustColor = CalamityUtils.MulticolorLerp(colorInterpolant, CalamityGlobalItem.ExoPalette); + Color dustColor = CalamityUtils.MulticolorLerp(colorInterpolant, CalamityUtils.ExoPalette); Vector2 currentDirection = projectile.velocity.SafeNormalize(-Vector2.UnitY); Vector2 tipPosition = projectile.Center + currentDirection * (projectile.height * 0.67f - 3f); tipPosition += Main.rand.NextVector2CircularEdge(0.35f, 0.35f); @@ -139,7 +138,7 @@ namespace CalamityMod.Projectiles.Rogue for (float i = 0f; i < dustCount; i++) { - Color dustColor = CalamityUtils.MulticolorLerp(Main.rand.NextFloat(), CalamityGlobalItem.ExoPalette); + Color dustColor = CalamityUtils.MulticolorLerp(Main.rand.NextFloat(), CalamityUtils.ExoPalette); Dust explosionDust = Dust.NewDustDirect(spawnPosition, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); explosionDust.position = spawnPosition; explosionDust.velocity = baseDustVelocity.RotatedBy(MathHelper.TwoPi * i / dustCount) * outwardFireSpeedFactor * Main.rand.NextFloat(0.8f, 1.2f); diff --git a/Projectiles/Summon/DaedalusGolem.cs b/Projectiles/Summon/DaedalusGolem.cs index ef481613a1..583a6b1c10 100644 --- a/Projectiles/Summon/DaedalusGolem.cs +++ b/Projectiles/Summon/DaedalusGolem.cs @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Summon light.scale = Main.rand.NextFloat(1.2f, 1.45f); light.noGravity = true; } - else if (AttackTimer >= ChargedLaserAttackTime / 2 && AttackTimer <= ChargedLaserAttackTime / 2 + 60 && AttackTimer % 10 == 9) + else if (AttackTimer >= ChargedLaserAttackTime / 2 && AttackTimer <= ChargedLaserAttackTime / 2 + 60 && AttackTimer % 16 == 15) { Main.PlaySound(SoundID.Item122, ArmPosition); if (Main.myPlayer == projectile.owner) diff --git a/Projectiles/Summon/GammaHead.cs b/Projectiles/Summon/GammaHead.cs index d989b40b4b..0574ead5ae 100644 --- a/Projectiles/Summon/GammaHead.cs +++ b/Projectiles/Summon/GammaHead.cs @@ -150,6 +150,9 @@ namespace CalamityMod.Projectiles.Summon // Direction affecting. if (target.Center.X - spawnPosition.X < 0) fireAngle += MathHelper.Pi; + if (projectile.direction == (target.Center.X < spawnPosition.X).ToDirectionInt()) + fireAngle += MathHelper.Pi; + idealRotation = fireAngle; // Shoot the actual canister. diff --git a/Projectiles/Summon/MechwormHead.cs b/Projectiles/Summon/MechwormHead.cs index 987d15575b..14fead861c 100644 --- a/Projectiles/Summon/MechwormHead.cs +++ b/Projectiles/Summon/MechwormHead.cs @@ -161,11 +161,11 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < 35; i++) { - Dust burstDust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.PurpleCosmolite); + Dust burstDust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.PurpleCosmilite); burstDust.velocity = (MathHelper.TwoPi * i / 35f).ToRotationVector2().RotatedByRandom(0.035f) * 12f; burstDust.noGravity = true; - burstDust = Dust.NewDustDirect(projectile.Center, 70, 70, (int)CalamityDusts.PurpleCosmolite); + burstDust = Dust.NewDustDirect(projectile.Center, 70, 70, (int)CalamityDusts.PurpleCosmilite); burstDust.velocity = Main.rand.NextVector2CircularEdge(6f, 6f); burstDust.scale = Main.rand.NextFloat(1.3f, 1.75f); } @@ -412,7 +412,7 @@ namespace CalamityMod.Projectiles.Summon // Spawn a little bit of dust when the portals are destroyed. if (!Main.dedServ) for (int j = 0; j < 16; j++) - Dust.NewDustDirect(proj.position, 45, 45, (int)CalamityDusts.PurpleCosmolite); + Dust.NewDustDirect(proj.position, 45, 45, (int)CalamityDusts.PurpleCosmilite); } } #endregion diff --git a/Projectiles/Summon/PerditionBeacon.cs b/Projectiles/Summon/PerditionBeacon.cs index fdd5ec89b8..c216d38ac1 100644 --- a/Projectiles/Summon/PerditionBeacon.cs +++ b/Projectiles/Summon/PerditionBeacon.cs @@ -152,7 +152,9 @@ namespace CalamityMod.Projectiles.Summon Vector2 spawnPosition = Target.Center + Vector2.UnitY.RotatedByRandom(0.27f) * 1150f; Vector2 shootVelocity = (Target.Center - spawnPosition).SafeNormalize(-Vector2.UnitY).RotatedByRandom(0.09f) * Main.rand.NextFloat(19f, 31f); - Projectile.NewProjectile(spawnPosition, shootVelocity, rng.Get(), projectile.damage, projectile.knockBack, projectile.owner); + int soul = Projectile.NewProjectile(spawnPosition, shootVelocity, rng.Get(), projectile.damage, projectile.knockBack, projectile.owner); + if (Main.projectile.IndexInRange(soul)) + Main.projectile[soul].Calamity().forceMinion = true; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Summon/SageSpirit.cs b/Projectiles/Summon/SageSpirit.cs index 105c02e434..e8b31cf92b 100644 --- a/Projectiles/Summon/SageSpirit.cs +++ b/Projectiles/Summon/SageSpirit.cs @@ -185,7 +185,7 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < 3; i++) { - Vector2 spikeVelocity = -Vector2.UnitY.RotatedBy(MathHelper.Lerp(-0.56f, 0.56f, i / 3f)) * 6f; + Vector2 spikeVelocity = -Vector2.UnitY.RotatedBy(MathHelper.Lerp(-0.43f, 0.43f, i / 3f)) * 6f; Projectile.NewProjectile(projectile.Top, spikeVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); } } diff --git a/Projectiles/Typeless/BossRushEffectThing.cs b/Projectiles/Typeless/BossRushEffectThing.cs new file mode 100644 index 0000000000..88cf0503ba --- /dev/null +++ b/Projectiles/Typeless/BossRushEffectThing.cs @@ -0,0 +1,77 @@ +using CalamityMod.Events; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.GameContent.Events; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class BossRushEffectThing : ModProjectile + { + public Player Owner => Main.player[projectile.owner]; + public ref float Time => ref projectile.ai[0]; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetDefaults() + { + projectile.width = 2; + projectile.height = 2; + projectile.aiStyle = -1; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.timeLeft = BossRushEvent.StartEffectTotalTime; + projectile.penetrate = -1; + } + + public override void AI() + { + projectile.Center = Owner.Center; + if (Time >= 70f) + MoonlordDeathDrama.RequestLight(Utils.InverseLerp(70f, 85f, Time, true), Main.LocalPlayer.Center); + + if (Time % 10f == 9f) + BossRushEvent.SyncStartTimer((int)Time); + + float currentShakePower = MathHelper.Lerp(8f, 12f, Utils.InverseLerp(BossRushEvent.StartEffectTotalTime * 0.6f, BossRushEvent.StartEffectTotalTime, Time, true)); + currentShakePower *= 1f - Utils.InverseLerp(1500f, 3700f, Main.LocalPlayer.Distance(projectile.Center), true); + Main.LocalPlayer.Calamity().GeneralScreenShakePower = currentShakePower; + + Time++; + } + + public override void Kill(int timeLeft) + { + BossRushEvent.SyncStartTimer(BossRushEvent.StartEffectTotalTime); + for (int doom = 0; doom < 200; doom++) + { + NPC n = Main.npc[doom]; + if (!n.active) + continue; + + // will also correctly despawn EoW because none of his segments are boss flagged + bool shouldDespawn = n.boss || n.type == NPCID.EaterofWorldsHead || n.type == NPCID.EaterofWorldsBody || n.type == NPCID.EaterofWorldsTail; + if (shouldDespawn) + { + n.active = false; + n.netUpdate = true; + } + } + + BossRushEvent.BossRushStage = 0; + BossRushEvent.BossRushActive = true; + string key = "Mods.CalamityMod.BossRushStartText"; + CalamityUtils.DisplayLocalizedText(key, BossRushEvent.XerocTextColor); + + CalamityNetcode.SyncWorld(); + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.BossRushStage); + netMessage.Write(BossRushEvent.BossRushStage); + netMessage.Send(); + } + } + } +} diff --git a/Projectiles/Typeless/BossRushEndEffectThing.cs b/Projectiles/Typeless/BossRushEndEffectThing.cs new file mode 100644 index 0000000000..c9abc03b68 --- /dev/null +++ b/Projectiles/Typeless/BossRushEndEffectThing.cs @@ -0,0 +1,49 @@ +using CalamityMod.Events; +using CalamityMod.Items; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.Events; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class BossRushEndEffectThing : ModProjectile + { + public Player Owner => Main.player[projectile.owner]; + public ref float Time => ref projectile.ai[0]; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetDefaults() + { + projectile.width = 2; + projectile.height = 2; + projectile.aiStyle = -1; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.timeLeft = BossRushEvent.EndVisualEffectTime; + projectile.penetrate = -1; + } + + public override void AI() + { + if (Time == 25f) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/BossRushEnd"), Main.LocalPlayer.Center); + + projectile.Center = Owner.Center; + BossRushEvent.SyncEndTimer((int)Time); + + float currentShakePower = MathHelper.Lerp(1f, 20f, Utils.InverseLerp(140f, 180f, Time, true) * Utils.InverseLerp(10f, 40f, projectile.timeLeft, true)); + Main.LocalPlayer.Calamity().GeneralScreenShakePower = currentShakePower; + + MoonlordDeathDrama.RequestLight(Utils.InverseLerp(220f, 265f, Time, true) * Utils.InverseLerp(10f, 30f, projectile.timeLeft, true), Main.LocalPlayer.Center); + + Time++; + } + + public override void Kill(int timeLeft) + { + BossRushEvent.End(); + DropHelper.DropItem(Main.LocalPlayer, ModContent.ItemType()); + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.BossRushTierFiveEndText", BossRushEvent.XerocTextColor); + } + } +} diff --git a/Projectiles/Typeless/BossRushFailureEffectThing.cs b/Projectiles/Typeless/BossRushFailureEffectThing.cs new file mode 100644 index 0000000000..1c25febbbf --- /dev/null +++ b/Projectiles/Typeless/BossRushFailureEffectThing.cs @@ -0,0 +1,38 @@ +using CalamityMod.Events; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.Events; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class BossRushFailureEffectThing : ModProjectile + { + public Player Owner => Main.player[projectile.owner]; + public ref float Time => ref projectile.ai[0]; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetDefaults() + { + projectile.width = 2; + projectile.height = 2; + projectile.aiStyle = -1; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.timeLeft = 120; + projectile.penetrate = -1; + } + + public override void AI() + { + MoonlordDeathDrama.RequestLight(Utils.InverseLerp(0f, 8f, Time, true), Main.LocalPlayer.Center); + if (Time >= 45f) + { + Main.PlaySound(SoundID.DD2_EtherianPortalOpen, Main.LocalPlayer.Center); + BossRushEvent.End(); + projectile.Kill(); + } + Time++; + } + } +} diff --git a/Projectiles/Typeless/CryonicShield.cs b/Projectiles/Typeless/CryonicShield.cs new file mode 100644 index 0000000000..59182e57fc --- /dev/null +++ b/Projectiles/Typeless/CryonicShield.cs @@ -0,0 +1,87 @@ +using CalamityMod.NPCs; +using CalamityMod.NPCs.AcidRain; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class CryonicShield : ModProjectile + { + public Player Owner => Main.player[projectile.owner]; + public override string Texture => "CalamityMod/NPCs/Cryogen/CryogenIce"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryonic Shield"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 222; + projectile.height = 216; + projectile.ignoreWater = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 90000; + projectile.tileCollide = false; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 25; + } + + public override void AI() + { + // Protect against projectile reflection. + projectile.friendly = true; + projectile.hostile = false; + + // Spin around. + projectile.rotation += MathHelper.Pi / 48f; + + projectile.Center = Owner.Center; + Lighting.AddLight(projectile.Center, projectile.Opacity * 0.2f, projectile.Opacity * 0.45f, projectile.Opacity * 0.5f); + + if (Owner is null || !Owner.active || Owner.dead) + projectile.Kill(); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(ModContent.BuffType(), 60); + + if (target.knockBackResist <= 0f) + return; + + if (CalamityGlobalNPC.ShouldAffectNPC(target)) + { + float knockbackMultiplier = knockback - (1f - target.knockBackResist); + if (knockbackMultiplier < 0) + knockbackMultiplier = 0; + + Vector2 trueKnockback = projectile.SafeDirectionTo(target.Center); + target.velocity = trueKnockback * knockbackMultiplier; + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(ModContent.BuffType(), 60); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, projectile.Size.Length() * 0.5f, targetHitbox); + + public override bool? CanHitNPC(NPC target) + { + if (target.catchItem != 0 && target.type != ModContent.NPCType()) + return false; + + return null; + } + } +} diff --git a/Projectiles/Typeless/CyanLabSeeker.cs b/Projectiles/Typeless/CyanLabSeeker.cs new file mode 100644 index 0000000000..41d77694d6 --- /dev/null +++ b/Projectiles/Typeless/CyanLabSeeker.cs @@ -0,0 +1,61 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class CyanLabSeeker : ModProjectile + { + public ref float Time => ref projectile.ai[0]; + public override string Texture => "CalamityMod/Items/LabFinders/CyanSeekingMechanism"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seeking Mechanism"); + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 24; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.timeLeft = 300; + } + + public override void AI() => RedLabSeeker.Behavior(projectile, CalamityWorld.SunkenSeaLabCenter, Color.Cyan, ref Time); + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 8; i++) + { + Dust dust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(16f, 16f), 267); + dust.color = Color.Cyan; + dust.scale = Main.rand.NextFloat(0.95f, 1.25f); + dust.velocity = Main.rand.NextVector2Circular(2.5f, 2.5f); + dust.velocity.Y -= 1.5f; + dust.fadeIn = 1.2f; + dust.noGravity = true; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + if (Time > 80f && projectile.ai[1] == 0f) + { + for (int i = 0; i < 24; i += 2) + { + Vector2 drawPosition = projectile.Center - projectile.velocity.SafeNormalize(Vector2.Zero) * i * Utils.InverseLerp(80f, 125f, Time, true) * 25f - Main.screenPosition; + spriteBatch.Draw(texture, drawPosition, null, projectile.GetAlpha(lightColor) * (1f - i / 24f), projectile.rotation, texture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + } + } + return true; + } + } +} diff --git a/Projectiles/Typeless/GreenLabSeeker.cs b/Projectiles/Typeless/GreenLabSeeker.cs new file mode 100644 index 0000000000..e4cecb13aa --- /dev/null +++ b/Projectiles/Typeless/GreenLabSeeker.cs @@ -0,0 +1,62 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class GreenLabSeeker : ModProjectile + { + public ref float Time => ref projectile.ai[0]; + public override string Texture => "CalamityMod/Items/LabFinders/GreenSeekingMechanism"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seeking Mechanism"); + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 24; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.timeLeft = 300; + } + + + public override void AI() => RedLabSeeker.Behavior(projectile, CalamityWorld.JungleLabCenter, Color.Green, ref Time); + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 8; i++) + { + Dust dust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(16f, 16f), 267); + dust.color = Color.Green; + dust.scale = Main.rand.NextFloat(0.95f, 1.25f); + dust.velocity = Main.rand.NextVector2Circular(2.5f, 2.5f); + dust.velocity.Y -= 1.5f; + dust.fadeIn = 1.2f; + dust.noGravity = true; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + if (Time > 80f && projectile.ai[1] == 0f) + { + for (int i = 0; i < 24; i += 2) + { + Vector2 drawPosition = projectile.Center - projectile.velocity.SafeNormalize(Vector2.Zero) * i * Utils.InverseLerp(80f, 125f, Time, true) * 25f - Main.screenPosition; + spriteBatch.Draw(texture, drawPosition, null, projectile.GetAlpha(lightColor) * (1f - i / 24f), projectile.rotation, texture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + } + } + return true; + } + } +} diff --git a/Projectiles/Typeless/NebulaDust.cs b/Projectiles/Typeless/NebulaDust.cs index 2e8ff2dc7b..0bf74e90ad 100644 --- a/Projectiles/Typeless/NebulaDust.cs +++ b/Projectiles/Typeless/NebulaDust.cs @@ -1,6 +1,10 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Typeless { public class NebulaDust : ModProjectile @@ -15,8 +19,8 @@ namespace CalamityMod.Projectiles.Typeless projectile.width = 32; projectile.height = 32; projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; + projectile.Opacity = 0f; + projectile.penetrate = -1; projectile.tileCollide = false; projectile.ignoreWater = true; projectile.timeLeft = 3600; @@ -27,39 +31,41 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { projectile.rotation += projectile.velocity.X * 0.02f; + if (projectile.velocity.X < 0f) - { projectile.rotation -= Math.Abs(projectile.velocity.Y) * 0.02f; - } else - { projectile.rotation += Math.Abs(projectile.velocity.Y) * 0.02f; - } + projectile.velocity *= 0.98f; + projectile.ai[0] += 1f; if (projectile.ai[0] >= 60f) { - if (projectile.alpha < 255) + if (projectile.Opacity > 0f) { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } + projectile.Opacity -= 0.02f; + if (projectile.Opacity < 0f) + projectile.Opacity = 0f; } else if (projectile.owner == Main.myPlayer) - { projectile.Kill(); - } } - else if (projectile.alpha > 80) + else if (projectile.Opacity < 0.7f) { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } + projectile.Opacity += 0.1f; + if (projectile.Opacity > 0.7f) + projectile.Opacity = 0.7f; } } - } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + lightColor.R = (byte)(255 * projectile.Opacity); + lightColor.G = (byte)(255 * projectile.Opacity); + lightColor.B = (byte)(255 * projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + return false; + } + } } diff --git a/Projectiles/Typeless/PurpleLabSeeker.cs b/Projectiles/Typeless/PurpleLabSeeker.cs new file mode 100644 index 0000000000..2d906043c7 --- /dev/null +++ b/Projectiles/Typeless/PurpleLabSeeker.cs @@ -0,0 +1,61 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class PurpleLabSeeker : ModProjectile + { + public ref float Time => ref projectile.ai[0]; + public override string Texture => "CalamityMod/Items/LabFinders/PurpleSeekingMechanism"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seeking Mechanism"); + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 24; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.timeLeft = 300; + } + + public override void AI() => RedLabSeeker.Behavior(projectile, CalamityWorld.PlanetoidLabCenter, Color.Magenta, ref Time); + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 8; i++) + { + Dust dust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(16f, 16f), 267); + dust.color = Color.Magenta; + dust.scale = Main.rand.NextFloat(0.95f, 1.25f); + dust.velocity = Main.rand.NextVector2Circular(2.5f, 2.5f); + dust.velocity.Y -= 1.5f; + dust.fadeIn = 1.2f; + dust.noGravity = true; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + if (Time > 80f && projectile.ai[1] == 0f) + { + for (int i = 0; i < 24; i += 2) + { + Vector2 drawPosition = projectile.Center - projectile.velocity.SafeNormalize(Vector2.Zero) * i * Utils.InverseLerp(80f, 125f, Time, true) * 25f - Main.screenPosition; + spriteBatch.Draw(texture, drawPosition, null, projectile.GetAlpha(lightColor) * (1f - i / 24f), projectile.rotation, texture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + } + } + return true; + } + } +} diff --git a/Projectiles/Typeless/RedLabSeeker.cs b/Projectiles/Typeless/RedLabSeeker.cs new file mode 100644 index 0000000000..f7fceae72b --- /dev/null +++ b/Projectiles/Typeless/RedLabSeeker.cs @@ -0,0 +1,105 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class RedLabSeeker : ModProjectile + { + public ref float Time => ref projectile.ai[0]; + public override string Texture => "CalamityMod/Items/LabFinders/RedSeekingMechanism"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seeking Mechanism"); + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 24; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.timeLeft = 300; + } + + public static void Behavior(Projectile projectile, Vector2 destination, Color dustColor, ref float time) + { + projectile.ai[1] = 0f; + + if (time < 45f) + projectile.velocity = Vector2.UnitY * Utils.InverseLerp(0f, 25f, time, true) * Utils.InverseLerp(30f, 25f, time, true) * -4.5f; + else if (time < 80f) + projectile.rotation = (projectile.AngleTo(destination) + MathHelper.PiOver2) * Utils.InverseLerp(45f, 70f, time, true); + else + { + if (projectile.WithinRange(destination, 420f)) + { + projectile.ai[1] = 1f; + projectile.velocity = Vector2.Lerp(projectile.velocity, Vector2.UnitY * (float)Math.Sin((time - 80f) / 24f) * 2.5f, 0.15f); + + if (!projectile.WithinRange(destination, 30f)) + projectile.Center = projectile.Center.MoveTowards(destination, 10f); + projectile.rotation *= 0.95f; + projectile.Center = Vector2.Lerp(projectile.Center, destination, 0.1f); + } + // Release lingering dust. + else + { + Dust dust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(8f, 8f), 267); + dust.velocity = Main.rand.NextVector2Circular(2f, 2f); + dust.noGravity = true; + dust.color = dustColor; + dust.scale = 1.6f; + dust.fadeIn = 1.45f; + } + } + + if (time > 80f && time < 120f) + projectile.velocity = (projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * Utils.InverseLerp(80f, 105f, time, true) * 25f; + + // Reset afterimages before the charge. + if (time < 80f) + projectile.oldPos = new Vector2[projectile.oldPos.Length]; + + Lighting.AddLight(projectile.Center, Vector3.One * 0.8f); + time++; + } + + public override void AI() => Behavior(projectile, CalamityWorld.HellLabCenter, Color.Red, ref Time); + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 8; i++) + { + Dust dust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(16f, 16f), 267); + dust.color = Color.Red; + dust.scale = Main.rand.NextFloat(0.95f, 1.25f); + dust.velocity = Main.rand.NextVector2Circular(2.5f, 2.5f); + dust.velocity.Y -= 1.5f; + dust.fadeIn = 1.2f; + dust.noGravity = true; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + if (Time > 80f && projectile.ai[1] == 0f) + { + for (int i = 0; i < 24; i += 2) + { + Vector2 drawPosition = projectile.Center - projectile.velocity.SafeNormalize(Vector2.Zero) * i * Utils.InverseLerp(80f, 125f, Time, true) * 25f - Main.screenPosition; + spriteBatch.Draw(texture, drawPosition, null, projectile.GetAlpha(lightColor) * (1f - i / 24f), projectile.rotation, texture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + } + } + return true; + } + } +} diff --git a/Projectiles/Typeless/TerminusHoldout.cs b/Projectiles/Typeless/TerminusHoldout.cs new file mode 100644 index 0000000000..70ed3804a0 --- /dev/null +++ b/Projectiles/Typeless/TerminusHoldout.cs @@ -0,0 +1,163 @@ +using CalamityMod.Events; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.GameContent.Events; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class TerminusHoldout : ModProjectile + { + public Player Owner => Main.player[projectile.owner]; + public ref float Time => ref projectile.ai[0]; + public const int Lifetime = 300; + public override string Texture => "CalamityMod/Items/SummonItems/BossRush"; + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.aiStyle = -1; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.timeLeft = Lifetime; + projectile.penetrate = -1; + } + + public override void AI() + { + Time++; + if (!Owner.channel || Owner.noItems || Owner.CCed) + { + // Reset the boss rush timer to what it would normally be if disabling is done prematurely. + if (BossRushEvent.BossRushActive || BossRushEvent.StartTimer > 0) + BossRushEvent.SyncStartTimer(BossRushEvent.StartEffectTotalTime); + + CreateMysticDeathDust(); + projectile.Kill(); + return; + } + + UpdatePlayerFields(); + if (BossRushEvent.BossRushActive || BossRushEvent.StartTimer > 0) + { + float lifetime = Utils.InverseLerp(0f, 30f, Time, true); + if (Time % 5f == 4f) + BossRushEvent.SyncStartTimer((int)MathHelper.Lerp(0f, BossRushEvent.StartEffectTotalTime, 1f - lifetime)); + + MoonlordDeathDrama.RequestLight(Utils.InverseLerp(0f, 15f, Time, true), Main.LocalPlayer.Center); + if (Time >= 45f) + { + Main.PlaySound(SoundID.DD2_EtherianPortalOpen, Main.LocalPlayer.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + BossRushEvent.End(); + + projectile.Kill(); + } + + return; + } + + if (projectile.timeLeft == 1) + { + projectile.Kill(); + CreateEffectsHandler(); + return; + } + + CreateIdleMagicDust(); + float currentShakePower = MathHelper.Lerp(0.2f, 8f, Utils.InverseLerp(Lifetime * 0.725f, Lifetime, Time, true)); + currentShakePower *= 1f - Utils.InverseLerp(1000f, 3100f, Main.LocalPlayer.Distance(projectile.Center), true); + Main.LocalPlayer.Calamity().GeneralScreenShakePower = currentShakePower; + } + + public void CreateEffectsHandler() + { + Main.PlaySound(SoundID.DD2_EtherianPortalDryadTouch, Main.LocalPlayer.Center); + Main.LocalPlayer.Calamity().GeneralScreenShakePower = 16f; + if (Main.myPlayer == projectile.owner) + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, projectile.owner); + } + + public void CreateMysticDeathDust() + { + if (Main.dedServ) + return; + + for (int i = 0; i < 20; i++) + { + Dust paleMagic = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(22f, 28f), 261); + paleMagic.velocity = -Vector2.UnitY * Main.rand.NextFloat(1.8f, 3.2f); + paleMagic.color = Color.White; + paleMagic.scale = Main.rand.NextFloat(1.1f, 1.35f); + paleMagic.fadeIn = 1.5f; + paleMagic.noGravity = true; + } + } + + public void CreateIdleMagicDust() + { + if (Main.dedServ) + return; + + int dustCount = (int)Math.Round(MathHelper.SmoothStep(1f, 5f, Time / Lifetime)); + float outwardness = MathHelper.SmoothStep(40f, 150f, Time / Lifetime); + float dustScale = MathHelper.Lerp(1.15f, 1.725f, Time / Lifetime); + for (int i = 0; i < dustCount; i++) + { + Vector2 spawnPosition = projectile.Center + Main.rand.NextVector2Unit() * outwardness * Main.rand.NextFloat(0.75f, 1.1f); + Vector2 dustVelocity = (projectile.Center - spawnPosition) * 0.085f + Owner.velocity; + + Dust paleMagic = Dust.NewDustPerfect(spawnPosition, 264); + paleMagic.velocity = dustVelocity; + paleMagic.scale = dustScale * Main.rand.NextFloat(0.75f, 1.15f); + paleMagic.color = Color.Lerp(Color.LightCoral, Color.White, Time / Lifetime * Main.rand.NextFloat(0.65f, 1f)); + paleMagic.noGravity = true; + paleMagic.noLight = true; + } + } + + public void UpdatePlayerFields() + { + if (projectile.localAI[0] == 0f) + { + projectile.spriteDirection = Owner.direction; + projectile.localAI[0] = 1f; + } + Owner.itemRotation = 0f; + Owner.heldProj = projectile.whoAmI; + Owner.itemTime = 2; + Owner.itemAnimation = 2; + Owner.ChangeDir(projectile.spriteDirection); + + projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter, true) + Vector2.UnitX * projectile.spriteDirection * 26f; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + Vector2 baseDrawPosition = projectile.Center - Main.screenPosition; + Vector2 origin = texture.Size() * 0.5f; + Color baseColor = Color.Lerp(projectile.GetAlpha(lightColor), Color.White, Utils.InverseLerp(40f, 120f, Time, true)); + SpriteEffects direction = projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + if (Time >= 150f) + { + float outwardness = MathHelper.SmoothStep(1f, 15f, Utils.InverseLerp(150f, Lifetime - 30f, Time, true)); + Color afterimageColor = Color.Lerp(baseColor, Color.LightCoral, Utils.InverseLerp(150f, 195f, Time, true)) * 0.225f; + afterimageColor.A = 0; + + for (int i = 0; i < 10; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 10f + Main.GlobalTime * 4.4f).ToRotationVector2() * outwardness; + spriteBatch.Draw(texture, baseDrawPosition + drawOffset, null, afterimageColor, 0f, origin, projectile.scale, direction, 0f); + } + } + spriteBatch.Draw(texture, baseDrawPosition, null, baseColor, 0f, origin, projectile.scale, direction, 0f); + + return false; + } + } +} diff --git a/Projectiles/Typeless/YanmeisKnifeSlash.cs b/Projectiles/Typeless/YanmeisKnifeSlash.cs index 346fbfc9d2..0ea7c02233 100644 --- a/Projectiles/Typeless/YanmeisKnifeSlash.cs +++ b/Projectiles/Typeless/YanmeisKnifeSlash.cs @@ -51,9 +51,6 @@ namespace CalamityMod.Projectiles.Typeless projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 20; - - // Not considered true melee to prevent Titan Scale from triggering. - // projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/Typeless/YellowLabSeeker.cs b/Projectiles/Typeless/YellowLabSeeker.cs new file mode 100644 index 0000000000..c73af6ad85 --- /dev/null +++ b/Projectiles/Typeless/YellowLabSeeker.cs @@ -0,0 +1,61 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class YellowLabSeeker : ModProjectile + { + public ref float Time => ref projectile.ai[0]; + public override string Texture => "CalamityMod/Items/LabFinders/YellowSeekingMechanism"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seeking Mechanism"); + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 24; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.timeLeft = 300; + } + + public override void AI() => RedLabSeeker.Behavior(projectile, CalamityWorld.IceLabCenter, Color.Yellow, ref Time); + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 8; i++) + { + Dust dust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(16f, 16f), 267); + dust.color = Color.Yellow; + dust.scale = Main.rand.NextFloat(0.95f, 1.25f); + dust.velocity = Main.rand.NextVector2Circular(2.5f, 2.5f); + dust.velocity.Y -= 1.5f; + dust.fadeIn = 1.2f; + dust.noGravity = true; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + if (Time > 80f && projectile.ai[1] == 0f) + { + for (int i = 0; i < 24; i += 2) + { + Vector2 drawPosition = projectile.Center - projectile.velocity.SafeNormalize(Vector2.Zero) * i * Utils.InverseLerp(80f, 125f, Time, true) * 25f - Main.screenPosition; + spriteBatch.Draw(texture, drawPosition, null, projectile.GetAlpha(lightColor) * (1f - i / 24f), projectile.rotation, texture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + } + } + return true; + } + } +} diff --git a/Skies/ExoMechsScreenShaderData.cs b/Skies/ExoMechsScreenShaderData.cs new file mode 100644 index 0000000000..6d981888e9 --- /dev/null +++ b/Skies/ExoMechsScreenShaderData.cs @@ -0,0 +1,23 @@ +using CalamityMod.NPCs; +using CalamityMod.NPCs.ExoMechs; +using Terraria; +using Terraria.Graphics.Shaders; + +namespace CalamityMod.Skies +{ + public class ExoMechsScreenShaderData : ScreenShaderData + { + public ExoMechsScreenShaderData(string passName) + : base(passName) + { + } + + public override void Apply() + { + if (CalamityGlobalNPC.draedon != -1 && Draedon.ExoMechIsPresent) + UseTargetPosition(Main.npc[CalamityGlobalNPC.draedon].Center); + + base.Apply(); + } + } +} diff --git a/Skies/ExoMechsSky.cs b/Skies/ExoMechsSky.cs new file mode 100644 index 0000000000..dec32d2f8f --- /dev/null +++ b/Skies/ExoMechsSky.cs @@ -0,0 +1,187 @@ +using CalamityMod.NPCs; +using CalamityMod.NPCs.ExoMechs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.Graphics; +using Terraria.Graphics.Effects; +using Terraria.ModLoader; + +namespace CalamityMod.Skies +{ + public class ExoMechsSky : CustomSky + { + public class Lightning + { + public int Lifetime; + public float Depth; + public Vector2 Position; + } + + public float BackgroundIntensity; + public float LightningIntensity; + public List LightningBolts = new List(); + public static bool CanSkyBeActive + { + get + { + int draedon = CalamityGlobalNPC.draedon; + if (draedon == -1 || !Main.npc[draedon].active) + return Draedon.ExoMechIsPresent; + + if ((Main.npc[draedon]?.ModNPC()?.DefeatTimer ?? 0) <= 0 && !Draedon.ExoMechIsPresent) + return false; + + return true; + } + } + + public float CurrentIntensity + { + get + { + float combinedLifeRatio = 0f; + if (CalamityGlobalNPC.draedonExoMechPrime != -1 && Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) + combinedLifeRatio += Main.npc[CalamityGlobalNPC.draedonExoMechPrime].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].lifeMax; + + if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1 && Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) + combinedLifeRatio += Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].lifeMax; + + if (CalamityGlobalNPC.draedonExoMechWorm != -1 && Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) + combinedLifeRatio += Main.npc[CalamityGlobalNPC.draedonExoMechWorm].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechWorm].lifeMax; + + return (float)Math.Pow(1f - combinedLifeRatio / 3f, 2D); + } + } + + public static readonly Color DrawColor = new Color(0.16f, 0.16f, 0.16f); + + public static void CreateLightningBolt(int count = 1, bool playSound = false) + { + for (int i = 0; i < count; i++) + { + Lightning lightning = new Lightning() + { + Lifetime = 30, + Depth = Main.rand.NextFloat(1.5f, 10f), + Position = new Vector2(Main.LocalPlayer.Center.X + Main.rand.NextFloatDirection() * 5000f, Main.rand.NextFloat(4850f)) + }; + (SkyManager.Instance["CalamityMod:ExoMechs"] as ExoMechsSky).LightningBolts.Add(lightning); + } + + // Make the sky flash if enough lightning bolts are created. + if (count >= 10) + { + (SkyManager.Instance["CalamityMod:ExoMechs"] as ExoMechsSky).LightningIntensity = 1f; + playSound = true; + } + + if (playSound && !Main.gamePaused) + { + var lightningSound = Main.PlaySound(CalamityMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), Main.LocalPlayer.Center); + if (lightningSound != null) + lightningSound.Volume *= 0.5f; + } + } + + public override void Update(GameTime gameTime) + { + if (!CanSkyBeActive) + { + LightningIntensity = 0f; + BackgroundIntensity = MathHelper.Clamp(BackgroundIntensity - 0.08f, 0f, 1f); + LightningBolts.Clear(); + return; + } + + LightningIntensity = MathHelper.Clamp(LightningIntensity * 0.95f - 0.025f, 0f, 1f); + BackgroundIntensity = MathHelper.Clamp(BackgroundIntensity + 0.01f, 0f, 1f); + + for (int i = 0; i < LightningBolts.Count; i++) + { + LightningBolts[i].Lifetime--; + } + + if (Main.rand.NextBool((int)MathHelper.Lerp(50f, 195f, CurrentIntensity))) + CreateLightningBolt(); + + // Occasionally make the whole screen flash with lightning and create 7 bolts. + if (Main.rand.NextBool((int)MathHelper.Lerp(780f, 300f, CurrentIntensity))) + { + LightningIntensity = 1f; + CreateLightningBolt(4); + + if (!Main.gamePaused) + { + var lightningSound = Main.PlaySound(CalamityMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), Main.LocalPlayer.Center); + if (lightningSound != null) + lightningSound.Volume *= 0.5f; + } + } + + Opacity = BackgroundIntensity; + } + + public override Color OnTileColor(Color inColor) => new Color(Vector4.Lerp(DrawColor.ToVector4(), inColor.ToVector4(), 1f - BackgroundIntensity)); + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= float.MaxValue) + { + // Draw lightning in the background based on Main.magicPixel. + // It is a long, white vertical strip that exists for some reason. + // This lightning effect is achieved by expanding this to fit the entire background and then drawing it as a distinct element. + Vector2 scale = new Vector2(Main.screenWidth * 1.1f / Main.magicPixel.Width, Main.screenHeight * 1.1f / Main.magicPixel.Height); + Vector2 screenArea = new Vector2(Main.screenWidth, Main.screenHeight) * 0.5f; + Color drawColor = Color.White * MathHelper.Lerp(0f, 0.24f, LightningIntensity) * BackgroundIntensity; + + // Draw a grey background as base. + spriteBatch.Draw(Main.magicPixel, screenArea, null, OnTileColor(Color.Transparent), 0f, Main.magicPixel.Size() * 0.5f, scale, SpriteEffects.None, 0f); + + for (int i = 0; i < 2; i++) + spriteBatch.Draw(Main.magicPixel, screenArea, null, drawColor, 0f, Main.magicPixel.Size() * 0.5f, scale, SpriteEffects.None, 0f); + } + + Texture2D flashTexture = TextureManager.Load("Images/Misc/VortexSky/Flash"); + Texture2D boltTexture = TextureManager.Load("Images/Misc/VortexSky/Bolt"); + + // Draw lightning bolts. + float spaceFade = Math.Min(1f, (Main.screenPosition.Y - 300f) / 300f); + Vector2 screenCenter = Main.screenPosition + new Vector2(Main.screenWidth * 0.5f, Main.screenHeight * 0.5f); + Rectangle rectangle = new Rectangle(-1000, -1000, 4000, 4000); + + LightningBolts.RemoveAll(l => l.Lifetime <= 0); + + for (int i = 0; i < LightningBolts.Count; i++) + { + if (LightningBolts[i].Depth > minDepth && LightningBolts[i].Depth < maxDepth) + { + Vector2 boltScale = new Vector2(1f / LightningBolts[i].Depth, 0.9f / LightningBolts[i].Depth); + Vector2 position = (LightningBolts[i].Position - screenCenter) * boltScale + screenCenter - Main.screenPosition; + if (rectangle.Contains((int)position.X, (int)position.Y)) + { + Texture2D texture = boltTexture; + int life = LightningBolts[i].Lifetime; + if (life > 24 && life % 2 == 0) + texture = flashTexture; + + float opacity = life * spaceFade / 20f; + spriteBatch.Draw(texture, position, null, Color.White * opacity, 0f, Vector2.Zero, boltScale.X * 5f, SpriteEffects.None, 0f); + } + } + } + } + + public override float GetCloudAlpha() => 0f; + + public override void Reset() { } + + public override void Activate(Vector2 position, params object[] args) { } + + public override void Deactivate(params object[] args) { } + + public override bool IsActive() => CanSkyBeActive && !Main.gameMenu; + } +} diff --git a/Sounds/Custom/AresEnraged.cs b/Sounds/Custom/AresEnraged.cs new file mode 100644 index 0000000000..950d2b3ce3 --- /dev/null +++ b/Sounds/Custom/AresEnraged.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class AresEnraged : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/AresEnraged.ogg b/Sounds/Custom/AresEnraged.ogg new file mode 100644 index 0000000000..64a53923da Binary files /dev/null and b/Sounds/Custom/AresEnraged.ogg differ diff --git a/Sounds/Custom/BossRushEnd.cs b/Sounds/Custom/BossRushEnd.cs new file mode 100644 index 0000000000..2a376e552c --- /dev/null +++ b/Sounds/Custom/BossRushEnd.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class BossRushEnd : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/BossRushEnd.ogg b/Sounds/Custom/BossRushEnd.ogg new file mode 100644 index 0000000000..e0978b3069 Binary files /dev/null and b/Sounds/Custom/BossRushEnd.ogg differ diff --git a/Sounds/Custom/CodebreakerBeam.cs b/Sounds/Custom/CodebreakerBeam.cs new file mode 100644 index 0000000000..42da2a17bf --- /dev/null +++ b/Sounds/Custom/CodebreakerBeam.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class CodebreakerBeam : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/CodebreakerBeam.ogg b/Sounds/Custom/CodebreakerBeam.ogg new file mode 100644 index 0000000000..86b77912d4 Binary files /dev/null and b/Sounds/Custom/CodebreakerBeam.ogg differ diff --git a/Sounds/Custom/DraedonTeleport.cs b/Sounds/Custom/DraedonTeleport.cs new file mode 100644 index 0000000000..46db40641f --- /dev/null +++ b/Sounds/Custom/DraedonTeleport.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class DraedonTeleport : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/DraedonTeleport.ogg b/Sounds/Custom/DraedonTeleport.ogg new file mode 100644 index 0000000000..8bee384131 Binary files /dev/null and b/Sounds/Custom/DraedonTeleport.ogg differ diff --git a/Sounds/Music/DraedonAmbience.ogg b/Sounds/Music/DraedonAmbience.ogg new file mode 100644 index 0000000000..888cfff0eb Binary files /dev/null and b/Sounds/Music/DraedonAmbience.ogg differ diff --git a/TileEntities/TECodebreaker.cs b/TileEntities/TECodebreaker.cs new file mode 100644 index 0000000000..0442166a17 --- /dev/null +++ b/TileEntities/TECodebreaker.cs @@ -0,0 +1,423 @@ +using CalamityMod.CustomRecipes; +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Tiles.DraedonSummoner; +using Microsoft.Xna.Framework; +using System; +using System.IO; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; + +namespace CalamityMod.TileEntities +{ + public class TECodebreaker : ModTileEntity + { + public int InputtedCellCount; + public int InitialCellCountBeforeDecrypting; + public int HeldSchematicID; + + public int DecryptionCountdown; + public int DecryptionTotalTime + { + get + { + // Decryption takes 35 minutes typically. + int decryptTime = 126000; + + // However, if this codebreaker has a quantum cell, it only takes 1 minute. + if (ContainsCoolingCell) + decryptTime = 3600; + return decryptTime; + } + } + + public int DecryptionCellCost + { + get + { + // You can't decrypt nothing. + if (HeldSchematicID == 0 || !CalamityLists.EncryptedSchematicIDRelationship.ContainsKey(HeldSchematicID)) + return 0; + + int schematicType = CalamityLists.EncryptedSchematicIDRelationship[HeldSchematicID]; + if (schematicType == ModContent.ItemType()) + return 500; + if (schematicType == ModContent.ItemType()) + return 950; + if (schematicType == ModContent.ItemType()) + return 1750; + if (schematicType == ModContent.ItemType()) + return 5000; + + return 0; + } + } + + public float DecryptionCompletion => 1f - DecryptionCountdown / (float)DecryptionTotalTime; + public bool ReadyToSummonDraedon => ContainsCoolingCell && DecryptionCountdown <= 0; + + public bool ContainsDecryptionComputer; + public bool ContainsSensorArray; + public bool ContainsAdvancedDisplay; + public bool ContainsVoltageRegulationSystem; + public bool ContainsCoolingCell; + + public bool CanDecryptHeldSchematic + { + get + { + // You can't decrypt nothing. + if (HeldSchematicID == 0 || !CalamityLists.EncryptedSchematicIDRelationship.ContainsKey(HeldSchematicID)) + return false; + + int schematicType = CalamityLists.EncryptedSchematicIDRelationship[HeldSchematicID]; + if (schematicType == ModContent.ItemType()) + return ContainsDecryptionComputer; + if (schematicType == ModContent.ItemType()) + return ContainsDecryptionComputer && ContainsSensorArray; + if (schematicType == ModContent.ItemType()) + return ContainsDecryptionComputer && ContainsSensorArray && ContainsAdvancedDisplay; + if (schematicType == ModContent.ItemType()) + return ContainsDecryptionComputer && ContainsSensorArray && ContainsAdvancedDisplay && ContainsVoltageRegulationSystem; + + return false; + } + } + + public string UnderlyingSchematicText + { + get + { + // You can't decrypt nothing. + if (HeldSchematicID == 0 || !CalamityLists.EncryptedSchematicIDRelationship.ContainsKey(HeldSchematicID)) + return string.Empty; + + int schematicType = CalamityLists.EncryptedSchematicIDRelationship[HeldSchematicID]; + if (schematicType == ModContent.ItemType()) + return "test1"; + if (schematicType == ModContent.ItemType()) + return "test2"; + if (schematicType == ModContent.ItemType()) + return "test3"; + if (schematicType == ModContent.ItemType()) + return "test4"; + + return string.Empty; + } + } + + public Vector2 Center => Position.ToWorldCoordinates(8f * CodebreakerTile.Width, 8f * CodebreakerTile.Height); + public const int MaxCellCapacity = 9999; + + // This guarantees that this tile entity will not persist if not placed directly on the top left corner of a Codebreaker tile. + public override bool ValidTile(int i, int j) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(i, j); + return tile.active() && tile.type == ModContent.TileType() && tile.frameX == 0 && tile.frameY == 0; + } + + // This code is called as a hook when the player places the Codebreaker tile so that the tile entity may be placed. + public override int Hook_AfterPlacement(int i, int j, int type, int style, int direction) + { + // If in multiplayer, tell the server to place the tile entity and DO NOT place it yourself. That would mismatch IDs. + // Also tell the server that you placed the 5x8 tiles that make up the Codebreaker. + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileRange(Main.myPlayer, i, j, CodebreakerTile.Width, CodebreakerTile.Height); + NetMessage.SendData(MessageID.TileEntityPlacement, -1, -1, null, i, j, Type); + return -1; + } + + // If in single player, just place the tile entity, no problems. + return Place(i, j); + } + + // This code is called on dedicated servers only. It is the server-side response to MessageID.TileEntityPlacement. + // When the server receives such a message from a client, it sends a MessageID.TileEntitySharing to all clients. + // This will cause them to Place the tile entity locally at that position, all with exactly the same ID. + public override void OnNetPlace() => NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); + + public override void Update() => UpdateTime(); + + public void DropConstituents(int x, int y) + { + if (ContainsDecryptionComputer) + Item.NewItem(x * 16, y * 16, 32, 32, ModContent.ItemType()); + if (ContainsSensorArray) + Item.NewItem(x * 16, y * 16, 32, 32, ModContent.ItemType()); + if (ContainsAdvancedDisplay) + Item.NewItem(x * 16, y * 16, 32, 32, ModContent.ItemType()); + if (ContainsVoltageRegulationSystem) + Item.NewItem(x * 16, y * 16, 32, 32, ModContent.ItemType()); + if (ContainsCoolingCell) + Item.NewItem(x * 16, y * 16, 32, 32, ModContent.ItemType()); + + if (CalamityLists.EncryptedSchematicIDRelationship.ContainsKey(HeldSchematicID)) + Item.NewItem(x * 16, y * 16, 32, 32, CalamityLists.EncryptedSchematicIDRelationship[HeldSchematicID]); + + while (InputtedCellCount > 0) + { + int totalCellsToDrop = InputtedCellCount; + if (totalCellsToDrop > 999) + totalCellsToDrop = 999; + InputtedCellCount -= totalCellsToDrop; + Item.NewItem(x * 16, y * 16, 32, 32, ModContent.ItemType(), totalCellsToDrop); + } + } + + public void SyncConstituents(short sender) + { + // Don't bother sending packets in singleplayer. + if (Main.netMode == NetmodeID.SinglePlayer) + return; + + ModPacket packet = mod.GetPacket(); + BitsByte containmentFlagWrapper = new BitsByte(); + containmentFlagWrapper[0] = ContainsDecryptionComputer; + containmentFlagWrapper[1] = ContainsSensorArray; + containmentFlagWrapper[2] = ContainsAdvancedDisplay; + containmentFlagWrapper[3] = ContainsVoltageRegulationSystem; + containmentFlagWrapper[4] = ContainsCoolingCell; + + packet.Write((byte)CalamityModMessageType.UpdateCodebreakerConstituents); + packet.Write(ID); + packet.Write(sender); + packet.Write(containmentFlagWrapper); + packet.Send(-1, sender); + } + + public static void ReadConstituentsUpdateSync(Mod mod, BinaryReader reader) + { + int id = reader.ReadInt32(); + short sender = reader.ReadInt16(); + bool exists = ByID.TryGetValue(id, out TileEntity tileEntity); + + // Continue reading to the end even if a tile entity with the given ID does not exist. + // Not doing this will cause errors/bugs. + BitsByte containmentFlagWrapper = reader.ReadByte(); + bool containsDecryptionComputer = containmentFlagWrapper[0]; + bool containsSensorArray = containmentFlagWrapper[1]; + bool containsAdvancedDisplay = containmentFlagWrapper[2]; + bool containsVoltageRegulationSystem = containmentFlagWrapper[3]; + bool containsCoolingCell = containmentFlagWrapper[4]; + + // After doing reading, check again to see if the tile entity is actually there. + // If it isn't don't bother doing anything else. + if (!exists) + return; + + // Furthermore, verify to ensure that the tile entity is a valid one. + if (!(tileEntity is TECodebreaker codebreakerTileEntity)) + return; + + codebreakerTileEntity.ContainsDecryptionComputer = containsDecryptionComputer; + codebreakerTileEntity.ContainsSensorArray = containsSensorArray; + codebreakerTileEntity.ContainsAdvancedDisplay = containsAdvancedDisplay; + codebreakerTileEntity.ContainsVoltageRegulationSystem = containsVoltageRegulationSystem; + codebreakerTileEntity.ContainsCoolingCell = containsCoolingCell; + + // Send the packet again to the other clients if this packet was received on the server. + // Since ModPackets go solely to the server when sent by a client this is necesssary + // to ensure that all clients are informed of what happened. + if (Main.netMode == NetmodeID.Server) + codebreakerTileEntity.SyncConstituents(sender); + } + + public void SyncContainedStuff() + { + // Don't bother sending packets in singleplayer. + if (Main.netMode == NetmodeID.SinglePlayer) + return; + + ModPacket packet = mod.GetPacket(); + packet.Write((byte)CalamityModMessageType.UpdateCodebreakerContainedStuff); + packet.Write(ID); + packet.Write(InputtedCellCount); + packet.Write(InitialCellCountBeforeDecrypting); + packet.Write(HeldSchematicID); + packet.Send(); + } + + public static void ReadContainmentSync(Mod mod, BinaryReader reader) + { + int id = reader.ReadInt32(); + bool exists = ByID.TryGetValue(id, out TileEntity tileEntity); + + // Continue reading to the end even if a tile entity with the given ID does not exist. + // Not doing this will cause errors/bugs. + int cellCount = reader.ReadInt32(); + int cellCountBeforeDecrypting = reader.ReadInt32(); + int schematicID = reader.ReadInt32(); + + // After doing reading, check again to see if the tile entity is actually there. + // If it isn't don't bother doing anything else. + if (!exists) + return; + + // Furthermore, verify to ensure that the tile entity is a valid one. + if (!(tileEntity is TECodebreaker codebreakerTileEntity)) + return; + + codebreakerTileEntity.InputtedCellCount = cellCount; + codebreakerTileEntity.InitialCellCountBeforeDecrypting = cellCountBeforeDecrypting; + codebreakerTileEntity.HeldSchematicID = schematicID; + } + + public void SyncDecryptCountdown() + { + // Don't bother sending packets in singleplayer. + if (Main.netMode == NetmodeID.SinglePlayer) + return; + + ModPacket packet = mod.GetPacket(); + packet.Write((byte)CalamityModMessageType.UpdateCodebreakerDecryptCountdown); + packet.Write(ID); + packet.Write(DecryptionCountdown); + packet.Send(); + } + + public static void ReadDecryptCountdownSync(Mod mod, BinaryReader reader) + { + int id = reader.ReadInt32(); + bool exists = ByID.TryGetValue(id, out TileEntity tileEntity); + + // Continue reading to the end even if a tile entity with the given ID does not exist. + // Not doing this will cause errors/bugs. + int countdown = reader.ReadInt32(); + + // After doing reading, check again to see if the tile entity is actually there. + // If it isn't don't bother doing anything else. + if (!exists) + return; + + // Furthermore, verify to ensure that the tile entity is a valid one. + if (!(tileEntity is TECodebreaker codebreakerTileEntity)) + return; + + codebreakerTileEntity.DecryptionCountdown = countdown; + } + + public void UpdateTime() + { + if (DecryptionCountdown > 0) + { + DecryptionCountdown--; + + // Gradually consume cells. + if (DecryptionCountdown % 5 == 0) + { + InputtedCellCount = InitialCellCountBeforeDecrypting - (int)(DecryptionCellCost * DecryptionCompletion); + if (Main.netMode != NetmodeID.MultiplayerClient) + SyncContainedStuff(); + } + + if (DecryptionCountdown == 0) + { + // Reset the cell count prior to decrypting. + InitialCellCountBeforeDecrypting = 0; + + LearnFromHeldSchematic(out bool anythingChanged); + if (Main.netMode == NetmodeID.Server) + { + SyncDecryptCountdown(); + SyncContainedStuff(); + } + else if (anythingChanged) + CombatText.NewText(Main.LocalPlayer.Hitbox, Color.Cyan, "You learned how to create new things!", true); + } + } + } + + public void LearnFromHeldSchematic(out bool anythingChanged) + { + anythingChanged = false; + + // Do nothing if no valid schematic is inputted at the moment. + if (!CalamityLists.EncryptedSchematicIDRelationship.ContainsKey(HeldSchematicID)) + return; + + int schematicType = CalamityLists.EncryptedSchematicIDRelationship[HeldSchematicID]; + + if (!RecipeUnlockHandler.HasUnlockedT2ArsenalRecipes && schematicType == ModContent.ItemType()) + { + RecipeUnlockHandler.HasUnlockedT2ArsenalRecipes = true; + anythingChanged = true; + } + if (!RecipeUnlockHandler.HasUnlockedT3ArsenalRecipes && schematicType == ModContent.ItemType()) + { + RecipeUnlockHandler.HasUnlockedT3ArsenalRecipes = true; + anythingChanged = true; + } + if (!RecipeUnlockHandler.HasUnlockedT4ArsenalRecipes && schematicType == ModContent.ItemType()) + { + RecipeUnlockHandler.HasUnlockedT4ArsenalRecipes = true; + anythingChanged = true; + } + if (!RecipeUnlockHandler.HasUnlockedT5ArsenalRecipes && schematicType == ModContent.ItemType()) + { + RecipeUnlockHandler.HasUnlockedT5ArsenalRecipes = true; + anythingChanged = true; + } + + if (Main.netMode == NetmodeID.Server && anythingChanged) + CalamityNetcode.SyncWorld(); + } + + public override TagCompound Save() + { + return new TagCompound + { + ["ContainsDecryptionComputer"] = ContainsDecryptionComputer, + ["ContainsSensorArray"] = ContainsSensorArray, + ["ContainsAdvancedDisplay"] = ContainsAdvancedDisplay, + ["ContainsVoltageRegulationSystem"] = ContainsVoltageRegulationSystem, + ["ContainsCoolingCell"] = ContainsCoolingCell, + ["InputtedCellCount"] = InputtedCellCount, + ["HeldSchematicID"] = HeldSchematicID, + ["DecryptionCountdown"] = DecryptionCountdown, + ["InitialCellCountBeforeDecrypting"] = InitialCellCountBeforeDecrypting + }; + } + + public override void Load(TagCompound tag) + { + ContainsDecryptionComputer = tag.GetBool("ContainsDecryptionComputer"); + ContainsSensorArray = tag.GetBool("ContainsSensorArray"); + ContainsAdvancedDisplay = tag.GetBool("ContainsAdvancedDisplay"); + ContainsVoltageRegulationSystem = tag.GetBool("ContainsVoltageRegulationSystem"); + ContainsCoolingCell = tag.GetBool("ContainsCoolingCell"); + InputtedCellCount = tag.GetInt("InputtedCellCount"); + HeldSchematicID = tag.GetInt("HeldSchematicID"); + DecryptionCountdown = tag.GetInt("DecryptionCountdown"); + InitialCellCountBeforeDecrypting = tag.GetInt("InitialCellCountBeforeDecrypting"); + } + + public override void NetSend(BinaryWriter writer, bool lightSend) + { + writer.Write(ContainsDecryptionComputer); + writer.Write(ContainsSensorArray); + writer.Write(ContainsAdvancedDisplay); + writer.Write(ContainsVoltageRegulationSystem); + writer.Write(ContainsCoolingCell); + writer.Write(InputtedCellCount); + writer.Write(HeldSchematicID); + writer.Write(DecryptionCountdown); + writer.Write(InitialCellCountBeforeDecrypting); + } + + public override void NetReceive(BinaryReader reader, bool lightReceive) + { + ContainsDecryptionComputer = reader.ReadBoolean(); + ContainsSensorArray = reader.ReadBoolean(); + ContainsAdvancedDisplay = reader.ReadBoolean(); + ContainsVoltageRegulationSystem = reader.ReadBoolean(); + ContainsCoolingCell = reader.ReadBoolean(); + InputtedCellCount = reader.ReadInt32(); + HeldSchematicID = reader.ReadInt32(); + DecryptionCountdown = reader.ReadInt32(); + InitialCellCountBeforeDecrypting = reader.ReadInt32(); + } + } +} diff --git a/TileEntities/TileEntityTimeHandler.cs b/TileEntities/TileEntityTimeHandler.cs index eadc860b7d..1c076e1428 100644 --- a/TileEntities/TileEntityTimeHandler.cs +++ b/TileEntities/TileEntityTimeHandler.cs @@ -19,6 +19,7 @@ namespace CalamityMod.TileEntities byte factoryType = ModContent.GetInstance().type; byte chargerType = ModContent.GetInstance().type; + byte codebreakerType = ModContent.GetInstance().type; var enumerator = TileEntity.ByID.Values.GetEnumerator(); do @@ -56,6 +57,13 @@ namespace CalamityMod.TileEntities // This makes sure they visually track targets in multiplayer. It will NOT fire projectiles; that code can only run server side. turret.UpdateAngle(); } + else if (te.type == codebreakerType) + { + // Specifically on multiplayer clients, manually update the time variables of the Codebreaker every frame. + // This is done so that clients can accurately gauge how complete decryptions are. + TECodebreaker codebreaker = (TECodebreaker)te; + codebreaker.UpdateTime(); + } } while (enumerator.MoveNext()); } } diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index c8971770ab..09dd4c1be5 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -8,6 +8,7 @@ using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.AstralDesert; using CalamityMod.Tiles.Crags; using CalamityMod.Tiles.DraedonStructures; +using CalamityMod.Tiles.DraedonSummoner; using CalamityMod.Tiles.Ores; using CalamityMod.Tiles.SunkenSea; using CalamityMod.World; @@ -587,8 +588,10 @@ namespace CalamityMod.Tiles int[] invincibleTiles = new int[] { ModContent.TileType(), - ModContent.TileType() + ModContent.TileType(), + ModContent.TileType() }; + // Prevent tiles below invincible tiles from being destroyed. This is like chests in vanilla. if (CalamityUtils.ParanoidTileRetrieval(i, j - 1).active() && CalamityUtils.ParanoidTileRetrieval(i, j).type != diff --git a/Tiles/DraedonSummoner/CodebreakerAdvancedDisplay.png b/Tiles/DraedonSummoner/CodebreakerAdvancedDisplay.png new file mode 100644 index 0000000000..8853083806 Binary files /dev/null and b/Tiles/DraedonSummoner/CodebreakerAdvancedDisplay.png differ diff --git a/Tiles/DraedonSummoner/CodebreakerAuricQuantumCoolingCell.png b/Tiles/DraedonSummoner/CodebreakerAuricQuantumCoolingCell.png new file mode 100644 index 0000000000..e098482c31 Binary files /dev/null and b/Tiles/DraedonSummoner/CodebreakerAuricQuantumCoolingCell.png differ diff --git a/Tiles/DraedonSummoner/CodebreakerDecryptionComputer.png b/Tiles/DraedonSummoner/CodebreakerDecryptionComputer.png new file mode 100644 index 0000000000..a5a0642811 Binary files /dev/null and b/Tiles/DraedonSummoner/CodebreakerDecryptionComputer.png differ diff --git a/Tiles/DraedonSummoner/CodebreakerLongRangedSensorArray.png b/Tiles/DraedonSummoner/CodebreakerLongRangedSensorArray.png new file mode 100644 index 0000000000..07d8351f6d Binary files /dev/null and b/Tiles/DraedonSummoner/CodebreakerLongRangedSensorArray.png differ diff --git a/Tiles/DraedonSummoner/CodebreakerTile.cs b/Tiles/DraedonSummoner/CodebreakerTile.cs new file mode 100644 index 0000000000..fb383ea9fd --- /dev/null +++ b/Tiles/DraedonSummoner/CodebreakerTile.cs @@ -0,0 +1,194 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.TileEntities; +using CalamityMod.UI; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.DraedonSummoner +{ + public class CodebreakerTile : ModTile + { + public const int Width = 5; + public const int Height = 8; + public const int OriginOffsetX = 2; + public const int OriginOffsetY = 7; + public const int SheetSquare = 18; + public static Texture2D TileTexture; + public static Texture2D ComputerTexture; + public static Texture2D SensorTexture; + public static Texture2D DisplayTexture; + public static Texture2D VoltageRegulatorTexture; + public static Texture2D VoltageRegulatorTexture2; + public static Texture2D CoolingCellTexture; + + public override void SetDefaults() + { + if (!Main.dedServ) + { + TileTexture = ModContent.GetTexture("CalamityMod/Tiles/DraedonSummoner/CodebreakerTile"); + ComputerTexture = ModContent.GetTexture("CalamityMod/Tiles/DraedonSummoner/CodebreakerDecryptionComputer"); + SensorTexture = ModContent.GetTexture("CalamityMod/Tiles/DraedonSummoner/CodebreakerLongRangedSensorArray"); + DisplayTexture = ModContent.GetTexture("CalamityMod/Tiles/DraedonSummoner/CodebreakerAdvancedDisplay"); + VoltageRegulatorTexture = ModContent.GetTexture("CalamityMod/Tiles/DraedonSummoner/CodebreakerVoltageRegulationSystem"); + VoltageRegulatorTexture2 = ModContent.GetTexture("CalamityMod/Tiles/DraedonSummoner/CodebreakerVoltageRegulationSystem2"); + CoolingCellTexture = ModContent.GetTexture("CalamityMod/Tiles/DraedonSummoner/CodebreakerAuricQuantumCoolingCell"); + } + + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = false; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Width = Width; + TileObjectData.newTile.Height = Height; + TileObjectData.newTile.Origin = new Point16(OriginOffsetX, OriginOffsetY); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateHeights = new int[Height]; + + // Initialize the coordinate heights of each frame based on the sheet area. The padding is shaved off. + for (int i = 0; i < Height; i++) + TileObjectData.newTile.CoordinateHeights[i] = SheetSquare - 2; + + TileObjectData.newTile.LavaDeath = false; + + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(ModContent.GetInstance().Hook_AfterPlacement, -1, 0, true); + + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("The Codebreaker"); + AddMapEntry(new Color(92, 107, 112), name); + animationFrameHeight = 144; + } + + public override bool CanExplode(int i, int j) => false; + + // Prevent the tile from being destroyed while it's busy decrypting. + // If it's destroyed the tile entity would be too and the resources used on decryption would be lost for nothing. + public override bool CanKillTile(int i, int j, ref bool blockDamaged) + { + TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); + if (codebreakerTileEntity is null) + return true; + if (codebreakerTileEntity.DecryptionCountdown > 0) + return false; + return true; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.18f; + g = 0.8f; + b = 0.9f; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 182); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + // Drop the base of the codebreaker. + Item.NewItem(i * 16, j * 16, 32, 32, ModContent.ItemType()); + + Tile t = Main.tile[i, j]; + int left = i - t.frameX % (Width * SheetSquare) / SheetSquare; + int top = j - t.frameY % (Height * SheetSquare) / SheetSquare; + + TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); + + // Drop any any attached components. + codebreakerTileEntity?.DropConstituents(i, j); + + // And destroy the tile entity, if it exists. + codebreakerTileEntity?.Kill(left, top); + } + + public override bool HasSmartInteract() => true; + + public override bool NewRightClick(int i, int j) + { + TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); + Player player = Main.LocalPlayer; + player.CancelSignsAndChests(); + + // If this is the tile the player is currently looking at, the associated tile entity doesn't really exist, or it's simply not upgraded enough, close the GUI. + if (codebreakerTileEntity is null || codebreakerTileEntity.ID == CodebreakerUI.ViewedTileEntityID || !codebreakerTileEntity.ContainsDecryptionComputer) + { + // Create a warning if someone attempts to click on a codebreaker without a computer with which to open the UI. + if (!codebreakerTileEntity.ContainsDecryptionComputer) + CombatText.NewText(player.Hitbox, Color.Cyan, "No decryption computer installed"); + + CodebreakerUI.ViewedTileEntityID = -1; + Main.PlaySound(SoundID.MenuClose); + } + + // Otherwise, open the decryption interface when it exists. This can be either opening the GUI from nothing, or just opening a separate codebreaker. + else if (codebreakerTileEntity != null) + { + // Play a sound depending on whether the player had another codebreaker open previously. + Main.PlaySound(CodebreakerUI.ViewedTileEntityID == -1 ? SoundID.MenuOpen : SoundID.MenuTick); + CodebreakerUI.ViewedTileEntityID = codebreakerTileEntity.ID; + Main.playerInventory = true; + Main.recBigList = false; + } + + Recipe.FindRecipes(); + return true; + } + + // All tile drawcode is done manually because the tile's animation is controlled by a tile entity. + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + // These offsets start as the tile offsets, i.e. which sub-tile of the FrameImportant structure this specific location is. + Tile t = Main.tile[i, j]; + int left = i - t.frameX % (Width * SheetSquare) / SheetSquare; + int frameXPos = t.frameX; + int frameYPos = t.frameY + Height * SheetSquare * (int)((Main.GlobalTime * 12f + left) % 8); + + // Grab the tile entity because it stores the information regarding what is actually attached. + TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); + + Vector2 offset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + if (t.halfBrick()) + offset.Y += 8f; + + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + offset; + Color drawColor = Lighting.GetColor(i, j); + Rectangle frame = new Rectangle(frameXPos, frameYPos, 16, 16); + + if ((!t.halfBrick() && t.slope() == 0) || t.halfBrick()) + { + spriteBatch.Draw(TileTexture, drawPosition, frame, drawColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + + // Place secondary parts. + if (codebreakerTileEntity != null) + { + if (codebreakerTileEntity.ContainsDecryptionComputer) + spriteBatch.Draw(ComputerTexture, drawPosition, frame, drawColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + if (codebreakerTileEntity.ContainsVoltageRegulationSystem) + spriteBatch.Draw(VoltageRegulatorTexture2, drawPosition, frame, drawColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + if (codebreakerTileEntity.ContainsSensorArray) + spriteBatch.Draw(SensorTexture, drawPosition, frame, drawColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + if (codebreakerTileEntity.ContainsCoolingCell) + spriteBatch.Draw(CoolingCellTexture, drawPosition, frame, drawColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + if (codebreakerTileEntity.ContainsVoltageRegulationSystem) + spriteBatch.Draw(VoltageRegulatorTexture, drawPosition, frame, drawColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + if (codebreakerTileEntity.ContainsAdvancedDisplay) + spriteBatch.Draw(DisplayTexture, drawPosition, frame, drawColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } + return false; + } + } +} diff --git a/Tiles/DraedonSummoner/CodebreakerTile.png b/Tiles/DraedonSummoner/CodebreakerTile.png new file mode 100644 index 0000000000..5b78410bec Binary files /dev/null and b/Tiles/DraedonSummoner/CodebreakerTile.png differ diff --git a/Tiles/DraedonSummoner/CodebreakerVoltageRegulationSystem.png b/Tiles/DraedonSummoner/CodebreakerVoltageRegulationSystem.png new file mode 100644 index 0000000000..86cffb899a Binary files /dev/null and b/Tiles/DraedonSummoner/CodebreakerVoltageRegulationSystem.png differ diff --git a/Tiles/DraedonSummoner/CodebreakerVoltageRegulationSystem2.png b/Tiles/DraedonSummoner/CodebreakerVoltageRegulationSystem2.png new file mode 100644 index 0000000000..22bab29496 Binary files /dev/null and b/Tiles/DraedonSummoner/CodebreakerVoltageRegulationSystem2.png differ diff --git a/Tiles/Furniture/BossTrophy.cs b/Tiles/Furniture/BossTrophy.cs index e6731142a8..f3688ff0d3 100644 --- a/Tiles/Furniture/BossTrophy.cs +++ b/Tiles/Furniture/BossTrophy.cs @@ -114,7 +114,19 @@ namespace CalamityMod.Tiles.Furniture case 27: item = ModContent.ItemType(); break; - } + case 28: + item = ModContent.ItemType(); + break; + case 29: + item = ModContent.ItemType(); + break; + case 30: + item = ModContent.ItemType(); + break; + case 31: + item = ModContent.ItemType(); + break; + } if (item > 0) { Item.NewItem(i * 16, j * 16, 48, 48, item); diff --git a/Tiles/Furniture/BossTrophy.png b/Tiles/Furniture/BossTrophy.png index 9e6ddb9cd5..1a7cee6bc6 100644 Binary files a/Tiles/Furniture/BossTrophy.png and b/Tiles/Furniture/BossTrophy.png differ diff --git a/Tiles/Furniture/CraftingStations/CosmicAnvil.cs b/Tiles/Furniture/CraftingStations/CosmicAnvil.cs new file mode 100644 index 0000000000..9b813bbfb5 --- /dev/null +++ b/Tiles/Furniture/CraftingStations/CosmicAnvil.cs @@ -0,0 +1,38 @@ +using CalamityMod.Items.Placeables.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.CraftingStations +{ + public class CosmicAnvil : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + // You cannot face the Cosmic Anvil left or right, it only has one orientation + TileObjectData.newTile.Direction = Terraria.Enums.TileObjectDirection.None; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cosmic Anvil"); + AddMapEntry(new Color(159, 125, 201), name); + disableSmartCursor = true; + // Visual Studio complains about this line. However, if you change it to DustID.BubbleBurst_Purple, it won't compile. + dustType = 179; + adjTiles = new int[] { TileID.Anvils, TileID.MythrilAnvil }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 16, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/CraftingStations/CosmicAnvil.png b/Tiles/Furniture/CraftingStations/CosmicAnvil.png new file mode 100644 index 0000000000..f36dea2aad Binary files /dev/null and b/Tiles/Furniture/CraftingStations/CosmicAnvil.png differ diff --git a/Tiles/Furniture/CraftingStations/DraedonsForge.cs b/Tiles/Furniture/CraftingStations/DraedonsForge.cs index d4519ddab1..faa00a1276 100644 --- a/Tiles/Furniture/CraftingStations/DraedonsForge.cs +++ b/Tiles/Furniture/CraftingStations/DraedonsForge.cs @@ -1,30 +1,60 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; namespace CalamityMod.Tiles.Furniture.CraftingStations { - public class DraedonsForge : ModTile //Legacy names used to avoid fucking over people's placed forges and ensure they are converted properly. + public class DraedonsForge : ModTile { - public override void SetDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //Changed from 3x2 to 4x2 due to sprite. + + TileObjectData.newTile.CopyFrom(TileObjectData.Style5x4); // Uses 5x4 style, but reduces height to 3. TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 18 }; + TileObjectData.newTile.Origin = new Point16(2, 1); TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cosmic Anvil"); - AddMapEntry(new Color(0, 255, 0), name); + name.SetDefault("Draedon's Forge"); + AddMapEntry(new Color(230, 157, 41), name); + + animationFrameHeight = 54; disableSmartCursor = true; - adjTiles = new int[] { TileID.Anvils, TileID.TinkerersWorkbench, TileID.WorkBenches, TileID.LunarCraftingStation, - TileID.MythrilAnvil, TileID.AdamantiteForge, TileID.DemonAltar }; //Specifically not furnaces + dustType = DustID.Platinum; // 84 + + adjTiles = new int[] { + TileID.WorkBenches, + TileID.Chairs, + TileID.Tables, + TileID.Anvils, + TileID.MythrilAnvil, + ModContent.TileType(), + TileID.Furnaces, + TileID.Hellforge, + TileID.AdamantiteForge, + TileID.TinkerersWorkbench, + TileID.LunarCraftingStation, + TileID.DemonAltar + }; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 11) + { + frame = (frame + 1) % 4; + frameCounter = 0; + } } public override void KillMultiTile(int i, int j, int frameX, int frameY) diff --git a/Tiles/Furniture/CraftingStations/DraedonsForge.png b/Tiles/Furniture/CraftingStations/DraedonsForge.png index f36dea2aad..4cf91ee3bc 100644 Binary files a/Tiles/Furniture/CraftingStations/DraedonsForge.png and b/Tiles/Furniture/CraftingStations/DraedonsForge.png differ diff --git a/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs b/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs index bae7dca78c..2912fab2db 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs @@ -85,7 +85,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite Tile tile = Main.tile[i, j]; if (tile.frameY == 18) { - CalamityUtils.DrawFlameSparks((int)CalamityDusts.PurpleCosmolite, 5, i, j); + CalamityUtils.DrawFlameSparks((int)CalamityDusts.PurpleCosmilite, 5, i, j); } } } diff --git a/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs b/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs index 84d244b13e..7f4d0cbfb0 100644 --- a/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs +++ b/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs @@ -90,7 +90,7 @@ namespace CalamityMod.Tiles.LivingFire public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 1, default, 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 1, default, 1f); return false; } } diff --git a/TrailGeneration/PrimitiveTrail.cs b/TrailGeneration/PrimitiveTrail.cs index 84c5adf374..7ad02a7ca4 100644 --- a/TrailGeneration/PrimitiveTrail.cs +++ b/TrailGeneration/PrimitiveTrail.cs @@ -105,18 +105,23 @@ namespace CalamityMod List basePoints = originalPositions.Where(originalPosition => originalPosition != Vector2.Zero).ToList(); List endPoints = new List(); - if (basePoints.Count < 3) - return endPoints; + if (basePoints.Count < 2) + { + for (int i = 0; i < basePoints.Count; i++) + basePoints[i] += generalOffset; + return basePoints; + } // Remap the original positions across a certain length. for (int i = 0; i < totalTrailPoints; i++) { - float completionRatio = i / (float)totalTrailPoints; - int currentColorIndex = (int)(completionRatio * (basePoints.Count - 1)); - Vector2 currentColor = basePoints[currentColorIndex]; - Vector2 nextColor = basePoints[(currentColorIndex + 1) % basePoints.Count]; - endPoints.Add(Vector2.Lerp(currentColor, nextColor, completionRatio * (basePoints.Count - 1) % 0.999f) + generalOffset); + float completionRatio = i / (float)(totalTrailPoints - 1f); + int currentIndex = (int)(completionRatio * (basePoints.Count - 1)); + Vector2 currentPoint = basePoints[currentIndex]; + Vector2 nextPoint = basePoints[(currentIndex + 1) % basePoints.Count]; + endPoints.Add(Vector2.Lerp(currentPoint, nextPoint, completionRatio * (basePoints.Count - 1) % 0.99999f) + generalOffset); } + endPoints.Add(basePoints.Last() + generalOffset); return endPoints; } @@ -247,7 +252,7 @@ namespace CalamityMod List trailPoints = TrailPointFunction(originalPositions, generalOffset, totalTrailPoints, originalRotations); // A trail with only one point or less has nothing to connect to, and therefore, can't make a trail. - if (trailPoints.Count <= 2) + if (trailPoints.Count < 2) return; // If the trail points have any NaN positions, don't draw anything. diff --git a/UI/BossHealthBarManager.cs b/UI/BossHealthBarManager.cs index b8f786368e..516551a6cd 100644 --- a/UI/BossHealthBarManager.cs +++ b/UI/BossHealthBarManager.cs @@ -164,10 +164,6 @@ namespace CalamityMod.UI int[] Slimes = new int[] { NPCType(), NPCType(), NPCType(), NPCType(), NPCType() }; OneToMany[NPCType()] = Slimes; - OneToMany[NPCType()] = Slimes; - OneToMany[NPCType()] = Slimes; - OneToMany[NPCType()] = Slimes; - OneToMany[NPCType()] = Slimes; SetupBossExclusionList(); SetupMinibossHPBarList(); @@ -352,7 +348,7 @@ namespace CalamityMod.UI continue; bool isEoWSegment = Main.npc[i].type == NPCID.EaterofWorldsBody || Main.npc[i].type == NPCID.EaterofWorldsTail; - if ((Main.npc[i].IsABoss() && !isEoWSegment) || MinibossHPBarList.Contains(Main.npc[i].type)) + if ((Main.npc[i].IsABoss() && !isEoWSegment) || MinibossHPBarList.Contains(Main.npc[i].type) || Main.npc[i].Calamity().CanHaveBossHealthBar) AttemptToAddBar(i); } @@ -573,7 +569,7 @@ namespace CalamityMod.UI OpenAnimationTimer = Utils.Clamp(OpenAnimationTimer + 1, 0, OpenAnimationTime); EnrageTimer = Utils.Clamp(EnrageTimer + NPCIsEnraged.ToDirectionInt(), 0, EnrageAnimationTime); - if (CombinedNPCMaxLife != 0 && InitialMaxLife == 0) + if (CombinedNPCMaxLife != 0 && (InitialMaxLife == 0 || InitialMaxLife < CombinedNPCMaxLife)) InitialMaxLife = CombinedNPCMaxLife; } diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index 71007090c9..23634d8c55 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -34,7 +34,7 @@ namespace CalamityMod.UI.CalamitasEnchants if (!Main.npc.IndexInRange(NPCIndex) || !Main.npc[NPCIndex].active) return false; - Rectangle validTalkArea = Utils.CenteredRectangle(Main.LocalPlayer.Center, new Vector2(Player.tileRangeX * 2f, Player.tileRangeY) * 16f); + Rectangle validTalkArea = Utils.CenteredRectangle(Main.LocalPlayer.Center, new Vector2(Player.tileRangeX * 3f, Player.tileRangeY * 2f) * 16f); return validTalkArea.Intersects(Main.npc[NPCIndex].Hitbox); } diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index d2a42cae4d..4e7c63f4c1 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -155,14 +155,14 @@ namespace CalamityMod.UI.CalamitasEnchants "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Indignant", null, player => player.Calamity().cursedSummonsEnchant = true, - item => item.damage > 0 && item.maxStack == 1 && item.summon), + item => item.IsEnchantable() && item.damage > 0 && item.summon), new Enchantment("Aflame", "Lights enemies ablaze on hit but also causes the user to take damage over time when holding this item.", 200, "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Aflame", null, player => player.Calamity().flamingItemEnchant = true, - item => item.damage > 0 && item.maxStack == 1 && !item.summon), + item => item.IsEnchantable() && item.damage > 0 && !item.summon), new Enchantment("Oblatory", "Reduces mana cost and greatly increases damage but sometimes causes this item to use your life.", 300, @@ -173,35 +173,35 @@ namespace CalamityMod.UI.CalamitasEnchants item.mana = (int)Math.Ceiling(item.mana * 0.6); }, player => player.Calamity().lifeManaEnchant = true, - item => item.damage > 0 && item.maxStack == 1 && item.magic && item.mana > 0), + item => item.IsEnchantable() && item.damage > 0 && item.magic && item.mana > 0), new Enchantment("Resentful", "Makes the damage of projectiles vary based on how far the hit target is from you. The farther, the more damage, and vice versa.", 400, "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Resentful", null, player => player.Calamity().farProximityRewardEnchant = true, - item => item.damage > 0 && item.maxStack == 1 && item.shoot > ProjectileID.None), + item => item.IsEnchantable() && item.damage > 0 && item.shoot > ProjectileID.None && !item.Calamity().trueMelee), new Enchantment("Bloodthirsty", "Makes the damage of projectiles vary based on how far the hit target is from you. The closer, the more damage, and vice versa.", 500, "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Bloodthirsty", null, player => player.Calamity().closeProximityRewardEnchant = true, - item => item.damage > 0 && item.maxStack == 1 && item.shoot > ProjectileID.None), + item => item.IsEnchantable() && item.damage > 0 && item.shoot > ProjectileID.None && !item.Calamity().trueMelee), new Enchantment("Ephemeral", "Causes the damage output of this item to discharge from exhaustive use. Its damage returns naturally when not being used. It starts off with more damage than it normally would have.", 600, "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Ephemeral", null, player => player.Calamity().dischargingItemEnchant = true, - item => item.damage > 0 && item.maxStack == 1 && !item.summon), + item => item.IsEnchantable() && item.damage > 0 && !item.summon), new Enchantment("Hellbound", "Causes minions to be created with a 40 second timer. Once it runs out, they explode violently. Minions do more damage the longer they live and idly explode as well.", 700, "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Hellbound", null, player => player.Calamity().explosiveMinionsEnchant = true, - item => item.damage > 0 && item.maxStack == 1 && item.summon), + item => item.IsEnchantable() && item.damage > 0 && item.summon), new Enchantment("Tainted", "Removes projectile shooting capabilities of this item. In exchange, two skeletal arms are released on use that slice at the mouse position.", 800, @@ -237,28 +237,28 @@ namespace CalamityMod.UI.CalamitasEnchants Main.projectile[blade].localAI[0] = -80f; } }, - item => item.damage > 0 && item.maxStack == 1 && item.melee && !item.noUseGraphic && item.shoot > ProjectileID.None), + item => item.IsEnchantable() && item.damage > 0 && item.melee && !item.noUseGraphic && item.shoot > ProjectileID.None), new Enchantment("Traitorous", "Causes this item to sometimes release a monster that hurts both you and enemies when you have less than 50% mana.", 900, "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Traitorous", null, player => player.Calamity().manaMonsterEnchant = true, - item => item.damage > 0 && item.maxStack == 1 && item.magic && item.mana > 0), + item => item.IsEnchantable() && item.damage > 0 && item.magic && item.mana > 0), new Enchantment("Withering", "You heal when hurt based on damage you've dealt. After being hurt, the weapon rapidly drains your life to deal massive damage.", 1000, "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Withered", null, player => player.Calamity().witheringWeaponEnchant = true, - item => item.damage > 0 && item.maxStack == 1 && !item.summon), + item => item.IsEnchantable() && item.damage > 0 && !item.summon), new Enchantment("Persecuted", "When attacked, or over time, demon portals appear near you. If sufficiently damaged they are friendly; otherwise they attack you.", 1100, "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Persecuted", null, player => player.Calamity().persecutedEnchant = true, - item => item.damage > 0 && item.maxStack == 1 && item.shoot > ProjectileID.None), + item => item.IsEnchantable() && item.damage > 0 && item.shoot > ProjectileID.None), new Enchantment("Lecherous", "Spawns a resilient brimstone orb that stays between you and your mouse that interferes with your homing weapons. It releases a bunch of hearts on death.", 1200, @@ -288,7 +288,7 @@ namespace CalamityMod.UI.CalamitasEnchants CalamityNetcode.NewNPC_ClientSide(player.Center, orbType, player); } }, - item => item.damage > 0 && item.maxStack == 1 && item.shoot > ProjectileID.None), + item => item.IsEnchantable() && item.damage > 0 && item.shoot > ProjectileID.None && !item.summon), }; // Special disenchantment thing. This is separated from the list on purpose. @@ -301,7 +301,7 @@ namespace CalamityMod.UI.CalamitasEnchants item.Calamity().AppliedEnchantment = null; item.Calamity().DischargeEnchantExhaustion = 0; }, - item => item.maxStack == 1 && item.shoot >= ProjectileID.None); + item => item.IsEnchantable() && item.shoot >= ProjectileID.None); ItemUpgradeRelationship = new Dictionary() { diff --git a/UI/CodebreakerUI.cs b/UI/CodebreakerUI.cs new file mode 100644 index 0000000000..46f8a49f1d --- /dev/null +++ b/UI/CodebreakerUI.cs @@ -0,0 +1,472 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.NPCs.ExoMechs; +using CalamityMod.TileEntities; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Linq; +using System.Text; +using Terraria; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.UI.Chat; + +namespace CalamityMod.UI +{ + public static class CodebreakerUI + { + public static int ViewedTileEntityID = -1; + public static bool AwaitingCloseConfirmation = false; + public static bool AwaitingDecryptionTextClose = false; + public static float VerificationButtonScale = 1f; + public static float CancelButtonScale = 0.75f; + public static float ContactButtonScale = 1f; + public static float MechIconScale = 1f; + public static Vector2 BackgroundCenter => new Vector2(500f, Main.screenHeight * 0.5f + 115f); + public static float GeneralScale => MathHelper.Lerp(1f, 0.7f, Utils.InverseLerp(1325f, 750f, Main.screenWidth, true)) * Main.UIScale; + + public static Rectangle MouseScreenArea => Utils.CenteredRectangle(Main.MouseScreen, Vector2.One * 2f); + public static void Draw(SpriteBatch spriteBatch) + { + // If not viewing the specific tile entity's interface anymore, if the ID is for some reason invalid, or if the player is not equipped to continue viewing the UI + // don't do anything other than resetting necessary data. + if (!TileEntity.ByID.ContainsKey(ViewedTileEntityID) || !(TileEntity.ByID[ViewedTileEntityID] is TECodebreaker codebreakerTileEntity) || !Main.LocalPlayer.WithinRange(codebreakerTileEntity.Center, 270f) || !Main.playerInventory) + { + VerificationButtonScale = 1f; + CancelButtonScale = 0.75f; + ContactButtonScale = 1f; + ViewedTileEntityID = -1; + AwaitingCloseConfirmation = false; + MechIconScale = 1f; + return; + } + + // Draw the background. + Texture2D backgroundTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonDecrypterBackground"); + spriteBatch.Draw(backgroundTexture, BackgroundCenter, null, Color.White, 0f, backgroundTexture.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0f); + + Rectangle backgroundArea = Utils.CenteredRectangle(BackgroundCenter, backgroundTexture.Size()); + if (MouseScreenArea.Intersects(backgroundArea)) + Main.blockMouse = Main.LocalPlayer.mouseInterface = true; + + bool canSummonDraedon = codebreakerTileEntity.ReadyToSummonDraedon && CalamityWorld.AbleToSummonDraedon; + Vector2 backgroundTopLeft = BackgroundCenter - backgroundTexture.Size() * GeneralScale * 0.5f; + + // Draw the cell payment slot icon. + Texture2D emptyCellIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/PowerCellSlot_Empty"); + Texture2D occupiedCellIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/PowerCellSlot_Filled"); + Texture2D textPanelTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonDecrypterScreen"); + Texture2D cellTexture = codebreakerTileEntity.InputtedCellCount > 0 ? occupiedCellIconTexture : emptyCellIconTexture; + Vector2 cellDrawCenter = backgroundTopLeft + Vector2.One * GeneralScale * 60f; + + Vector2 schematicSlotDrawCenter = cellDrawCenter + Vector2.UnitY * GeneralScale * 70f; + Vector2 costDisplayLocation = schematicSlotDrawCenter + Vector2.UnitY * GeneralScale * 20f; + Vector2 costVerificationLocation = costDisplayLocation + Vector2.UnitY * GeneralScale * 60f; + Vector2 textPanelCenter = backgroundTopLeft + Vector2.UnitX * backgroundTexture.Width + textPanelTexture.Size() * GeneralScale * new Vector2(-0.5f, 0.5f); + Vector2 summonButtonCenter = backgroundTopLeft + new Vector2(58f, backgroundTexture.Height - 48f) * GeneralScale; + + // Display some error text if the codebreaker isn't strong enough to decrypt the schematic. + if (codebreakerTileEntity.HeldSchematicID != 0 && !codebreakerTileEntity.CanDecryptHeldSchematic) + DisplayNotStrongEnoughErrorText(schematicSlotDrawCenter + new Vector2(-24f, 30f)); + + // Handle decryption costs. + else if (codebreakerTileEntity.HeldSchematicID != 0 && codebreakerTileEntity.DecryptionCountdown == 0) + { + int cost = codebreakerTileEntity.DecryptionCellCost; + DisplayCostText(costDisplayLocation, cost); + + if (codebreakerTileEntity.InputtedCellCount >= cost) + { + if (canSummonDraedon) + { + costVerificationLocation.X -= GeneralScale * 15f; + summonButtonCenter.X += GeneralScale * 15f; + } + DrawCostVerificationButton(codebreakerTileEntity, costVerificationLocation); + } + } + else if (codebreakerTileEntity.DecryptionCountdown > 0) + { + if (!AwaitingCloseConfirmation) + DisplayDecryptCancelButton(codebreakerTileEntity, costVerificationLocation - Vector2.UnitY * GeneralScale * 30f); + else + DisplayDecryptCancelButton(codebreakerTileEntity, textPanelCenter + Vector2.UnitY * GeneralScale * 110f); + } + + if (canSummonDraedon) + HandleDraedonSummonButton(codebreakerTileEntity, summonButtonCenter); + + if (codebreakerTileEntity.DecryptionCountdown > 0 || AwaitingDecryptionTextClose) + HandleDecryptionStuff(codebreakerTileEntity, backgroundTexture, backgroundTopLeft, schematicSlotDrawCenter + Vector2.UnitY * GeneralScale * 80f); + if (codebreakerTileEntity.DecryptionCountdown > 0 && AwaitingCloseConfirmation) + DrawDecryptCancelConfirmationText(textPanelCenter); + + // Draw the schematic icon. + Texture2D schematicIconBG = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/EncryptedSchematicSlotBackground"); + Texture2D schematicIconTexture = schematicIconBG; + int schematicType = 0; + + if (codebreakerTileEntity.HeldSchematicID > 0) + schematicType = CalamityLists.EncryptedSchematicIDRelationship[codebreakerTileEntity.HeldSchematicID]; + + if (schematicType == ModContent.ItemType()) + schematicIconTexture = ModContent.GetTexture("CalamityMod/Items/DraedonMisc/EncryptedSchematicPlanetoid"); + if (schematicType == ModContent.ItemType()) + schematicIconTexture = ModContent.GetTexture("CalamityMod/Items/DraedonMisc/EncryptedSchematicJungle"); + if (schematicType == ModContent.ItemType()) + schematicIconTexture = ModContent.GetTexture("CalamityMod/Items/DraedonMisc/EncryptedSchematicHell"); + if (schematicType == ModContent.ItemType()) + schematicIconTexture = ModContent.GetTexture("CalamityMod/Items/DraedonMisc/EncryptedSchematicIce"); + + spriteBatch.Draw(schematicIconBG, schematicSlotDrawCenter, null, Color.White, 0f, schematicIconBG.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0f); + if (codebreakerTileEntity.HeldSchematicID != 0) + spriteBatch.Draw(schematicIconTexture, schematicSlotDrawCenter, null, Color.White, 0f, schematicIconTexture.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0f); + HandleSchematicSlotInteractions(codebreakerTileEntity, schematicSlotDrawCenter, cellTexture.Size() * GeneralScale); + + // Create a temporary item for drawing purposes. + // If cells are present, make the item reflect that. + Item temporaryPowerCell = new Item(); + temporaryPowerCell.SetDefaults(ModContent.ItemType()); + temporaryPowerCell.stack = codebreakerTileEntity.InputtedCellCount; + + CalamityUtils.DrawPowercellSlot(spriteBatch, temporaryPowerCell, cellDrawCenter, GeneralScale); + HandleCellSlotInteractions(codebreakerTileEntity, temporaryPowerCell, cellDrawCenter, cellTexture.Size()); + } + + public static void HandleCellSlotInteractions(TECodebreaker codebreakerTileEntity, Item temporaryItem, Vector2 cellIconCenter, Vector2 area) + { + Rectangle clickArea = Utils.CenteredRectangle(cellIconCenter, area); + + // If the mouse is not in the specific area don't do anything else. + if (!MouseScreenArea.Intersects(clickArea)) + return; + + ref Item playerHandItem = ref Main.mouseItem; + + if (!temporaryItem.IsAir) + Main.HoverItem = temporaryItem; + + if (Main.mouseLeft && Main.mouseLeftRelease && codebreakerTileEntity.DecryptionCountdown <= 0) + { + int powerCellID = ModContent.ItemType(); + short cellStackDiff = 0; + bool shouldPlaySound = true; + + // If the player is holding shift and has space for the power cells, just spawn all of them on his or her face, up to the max-stack limit. + if (Main.keyState.PressingShift() && Main.LocalPlayer.ItemSpace(temporaryItem)) + { + cellStackDiff = (short)-Math.Min(temporaryItem.stack, temporaryItem.maxStack); + DropHelper.DropItem(Main.LocalPlayer, powerCellID, -cellStackDiff); + + // Do not play a sound in this situation. The player is going to pick up the dropped cells in a few frames, which will make sound. + shouldPlaySound = false; + } + + // If the slot is normally clicked, behavior depends on whether the player is holding power cells. + else + { + bool holdingPowercell = playerHandItem.type == powerCellID; + + // If the player's held power cells can be stacked on top of what's already in the codeberaker, then stack them. + if (holdingPowercell && temporaryItem.stack < TECodebreaker.MaxCellCapacity) + { + int spaceLeft = TECodebreaker.MaxCellCapacity - temporaryItem.stack; + + // If the player has more cells than there is space left, insert as many as possible. Otherwise insert all the cells. + int cellsToInsert = Math.Min(playerHandItem.stack, spaceLeft); + cellStackDiff = (short)cellsToInsert; + playerHandItem.stack -= cellsToInsert; + if (playerHandItem.stack == 0) + playerHandItem.TurnToAir(); + AwaitingDecryptionTextClose = false; + } + + // If the player is holding nothing, then pick up all the power cells (if any exist), up to the max-stack limit. + else if (playerHandItem.IsAir && temporaryItem.stack > 0) + { + cellStackDiff = (short)-temporaryItem.stack; + if (cellStackDiff < -temporaryItem.maxStack) + cellStackDiff = (short)-temporaryItem.maxStack; + + playerHandItem.SetDefaults(temporaryItem.type); + playerHandItem.stack = -cellStackDiff; + temporaryItem.TurnToAir(); + AwaitingDecryptionTextClose = false; + } + } + + if (cellStackDiff != 0) + { + if (shouldPlaySound) + Main.PlaySound(SoundID.Grab); + AwaitingDecryptionTextClose = false; + codebreakerTileEntity.InputtedCellCount += cellStackDiff; + codebreakerTileEntity.SyncContainedStuff(); + } + } + + // Force the hover item to be drawn. + // Since HoverItem is active, we don't need to input anything into this method. + if (temporaryItem.stack > 0) + Main.instance.MouseTextHackZoom(string.Empty); + } + + public static void HandleSchematicSlotInteractions(TECodebreaker codebreakerTileEntity, Vector2 schematicIconCenter, Vector2 area) + { + Rectangle clickArea = Utils.CenteredRectangle(schematicIconCenter, area); + + // If the mouse is not in the specific area don't do anything else. + if (!MouseScreenArea.Intersects(clickArea)) + return; + + ref Item playerHandItem = ref Main.mouseItem; + + // Handle mouse click interactions. + if (Main.mouseLeft && Main.mouseLeftRelease) + { + // If the player's hand item is empty and the codebreaker has a schematic, grab it. + // This doesn't work if the Codebreaker is busy decrypting the schematic in question. + if (playerHandItem.IsAir && CalamityLists.EncryptedSchematicIDRelationship.ContainsKey(codebreakerTileEntity.HeldSchematicID) && codebreakerTileEntity.DecryptionCountdown <= 0) + { + playerHandItem.SetDefaults(CalamityLists.EncryptedSchematicIDRelationship[codebreakerTileEntity.HeldSchematicID]); + codebreakerTileEntity.HeldSchematicID = 0; + codebreakerTileEntity.DecryptionCountdown = 0; + codebreakerTileEntity.SyncContainedStuff(); + Main.PlaySound(SoundID.Grab); + + AwaitingDecryptionTextClose = false; + } + + // Otherwise, if the player has an encrypted schematic and the Codebreaker doesn't, insert it into the machine. + else if (CalamityLists.EncryptedSchematicIDRelationship.ContainsValue(playerHandItem.type)) + { + codebreakerTileEntity.HeldSchematicID = CalamityLists.EncryptedSchematicIDRelationship.First(i => i.Value == Main.mouseItem.type).Key; + playerHandItem.TurnToAir(); + codebreakerTileEntity.SyncContainedStuff(); + Main.PlaySound(SoundID.Grab); + + AwaitingDecryptionTextClose = false; + } + } + } + + public static void DisplayCostText(Vector2 drawPosition, int totalCellsCost) + { + // Display the cost text. + string text = "Cost: "; + drawPosition.X -= GeneralScale * 30f; + Utils.DrawBorderStringFourWay(Main.spriteBatch, Main.fontMouseText, text, drawPosition.X, drawPosition.Y + GeneralScale * 20f, Color.White * (Main.mouseTextColor / 255f), Color.Black, Vector2.Zero, GeneralScale); + + // And draw the cells to the right of the text. + Texture2D cellTexture = ModContent.GetTexture("CalamityMod/Items/DraedonMisc/PowerCell"); + Vector2 offsetDrawPosition = new Vector2(drawPosition.X + ChatManager.GetStringSize(Main.fontMouseText, text, Vector2.One, -1f).X * GeneralScale + GeneralScale * 15f, drawPosition.Y + GeneralScale * 30f); + Main.spriteBatch.Draw(cellTexture, offsetDrawPosition, null, Color.White, 0f, cellTexture.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0f); + + // Display the cell quantity numerically below the drawn cells. + Utils.DrawBorderStringFourWay(Main.spriteBatch, Main.fontItemStack, totalCellsCost.ToString(), offsetDrawPosition.X - GeneralScale * 11f, offsetDrawPosition.Y, Color.White, Color.Black, new Vector2(0.3f), GeneralScale * 0.75f); + } + + public static void DrawCostVerificationButton(TECodebreaker codebreakerTileEntity, Vector2 drawPosition) + { + Texture2D confirmationTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DecryptIcon"); + Rectangle clickArea = Utils.CenteredRectangle(drawPosition, confirmationTexture.Size() * VerificationButtonScale); + + // Check if the mouse is hovering over the cost button area. + if (MouseScreenArea.Intersects(clickArea)) + { + // If so, cause the button to inflate a little bit. + VerificationButtonScale = MathHelper.Clamp(VerificationButtonScale + 0.035f, 1f, 1.35f); + + // If a click is done, begin the decryption process. + // This will "lock" various things and make the Codebreaker unbreakable, to prevent complications with lost items. + // Also play a cool sound. + if (Main.mouseLeft && Main.mouseLeftRelease) + { + Main.PlaySound(SoundID.Zombie, Main.LocalPlayer.Center, 67); + AwaitingDecryptionTextClose = true; + codebreakerTileEntity.InitialCellCountBeforeDecrypting = codebreakerTileEntity.InputtedCellCount; + codebreakerTileEntity.DecryptionCountdown = codebreakerTileEntity.DecryptionTotalTime; + codebreakerTileEntity.SyncContainedStuff(); + codebreakerTileEntity.SyncDecryptCountdown(); + } + } + + // Otherwise, if not hovering, cause the button to deflate back to its normal size. + else + VerificationButtonScale = MathHelper.Clamp(VerificationButtonScale - 0.05f, 1f, 1.35f); + + // Draw the confirmation icon. + Main.spriteBatch.Draw(confirmationTexture, drawPosition, null, Color.White, 0f, confirmationTexture.Size() * 0.5f, VerificationButtonScale * GeneralScale, SpriteEffects.None, 0f); + } + + public static void DisplayDecryptCancelButton(TECodebreaker codebreakerTileEntity, Vector2 drawPosition) + { + bool clickingMouse = Main.mouseLeft && Main.mouseLeftRelease; + Texture2D cancelTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DecryptCancelIcon"); + Rectangle clickArea = Utils.CenteredRectangle(drawPosition, cancelTexture.Size() * CancelButtonScale * 1.2f); + + // Check if the mouse is hovering over the decrypt button area. + if (MouseScreenArea.Intersects(clickArea)) + { + // If so, cause the button to inflate a little bit. + CancelButtonScale = MathHelper.Clamp(CancelButtonScale + 0.035f, 0.9f, 1.2f); + + // If a click is done, cancel the decryption process. + // This will cause already consumed cells to be lost. + if (clickingMouse) + { + if (AwaitingCloseConfirmation) + { + Main.PlaySound(SoundID.Item94, Main.LocalPlayer.Center); + + AwaitingDecryptionTextClose = false; + codebreakerTileEntity.InitialCellCountBeforeDecrypting = 0; + codebreakerTileEntity.DecryptionCountdown = 0; + codebreakerTileEntity.SyncContainedStuff(); + codebreakerTileEntity.SyncDecryptCountdown(); + AwaitingCloseConfirmation = false; + } + else + AwaitingCloseConfirmation = true; + } + } + + // Otherwise, if not hovering, cause the button to deflate back to its normal size. + else + { + CancelButtonScale = MathHelper.Clamp(CancelButtonScale - 0.05f, 0.9f, 1.2f); + if (clickingMouse) + AwaitingCloseConfirmation = false; + } + + // Draw the cancel icon. + Main.spriteBatch.Draw(cancelTexture, drawPosition, null, Color.White, 0f, cancelTexture.Size() * 0.5f, CancelButtonScale * GeneralScale, SpriteEffects.None, 0f); + } + + public static void DrawDecryptCancelConfirmationText(Vector2 drawPosition) + { + Texture2D textPanelTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonDecrypterScreen"); + Vector2 scale = new Vector2(1f, 0.3f) * GeneralScale; + Main.spriteBatch.Draw(textPanelTexture, drawPosition, null, Color.White, 0f, textPanelTexture.Size() * 0.5f, scale, SpriteEffects.None, 0); + + string confirmationText = "Are you sure?"; + Vector2 confirmationTextPosition = drawPosition - Main.fontMouseText.MeasureString(confirmationText) * GeneralScale * 0.5f + Vector2.UnitY * GeneralScale * 4f; + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, confirmationText, confirmationTextPosition, Color.Red, 0f, Vector2.Zero, Vector2.One * GeneralScale); + } + + public static void HandleDecryptionStuff(TECodebreaker codebreakerTileEntity, Texture2D backgroundTexture, Vector2 backgroundTopLeft, Vector2 barCenter) + { + Texture2D textPanelTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonDecrypterScreen"); + Vector2 textPanelCenter = backgroundTopLeft + Vector2.UnitX * backgroundTexture.Width * GeneralScale + textPanelTexture.Size() * new Vector2(-0.5f, 0.5f) * GeneralScale; + Main.spriteBatch.Draw(textPanelTexture, textPanelCenter, null, Color.White, 0f, textPanelTexture.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0f); + + // Generate gibberish and use slowly insert the real text. + // When decryption is done the gibberish will go away and only the underlying text will remain. + int textPadding = 6; + string trueMessage = codebreakerTileEntity.UnderlyingSchematicText; + StringBuilder text = new StringBuilder(codebreakerTileEntity.DecryptionCountdown == 0 ? trueMessage : CalamityUtils.GenerateRandomAlphanumericString(500)); + + // Messing with whitespace characters so can cause the word-wrap to "jump" around. + // As a result, changes to whitespace characters in the true text do not stay. + for (int i = 0; i < trueMessage.Length; i++) + { + if (char.IsWhiteSpace(trueMessage[i])) + text[i] = trueMessage[i]; + } + + // Insert the necessary amount of true text. + for (int i = 0; i < (int)(trueMessage.Length * codebreakerTileEntity.DecryptionCompletion); i++) + text[i] = trueMessage[i]; + + // Define the initial text draw position. + Vector2 currentTextDrawPosition = backgroundTopLeft + new Vector2(backgroundTexture.Width - textPanelTexture.Width + textPadding, 6f) * GeneralScale; + + // Draw the lines of text. A maximum of 10 may be drawn and the vertical offset per line is 16 pixels. + foreach (string line in Utils.WordwrapString(text.ToString(), Main.fontMouseText, (int)(textPanelTexture.Width * 1.5 - textPadding * 2), 10, out _)) + { + // If a line is null or empty for some reason, don't attempt to draw it or move to the next line position. + if (string.IsNullOrEmpty(line)) + continue; + + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, line, currentTextDrawPosition, Color.Cyan, 0f, Vector2.Zero, new Vector2(0.6f) * GeneralScale); + currentTextDrawPosition.Y += GeneralScale * 16f; + } + + // Handle special drawing when decryption is ongoing. + // If it isn't, return; the below logic is unnecessary. + if (codebreakerTileEntity.DecryptionCountdown <= 0) + return; + + // Draw a small bar at the bottom to indicate how much work is left. + Texture2D borderTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CodebreakerDecyptionBar"); + Texture2D barTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CodebreakerDecyptionBarCharge"); + Main.spriteBatch.Draw(borderTexture, barCenter, null, Color.White, 0f, borderTexture.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0); + Rectangle barRectangle = new Rectangle(0, 0, (int)(barTexture.Width * codebreakerTileEntity.DecryptionCompletion), barTexture.Width); + Main.spriteBatch.Draw(barTexture, barCenter, barRectangle, Color.White, 0f, barTexture.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0); + + // Display a completion percentage below the bar as a more precise indicator. + string completionText = $"{codebreakerTileEntity.DecryptionCompletion * 100f:n2}%"; + Vector2 textDrawPosition = barCenter + new Vector2(-Main.fontMouseText.MeasureString(completionText).X * 0.5f, 10f) * GeneralScale; + Utils.DrawBorderStringFourWay(Main.spriteBatch, Main.fontMouseText, completionText, textDrawPosition.X, textDrawPosition.Y, Color.Cyan * 1.2f, Color.Black, Vector2.Zero, GeneralScale); + } + + public static void HandleDraedonSummonButton(TECodebreaker codebreakerTileEntity, Vector2 drawPosition) + { + Texture2D contactButton = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ContactIcon_THanos"); + + Rectangle clickArea = Utils.CenteredRectangle(drawPosition, contactButton.Size() * VerificationButtonScale); + + // Check if the mouse is hovering over the contact button area. + if (MouseScreenArea.Intersects(clickArea)) + { + // If so, cause the button to inflate a little bit. + ContactButtonScale = MathHelper.Clamp(ContactButtonScale + 0.035f, 1f, 1.35f); + + // If a click is done, do a check. + // Prepare the summoning process by defining the countdown and current summon position. The mech will be summoned by the Draedon NPC. + // Also play a cool sound. + if (Main.mouseLeft && Main.mouseLeftRelease) + { + CalamityWorld.DraedonSummonCountdown = CalamityWorld.DraedonSummonCountdownMax; + CalamityWorld.DraedonSummonPosition = codebreakerTileEntity.Center + new Vector2(-8f, -100f); + Main.PlaySound(CalamityMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/CodebreakerBeam"), CalamityWorld.DraedonSummonPosition); + + if (Main.netMode != NetmodeID.SinglePlayer) + { + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.CodebreakerSummonStuff); + netMessage.Write(CalamityWorld.DraedonSummonCountdown); + netMessage.WriteVector2(CalamityWorld.DraedonSummonPosition); + netMessage.Send(); + } + } + } + + // Otherwise, if not hovering, cause the button to deflate back to its normal size. + else + ContactButtonScale = MathHelper.Clamp(ContactButtonScale - 0.05f, 1f, 1.35f); + + // Draw the contact button. + Main.spriteBatch.Draw(contactButton, drawPosition, null, Color.White, 0f, contactButton.Size() * 0.5f, ContactButtonScale * GeneralScale, SpriteEffects.None, 0f); + + // And display a text indicator that describes the function of the button. + // The color of the text cycles through the exo mech crystal palette. + string contactText = "Contact"; + Color contactTextColor = CalamityUtils.MulticolorLerp((float)Math.Cos(Main.GlobalTime * 0.7f) * 0.5f + 0.5f, CalamityUtils.ExoPalette); + + // Center the draw position. + drawPosition.X -= Main.fontMouseText.MeasureString(contactText).X * GeneralScale * 0.5f; + drawPosition.Y += GeneralScale * 20f; + Utils.DrawBorderStringFourWay(Main.spriteBatch, Main.fontMouseText, contactText, drawPosition.X, drawPosition.Y, contactTextColor, Color.Black, Vector2.Zero, GeneralScale); + } + + public static void DisplayNotStrongEnoughErrorText(Vector2 drawPosition) + { + string text = "Encryption unsolveable: Upgrades required."; + Utils.DrawBorderStringFourWay(Main.spriteBatch, Main.fontMouseText, text, drawPosition.X, drawPosition.Y, Color.IndianRed * (Main.mouseTextColor / 255f), Color.Black, Vector2.Zero, GeneralScale); + } + } +} diff --git a/UI/ExoMechSelectionUI.cs b/UI/ExoMechSelectionUI.cs new file mode 100644 index 0000000000..803eb03092 --- /dev/null +++ b/UI/ExoMechSelectionUI.cs @@ -0,0 +1,123 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.NPCs.ExoMechs; +using CalamityMod.TileEntities; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Linq; +using System.Text; +using Terraria; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.UI.Chat; + +namespace CalamityMod.UI +{ + public static class ExoMechSelectionUI + { + public static float DestroyerIconScale = 1f; + public static float PrimeIconScale = 1f; + public static float TwinsIconScale = 1f; + public static readonly Color HoverTextColor = Draedon.TextColor; + public static Rectangle MouseScreenArea => Utils.CenteredRectangle(Main.MouseScreen, Vector2.One * 2f); + public static void Draw(SpriteBatch spriteBatch) + { + Vector2 drawAreaVerticalOffset = Vector2.UnitY * 105f; + Vector2 baseDrawPosition = Main.LocalPlayer.Top + drawAreaVerticalOffset - Main.screenPosition; + Vector2 destroyerIconDrawOffset = new Vector2(-78f, -124f); + Vector2 primeIconDrawOffset = new Vector2(0f, -140f); + Vector2 twinsIconDrawOffset = new Vector2(78f, -124f); + + HandleInteractionWithButton(baseDrawPosition + destroyerIconDrawOffset, ExoMech.Destroyer); + HandleInteractionWithButton(baseDrawPosition + primeIconDrawOffset, ExoMech.Prime); + HandleInteractionWithButton(baseDrawPosition + twinsIconDrawOffset, ExoMech.Twins); + } + + public static bool HandleInteractionWithButton(Vector2 drawPosition, ExoMech exoMech) + { + float iconScale; + string description; + Texture2D iconMechTexture; + + switch (exoMech) + { + case ExoMech.Destroyer: + iconScale = DestroyerIconScale; + iconMechTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/HeadIcon_THanos"); + description = "Thanatos, a serpentine terror with impervious armor and innumerable laser turrets."; + break; + case ExoMech.Prime: + iconScale = PrimeIconScale; + iconMechTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/HeadIcon_Ares"); + description = "Ares, a heavyweight, diabolical monstrosity with four Exo superweapons."; + break; + default: + case ExoMech.Twins: + iconScale = TwinsIconScale; + iconMechTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/HeadIcon_ArtemisApollo"); + description = "Artemis and Apollo, a pair of extremely agile destroyers with pulse cannons."; + break; + } + + // Check for mouse collision/clicks. + Rectangle clickArea = Utils.CenteredRectangle(drawPosition, iconMechTexture.Size() * iconScale * 0.9f); + + // Check if the mouse is hovering over the contact button area. + bool hoveringOverIcon = MouseScreenArea.Intersects(clickArea); + if (hoveringOverIcon) + { + // If so, cause the button to inflate a little bit. + iconScale = MathHelper.Clamp(iconScale + 0.035f, 1f, 1.35f); + + // Make the selection known if a click is done. + if (Main.mouseLeft && Main.mouseLeftRelease) + { + CalamityWorld.DraedonMechToSummon = exoMech; + + if (Main.netMode != NetmodeID.SinglePlayer) + { + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.ExoMechSelection); + netMessage.Write((int)CalamityWorld.DraedonMechToSummon); + netMessage.Send(); + } + } + Main.blockMouse = Main.LocalPlayer.mouseInterface = true; + } + + // Otherwise, if not hovering, cause the button to deflate back to its normal size. + else + iconScale = MathHelper.Clamp(iconScale - 0.05f, 1f, 1.2f); + + // Draw the icon with the new scale. + Main.spriteBatch.Draw(iconMechTexture, drawPosition, null, Color.White, 0f, iconMechTexture.Size() * 0.5f, iconScale, SpriteEffects.None, 0f); + + // Draw the descrption if hovering over the icon. + if (hoveringOverIcon) + { + drawPosition.X -= Main.fontMouseText.MeasureString(description).X * 0.5f; + drawPosition.Y += 36f; + Utils.DrawBorderStringFourWay(Main.spriteBatch, Main.fontMouseText, description, drawPosition.X, drawPosition.Y, HoverTextColor, Color.Black, Vector2.Zero, 1f); + } + + // And update to reflect the new scale. + switch (exoMech) + { + case ExoMech.Destroyer: + DestroyerIconScale = iconScale; + break; + case ExoMech.Prime: + PrimeIconScale = iconScale; + break; + default: + case ExoMech.Twins: + TwinsIconScale = iconScale; + break; + } + return false; + } + } +} diff --git a/UI/RipperUI.cs b/UI/RipperUI.cs index 77531b44e3..b60b16b398 100644 --- a/UI/RipperUI.cs +++ b/UI/RipperUI.cs @@ -95,7 +95,7 @@ namespace CalamityMod.UI public static void Draw(SpriteBatch spriteBatch, Player player) { // If Revengeance isn't on, or Rage and Adrenaline are turned off, don't draw anything. - if (!CalamityWorld.revenge || !CalamityConfig.Instance.Rippers) + if (!CalamityWorld.revenge) return; // If for some reason either of the bars has been thrown into the corner (likely to 0,0 by default), put them at their default positions diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index 76bc25eaec..22a268ab9e 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -10,6 +10,7 @@ using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Tools; using System.Collections.Generic; using System.Linq; using Terraria; @@ -27,12 +28,14 @@ namespace CalamityMod public static void AddRecipes() { - EditLeatherRecipe(); - EditTerraBladeRecipe(); + EditLeatherRecipe(); + EditTerraBladeRecipe(); EditFireGauntletRecipe(); - EditMechBossSummonRecipes(); - EditWingRecipes(); - EditPhasesaberRecipes(); + EditGoblinArmySummonRecipe(); + EditMechBossSummonRecipes(); + EditWingRecipes(); + EditEvilBulletRecipes(); + EditPhasesaberRecipes(); AstralAlternatives(); AddPotionRecipes(); @@ -67,15 +70,15 @@ namespace CalamityMod r.SetResult(ItemID.FallenStar); r.AddRecipe(); - // Hallowed Bars - r = GetNewRecipe(); - r.AddIngredient(ModContent.ItemType(), 4); - r.AddTile(TileID.AdamantiteForge); - r.SetResult(ItemID.HallowedBar); - r.AddRecipe(); + // Hallowed Bars + r = GetNewRecipe(); + r.AddIngredient(ModContent.ItemType(), 4); + r.AddTile(TileID.AdamantiteForge); + r.SetResult(ItemID.HallowedBar); + r.AddRecipe(); - // Ectoplasm from Ectoblood - r = GetNewRecipe(); + // Ectoplasm from Ectoblood + r = GetNewRecipe(); r.AddIngredient(ModContent.ItemType(), 3); r.AddTile(TileID.MythrilAnvil); r.SetResult(ItemID.Ectoplasm); @@ -92,8 +95,8 @@ namespace CalamityMod // Life Crystal r = GetNewRecipe(); r.AddIngredient(ItemID.StoneBlock, 5); - r.AddIngredient(ItemID.Ruby, 2); - r.AddIngredient(ItemID.HealingPotion); + r.AddIngredient(ItemID.Ruby, 2); + r.AddIngredient(ItemID.HealingPotion); r.AddTile(TileID.Anvils); r.SetResult(ItemID.LifeCrystal); r.AddRecipe(); @@ -114,18 +117,18 @@ namespace CalamityMod r.AddRecipe(); } - // Change Leather's recipe to require 2 Rotten Chunks/Vertebrae - private static void EditLeatherRecipe() - { - List rec = Main.recipe.ToList(); - rec.Where(x => x.createItem.type == ItemID.Leather).ToList().ForEach(s => - { - s.requiredItem[0].stack = 2; - }); - } + // Change Leather's recipe to require 2 Rotten Chunks/Vertebrae + private static void EditLeatherRecipe() + { + List rec = Main.recipe.ToList(); + rec.Where(x => x.createItem.type == ItemID.Leather).ToList().ForEach(s => + { + s.requiredItem[0].stack = 2; + }); + } - // Change Terra Blade's recipe to require 7 Living Shards (forces the Blade to be post-Plantera) - private static void EditTerraBladeRecipe() + // Change Terra Blade's recipe to require 7 Living Shards (forces the Blade to be post-Plantera) + private static void EditTerraBladeRecipe() { List rec = Main.recipe.ToList(); rec.Where(x => x.createItem.type == ItemID.TerraBlade).ToList().ForEach(s => @@ -168,37 +171,55 @@ namespace CalamityMod }); } - private static void EditMechBossSummonRecipes() - { - List rec = Main.recipe.ToList(); - rec.Where(x => x.createItem.type == ItemID.MechanicalWorm || x.createItem.type == ItemID.MechanicalEye || x.createItem.type == ItemID.MechanicalSkull).ToList().ForEach(s => - { - s.requiredTile[0] = TileID.Anvils; - }); - } + private static void EditGoblinArmySummonRecipe() + { + List rec = Main.recipe.ToList(); + rec.Where(x => x.createItem.type == ItemID.GoblinBattleStandard).ToList().ForEach(s => + { + s.requiredItem[0].stack = 5; + }); + } + private static void EditMechBossSummonRecipes() + { + List rec = Main.recipe.ToList(); + rec.Where(x => x.createItem.type == ItemID.MechanicalWorm || x.createItem.type == ItemID.MechanicalEye || x.createItem.type == ItemID.MechanicalSkull).ToList().ForEach(s => + { + s.requiredTile[0] = TileID.Anvils; + }); + } - private static void EditWingRecipes() - { - List rec = Main.recipe.ToList(); - rec.Where(x => x.createItem.type == ItemID.AngelWings || x.createItem.type == ItemID.DemonWings).ToList().ForEach(s => - { - s.requiredTile[0] = TileID.Anvils; - }); - } + private static void EditWingRecipes() + { + List rec = Main.recipe.ToList(); + rec.Where(x => x.createItem.type == ItemID.AngelWings || x.createItem.type == ItemID.DemonWings).ToList().ForEach(s => + { + s.requiredTile[0] = TileID.Anvils; + }); + } - // Change Phasesaber recipes to require 20 Crystal Shards - private static void EditPhasesaberRecipes() - { - List rec = Main.recipe.ToList(); - rec.Where(x => x.createItem.type == ItemID.BluePhasesaber || x.createItem.type == ItemID.GreenPhasesaber || x.createItem.type == ItemID.PurplePhasesaber || - x.createItem.type == ItemID.RedPhasesaber || x.createItem.type == ItemID.WhitePhasesaber || x.createItem.type == ItemID.YellowPhasesaber).ToList().ForEach(s => - { - s.requiredItem[1].stack = 20; - }); - } + // Change Ichor, and Cursed Bullets/Arrows to be pre-Hardmode Boss + private static void EditEvilBulletRecipes() + { + List rec = Main.recipe.ToList(); + rec.Where(x => x.createItem.type == ItemID.IchorBullet || x.createItem.type == ItemID.IchorArrow || x.createItem.type == ItemID.CursedBullet || x.createItem.type == ItemID.CursedArrow).ToList().ForEach(s => + { + s.requiredTile[0] = TileID.Anvils; + }); + } - #region Astral Alternatives - private static void AstralAlternatives() + // Change Phasesaber recipes to require 20 Crystal Shards + private static void EditPhasesaberRecipes() + { + List rec = Main.recipe.ToList(); + rec.Where(x => x.createItem.type == ItemID.BluePhasesaber || x.createItem.type == ItemID.GreenPhasesaber || x.createItem.type == ItemID.PurplePhasesaber || + x.createItem.type == ItemID.RedPhasesaber || x.createItem.type == ItemID.WhitePhasesaber || x.createItem.type == ItemID.YellowPhasesaber).ToList().ForEach(s => + { + s.requiredItem[1].stack = 20; + }); + } + + #region Astral Alternatives + private static void AstralAlternatives() { //Bowl ModRecipe r = GetNewRecipe(); @@ -784,19 +805,19 @@ namespace CalamityMod r.SetResult(ItemID.EskimoPants); r.AddRecipe(); - // Pharaoh set - r = GetNewRecipe(); - r.AddIngredient(ItemID.AncientCloth, 3); - r.AddTile(TileID.Loom); - r.SetResult(ItemID.PharaohsMask); - r.AddRecipe(); + // Pharaoh set + r = GetNewRecipe(); + r.AddIngredient(ItemID.AncientCloth, 3); + r.AddTile(TileID.Loom); + r.SetResult(ItemID.PharaohsMask); + r.AddRecipe(); - r = GetNewRecipe(); - r.AddIngredient(ItemID.AncientCloth, 4); - r.AddTile(TileID.Loom); - r.SetResult(ItemID.PharaohsRobe); - r.AddRecipe(); - } + r = GetNewRecipe(); + r.AddIngredient(ItemID.AncientCloth, 4); + r.AddTile(TileID.Loom); + r.SetResult(ItemID.PharaohsRobe); + r.AddRecipe(); + } #endregion #region AnkhShield @@ -1008,14 +1029,14 @@ namespace CalamityMod }); RecipeGroup.RegisterGroup("AnyCobaltBar", group); - group = new RecipeGroup(() => "Any Mythril Bar", new int[] - { - ItemID.MythrilBar, - ItemID.OrichalcumBar - }); - RecipeGroup.RegisterGroup("AnyMythrilBar", group); + group = new RecipeGroup(() => "Any Mythril Bar", new int[] + { + ItemID.MythrilBar, + ItemID.OrichalcumBar + }); + RecipeGroup.RegisterGroup("AnyMythrilBar", group); - group = new RecipeGroup(() => "Any Adamantite Bar", new int[] + group = new RecipeGroup(() => "Any Adamantite Bar", new int[] { ItemID.AdamantiteBar, ItemID.TitaniumBar @@ -1087,11 +1108,11 @@ namespace CalamityMod ItemID.HallowedHelmet, ItemID.HallowedHeadgear, ItemID.HallowedMask/*, - ItemID.HallowedHood, + ItemID.HallowedHood, ItemID.AncientHallowedHelmet, ItemID.AncientHallowedHeadgear, ItemID.AncientHallowedMask, - ItemID.AncientHallowedHood*/ + ItemID.AncientHallowedHood*/ }); RecipeGroup.RegisterGroup("AnyHallowedHelmet", group); @@ -1128,7 +1149,8 @@ namespace CalamityMod ItemID.SolarFlarePickaxe, ItemID.VortexPickaxe, ItemID.NebulaPickaxe, - ItemID.StardustPickaxe + ItemID.StardustPickaxe, + ModContent.ItemType() }); RecipeGroup.RegisterGroup("LunarPickaxe", group); @@ -1141,19 +1163,19 @@ namespace CalamityMod }); RecipeGroup.RegisterGroup("LunarHamaxe", group); - group = new RecipeGroup(() => "Any Large Gem", new int[] - { - ItemID.LargeAmber, - ItemID.LargeAmethyst, - ItemID.LargeDiamond, - ItemID.LargeEmerald, - ItemID.LargeRuby, - ItemID.LargeSapphire, - ItemID.LargeTopaz - }); - RecipeGroup.RegisterGroup("AnyLargeGem", group); + group = new RecipeGroup(() => "Any Large Gem", new int[] + { + ItemID.LargeAmber, + ItemID.LargeAmethyst, + ItemID.LargeDiamond, + ItemID.LargeEmerald, + ItemID.LargeRuby, + ItemID.LargeSapphire, + ItemID.LargeTopaz + }); + RecipeGroup.RegisterGroup("AnyLargeGem", group); - group = new RecipeGroup(() => "Any Food Item", new int[] + group = new RecipeGroup(() => "Any Food Item", new int[] { ItemID.CookedFish, ItemID.CookedMarshmallow, @@ -1213,16 +1235,16 @@ namespace CalamityMod ItemID.BetsyWings, ItemID.ArkhalisWings, ItemID.LeinforsWings, - ItemID.BejeweledValkyrieWing, - /* - ItemID.GhostarsWings, - ItemID.GroxTheGreatWings, - ItemID.FoodBarbarianWings, - ItemID.SafemanWings, - ItemID.CreativeWings, - ItemID.RainbowWings, - ItemID.LongRainbowTrailWings, - */ + ItemID.BejeweledValkyrieWing, + /* + ItemID.GhostarsWings, + ItemID.GroxTheGreatWings, + ItemID.FoodBarbarianWings, + ItemID.SafemanWings, + ItemID.CreativeWings, + ItemID.RainbowWings, + ItemID.LongRainbowTrailWings, + */ ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), diff --git a/Utilities/CollisionUtils.cs b/Utilities/CollisionUtils.cs index 13537d71e1..7170919ac6 100644 --- a/Utilities/CollisionUtils.cs +++ b/Utilities/CollisionUtils.cs @@ -48,5 +48,34 @@ namespace CalamityMod return distanceToClosestPoint <= radius; } + + /// Determines the distance required before a ray in a given direction from a given starting position hits solid tiles. Gives up after a certain quantity of tiles, or when a world border is reached. + /// + /// The point to check from. + /// The direction in which tiles are checked. Will always be a unit vector. + public static float? DistanceToTileCollisionHit(Vector2 startingPoint, Vector2 checkDirection, int giveUpLimit = 500) + { + // Ensure that the check direction is normalized. + checkDirection = checkDirection.SafeNormalize(Vector2.Zero); + + for (int i = 1; i < giveUpLimit; i++) + { + Point checkPosition = startingPoint.ToTileCoordinates(); + checkPosition.X += (int)(checkDirection.X * i); + checkPosition.Y += (int)(checkDirection.Y * i); + + // Don't bother checking any further if the check has left the world. + if (!WorldGen.InWorld(checkPosition.X, checkPosition.Y, 2)) + return null; + + // If a solid tile is hit, return the distance. + // Since Terraria's tile coordinate system is discrete and does not care for more advanced concepts, + // the amount of tiles searched such far is a sufficient answer. + Tile tile = ParanoidTileRetrieval(checkPosition.X, checkPosition.Y); + if (WorldGen.SolidTile(tile) || (checkDirection.Y > 0f && tile.active() && Main.tileSolidTop[tile.type])) + return i; + } + return null; + } } } diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs index a9c0dea443..e9cc64ecde 100644 --- a/Utilities/DrawingUtils.cs +++ b/Utilities/DrawingUtils.cs @@ -14,6 +14,18 @@ namespace CalamityMod { public static partial class CalamityUtils { + public static readonly Color[] ExoPalette = new Color[] + { + new Color(250, 255, 112), + new Color(211, 235, 108), + new Color(166, 240, 105), + new Color(105, 240, 220), + new Color(64, 130, 145), + new Color(145, 96, 145), + new Color(242, 112, 73), + new Color(199, 62, 62), + }; + #region Projectile Afterimages /// /// Draws a projectile as a series of afterimages. The first of these afterimages is centered on the center of the projectile's hitbox.
@@ -457,14 +469,30 @@ namespace CalamityMod } // Cached for efficiency purposes. - internal static readonly FieldInfo UImageField = typeof(MiscShaderData).GetField("_uImage", BindingFlags.NonPublic | BindingFlags.Instance); + internal static readonly FieldInfo UImageFieldMisc = typeof(MiscShaderData).GetField("_uImage", BindingFlags.NonPublic | BindingFlags.Instance); + internal static readonly FieldInfo UImageFieldArmor = typeof(ArmorShaderData).GetField("_uImage", BindingFlags.NonPublic | BindingFlags.Instance); /// /// Manually sets the texture of a instance, since vanilla's implementation only supports strings that access vanilla textures. /// /// The shader to bind the texture to. /// The texture to bind. - public static void SetShaderTexture(this MiscShaderData shader, Texture2D texture) => UImageField.SetValue(shader, new Ref(texture)); + public static MiscShaderData SetShaderTexture(this MiscShaderData shader, Texture2D texture) + { + UImageFieldMisc.SetValue(shader, new Ref(texture)); + return shader; + } + + /// + /// Manually sets the texture of a instance, since vanilla's implementation only supports strings that access vanilla textures. + /// + /// The shader to bind the texture to. + /// The texture to bind. + public static ArmorShaderData SetShaderTexture(this ArmorShaderData shader, Texture2D texture) + { + UImageFieldArmor.SetValue(shader, new Ref(texture)); + return shader; + } public static void EnterShaderRegion(this SpriteBatch spriteBatch) { diff --git a/Utilities/ILEditingUtils.cs b/Utilities/ILEditingUtils.cs new file mode 100644 index 0000000000..3c4f225e2f --- /dev/null +++ b/Utilities/ILEditingUtils.cs @@ -0,0 +1,17 @@ +using MonoMod.Cil; + +namespace CalamityMod +{ + public static partial class CalamityUtils + { + /// + /// Moves an to the final Ret call in the method the cursor is assocated with. + /// + /// The cursor. + public static ILCursor GotoFinalRet(this ILCursor cursor) + { + while (cursor.TryGotoNext(c => c.MatchRet())) { } + return cursor; + } + } +} diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index 00b12acb8e..8c2dda41bf 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -198,6 +198,29 @@ namespace CalamityMod return moved; } + public static bool IsEnchantable(this Item item) + { + // If the item is air just immediately return false. + // It will not have a CalamityGlobalItem instance to use and attempting to do anything with it + // would just result in errors. + if (item.IsAir) + return false; + + // Items with a max stack greater than one cannot be enchanted, due to problems with data duplication. + if (item.maxStack > 1) + return false; + + // Ammo cannot be enchanted because it is practically useless when held directly. + if (item.ammo != AmmoID.None) + return false; + + // Ignore items that explicitly say to not be enchanted. + if (item.Calamity().CannotBeEnchanted) + return false; + + return true; + } + /// /// Determines if a given item is enchanted based on Calamitas' special system. /// diff --git a/Utilities/MiscUtils.cs b/Utilities/MiscUtils.cs index 31d3f21c91..0970db23c4 100644 --- a/Utilities/MiscUtils.cs +++ b/Utilities/MiscUtils.cs @@ -235,7 +235,7 @@ namespace CalamityMod ///
/// The spot to spawn the explosion clouds /// Number of times it loops to spawn gores - public static void ExplosionGores(Vector2 goreSource, int goreAmt, bool thanatos = false, Vector2 thanatosVelocity = default) + public static void ExplosionGores(Vector2 goreSource, int goreAmt) { Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) @@ -250,43 +250,27 @@ namespace CalamityMod velocityMult = 1f; } Mod mod = ModContent.GetInstance(); - int type = thanatos ? Main.rand.Next(mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle1"), mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle3") + 1) : Main.rand.Next(61, 64); + int type = Main.rand.Next(61, 64); int smoke = Gore.NewGore(source, default, type, 1f); Gore gore = Main.gore[smoke]; - if (thanatos) - { - gore.velocity = thanatosVelocity * -0.5f; - } gore.velocity *= velocityMult; gore.velocity.X += 1f; gore.velocity.Y += 1f; - type = thanatos ? Main.rand.Next(mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle1"), mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle3") + 1) : Main.rand.Next(61, 64); + type = Main.rand.Next(61, 64); smoke = Gore.NewGore(source, default, type, 1f); gore = Main.gore[smoke]; - if (thanatos) - { - gore.velocity = thanatosVelocity * -0.5f; - } gore.velocity *= velocityMult; gore.velocity.X -= 1f; gore.velocity.Y += 1f; - type = thanatos ? Main.rand.Next(mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle1"), mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle3") + 1) : Main.rand.Next(61, 64); + type = Main.rand.Next(61, 64); smoke = Gore.NewGore(source, default, type, 1f); gore = Main.gore[smoke]; - if (thanatos) - { - gore.velocity = thanatosVelocity * -0.5f; - } gore.velocity *= velocityMult; gore.velocity.X += 1f; gore.velocity.Y -= 1f; - type = thanatos ? Main.rand.Next(mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle1"), mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle3") + 1) : Main.rand.Next(61, 64); + type = Main.rand.Next(61, 64); smoke = Gore.NewGore(source, default, type, 1f); gore = Main.gore[smoke]; - if (thanatos) - { - gore.velocity = thanatosVelocity * -0.5f; - } gore.velocity *= velocityMult; gore.velocity.X -= 1f; gore.velocity.Y -= 1f; diff --git a/Utilities/NPCStats.cs b/Utilities/NPCStats.cs index d0d4115344..01981d44e5 100644 --- a/Utilities/NPCStats.cs +++ b/Utilities/NPCStats.cs @@ -806,20 +806,20 @@ namespace CalamityMod { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 600, 632, 648, 948 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, - // { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 450, 676, 712, 732, 1068 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, - // { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 600, 632, 648, 948 } }, - // { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 450, 676, 712, 732, 1068 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 450, 676, 712, 732, 1068 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 600, 632, 648, 948 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 450, 676, 712, 732, 1068 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 500, 752, 788, 808, 1182 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 500, 752, 788, 808, 1182 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 500, 752, 788, 808, 1182 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 450, 676, 712, 732, 1068 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 600, 632, 648, 948 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 500, 752, 788, 808, 1182 } }, diff --git a/Utilities/StringUtils.cs b/Utilities/StringUtils.cs new file mode 100644 index 0000000000..1c08f38964 --- /dev/null +++ b/Utilities/StringUtils.cs @@ -0,0 +1,11 @@ +using System.Linq; +using Terraria; + +namespace CalamityMod +{ + public static partial class CalamityUtils + { + internal static readonly string AlphanumericCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + public static string GenerateRandomAlphanumericString(int length) => new string(Enumerable.Repeat(AlphanumericCharacters, length).Select(s => s[Main.rand.Next(s.Length)]).ToArray()); + } +} diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index 117c270abb..7defb32ca0 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.CustomRecipes; using CalamityMod.DataStructures; using CalamityMod.Events; using CalamityMod.NPCs; @@ -11,6 +12,11 @@ using CalamityMod.NPCs.Crabulon; using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.DesertScourge; using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs; +using CalamityMod.NPCs.ExoMechs.Apollo; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Artemis; +using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.NPCs.HiveMind; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.OldDuke; @@ -52,6 +58,7 @@ namespace CalamityMod.World public static int ArmoredDiggerSpawnCooldown = 0; public static int MoneyStolenByBandit = 0; public static int Reforges; + public static bool IsWorldAfterDraedonUpdate = false; // Boss Rush public static int bossRushHostileProjKillCounter = 0; @@ -155,6 +162,41 @@ namespace CalamityMod.World public static bool witchDoctorName = false; public static bool wizardName = false; + // Draedon Summoning stuff. + public static int DraedonSummonCountdown = 0; + public static ExoMech DraedonMechToSummon; + public static Vector2 DraedonSummonPosition = Vector2.Zero; + public static bool AbleToSummonDraedon + { + get + { + if (DraedonSummonCountdown > 0) + return false; + + if (NPC.AnyNPCs(ModContent.NPCType())) + return false; + + if (NPC.AnyNPCs(ModContent.NPCType())) + return false; + + if (NPC.AnyNPCs(ModContent.NPCType())) + return false; + + if (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType())) + return false; + + return true; + } + } + public const int DraedonSummonCountdownMax = 260; + + // Draedon Lab Locations. + public static Vector2 SunkenSeaLabCenter; + public static Vector2 PlanetoidLabCenter; + public static Vector2 JungleLabCenter; + public static Vector2 HellLabCenter; + public static Vector2 IceLabCenter; + #region Downed Bools public static bool downedDesertScourge = false; public static bool downedCrabulon = false; @@ -187,7 +229,12 @@ namespace CalamityMod.World public static bool downedGSS = false; public static bool downedCLAM = false; public static bool downedCLAMHardMode = false; - public static bool downedBetsy = false; //Betsy + public static bool downedBetsy = false; // Betsy + + // These are purely used for loot drops, nothing else + public static bool downedAres = false; + public static bool downedThanatos = false; + public static bool downedArtemisAndApollo = false; public static bool downedEoCAcidRain = false; public static bool downedAquaticScourgeAcidRain = false; @@ -198,8 +245,7 @@ namespace CalamityMod.World #region Initialize public override void Initialize() { - if (CalamityConfig.Instance.NerfExpertPillars) - NPC.LunarShieldPowerExpert = 100; + NPC.LunarShieldPowerExpert = 100; CalamityGlobalNPC.holyBoss = -1; CalamityGlobalNPC.doughnutBoss = -1; @@ -284,6 +330,9 @@ namespace CalamityMod.World downedSentinel3 = false; downedYharon = false; downedExoMechs = false; + downedAres = false; + downedThanatos = false; + downedArtemisAndApollo = false; downedSCal = false; downedAdultEidolonWyrm = false; downedCLAM = false; @@ -353,6 +402,12 @@ namespace CalamityMod.World downed.Add("yharon"); if (downedExoMechs) downed.Add("exoMechs"); + if (downedAres) + downed.Add("ares"); + if (downedThanatos) + downed.Add("thanatos"); + if (downedArtemisAndApollo) + downed.Add("artemisAndApollo"); if (downedSCal) downed.Add("supremeCalamitas"); if (downedAdultEidolonWyrm) @@ -471,24 +526,23 @@ namespace CalamityMod.World downed.Add("encounteredOldDuke"); if (HasGeneratedLuminitePlanetoids) downed.Add("HasGeneratedLuminitePlanetoids"); + downed.AddWithCondition("IsWorldAfterDraedonUpdate", IsWorldAfterDraedonUpdate); + + RecipeUnlockHandler.Save(downed); return new TagCompound { - { - "downed", downed - }, - { - "abyssChasmBottom", abyssChasmBottom - }, - { - "acidRainPoints", acidRainPoints - }, - { - "Reforges", Reforges - }, - { - "MoneyStolenByBandit", MoneyStolenByBandit - } + ["downed"] = downed, + ["abyssChasmBottom"] = abyssChasmBottom, + ["acidRainPoints"] = acidRainPoints, + ["Reforges"] = Reforges, + ["MoneyStolenByBandit"] = MoneyStolenByBandit, + + ["SunkenSeaLabCenter"] = SunkenSeaLabCenter, + ["PlanetoidLabCenter"] = PlanetoidLabCenter, + ["JungleLabCenter"] = JungleLabCenter, + ["HellLabCenter"] = HellLabCenter, + ["IceLabCenter"] = IceLabCenter, }; } #endregion @@ -516,6 +570,9 @@ namespace CalamityMod.World downedSecondSentinels = downed.Contains("secondSentinels"); downedYharon = downed.Contains("yharon"); downedExoMechs = downed.Contains("exoMechs"); + downedAres = downed.Contains("ares"); + downedThanatos = downed.Contains("thanatos"); + downedArtemisAndApollo = downed.Contains("artemisAndApollo"); downedSCal = downed.Contains("supremeCalamitas"); downedAdultEidolonWyrm = downed.Contains("adultEidolonWyrm"); downedBumble = downed.Contains("bumblebirb"); @@ -578,11 +635,20 @@ namespace CalamityMod.World forcedDownpourWithTear = downed.Contains("forcedTear"); encounteredOldDuke = downed.Contains("encounteredOldDuke"); HasGeneratedLuminitePlanetoids = downed.Contains("HasGeneratedLuminitePlanetoids"); + IsWorldAfterDraedonUpdate = downed.Contains("IsWorldAfterDraedonUpdate"); + + RecipeUnlockHandler.Load(downed); abyssChasmBottom = tag.GetInt("abyssChasmBottom"); acidRainPoints = tag.GetInt("acidRainPoints"); Reforges = tag.GetInt("Reforges"); MoneyStolenByBandit = tag.GetInt("MoneyStolenByBandit"); + + SunkenSeaLabCenter = tag.Get("SunkenSeaLabCenter"); + PlanetoidLabCenter = tag.Get("PlanetoidLabCenter"); + JungleLabCenter = tag.Get("JungleLabCenter"); + HellLabCenter = tag.Get("HellLabCenter"); + IceLabCenter = tag.Get("IceLabCenter"); } #endregion @@ -703,6 +769,9 @@ namespace CalamityMod.World HasGeneratedLuminitePlanetoids = flags11[1]; downedAdultEidolonWyrm = flags11[2]; downedExoMechs = flags11[3]; + downedAres = flags11[4]; + downedThanatos = flags11[5]; + downedArtemisAndApollo = flags11[6]; } else { @@ -820,6 +889,9 @@ namespace CalamityMod.World flags11[1] = HasGeneratedLuminitePlanetoids; flags11[2] = downedAdultEidolonWyrm; flags11[3] = downedExoMechs; + flags11[4] = downedAres; + flags11[5] = downedThanatos; + flags11[6] = downedArtemisAndApollo; writer.Write(flags); writer.Write(flags2); @@ -832,10 +904,21 @@ namespace CalamityMod.World writer.Write(flags9); writer.Write(flags10); writer.Write(flags11); + + RecipeUnlockHandler.SendData(writer); + writer.Write(abyssChasmBottom); writer.Write(acidRainPoints); writer.Write(Reforges); writer.Write(MoneyStolenByBandit); + writer.Write(DraedonSummonCountdown); + writer.Write((int)DraedonMechToSummon); + writer.WriteVector2(DraedonSummonPosition); + writer.WriteVector2(SunkenSeaLabCenter); + writer.WriteVector2(PlanetoidLabCenter); + writer.WriteVector2(JungleLabCenter); + writer.WriteVector2(HellLabCenter); + writer.WriteVector2(IceLabCenter); } #endregion @@ -943,16 +1026,29 @@ namespace CalamityMod.World _ = flags10[6]; _ = flags10[7]; + RecipeUnlockHandler.ReceiveData(reader); + BitsByte flags11 = reader.ReadByte(); malice = flags11[0]; HasGeneratedLuminitePlanetoids = flags11[1]; downedAdultEidolonWyrm = flags11[2]; downedExoMechs = flags11[3]; + downedAres = flags11[4]; + downedThanatos = flags11[5]; + downedArtemisAndApollo = flags11[6]; abyssChasmBottom = reader.ReadInt32(); acidRainPoints = reader.ReadInt32(); Reforges = reader.ReadInt32(); MoneyStolenByBandit = reader.ReadInt32(); + DraedonSummonCountdown = reader.ReadInt32(); + DraedonMechToSummon = (ExoMech)reader.ReadInt32(); + DraedonSummonPosition = reader.ReadVector2(); + SunkenSeaLabCenter = reader.ReadVector2(); + PlanetoidLabCenter = reader.ReadVector2(); + JungleLabCenter = reader.ReadVector2(); + HellLabCenter = reader.ReadVector2(); + IceLabCenter = reader.ReadVector2(); } #endregion @@ -990,6 +1086,10 @@ namespace CalamityMod.World { numAbyssIslands = 0; roxShrinePlaced = false; + + // This will only be applied at world-gen time to new worlds. + // Old worlds will never receive this marker naturally. + IsWorldAfterDraedonUpdate = true; } #endregion diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs index f10e8a59d7..939de95903 100644 --- a/World/DraedonStructures.cs +++ b/World/DraedonStructures.cs @@ -17,6 +17,7 @@ namespace CalamityMod.World public static class DraedonStructures { private static int[] otherModTilesToAvoid; + public const int HellVerticalAvoidance = 100; internal static void Load() { @@ -227,7 +228,7 @@ namespace CalamityMod.World { contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); contents.Insert(1, new ChestItem(ModContent.ItemType(), 1)); - contents.Insert(2, new ChestItem(ModContent.ItemType(), 1)); + contents.Insert(2, new ChestItem(ModContent.ItemType(), 1)); } for (int i = 0; i < contents.Count; i++) { @@ -273,6 +274,7 @@ namespace CalamityMod.World { bool hasPlacedMurasama = false; PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref hasPlacedMurasama, new Action(FillHellLaboratoryChest)); + CalamityWorld.HellLabCenter = placementPoint.ToWorldCoordinates() + new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)) * 8f; break; } } @@ -298,7 +300,7 @@ namespace CalamityMod.World if (!hasPlacedLogAndSchematic) { contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); - contents.Insert(1, new ChestItem(ModContent.ItemType(), 1)); + contents.Insert(1, new ChestItem(ModContent.ItemType(), 1)); } for (int i = 0; i < contents.Count; i++) { @@ -345,6 +347,7 @@ namespace CalamityMod.World bool hasPlacedLogAndSchematic = false; PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref hasPlacedLogAndSchematic, new Action(FillSunkenSeaLaboratoryChest)); + CalamityWorld.SunkenSeaLabCenter = placementPoint.ToWorldCoordinates() + new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)) * 8f; } #endregion @@ -365,7 +368,7 @@ namespace CalamityMod.World if (!hasPlacedLogAndSchematic) { contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); - contents.Insert(1, new ChestItem(ModContent.ItemType(), 1)); + contents.Insert(1, new ChestItem(ModContent.ItemType(), 1)); } // If it's a frozen chest. if (type == TileID.Containers) @@ -391,7 +394,7 @@ namespace CalamityMod.World { int underworldTop = Main.maxTilesY - 200; int placementPositionX = WorldGen.genRand.Next(120, Main.maxTilesX - 120); - int placementPositionY = WorldGen.genRand.Next((int)Main.worldSurface + 160, underworldTop); + int placementPositionY = WorldGen.genRand.Next((int)Main.worldSurface + 160, underworldTop - HellVerticalAvoidance); placementPoint = new Point(placementPositionX, placementPositionY); Vector2 schematicSize = new Vector2(schematic.GetLength(0), schematic.GetLength(1)); @@ -424,6 +427,7 @@ namespace CalamityMod.World { bool hasPlacedLogAndSchematic = false; PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref hasPlacedLogAndSchematic, new Action(FillIceLaboratoryChest)); + CalamityWorld.IceLabCenter = placementPoint.ToWorldCoordinates() + new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)) * 8f; break; } } @@ -448,7 +452,7 @@ namespace CalamityMod.World if (!hasPlacedLogAndSchematic) { contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); - contents.Insert(1, new ChestItem(ModContent.ItemType(), 1)); + contents.Insert(1, new ChestItem(ModContent.ItemType(), 1)); } for (int i = 0; i < contents.Count; i++) { @@ -468,7 +472,7 @@ namespace CalamityMod.World { int underworldTop = Main.maxTilesY - 200; int placementPositionX = WorldGen.genRand.Next(120, Main.maxTilesX - 120); - int placementPositionY = WorldGen.genRand.Next((int)Main.worldSurface + 160, underworldTop); + int placementPositionY = WorldGen.genRand.Next((int)Main.worldSurface + 160, underworldTop - HellVerticalAvoidance); placementPoint = new Point(placementPositionX, placementPositionY); Vector2 schematicSize = new Vector2(schematic.GetLength(0), schematic.GetLength(1)); @@ -503,6 +507,7 @@ namespace CalamityMod.World { bool hasPlacedLogAndSchematic = false; PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref hasPlacedLogAndSchematic, new Action(FillPlagueLaboratoryChest)); + CalamityWorld.JungleLabCenter = placementPoint.ToWorldCoordinates() + new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)) * 8f; break; } } @@ -541,7 +546,7 @@ namespace CalamityMod.World if (!hasPlacedLogAndSchematic) { contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); - contents.Insert(1, new ChestItem(ModContent.ItemType(), 1)); + contents.Insert(1, new ChestItem(ModContent.ItemType(), 1)); } for (int i = 0; i < contents.Count; i++) { diff --git a/World/Planets/MainPlanet.cs b/World/Planets/MainPlanet.cs index f2ec4f0f5e..2b82e2d855 100644 --- a/World/Planets/MainPlanet.cs +++ b/World/Planets/MainPlanet.cs @@ -109,6 +109,7 @@ namespace CalamityMod.World.Planets // TODO -- This should probably use PlacementAnchor.Center and just provide the center of the planetoid... bool hasPlacedLogAndSchematic = false; SchematicManager.PlaceSchematic("Planetoid Laboratory", new Point(origin.X - 33, origin.Y - 17), SchematicAnchor.TopLeft, ref hasPlacedLogAndSchematic, new Action(DraedonStructures.FillPlanetoidLaboratoryChest)); + CalamityWorld.PlanetoidLabCenter = origin.ToWorldCoordinates(); //PLACE BREAKABLE GRASS AND TREES WorldUtils.Gen(origin, new ModShapes.OuterOutline(mainShape, true, true), Actions.Chain(new GenAction[] diff --git a/World/WorldUpdateMiscEffects.cs b/World/WorldUpdateMiscEffects.cs index 12ad63b706..d599a963fd 100644 --- a/World/WorldUpdateMiscEffects.cs +++ b/World/WorldUpdateMiscEffects.cs @@ -11,12 +11,14 @@ using CalamityMod.NPCs.Crabulon; using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.DesertScourge; using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs; using CalamityMod.NPCs.HiveMind; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.Perforator; using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Signus; using CalamityMod.NPCs.StormWeaver; +using CalamityMod.Projectiles.Boss; using CalamityMod.Tiles; using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.SunkenSea; @@ -36,6 +38,16 @@ namespace CalamityMod.World { public static void PerformWorldUpdates() { + // Reset the exo mech to summon if Draedon is absent. + if (DraedonMechToSummon != ExoMech.None && CalamityGlobalNPC.draedon == -1) + DraedonMechToSummon = ExoMech.None; + + if (Main.netMode != NetmodeID.MultiplayerClient && DraedonSummonCountdown > 0) + { + DraedonSummonCountdown--; + HandleDraedonSummoning(); + } + // Sunken Sea Location...duh SunkenSeaLocation = new Rectangle(WorldGen.UndergroundDesertLocation.Left, WorldGen.UndergroundDesertLocation.Bottom, WorldGen.UndergroundDesertLocation.Width, WorldGen.UndergroundDesertLocation.Height / 2); @@ -89,6 +101,16 @@ namespace CalamityMod.World if (!downedDesertScourge && Main.netMode != NetmodeID.MultiplayerClient && !Main.hardMode) CalamityUtils.StopSandstorm(); + // Attempt to summon lab critters manually since they refuse to exist when using vanilla's spawn methods. + // This needs to check all players since the method only runs server-side. + for (int i = 0; i < Main.maxPlayers; i++) + { + if (!Main.player[i].active || Main.player[i].dead) + continue; + + CalamityGlobalNPC.AttemptToSpawnLabCritters(Main.player[i]); + } + // Make the cultist countdown happen much more quickly. if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -101,6 +123,22 @@ namespace CalamityMod.World } } + #region Handle Draedon Summoning + + public static void HandleDraedonSummoning() + { + Main.LocalPlayer.Calamity().MusicMuffleFactor = Utils.InverseLerp(DraedonSummonCountdownMax, 32f, DraedonSummonCountdown, true); + Main.LocalPlayer.Calamity().MusicMuffleFactor = (float)Math.Pow(Main.LocalPlayer.Calamity().MusicMuffleFactor, 0.1); + + // Fire a giant laser into the sky. + if (DraedonSummonCountdown == DraedonSummonCountdownMax - 45) + Projectile.NewProjectile(DraedonSummonPosition + Vector2.UnitY * 80f, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); + + if (DraedonSummonCountdown == 0) + NPC.NewNPC((int)DraedonSummonPosition.X, (int)DraedonSummonPosition.Y, ModContent.NPCType()); + } + #endregion Handle Draedon Summoning + #region Handle Tile Growing public static void HandleTileGrowth()