diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 8bd7f64dfe..1fae88c626 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -321,10 +321,6 @@ namespace CalamityMod.Balancing #endregion #region Old Duke - // 60% resist to The Last Mourning's projectiles. - // This will technically catch pumpkins from The Horseman's Blade but that shouldn't really matter. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.4f, ProjectileType(), ProjectileID.FlamingJack))); - // 20% resist to Time Bolt. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.8f, ProjectileType()))); #endregion diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index eed9b2b6ea..d5326f5e54 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -471,8 +471,14 @@ namespace CalamityMod.CalPlayer SpriteEffects spriteEffects = Player.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + int xOffset = 9; + // Photoviscerator's tank is extended a bit more out + if (thingToDraw == ModContent.Request("CalamityMod/CalPlayer/DrawLayers/Backpack_Photoviscerator").Value) + { + xOffset = 16; + } DrawData howDoIDrawThings = new DrawData(thingToDraw, - new Vector2((int)(drawPlayer.position.X - Main.screenPosition.X + (drawPlayer.width / 2) - (9 * drawPlayer.direction)) - 4f * drawPlayer.direction, (int)(drawPlayer.position.Y - Main.screenPosition.Y + (drawPlayer.height / 2) + 2f * drawPlayer.gravDir - 8f * drawPlayer.gravDir)), + new Vector2((int)(drawPlayer.position.X - Main.screenPosition.X + (drawPlayer.width / 2) - (xOffset * drawPlayer.direction)) - 4f * drawPlayer.direction, (int)(drawPlayer.position.Y - Main.screenPosition.Y + (drawPlayer.height / 2) + 2f * drawPlayer.gravDir - 8f * drawPlayer.gravDir + drawPlayer.gfxOffY)), new Rectangle(0, 0, thingToDraw.Width, thingToDraw.Height), drawInfo.colorArmorBody, drawPlayer.bodyRotation, diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 367f3910e9..975677a7ba 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -1621,7 +1621,7 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(SoundID.NPCHit4, Player.Center); //metal hit noise hurtSoundTimer = 10; } - else if ((aquaticHeartPower || aquaticHeartForce) && !aquaticHeartHide) + else if (((aquaticHeartPower || aquaticHeartForce) && !aquaticHeartHide) || Player.GetModPlayer().vanityEquipped) { modifiers.DisableSound(); SoundEngine.PlaySound(SoundID.FemaleHit, Player.Center); //female hit noise diff --git a/CalPlayer/DrawLayers/Backpack_Photoviscerator.png b/CalPlayer/DrawLayers/Backpack_Photoviscerator.png index aa94ab14fd..5eb58e0d3e 100644 Binary files a/CalPlayer/DrawLayers/Backpack_Photoviscerator.png and b/CalPlayer/DrawLayers/Backpack_Photoviscerator.png differ diff --git a/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs index cb9e490ba8..6e956ede84 100644 --- a/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs +++ b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using CalamityMod.Items.SummonItems; +using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; @@ -47,6 +48,8 @@ namespace CalamityMod.CalPlayer.DrawLayers glowMask = ModContent.Request("CalamityMod/Items/Weapons/Ranged/AuroraBlazerGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Ranged/CleansingBlazeGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Summon/CosmicImmaterializerGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/DeathhailStaffGlow").Value; else if (itemType == ModContent.ItemType()) @@ -77,6 +80,8 @@ namespace CalamityMod.CalPlayer.DrawLayers glowMask = ModContent.Request("CalamityMod/Items/Weapons/Summon/PlantationStaffGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/PulseRifleGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/SoulPiercerGlow").Value; else if (itemType == ModContent.ItemType()) @@ -87,6 +92,8 @@ namespace CalamityMod.CalPlayer.DrawLayers glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/TheEnforcerGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Ranged/VernalBolterGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/VividClarityGlow").Value; if (glowMask == default) return; diff --git a/CalamityLists.cs b/CalamityLists.cs index 354f4a9b88..0e29515d35 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -1613,14 +1613,14 @@ namespace CalamityMod ItemType(), ItemType(), ItemType(), - ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), @@ -2428,6 +2428,9 @@ namespace CalamityMod { NPCID.UmbrellaSlime, 5400 }, { NPCID.RainbowSlime, 30000 }, { NPCID.Pinky, 15000 }, + { NPCType(), 21000 }, + { NPCType(), 18000 }, + { NPCType(), 24000 }, { NPCID.EyeofCthulhu, 450000 }, // 30 seconds { NPCID.ServantofCthulhu, 6000 }, @@ -2441,6 +2444,11 @@ namespace CalamityMod { NPCID.Creeper, 10000 }, { NPCID.QueenBee, 315000 }, // 30 seconds + { NPCID.Bee, 3000 }, + { NPCID.BeeSmall, 2000 }, + { NPCID.BigHornetHoney, 10000 }, + { NPCID.HornetHoney, 7500 }, + { NPCID.LittleHornetHoney, 5000 }, { NPCID.Deerclops, 315000 }, // 30 seconds @@ -2449,6 +2457,11 @@ namespace CalamityMod { NPCID.WallofFlesh, 450000 }, // 30 seconds { NPCID.WallofFleshEye, 450000 }, + { NPCID.TheHungry, 10000 }, + { NPCID.TheHungryII, 5000 }, + { NPCID.LeechHead, 5000 }, + { NPCID.LeechBody, 5000 }, + { NPCID.LeechTail, 5000 }, // Tier 2 { NPCID.QueenSlimeBoss, 150000 }, // 30 seconds @@ -2462,7 +2475,7 @@ namespace CalamityMod { NPCID.TheDestroyer, 250000 }, // 30 seconds + immunity timer at start { NPCID.TheDestroyerBody, 250000 }, { NPCID.TheDestroyerTail, 250000 }, - { NPCID.Probe, 10000 }, + { NPCID.Probe, 5000 }, { NPCID.SkeletronPrime, 160000 }, // 30 seconds { NPCType(), 160000 }, @@ -2472,7 +2485,8 @@ namespace CalamityMod { NPCID.PrimeLaser, 38000 }, { NPCID.Plantera, 160000 }, // 30 seconds - { NPCID.PlanterasTentacle, 40000 }, + { NPCID.PlanterasTentacle, 5000 }, + { NPCType(), 5000 }, // Tier 3 { NPCID.Golem, 50000 }, // 30 seconds diff --git a/DataStructures/NPCStats.cs b/DataStructures/NPCStats.cs index dc4a0cf239..15d755c415 100644 --- a/DataStructures/NPCStats.cs +++ b/DataStructures/NPCStats.cs @@ -564,6 +564,7 @@ namespace CalamityMod { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 26, 36, 44, 52, 84 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 26, 36, 44, 52, 84 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 26, 36, 44, 52, 84 } }, { new Tuple(NPCID.EyeofCthulhu, ProjectileID.BloodNautilusShot), new int[] { 26, 44, 60, 76, 108 } }, { new Tuple(ModContent.NPCType(), ProjectileID.BloodShot), new int[] { 26, 36, 44, 52, 84 } }, diff --git a/Events/BossRushEvent.cs b/Events/BossRushEvent.cs index db1129961a..07e1b805da 100644 --- a/Events/BossRushEvent.cs +++ b/Events/BossRushEvent.cs @@ -182,7 +182,7 @@ namespace CalamityMod.Events ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() ,ModContent.NPCType() }), - new Boss(NPCID.QueenBee, permittedNPCs: new int[] { NPCID.Bee, NPCID.BeeSmall }), + new Boss(NPCID.QueenBee, permittedNPCs: new int[] { NPCID.Bee, NPCID.BeeSmall, NPCID.LittleHornetHoney, NPCID.HornetHoney, NPCID.BigHornetHoney }), new Boss(NPCID.Deerclops), diff --git a/Items/Accessories/DaawnlightSpiritOrigin.cs b/Items/Accessories/DaawnlightSpiritOrigin.cs index e6a42c5c25..e37ec2dcc2 100644 --- a/Items/Accessories/DaawnlightSpiritOrigin.cs +++ b/Items/Accessories/DaawnlightSpiritOrigin.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories // Regular crits are intentionally weak, especially because they rarely happen (your crit chance gets murdered). // Bullseyes should be doing all the work. private const float OriginBullseyeCritRatio = 3.5f; // Bullseye crits deal x3.5 damage instead of x2. - private const float RicoshotBullseyeCritRatio = 2.4f; // If you use Ricoshot mechanics to "force" a bullseye, you get less of a reward. + private const float ForcedCritBullseyeCritRatio = 2.4f; // If your projectile is forced to crit, you get less of a reward. private const float StoredCritConversionRatio = 0.01f; // Add +1% more damage to crits for every 1% critical chance the player would have had. private const float MinUseTimeForSlowBonus = 11f; @@ -39,8 +39,8 @@ namespace CalamityMod.Items.Accessories if (hitBullseye) { // Bullseye crits are weaker if the projectile was already a forced crit. - // This currently only occurs due to ULTRAKILL-style ricoshots. - baseCritMult = wasForcedCrit ? RicoshotBullseyeCritRatio : OriginBullseyeCritRatio; + // This is currently implemented for ULTRAKILL-style ricoshots and for Heavenly Gale's lightning. + baseCritMult = wasForcedCrit ? ForcedCritBullseyeCritRatio : OriginBullseyeCritRatio; } // Factor in the critical strike chance the player isn't getting to use. diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index e34baeea82..6c0d570a95 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -918,12 +918,22 @@ namespace CalamityMod.Items return MathHelper.Lerp(DischargeEnchantMinDamageFactor, DischargeEnchantMaxDamageFactor, interpolant); } - // This formula gives a slightly higher value than 1.0 above 85% charge, and a slightly lower value than 0.0 at 0% charge. - // Specifically, it gives 0.0 or less at 0.36% charge or lower. This is fine because the result is immediately clamped. + // 07MAY2024: Ozzatron: adjusted charge formula again to more closely match previous behavior + // old formula: 1.087 - 0.08 / (x + 0.07) + // new formula: 1.08 - 0.04 / (x + 0.06) + // + // Intended behavior: Any charge above 50% guarantees 100% damage, so charge weapons are easy to use + // Actual behavior: + // 44%+ charge = 100% damage + // 20% charge = 92.6% damage + // 10% charge = 83% damage + // 0% charge = 41.33% damage + // + // Fabsol - I changed this formula because it was bad and confusing, and I had promised to do so a while ago. internal float ChargeDamageFormula() { float x = MathHelper.Clamp(ChargeRatio, 0f, 1f); - float y = 1.087f - 0.08f / (x + 0.07f); + float y = 1.08f - 0.04f / (x + 0.06f); return MathHelper.Clamp(y, 0f, 1f); } #endregion diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index c0ae5fd933..141680d6f9 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -820,7 +820,7 @@ namespace CalamityMod.Items if (item.type == ItemID.PlatinumHelmet) AddTooltip("6% increased damage"); if (item.type == ItemID.PlatinumChainmail) - AddTooltip("5% increased critical strike chance"); + AddTooltip("3% increased critical strike chance"); if (item.type == ItemID.PlatinumGreaves) AddTooltip("10% increased movement speed"); diff --git a/Items/Placeables/Furniture/BossRelics/PerforatorsRelic.png b/Items/Placeables/Furniture/BossRelics/PerforatorsRelic.png index 32a6ac44cc..f0a356d064 100644 Binary files a/Items/Placeables/Furniture/BossRelics/PerforatorsRelic.png and b/Items/Placeables/Furniture/BossRelics/PerforatorsRelic.png differ diff --git a/Items/SummonItems/DesertMedallion.cs b/Items/SummonItems/DesertMedallion.cs index cf9414bad1..14d89b62de 100644 --- a/Items/SummonItems/DesertMedallion.cs +++ b/Items/SummonItems/DesertMedallion.cs @@ -47,19 +47,6 @@ namespace CalamityMod.Items.SummonItems else NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - if (CalamityWorld.revenge) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - } - return true; } diff --git a/Items/SummonItems/Invasion/MartianDistressRemote.cs b/Items/SummonItems/Invasion/MartianDistressRemote.cs index 84d7e66bfe..965b1b0ff3 100644 --- a/Items/SummonItems/Invasion/MartianDistressRemote.cs +++ b/Items/SummonItems/Invasion/MartianDistressRemote.cs @@ -27,6 +27,7 @@ namespace CalamityMod.Items.SummonItems.Invasion Item.useTime = 10; Item.useStyle = ItemUseStyleID.HoldUp; Item.consumable = false; + Item.UseSound = SoundID.Zombie67; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/VanillaArmorChanges/GoldArmorSetChange.cs b/Items/VanillaArmorChanges/GoldArmorSetChange.cs index eb18aab587..1cd9c38894 100644 --- a/Items/VanillaArmorChanges/GoldArmorSetChange.cs +++ b/Items/VanillaArmorChanges/GoldArmorSetChange.cs @@ -1,5 +1,4 @@ using System; -using System.Text; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -21,10 +20,10 @@ namespace CalamityMod.Items.VanillaArmorChanges public const float HeadDamage = 0.06f; public const float ChestDR = 0.05f; public const float LegsMoveSpeed = 0.1f; - public const float GoldDropChanceFromEnemies = 0.04f; + public const float GoldDropChanceFromEnemies = 0.02f; public const int GoldFromBosses = 3; - public const float SetBonusCritPerGoldCoin = 0.2f; // 5 gold coins = +1% crit chance - public const float MaximumCritBonus = 10f; + public const float SetBonusCritPerGoldCoin = 0.1f; // 10 gold coins = +1% crit chance + public const float MaximumCritBonus = 9f; public override void ApplyHeadPieceEffect(Player player) => player.GetDamage() += HeadDamage; @@ -50,8 +49,8 @@ namespace CalamityMod.Items.VanillaArmorChanges { // 13FEB2024: Ozzatron: this function doesn't cap at its second argument, it just stops counting if it exceeds that number // so this can give up to 100 gold coins - int goldCoins = player.CountItem(ItemID.GoldCoin, 50); - critFromGold = Math.Max(goldCoins * SetBonusCritPerGoldCoin, MaximumCritBonus); + int goldCoins = player.CountItem(ItemID.GoldCoin, 90); + critFromGold = Math.Min(goldCoins * SetBonusCritPerGoldCoin, MaximumCritBonus); } player.GetCritChance() += critFromGold; diff --git a/Items/VanillaArmorChanges/LeadArmorSetChange.cs b/Items/VanillaArmorChanges/LeadArmorSetChange.cs index fccf0e14f1..4fc7541f41 100644 --- a/Items/VanillaArmorChanges/LeadArmorSetChange.cs +++ b/Items/VanillaArmorChanges/LeadArmorSetChange.cs @@ -1,5 +1,4 @@ -using System.Text; -using Terraria; +using Terraria; using Terraria.ID; namespace CalamityMod.Items.VanillaArmorChanges @@ -14,8 +13,8 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Lead"; - public const float ArmorPieceDR = 0.03f; - public const float SetBonusDR = 0.03f; + public const float ArmorPieceDR = 0.02f; + public const float SetBonusDR = 0.04f; public const int SetBonusLifeRegen = 1; public override void ApplyHeadPieceEffect(Player player) => player.endurance += ArmorPieceDR; diff --git a/Items/VanillaArmorChanges/PlatinumArmorSetChange.cs b/Items/VanillaArmorChanges/PlatinumArmorSetChange.cs index 64a39bf6cb..d709df88d2 100644 --- a/Items/VanillaArmorChanges/PlatinumArmorSetChange.cs +++ b/Items/VanillaArmorChanges/PlatinumArmorSetChange.cs @@ -16,9 +16,8 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Platinum"; public const float HeadDamage = 0.06f; - public const float ChestCrit = 5f; + public const float ChestCrit = 3f; public const float LegsMoveSpeed = 0.1f; - public const float SetBonusLifeRegenPerDefense = 0.1f; // 10 defense = +1 life regen public const float SetBonusDamagePerDefense = 0.001f; // 10 defense = +1% damage public const float SetBonusCritPerDefense = 0.1f; // 10 defense = +1% crit chance public const int SetBonusDefenseCap = 40; @@ -36,12 +35,15 @@ namespace CalamityMod.Items.VanillaArmorChanges public override void ApplyArmorSetBonus(Player player) { - int defense = player.statDefense; - if (defense > SetBonusDefenseCap) - defense = SetBonusDefenseCap; - player.lifeRegen += (int)(defense * SetBonusLifeRegenPerDefense); - player.GetDamage() += defense * SetBonusDamagePerDefense; - player.GetCritChance() += defense * SetBonusCritPerDefense; + // 07MAY2024: Ozzatron: Platinum armor doesn't count its own defense for its set bonus + int defenseBesidesThisArmor = player.statDefense - (4 + 6 + 4 + 4); + if (defenseBesidesThisArmor <= 0) + return; + + if (defenseBesidesThisArmor > SetBonusDefenseCap) + defenseBesidesThisArmor = SetBonusDefenseCap; + player.GetDamage() += defenseBesidesThisArmor * SetBonusDamagePerDefense; + player.GetCritChance() += defenseBesidesThisArmor * SetBonusCritPerDefense; } } } diff --git a/Items/Weapons/DraedonsArsenal/PulseRifle.cs b/Items/Weapons/DraedonsArsenal/PulseRifle.cs index a9b060474c..21190b3ab9 100644 --- a/Items/Weapons/DraedonsArsenal/PulseRifle.cs +++ b/Items/Weapons/DraedonsArsenal/PulseRifle.cs @@ -6,6 +6,7 @@ using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -17,22 +18,22 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public class PulseRifle : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; - public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/PulseRifleFire"); + public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/PulseRifleFire") { Volume = 0.8f }; - private int BaseDamage = 1150; + private int BaseDamage = 990; public int FiringTimer = 30; public override void SetDefaults() { CalamityGlobalItem modItem = Item.Calamity(); - Item.width = 62; - Item.height = 22; + Item.width = 98; + Item.height = 32; Item.DamageType = DamageClass.Ranged; Item.damage = BaseDamage; Item.knockBack = 0f; - Item.useTime = 45; - Item.useAnimation = 45; + Item.useTime = 55; + Item.useAnimation = 55; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Shoot; @@ -52,13 +53,17 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - SoundEngine.PlaySound(FireSound with { Volume = 0.7f, Pitch = 0.3f }); + SoundEngine.PlaySound(FireSound); Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); return false; } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/PulseRifleGlow").Value); + } - public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + public override Vector2? HoldoutOffset() => new Vector2(-15, 0); public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 5); diff --git a/Items/Weapons/DraedonsArsenal/PulseRifle.png b/Items/Weapons/DraedonsArsenal/PulseRifle.png index df7ca50eb2..4075f9d594 100644 Binary files a/Items/Weapons/DraedonsArsenal/PulseRifle.png and b/Items/Weapons/DraedonsArsenal/PulseRifle.png differ diff --git a/Items/Weapons/DraedonsArsenal/PulseRifleGlow.png b/Items/Weapons/DraedonsArsenal/PulseRifleGlow.png new file mode 100644 index 0000000000..8a109d4ccf Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/PulseRifleGlow.png differ diff --git a/Items/Weapons/Magic/AlphaRay.cs b/Items/Weapons/Magic/AlphaRay.cs deleted file mode 100644 index 4e43df2c20..0000000000 --- a/Items/Weapons/Magic/AlphaRay.cs +++ /dev/null @@ -1,97 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Rarities; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Magic -{ - public class AlphaRay : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Magic"; - public override void SetStaticDefaults() - { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; - } - - - public override void SetDefaults() - { - Item.width = 84; - Item.height = 74; - Item.damage = 160; - Item.DamageType = DamageClass.Magic; - Item.mana = 8; - Item.useTime = Item.useAnimation = 4; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 1.5f; - Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.UseSound = SoundID.Item33; - Item.autoReuse = true; - Item.shootSpeed = 6f; - Item.shoot = ModContent.ProjectileType(); - Item.rare = ModContent.RarityType(); - } - - public override Vector2? HoldoutOffset() => new Vector2(-5, 0); - - public override bool AltFunctionUse(Player player) => true; - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - if (player.altFunctionUse == 2) - { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X * 1.35f, velocity.Y * 1.35f, ModContent.ProjectileType(), (int)(damage * 1.6625), knockback, player.whoAmI); - int laserAmt = 3; - float SpeedX = velocity.X + Main.rand.NextFloat(-1f, 1f); - float SpeedY = velocity.Y + Main.rand.NextFloat(-1f, 1f); - for (int i = 0; i < laserAmt; ++i) - { - int laser = Projectile.NewProjectile(source, position.X, position.Y, SpeedX * 1.15f, SpeedY * 1.15f, ProjectileID.LaserMachinegunLaser, (int)(damage * 0.4), knockback * 0.4f, player.whoAmI); - Main.projectile[laser].timeLeft = 120; - Main.projectile[laser].tileCollide = false; - } - } - else - { - Vector2 laserSpawnPos = player.RotatedRelativePoint(player.MountedCenter, true); - float tenthPi = 0.314159274f; - int laserAmt = 3; - Vector2 laserVelocity = velocity; - laserVelocity.Normalize(); - laserVelocity *= 80f; - bool laserHitsTiles = Collision.CanHit(laserSpawnPos, 0, 0, laserSpawnPos + laserVelocity, 0, 0); - for (int i = 0; i < laserAmt; i++) - { - float laserOffset = (float)i - ((float)laserAmt - 1f) / 2f; - Vector2 offsetSpawnPos = laserVelocity.RotatedBy((double)(tenthPi * laserOffset), default); - if (!laserHitsTiles) - { - offsetSpawnPos -= laserVelocity; - } - Projectile.NewProjectile(source, laserSpawnPos.X + offsetSpawnPos.X, laserSpawnPos.Y + offsetSpawnPos.Y, velocity.X * 1.5f, velocity.Y * 1.5f, type, (int)(damage * 0.8), knockback, player.whoAmI); - int laser = Projectile.NewProjectile(source, laserSpawnPos.X + offsetSpawnPos.X, laserSpawnPos.Y + offsetSpawnPos.Y, velocity.X * 2f, velocity.Y * 2f, ProjectileID.LaserMachinegunLaser, (int)(damage * 0.4), knockback * 0.4f, player.whoAmI); - Main.projectile[laser].timeLeft = 120; - Main.projectile[laser].tileCollide = false; - } - } - return false; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(2). - AddIngredient(5). - AddIngredient(10). - AddTile(). - Register(); - } - } -} diff --git a/Items/Weapons/Magic/AlphaRay.png b/Items/Weapons/Magic/AlphaRay.png deleted file mode 100644 index 429d526d81..0000000000 Binary files a/Items/Weapons/Magic/AlphaRay.png and /dev/null differ diff --git a/Items/Weapons/Magic/Genisis.cs b/Items/Weapons/Magic/Genesis.cs similarity index 55% rename from Items/Weapons/Magic/Genisis.cs rename to Items/Weapons/Magic/Genesis.cs index 7ee65b690a..4191f822ec 100644 --- a/Items/Weapons/Magic/Genisis.cs +++ b/Items/Weapons/Magic/Genesis.cs @@ -8,16 +8,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic { - public class Genisis : ModItem, ILocalizedModType + [LegacyName("Genisis")] + public class Genesis : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { - Item.width = 74; - Item.height = 28; - Item.damage = 70; + Item.width = 108; + Item.height = 46; + Item.damage = 60; Item.DamageType = DamageClass.Magic; - Item.mana = 4; + Item.mana = 20; Item.useTime = 4; Item.useAnimation = 4; Item.useStyle = ItemUseStyleID.Shoot; @@ -25,31 +26,29 @@ namespace CalamityMod.Items.Weapons.Magic Item.knockBack = 1.5f; Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; - Item.UseSound = SoundID.Item33; + Item.UseSound = null; Item.autoReuse = true; Item.shootSpeed = 6f; - Item.shoot = ModContent.ProjectileType(); + Item.channel = true; + Item.noUseGraphic = true; + Item.shoot = ModContent.ProjectileType(); } - public override Vector2? HoldoutOffset() => new Vector2(-5, 0); + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + // Makes the rotation of the mouse around the player sync in multiplayer. + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); - float SpeedX = velocity.X + (float)Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-20, 21) * 0.05f; - for (int index = 0; index < 3; ++index) - { - int projectile = Projectile.NewProjectile(source, position.X, position.Y, SpeedX * 1.05f, SpeedY * 1.05f, ProjectileID.LaserMachinegunLaser, (int)(damage * 0.65), knockback * 0.6f, player.whoAmI, 0f, 0f); - Main.projectile[projectile].timeLeft = 120; - } + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 0, 0); + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); + return false; } - public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.LaserMachinegun). + AddIngredient(ItemID.LaserRifle). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). AddTile(TileID.LunarCraftingStation). diff --git a/Items/Weapons/Magic/Genesis.png b/Items/Weapons/Magic/Genesis.png new file mode 100644 index 0000000000..b009a20298 Binary files /dev/null and b/Items/Weapons/Magic/Genesis.png differ diff --git a/Items/Weapons/Magic/Genisis.png b/Items/Weapons/Magic/Genisis.png deleted file mode 100644 index a7d8fbdcca..0000000000 Binary files a/Items/Weapons/Magic/Genisis.png and /dev/null differ diff --git a/Items/Weapons/Magic/Omicron.cs b/Items/Weapons/Magic/Omicron.cs new file mode 100644 index 0000000000..5028c9f3a0 --- /dev/null +++ b/Items/Weapons/Magic/Omicron.cs @@ -0,0 +1,65 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class Omicron : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Magic"; + + public override void SetDefaults() + { + Item.width = 122; + Item.height = 54; + Item.damage = 82; + Item.DamageType = DamageClass.Magic; + Item.mana = 8; + Item.useTime = Item.useAnimation = 4; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 1.5f; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; + Item.UseSound = null; + Item.autoReuse = true; + Item.shootSpeed = 6f; + Item.channel = true; + Item.noUseGraphic = true; + Item.shoot = ModContent.ProjectileType(); + Item.rare = ModContent.RarityType(); + } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.ownedProjectileCounts[ModContent.ProjectileType()] < 2; + + // Makes the rotation of the mouse around the player sync in multiplayer. + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + for (int i = 0; i < 2; i++) + { + Projectile holdout2 = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 0, i == 0 ? 1 : -1); + holdout2.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); + } + + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 0, 0); + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); + + return false; + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddIngredient(). + AddIngredient(5). + AddIngredient(10). + AddTile(). + Register(); + } + } +} diff --git a/Items/Weapons/Magic/Omicron.png b/Items/Weapons/Magic/Omicron.png new file mode 100644 index 0000000000..49a0e14e11 Binary files /dev/null and b/Items/Weapons/Magic/Omicron.png differ diff --git a/Items/Weapons/Magic/VividClarity.cs b/Items/Weapons/Magic/VividClarity.cs index b51b21e2f5..0180a48fb2 100644 --- a/Items/Weapons/Magic/VividClarity.cs +++ b/Items/Weapons/Magic/VividClarity.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -24,8 +25,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.width = 90; - Item.height = 112; + Item.width = 140; + Item.height = 140; Item.damage = 133; Item.DamageType = DamageClass.Magic; Item.mana = 42; @@ -71,6 +72,11 @@ namespace CalamityMod.Items.Weapons.Magic return false; } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Magic/VividClarityGlow").Value); + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/VividClarity.png b/Items/Weapons/Magic/VividClarity.png index a09e59afd7..e0f181f0ed 100644 Binary files a/Items/Weapons/Magic/VividClarity.png and b/Items/Weapons/Magic/VividClarity.png differ diff --git a/Items/Weapons/Magic/VividClarityGlow.png b/Items/Weapons/Magic/VividClarityGlow.png new file mode 100644 index 0000000000..f404339f68 Binary files /dev/null and b/Items/Weapons/Magic/VividClarityGlow.png differ diff --git a/Items/Weapons/Magic/Wingman.cs b/Items/Weapons/Magic/Wingman.cs index b2db99864b..078a802904 100644 --- a/Items/Weapons/Magic/Wingman.cs +++ b/Items/Weapons/Magic/Wingman.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -11,31 +12,39 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { - Item.width = 42; - Item.height = 22; - Item.damage = 70; + Item.width = 44; + Item.height = 42; + Item.damage = 71; Item.DamageType = DamageClass.Magic; - Item.mana = 12; + Item.mana = 5; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 3f; + Item.knockBack = 1.5f; + Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; - Item.UseSound = SoundID.Item33; + Item.UseSound = null; Item.autoReuse = true; Item.shootSpeed = 25f; - Item.shoot = ProjectileID.LaserMachinegunLaser; + Item.shoot = ModContent.ProjectileType(); + Item.channel = true; } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] < 2; + + // Makes the rotation of the mouse around the player sync in multiplayer. + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int beamAmt = 3; - for (int index = 0; index < beamAmt; ++index) + for (int i = 0; i < 2; i++) { - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 0, i == 0 ? 1 : -1); + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); } + return false; } } diff --git a/Items/Weapons/Magic/Wingman.png b/Items/Weapons/Magic/Wingman.png index 05e9fe8993..f1030e5a6d 100644 Binary files a/Items/Weapons/Magic/Wingman.png and b/Items/Weapons/Magic/Wingman.png differ diff --git a/Items/Weapons/Magic/WingmanAlt.png b/Items/Weapons/Magic/WingmanAlt.png new file mode 100644 index 0000000000..bf6ca61d33 Binary files /dev/null and b/Items/Weapons/Magic/WingmanAlt.png differ diff --git a/Items/Weapons/Melee/Exoblade.cs b/Items/Weapons/Melee/Exoblade.cs index c1c551acd5..e4e2851a5e 100644 --- a/Items/Weapons/Melee/Exoblade.cs +++ b/Items/Weapons/Melee/Exoblade.cs @@ -4,6 +4,7 @@ using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -126,6 +127,11 @@ namespace CalamityMod.Items.Weapons.Melee return false; } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/ExobladeGlow").Value); + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Melee/ExobladeGlow.png b/Items/Weapons/Melee/ExobladeGlow.png new file mode 100644 index 0000000000..5529b42e13 Binary files /dev/null and b/Items/Weapons/Melee/ExobladeGlow.png differ diff --git a/Items/Weapons/Melee/ExobladeSquare.png b/Items/Weapons/Melee/ExobladeSquare.png index fd9fe0288c..f679194f8d 100644 Binary files a/Items/Weapons/Melee/ExobladeSquare.png and b/Items/Weapons/Melee/ExobladeSquare.png differ diff --git a/Items/Weapons/Melee/LionHeart.cs b/Items/Weapons/Melee/LionHeart.cs index dd0b0df4ed..5b06e0992b 100644 --- a/Items/Weapons/Melee/LionHeart.cs +++ b/Items/Weapons/Melee/LionHeart.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 60; Item.height = 62; - Item.damage = 323; + Item.damage = 960; Item.knockBack = 5.5f; Item.useStyle = ItemUseStyleID.Swing; Item.useAnimation = 15; diff --git a/Items/Weapons/Melee/StygianShield.cs b/Items/Weapons/Melee/StygianShield.cs index 1f2983725a..3b6b75e84f 100644 --- a/Items/Weapons/Melee/StygianShield.cs +++ b/Items/Weapons/Melee/StygianShield.cs @@ -1,8 +1,10 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -14,6 +16,14 @@ namespace CalamityMod.Items.Weapons.Melee { public new string LocalizationCategory => "Items.Weapons.Melee"; + public static readonly SoundStyle DashChargeSound = new("CalamityMod/Sounds/Item/StygianDashCharge"); + public static readonly SoundStyle DashSound = new("CalamityMod/Sounds/Item/StygianDash"); + public static readonly SoundStyle DashHitSound = new("CalamityMod/Sounds/Item/StygianBonk", 3); + public static readonly SoundStyle ShieldThrowSound = new("CalamityMod/Sounds/Item/StygianThrow"); + public static readonly SoundStyle ThrowLoopSound = new("CalamityMod/Sounds/Item/StygianThrowLoop"); + public static readonly SoundStyle ShieldThrowHitSound = CommonCalamitySounds.ExoHitSound; + public static readonly SoundStyle ShieldCatchSound = new("CalamityMod/Sounds/Item/StygianCatch"); + // Held stats public const int HeldDefense = 16; public const int DisableDashDuration = 90; diff --git a/Items/Weapons/Melee/TheLastMourning.cs b/Items/Weapons/Melee/TheLastMourning.cs index 3cc6fe5c75..19f4ae60b0 100644 --- a/Items/Weapons/Melee/TheLastMourning.cs +++ b/Items/Weapons/Melee/TheLastMourning.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 94; Item.height = 94; Item.DamageType = DamageClass.Melee; - Item.damage = 360; + Item.damage = 550; Item.knockBack = 8.5f; Item.useAnimation = 20; Item.useTime = 20; diff --git a/Items/Weapons/Ranged/HeavenlyGale.cs b/Items/Weapons/Ranged/HeavenlyGale.cs index 543b09b5a3..3c3643b112 100644 --- a/Items/Weapons/Ranged/HeavenlyGale.cs +++ b/Items/Weapons/Ranged/HeavenlyGale.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Ranged public const float ArrowTargetingRange = 1100f; - public const float MaxChargeDamageBoost = 4.5f; + public const float MaxChargeDamageBoost = 3.5f; public const float LightningDamageFactor = 0.36f; @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 138; Item.height = 176; - Item.damage = 215; + Item.damage = 256; Item.DamageType = DamageClass.Ranged; Item.useAnimation = Item.useTime = ArrowShootTime; // 40 Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Ranged/Hydra.cs b/Items/Weapons/Ranged/Hydra.cs index 600a509958..bdc1828846 100644 --- a/Items/Weapons/Ranged/Hydra.cs +++ b/Items/Weapons/Ranged/Hydra.cs @@ -85,9 +85,9 @@ namespace CalamityMod.Items.Weapons.Ranged return false; //Otherwise, launch the guns + SoundEngine.PlaySound(LaunchSound, player.Center); for (int i = 0; i < Main.maxProjectiles; i++) { - SoundEngine.PlaySound(LaunchSound, player.Center); if (Main.projectile[i].type == HeadID && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].active) Main.projectile[i].ai[1] = -1f; } diff --git a/Items/Weapons/Ranged/Photoviscerator.cs b/Items/Weapons/Ranged/Photoviscerator.cs index a6a8c92440..b65537e9bf 100644 --- a/Items/Weapons/Ranged/Photoviscerator.cs +++ b/Items/Weapons/Ranged/Photoviscerator.cs @@ -4,6 +4,7 @@ using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -84,6 +85,11 @@ namespace CalamityMod.Items.Weapons.Ranged return false; } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Ranged/PhotovisceratorGlow").Value); + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Ranged/PhotovisceratorGlow.png b/Items/Weapons/Ranged/PhotovisceratorGlow.png new file mode 100644 index 0000000000..90365e976f Binary files /dev/null and b/Items/Weapons/Ranged/PhotovisceratorGlow.png differ diff --git a/Items/Weapons/Rogue/HeavenfallenStardisk.cs b/Items/Weapons/Rogue/HeavenfallenStardisk.cs index feedf4ed5c..0e0263c937 100644 --- a/Items/Weapons/Rogue/HeavenfallenStardisk.cs +++ b/Items/Weapons/Rogue/HeavenfallenStardisk.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 44; Item.height = 48; - Item.damage = 90; + Item.damage = 155; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 40; @@ -28,16 +28,28 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 20; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int proj = Projectile.NewProjectile(source, position, velocity.Length() * -Vector2.UnitY, type, damage, knockback, player.whoAmI); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - - return false; + { + int proj = Projectile.NewProjectile(source, position, velocity.Length() * -Vector2.UnitY, type, damage, knockback, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + { + int spread = 15; + for (int i = 0; i < 2; i++) + { + Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-8, 8), velocity.Y + Main.rand.Next(-2, 3)).RotatedBy(MathHelper.ToRadians(spread)); + Projectile.NewProjectile(source, position, perturbedspeed.Length() * -Vector2.UnitY, type, (int)(damage * 0.3), knockback, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + } + spread -= Main.rand.Next(5, 8); + } + } + return false; + } } } } diff --git a/Items/Weapons/Rogue/Supernova.cs b/Items/Weapons/Rogue/Supernova.cs index 775fcbac13..d6bef9b091 100644 --- a/Items/Weapons/Rogue/Supernova.cs +++ b/Items/Weapons/Rogue/Supernova.cs @@ -4,6 +4,7 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -53,6 +54,11 @@ namespace CalamityMod.Items.Weapons.Rogue return false; } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Rogue/SupernovaGlow").Value); + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Rogue/SupernovaGlow.png b/Items/Weapons/Rogue/SupernovaGlow.png new file mode 100644 index 0000000000..0d383aedb3 Binary files /dev/null and b/Items/Weapons/Rogue/SupernovaGlow.png differ diff --git a/Items/Weapons/Summon/CosmicImmaterializer.cs b/Items/Weapons/Summon/CosmicImmaterializer.cs index 477e19cd22..d7d6ac4aa8 100644 --- a/Items/Weapons/Summon/CosmicImmaterializer.cs +++ b/Items/Weapons/Summon/CosmicImmaterializer.cs @@ -4,6 +4,7 @@ using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -16,8 +17,8 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.width = 74; - Item.height = 72; + Item.width = 170; + Item.height = 164; Item.mana = 10; Item.damage = 560; Item.useStyle = ItemUseStyleID.Swing; @@ -43,6 +44,11 @@ namespace CalamityMod.Items.Weapons.Summon return false; } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Summon/CosmicImmaterializerGlow").Value); + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Summon/CosmicImmaterializer.png b/Items/Weapons/Summon/CosmicImmaterializer.png index aaf579725d..21ac8d7523 100644 Binary files a/Items/Weapons/Summon/CosmicImmaterializer.png and b/Items/Weapons/Summon/CosmicImmaterializer.png differ diff --git a/Items/Weapons/Summon/CosmicImmaterializerGlow.png b/Items/Weapons/Summon/CosmicImmaterializerGlow.png new file mode 100644 index 0000000000..b2854e2cae Binary files /dev/null and b/Items/Weapons/Summon/CosmicImmaterializerGlow.png differ diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index 70595645f7..2db3dd95ea 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -455,7 +455,7 @@ OldDukeRelic: { PerforatorsRelic: { DisplayName: Perforators Relic - Tooltip: A glimpse into what could have been... + Tooltip: "" } PlaguebringerGoliathRelic: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index f857698016..4a2ee65579 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -27,15 +27,6 @@ AethersWhisper: { ''' } -AlphaRay: { - DisplayName: Alpha Ray - Tooltip: - ''' - Disintegrates everything with a tri-beam of energy and lasers - Press to fire a Y-shaped beam of destructive energy and a spread of lasers - ''' -} - AlulaAustralis: { DisplayName: Alula Australis Tooltip: Fires a beautiful aurora trailed by a star shower @@ -345,9 +336,14 @@ FrostBolt: { Tooltip: Casts a slow-moving ball of frost } -Genisis: { - DisplayName: Genisis - Tooltip: Fires a Y-shaped beam of destructive energy and a spread of lasers +Genesis: { + DisplayName: Genesis + Tooltip: + ''' + Fire an array of lasers that decreases in spread for each shot + Every sixth shot fires a splitting Genesis Beam and resets the spread of the weapon + Hitting an enemy where the Genesis Beam splits deals increased damage + ''' } GhastlyVisage: { @@ -548,6 +544,17 @@ NuclearFury: { Tooltip: Casts a torrent of cosmic typhoons } +Omicron: { + DisplayName: Omicron + Tooltip: + ''' + Fires a continuous array of lasers and spawns two Wingmen which orbit you and fire lasers at your cursor + Press when firing to shoot an Omicron Beam that splits upon hitting an enemy + After firing an Omicron Beam your Wingmen will launch a pair of grenades + Hitting an enemy with an Omicron Beam right as it is fired will increase the damage done substantially and stop it from splitting + ''' +} + ParasiticSceptor: { DisplayName: Parasitic Scepter Tooltip: Fires a spread of radioactive water leeches that latch onto enemies, increasing damage over time per leech @@ -939,7 +946,12 @@ Waywasher: { Wingman: { DisplayName: Wingman - Tooltip: Fires a concentrated laser beam + Tooltip: + ''' + Spawns two Wingmen which orbit you and fire lasers at your cursor + Press while firing to order the Wingmen to launch grenades + Grenades have a cooldown which is shortened if the Wingmen are fully revved up + ''' } WintersFury: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 03a00d6437..d92ae3dc73 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -538,8 +538,8 @@ HeavenfallenStardisk: { Tooltip: ''' Throws a stardisk upwards which then launches itself towards your mouse cursor - Explodes into 5 astral energy bolts if the thrower is moving vertically when throwing it - Stealth strikes rain astral energy bolts from the sky + Explodes into a star of astral bolts on hit + Stealth strikes throw three disks that rain astral energy bolts from the sky ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson index 7a682b6ca9..b9a91f0fb0 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson @@ -43,6 +43,7 @@ CirrusVolatileVodkaBottle.DisplayName: Volatile Vodka Bottle DarkEnergyBall.DisplayName: Dark Energy DarkEnergyBall2.DisplayName: Dark Energy DarkOrb.DisplayName: Dark Orb +DesertScourgeDiveSplash.DisplayName: Desert Scourge Dive Splash DesertScourgeSpit.DisplayName: Scourge Spit DestroyerCursedLaser.DisplayName: Cursed Laser DestroyerElectricLaser.DisplayName: Electric Laser diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index d6f92ff7fb..cf3b8f5fa3 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -78,6 +78,7 @@ ForbiddenSunProjectile.DisplayName: Forbidden Sun FrigidflashBoltProjectile.DisplayName: Frigidflash Bolt FrostBoltProjectile.DisplayName: Frost Ball GammaLaser.DisplayName: Gamma Laser +GenesisBeam.DisplayName: Genesis Beam GhastlyBlast.DisplayName: Ghast Blast GhastlyExplosion.DisplayName: Ghastly Explosion GhastlyExplosionShard.DisplayName: Ghastly Fragment @@ -150,7 +151,7 @@ NightBolt.DisplayName: Night's Bolt NightOrb.DisplayName: Night's Orb NightsRayBeam.DisplayName: Night's Ray NuclearFuryProjectile.DisplayName: Nuclear Fury -ParticleBeamofDoom.DisplayName: Doom +OmicronBeam.DisplayName: Omicron Beam PartySparkle.DisplayName: Pretty Sparkle PhantasmalFuryProj.DisplayName: Phantasmal Fury Phantom.DisplayName: Phantom @@ -249,6 +250,8 @@ VolatileStarcore.DisplayName: Volatile Starcore VortexElementalBeam.DisplayName: Vortex Lightning WaterLeechProj.DisplayName: Water Leech WaywasherProj.DisplayName: Waywasher Blast +WingmanShot.DisplayName: Mana Shot +WingmanGrenade.DisplayName: Mana Grenade WulfrumBolt.DisplayName: Wulfrum Bolt WulfrumManaDrain.DisplayName: Mana Drain WyvernFeatherGreen.DisplayName: Feather diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson index dbc84a461e..c5259da203 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson @@ -55,8 +55,8 @@ SetBonus: { ''' Gold: ''' - All enemies have a 4% chance to drop 1 gold. All bosses killed drop 3 gold - You gain 1% critical strike chance for every 5 gold in your inventory, capped at 10% + All enemies have a 2% chance to drop 1 gold. All bosses killed drop 3 gold + You gain 1% critical strike chance for every 10 gold in your inventory, capped at 9% ''' Iron: ''' @@ -66,7 +66,7 @@ SetBonus: { Jungle: 10% reduced mana costs Lead: ''' - Increases damage reduction by 3% + Increases damage reduction by 4% +0.5 HP/s life regen Grants immunity to knockback ''' @@ -99,10 +99,12 @@ SetBonus: { Increases minion damage by 15% Grants immunity to fire blocks and temporary immunity to lava ''' + PlatinumChainmail: 3% increased critical strike chance Platinum: ''' - Every 10 defense gives you +0.5 HP/s life regen, 1% increased damage and 1% increased critical strike chance - These effects cap at 40 defense + Every 10 extra defense gives you 1% increased damage and 1% increased critical strike chance + The 20 defense from the Platinum Armor itself does not contribute to this effect + Bonus damage and critical strike chance cap at 40 extra defense ''' Silver: ''' diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index 1e2c178a11..181b292122 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -37,11 +37,11 @@ namespace CalamityMod.NPCs.AstrumDeus public class AstrumDeusHead : ModNPC { public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/AstrumDeus/AstrumDeusSpawn"); - public static readonly SoundStyle LaserSound = new("CalamityMod/Sounds/Custom/AstrumDeus/AstrumDeusLaser"); - public static readonly SoundStyle GodRaySound = new("CalamityMod/Sounds/Custom/AstrumDeus/AstrumDeusGodRay"); - public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/AstrumDeus/AstrumDeusMine"); + public static readonly SoundStyle LaserSound = new("CalamityMod/Sounds/Custom/AstrumDeus/AstrumDeusLaser") { Volume = 0.35f }; + public static readonly SoundStyle GodRaySound = new("CalamityMod/Sounds/Custom/AstrumDeus/AstrumDeusGodRay") { Volume = 0.4f }; + public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/AstrumDeus/AstrumDeusMine") { Volume = 0.4f }; public static readonly SoundStyle SplitSound = new("CalamityMod/Sounds/Custom/AstrumDeus/AstrumDeusSplit"); - public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/AstrumDeusHit", 2) { Volume = 1.25f }; + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/AstrumDeusHit", 2) { Volume = 0.7f }; public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/AstrumDeusDeath"); public static Asset TextureGlow1; diff --git a/NPCs/Bumblebirb/Bumblefuck2.cs b/NPCs/Bumblebirb/Bumblefuck2.cs index 957905ed53..b79d7fb64a 100644 --- a/NPCs/Bumblebirb/Bumblefuck2.cs +++ b/NPCs/Bumblebirb/Bumblefuck2.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.Bumblebirb NPC.width = 120; NPC.height = 80; NPC.defense = 20; - NPC.LifeMaxNERB(9375, 11250, 5000); // Old HP - 12000, 15000 + NPC.LifeMaxNERB(9375, 11250, 5000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.knockBackResist = 0.15f; diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 45f23c52f6..7800b4b05b 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -142,6 +142,7 @@ namespace CalamityMod.NPCs "Daawn", // <@!206162323541458944> (daawnily) "Robin", // <@!654737510030639112> (altzeus) "Curly", // <@!673092101780668416> (curly4830) + "Cobalt", // <@!132962828922388481> (cobalt_44) }; private static readonly string[] MerchantNames = { diff --git a/NPCs/DesertScourge/DesertNuisanceBody.cs b/NPCs/DesertScourge/DesertNuisanceBody.cs index e594d5af1f..c4d0d59040 100644 --- a/NPCs/DesertScourge/DesertNuisanceBody.cs +++ b/NPCs/DesertScourge/DesertNuisanceBody.cs @@ -41,11 +41,14 @@ namespace CalamityMod.NPCs.DesertScourge NPC.width = 88; NPC.height = 88; - NPC.defense = 4; + NPC.defense = 5; if (Main.getGoodWorld) - NPC.defense += 26; + NPC.defense += 27; + + NPC.LifeMaxNERB(1500, 1800, 40000); + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + NPC.lifeMax = 4800; - NPC.lifeMax = BossRushEvent.BossRushActive ? 35000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 4000 : 1300; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; diff --git a/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs b/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs index 6ce2017799..2094ce55fe 100644 --- a/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs +++ b/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs @@ -45,7 +45,10 @@ namespace CalamityMod.NPCs.DesertScourge if (Main.getGoodWorld) NPC.defense += 26; - NPC.lifeMax = BossRushEvent.BossRushActive ? 35000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 4000 : 1300; + NPC.LifeMaxNERB(1300, 1560, 35000); + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + NPC.lifeMax = 4000; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; diff --git a/NPCs/DesertScourge/DesertNuisanceHead.cs b/NPCs/DesertScourge/DesertNuisanceHead.cs index 220984be48..fc4b6f42e7 100644 --- a/NPCs/DesertScourge/DesertNuisanceHead.cs +++ b/NPCs/DesertScourge/DesertNuisanceHead.cs @@ -53,13 +53,17 @@ namespace CalamityMod.NPCs.DesertScourge NPC.Calamity().canBreakPlayerDefense = true; NPC.GetNPCDamage(); - NPC.defense = 2; + NPC.defense = 3; if (Main.getGoodWorld) - NPC.defense += 18; + NPC.defense += 19; NPC.width = 88; NPC.height = 88; - NPC.lifeMax = BossRushEvent.BossRushActive ? 35000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 4000 : 1300; + + NPC.LifeMaxNERB(1500, 1800, 40000); + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + NPC.lifeMax = 4800; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -110,6 +114,9 @@ namespace CalamityMod.NPCs.DesertScourge bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; + // Become angry when the other Nuisance dies. + bool getMad = !NPC.AnyNPCs(ModContent.NPCType()) && expertMode; + // Enrage if (!Main.player[NPC.target].ZoneDesert && !bossRush) { @@ -121,7 +128,7 @@ namespace CalamityMod.NPCs.DesertScourge bool biomeEnraged = biomeEnrageTimer <= 0 || bossRush; - float enrageScale = bossRush ? 1f : 0f; + float enrageScale = bossRush ? 1f : getMad ? 0.5f : 0f; if (biomeEnraged) { NPC.Calamity().CurrentlyEnraged = !bossRush; diff --git a/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs b/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs index 0a798ba1d3..00c006ffab 100644 --- a/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs +++ b/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs @@ -1,6 +1,7 @@ using System; using System.IO; using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -24,6 +25,8 @@ namespace CalamityMod.NPCs.DesertScourge public const float SegmentVelocity_GoodWorld = 15f; public const float SegmentVelocity_ZenithSeed = 17.5f; + public const float SpitGateValue = 180f; + public const float OpenMouthForBiteDistance = 220f; private const int OpenMouthStopFrame = 4; @@ -47,7 +50,11 @@ namespace CalamityMod.NPCs.DesertScourge NPC.width = 78; NPC.height = 78; - NPC.lifeMax = BossRushEvent.BossRushActive ? 35000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 4000 : 1300; + + NPC.LifeMaxNERB(1300, 1560, 35000); + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + NPC.lifeMax = 4000; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -71,11 +78,15 @@ namespace CalamityMod.NPCs.DesertScourge public override void SendExtraAI(BinaryWriter writer) { writer.Write(biomeEnrageTimer); + for (int i = 0; i < 4; i++) + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { biomeEnrageTimer = reader.ReadInt32(); + for (int i = 0; i < 4; i++) + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -98,6 +109,9 @@ namespace CalamityMod.NPCs.DesertScourge bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; + // Become angry when the other Nuisance dies. + bool getMad = !NPC.AnyNPCs(ModContent.NPCType()) && expertMode; + // Enrage if (!Main.player[NPC.target].ZoneDesert && !bossRush) { @@ -109,7 +123,7 @@ namespace CalamityMod.NPCs.DesertScourge bool biomeEnraged = biomeEnrageTimer <= 0 || bossRush; - float enrageScale = bossRush ? 1f : 0f; + float enrageScale = bossRush ? 1f : getMad ? 0.25f : 0f; if (biomeEnraged) { NPC.Calamity().CurrentlyEnraged = !bossRush; @@ -140,6 +154,42 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.alpha < 0) NPC.alpha = 0; + if (getMad && NPC.Distance(Main.player[NPC.target].Center) > 240f) + { + if ((Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation()) + NPC.Calamity().newAI[0] += 1f; + + if (NPC.Calamity().newAI[0] >= SpitGateValue) + { + NPC.Calamity().newAI[0] = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * (revenge ? 10f : 8f); + int numProj = death ? 6 : 4; + int spread = masterMode ? 28 : 20; + if (masterMode) + { + numProj += 2; + spread += 8; + } + + float rotation = MathHelper.ToRadians(spread); + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].aiStyle = -1; + Main.projectile[proj].netUpdate = true; + } + } + } + } + } + if (Main.netMode != NetmodeID.MultiplayerClient) { if (!tailSpawned && NPC.ai[0] == 0f) @@ -504,6 +554,8 @@ namespace CalamityMod.NPCs.DesertScourge public override void FindFrame(int frameHeight) { // Open mouth to prepare for a nibble ;3 + // Also open mouth for projectile spreads + bool aboutToSpitSpread = NPC.Calamity().newAI[0] > SpitGateValue - 30f; bool openMouth = NPC.Distance(Main.player[NPC.target].Center) < OpenMouthForBiteDistance && (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation() && NPC.ai[3] == 0f; @@ -532,7 +584,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.frame.Y = 0; } } - else if (openMouth) + else if (openMouth || aboutToSpitSpread) { NPC.frameCounter += 1D; if (NPC.frameCounter > 4D) diff --git a/NPCs/DesertScourge/DesertNuisanceTail.cs b/NPCs/DesertScourge/DesertNuisanceTail.cs index 7c5ed2b02f..f5ffaa7224 100644 --- a/NPCs/DesertScourge/DesertNuisanceTail.cs +++ b/NPCs/DesertScourge/DesertNuisanceTail.cs @@ -23,11 +23,14 @@ namespace CalamityMod.NPCs.DesertScourge NPC.width = 88; NPC.height = 88; - NPC.defense = 7; + NPC.defense = 8; if (Main.getGoodWorld) - NPC.defense += 33; + NPC.defense += 34; + + NPC.LifeMaxNERB(1500, 1800, 40000); + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + NPC.lifeMax = 4800; - NPC.lifeMax = BossRushEvent.BossRushActive ? 35000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 4000 : 1300; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; diff --git a/NPCs/DesertScourge/DesertNuisanceTailYoung.cs b/NPCs/DesertScourge/DesertNuisanceTailYoung.cs index 56e7759315..1f2e632dc6 100644 --- a/NPCs/DesertScourge/DesertNuisanceTailYoung.cs +++ b/NPCs/DesertScourge/DesertNuisanceTailYoung.cs @@ -27,7 +27,10 @@ namespace CalamityMod.NPCs.DesertScourge if (Main.getGoodWorld) NPC.defense += 33; - NPC.lifeMax = BossRushEvent.BossRushActive ? 35000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 4000 : 1300; + NPC.LifeMaxNERB(1300, 1560, 35000); + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + NPC.lifeMax = 4000; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index 9237f734fb..c44d91cf26 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -78,6 +78,9 @@ namespace CalamityMod.NPCs.DesertScourge public override void SendExtraAI(BinaryWriter writer) { + writer.Write(NPC.alpha); + writer.Write(NPC.dontTakeDamage); + // Frame syncs writer.Write(NPC.frame.X); writer.Write(NPC.frame.Y); @@ -87,6 +90,9 @@ namespace CalamityMod.NPCs.DesertScourge public override void ReceiveExtraAI(BinaryReader reader) { + NPC.alpha = reader.ReadInt32(); + NPC.dontTakeDamage = reader.ReadBoolean(); + // Frame syncs Rectangle frame = new Rectangle(reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32()); if (frame.Width > 0 && frame.Height > 0) @@ -165,6 +171,8 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.life > Main.npc[(int)NPC.ai[1]].life) NPC.life = Main.npc[(int)NPC.ai[1]].life; + NPC.dontTakeDamage = Main.npc[(int)NPC.ai[1]].dontTakeDamage; + // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -201,6 +209,8 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.alpha < 0) NPC.alpha = 0; } + else + NPC.alpha = Main.npc[(int)NPC.ai[1]].alpha; if (Main.player[NPC.target].dead) NPC.TargetClosest(false); @@ -239,7 +249,7 @@ namespace CalamityMod.NPCs.DesertScourge float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; float minimalDamageVelocity = maxChaseSpeed * 0.5f; float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) + if (bodyAndTailVelocity <= minimalContactDamageVelocity || NPC.dontTakeDamage) { NPC.damage = 0; } @@ -287,7 +297,7 @@ namespace CalamityMod.NPCs.DesertScourge break; } - return minDist <= hitDistance * NPC.scale; + return minDist <= hitDistance * NPC.scale && NPC.alpha <= 0; } public override void FindFrame(int frameHeight) diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 59cde20e23..ab6c03fc94 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; @@ -43,12 +44,13 @@ namespace CalamityMod.NPCs.DesertScourge public const float SegmentVelocity_GoodWorld = 21f; public const float SegmentVelocity_ZenithSeed = 24f; - public const float BurrowTimeGateValue = 540f; - public const float BurrowTimeGateValue_Death = 420f; + public const float BurrowTimeGateValue = 720f; + public const float BurrowTimeGateValue_Death = 600f; public const float BurrowResetTimeGateValue = 600f; public const float LungeUpwardDistanceOffset = 600f; public const float LungeUpwardCutoffDistance = 420f; + public const float BurrowDistance_Hide = 1080f; public const float BurrowDistance = 800f; public const float BurrowDistance_BossRush = 400f; public const float OpenMouthForBiteDistance = 220f; @@ -115,6 +117,12 @@ namespace CalamityMod.NPCs.DesertScourge NPC.Calamity().VulnerableToWater = true; } + public override void BossHeadSlot(ref int index) + { + if (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType())) + index = -1; + } + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] @@ -126,16 +134,24 @@ namespace CalamityMod.NPCs.DesertScourge public override void SendExtraAI(BinaryWriter writer) { + writer.Write(NPC.alpha); + writer.Write(NPC.dontTakeDamage); writer.Write(biomeEnrageTimer); writer.Write(playRoarSound); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); for (int i = 0; i < 4; i++) writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { + NPC.alpha = reader.ReadInt32(); + NPC.dontTakeDamage = reader.ReadBoolean(); biomeEnrageTimer = reader.ReadInt32(); playRoarSound = reader.ReadBoolean(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); for (int i = 0; i < 4; i++) NPC.Calamity().newAI[i] = reader.ReadSingle(); } @@ -148,6 +164,19 @@ namespace CalamityMod.NPCs.DesertScourge bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; + // Check for Nuisances + bool hide = NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()); + if (hide) + { + NPC.Calamity().newAI[0] = 0f; + NPC.Calamity().newAI[1] = 0f; + NPC.Calamity().newAI[3] = 0f; + NPC.localAI[3] = 0f; + playRoarSound = false; + } + + NPC.dontTakeDamage = hide; + // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); @@ -179,6 +208,17 @@ namespace CalamityMod.NPCs.DesertScourge // Percent life remaining. float lifeRatio = NPC.life / (float)NPC.lifeMax; + // Summon the Nuisances. + if (lifeRatio < 0.5f) + { + if (NPC.localAI[2] == 0f) + { + NPC.localAI[2] = 1f; + NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); + NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); + } + } + // Only increment the burrow timer if the head is beneath the player. if (NPC.Center.Y > Main.player[NPC.target].Center.Y) { @@ -192,6 +232,8 @@ namespace CalamityMod.NPCs.DesertScourge bool lungeUpward = burrow && NPC.Calamity().newAI[1] == 1f; bool quickFall = NPC.Calamity().newAI[1] == 2f; + float burrowDistance = hide ? BurrowDistance_Hide : bossRush ? BurrowDistance_BossRush : BurrowDistance; + float speed = death ? 0.18f : 0.15f; float turnSpeed = death ? 0.36f : 0.3f; @@ -210,7 +252,93 @@ namespace CalamityMod.NPCs.DesertScourge turnSpeed *= 1.2f; } - if (lungeUpward || burrow) + // Sand splash + if (!quickFall) + { + if (lungeUpward) + { + if (NPC.localAI[3] == 0f) + { + Point headTileCenter = NPC.Top.ToTileCoordinates(); + Tile tileSafely = Framing.GetTileSafely(headTileCenter); + bool inSolidTile = tileSafely.HasUnactuatedTile; + bool finsInSolidTile = Framing.GetTileSafely(Main.npc[(int)NPC.ai[0]].Center.ToTileCoordinates()).HasUnactuatedTile; + if (!inSolidTile && finsInSolidTile && Collision.CanHit(NPC.Top, 1, 1, player.Center, 1, 1)) + { + NPC.localAI[3] = 1f; + SoundEngine.PlaySound(SoundID.Item74, NPC.Center); + + int bestY = headTileCenter.Y; + for (int j = 0; j < 20; j++) + { + if (bestY < 10) + break; + + if (!WorldGen.SolidTile(headTileCenter.X, bestY)) + break; + + bestY--; + } + + for (int k = 0; k < 20; k++) + { + if (bestY > Main.maxTilesY - 10) + break; + + if (WorldGen.ActiveAndWalkableTile(headTileCenter.X, bestY)) + break; + + bestY++; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), new Vector2(headTileCenter.X * 16 + 8, bestY * 16 - 40), Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + } + } + } + else if (burrow) + { + if (NPC.localAI[3] == 0f) + { + Point headTileCenter = NPC.Bottom.ToTileCoordinates(); + Tile tileSafely = Framing.GetTileSafely(headTileCenter); + bool inSolidTile = tileSafely.HasUnactuatedTile; + if (inSolidTile && Collision.CanHit(NPC.Top, 1, 1, player.Center, 1, 1)) + { + NPC.localAI[3] = 1f; + SoundEngine.PlaySound(SoundID.Item74, NPC.Center); + + int bestY = headTileCenter.Y; + for (int j = 0; j < 20; j++) + { + if (bestY < 10) + break; + + if (!WorldGen.SolidTile(headTileCenter.X, bestY)) + break; + + bestY--; + } + + for (int k = 0; k < 20; k++) + { + if (bestY > Main.maxTilesY - 10) + break; + + if (WorldGen.ActiveAndWalkableTile(headTileCenter.X, bestY)) + break; + + bestY++; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), new Vector2(headTileCenter.X * 16 + 8, bestY * 16 - 40), Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + } + } + } + } + + if (lungeUpward || burrow || hide) { speed *= 1.5f; turnSpeed *= 1.5f; @@ -222,9 +350,18 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; + if (hide) + { + NPC.alpha += 3; + if (NPC.alpha > 255) + NPC.alpha = 255; + } + else + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -294,7 +431,7 @@ namespace CalamityMod.NPCs.DesertScourge if (tileWidthPosY > Main.maxTilesY) tileWidthPosY = Main.maxTilesY; - bool shouldFly = lungeUpward; + bool shouldFly = lungeUpward || hide; if (!shouldFly) { for (int k = tilePositionX; k < tileWidthPosX; k++) @@ -361,7 +498,7 @@ namespace CalamityMod.NPCs.DesertScourge masterMode ? SegmentVelocity_Master : expertMode ? SegmentVelocity_Expert : SegmentVelocity_Normal; - if (burrow || lungeUpward) + if (burrow || lungeUpward || hide) maxChaseSpeed *= 1.5f; if (expertMode) maxChaseSpeed += maxChaseSpeed * 0.5f * (1f - lifeRatio); @@ -386,12 +523,11 @@ namespace CalamityMod.NPCs.DesertScourge } } - float burrowDistance = bossRush ? BurrowDistance_BossRush : BurrowDistance; float burrowTarget = player.Center.Y + burrowDistance; float lungeTarget = NPC.Calamity().newAI[3]; Vector2 npcCenter = NPC.Center; float playerX = player.Center.X; - float targettingPosition = lungeUpward ? lungeTarget : burrow ? burrowTarget : player.Center.Y; + float targettingPosition = lungeUpward ? lungeTarget : (burrow || hide) ? burrowTarget : player.Center.Y; playerX = (float)((int)(playerX / 16f) * 16); targettingPosition = (float)((int)(targettingPosition / 16f) * 16); npcCenter.X = (float)((int)(npcCenter.X / 16f) * 16); @@ -404,6 +540,7 @@ namespace CalamityMod.NPCs.DesertScourge if (burrow && NPC.Center.Y >= burrowTarget - 16f) { NPC.Calamity().newAI[1] = 1f; + NPC.localAI[3] = 0f; if (!playRoarSound) { SoundEngine.PlaySound(RoarSound, player.Center); @@ -412,7 +549,7 @@ namespace CalamityMod.NPCs.DesertScourge } // Quickly fall back down once above target - if (lungeUpward && NPC.Center.Y <= NPC.Calamity().newAI[3] + LungeUpwardDistanceOffset - LungeUpwardCutoffDistance) + if (lungeUpward && NPC.Center.Y <= NPC.Calamity().newAI[3] + LungeUpwardDistanceOffset - LungeUpwardCutoffDistance && Math.Abs(NPC.Center.X - player.Center.X) < 480f) { // Spit a huge spread of sand upwards that falls down SoundEngine.PlaySound(SoundID.NPCDeath13, NPC.Center); @@ -431,7 +568,7 @@ namespace CalamityMod.NPCs.DesertScourge Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); for (int k = 0; k < 10; k++) - Dust.NewDust(NPC.Center + Vector2.Normalize(perturbedSpeed) * 5f, 10, 10, DustID.UnusedBrown, perturbedSpeed.X, perturbedSpeed.Y); + Dust.NewDust(NPC.Center + Vector2.Normalize(perturbedSpeed) * 5f, 10, 10, (int)CalamityDusts.SulphurousSeaAcid, perturbedSpeed.X, perturbedSpeed.Y); if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(perturbedSpeed) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer); @@ -439,6 +576,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.TargetClosest(); NPC.Calamity().newAI[1] = 2f; + NPC.localAI[3] = 0f; playRoarSound = false; } @@ -451,6 +589,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.Calamity().newAI[0] = 0f; NPC.Calamity().newAI[1] = 0f; NPC.Calamity().newAI[3] = 0f; + NPC.localAI[3] = 0f; playRoarSound = false; } } @@ -460,6 +599,7 @@ namespace CalamityMod.NPCs.DesertScourge { NPC.Calamity().newAI[0] = 0f; NPC.Calamity().newAI[1] = 0f; + NPC.localAI[3] = 0f; } if (!shouldFly) @@ -597,17 +737,30 @@ namespace CalamityMod.NPCs.DesertScourge } } + if (!burrow && !quickFall && !hide) + { + if (NPC.Distance(player.Center) > 2000f) + NPC.velocity += (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * turnSpeed; + } + // Calculate contact damage based on velocity float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; float minimalDamageVelocity = maxChaseSpeed * 0.5f; - if (NPC.velocity.Length() <= minimalContactDamageVelocity) + if (hide) { - NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); + NPC.damage = 0; } else { - float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); + if (NPC.velocity.Length() <= minimalContactDamageVelocity) + { + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); + } + else + { + float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); + } } NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + MathHelper.PiOver2; @@ -648,7 +801,7 @@ namespace CalamityMod.NPCs.DesertScourge if (hitboxBotRight < minDist) minDist = hitboxBotRight; - return minDist <= 60f * NPC.scale; + return minDist <= 60f * NPC.scale && NPC.alpha <= 0; } public override void FindFrame(int frameHeight) diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index 02a0c54e98..a9fcfafe36 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -2,6 +2,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -53,6 +54,18 @@ namespace CalamityMod.NPCs.DesertScourge NPC.Calamity().VulnerableToWater = true; } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(NPC.alpha); + writer.Write(NPC.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + NPC.alpha = reader.ReadInt32(); + NPC.dontTakeDamage = reader.ReadBoolean(); + } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; public override void AI() @@ -67,6 +80,8 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.life > Main.npc[(int)NPC.ai[1]].life) NPC.life = Main.npc[(int)NPC.ai[1]].life; + NPC.dontTakeDamage = Main.npc[(int)NPC.ai[1]].dontTakeDamage; + // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -103,6 +118,8 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.alpha < 0) NPC.alpha = 0; } + else + NPC.alpha = Main.npc[(int)NPC.ai[1]].alpha; if (Main.player[NPC.target].dead) NPC.TargetClosest(false); @@ -165,7 +182,7 @@ namespace CalamityMod.NPCs.DesertScourge float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; float minimalDamageVelocity = maxChaseSpeed * 0.5f; float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) + if (bodyAndTailVelocity <= minimalContactDamageVelocity || NPC.dontTakeDamage) { NPC.damage = 0; } @@ -193,7 +210,7 @@ namespace CalamityMod.NPCs.DesertScourge if (hitboxBotRight < minDist) minDist = hitboxBotRight; - return minDist <= 30f * NPC.scale; + return minDist <= 30f * NPC.scale && NPC.alpha <= 0; } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/NormalNPCs/BloodlettingServant.cs b/NPCs/NormalNPCs/BloodlettingServant.cs index 92d49c536e..522b8b7b69 100644 --- a/NPCs/NormalNPCs/BloodlettingServant.cs +++ b/NPCs/NormalNPCs/BloodlettingServant.cs @@ -4,8 +4,10 @@ using CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -15,9 +17,15 @@ namespace CalamityMod.NPCs.NormalNPCs { public override string Texture => $"Terraria/Images/NPC_{NPCID.WanderingEye}"; + private const float ChargeGateValue = 180f; + private const float ChargeTelegraphGateValue = 90f; + private const float ChargeDuration = 60f; + private const float ChargeDuration_Death = 50f; + public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[Type] = 4; + NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData); } @@ -52,25 +60,15 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { + Lighting.AddLight(NPC.Center, 0.8f, 0f, 0f); + NPC.TargetClosest(); Player target = Main.player[NPC.target]; - - Vector2 lookAt = target.Center - NPC.Center; - if (lookAt.X > 0f) - { - NPC.spriteDirection = 1; - NPC.rotation = (float)Math.Atan2(lookAt.Y, lookAt.X); - } - if (lookAt.X < 0f) - { - NPC.spriteDirection = -1; - NPC.rotation = (float)Math.Atan2(lookAt.Y, lookAt.X) + MathHelper.Pi; - } - - Lighting.AddLight(NPC.Center, 0.8f, 0f, 0f); + bool targetDead = target.dead; bool phase2 = NPC.life < NPC.lifeMax * 0.5; float enrageScale = 1f + NPC.ai[2]; + float enrageScaleMaxSpeedBonus = 2f * enrageScale; float maxSpeedX = (phase2 ? (CalamityWorld.death ? 10f : 8f) : (CalamityWorld.death ? 8f : 6f)) + enrageScaleMaxSpeedBonus; float maxSpeedY = (phase2 ? (CalamityWorld.death ? 8f : 6f) : (CalamityWorld.death ? 4f : 3f)) + enrageScaleMaxSpeedBonus; @@ -81,43 +79,140 @@ namespace CalamityMod.NPCs.NormalNPCs float yAccelBoost1 = maxSpeedY * 0.01f; float yAccelBoost2 = maxSpeedY * 0.0075f; - if (target.dead) + float chargeVelocity = 12f + enrageScaleMaxSpeedBonus * 2f; + bool attemptingToCharge = NPC.ai[0] >= ChargeGateValue; + bool farEnoughForCharge = NPC.Distance(target.Center) >= 320f; + bool closeEnoughForCharge = NPC.Distance(target.Center) < 480f; + bool charging = (attemptingToCharge && farEnoughForCharge && closeEnoughForCharge) || NPC.ai[1] > 0f; + + float projectileShootGateValue = CalamityWorld.death ? 180f : 270f; + if (Main.getGoodWorld) + projectileShootGateValue *= 0.5f; + + Vector2 lookAt = target.Center - NPC.Center; + float rateOfRotation = charging ? 0f : 0.1f; + float chargeDuration = CalamityWorld.death ? ChargeDuration_Death : ChargeDuration; + if (charging) + { + if (NPC.ai[1] == 0f) + { + SoundEngine.PlaySound(SoundID.NPCDeath9, NPC.Center); + NPC.velocity = lookAt.SafeNormalize(Vector2.UnitY) * chargeVelocity; + NPC.spriteDirection = lookAt.X < 0f ? -1 : 1; + NPC.rotation = NPC.velocity.ToRotation() + (lookAt.X < 0f ? MathHelper.Pi : 0f); + + NPC.ai[1] = 1f; + if (NPC.ai[3] > projectileShootGateValue * 0.5f) + NPC.ai[3] = projectileShootGateValue * 0.5f; + + NPC.netUpdate = true; + NPC.netSpam = 0; + } + + if (NPC.ai[1] < ChargeDuration + 1f) + { + NPC.ai[1] += 1f; + if (NPC.ai[1] > ChargeDuration + 1f - 10f) + NPC.velocity *= 0.8f; + + if (NPC.ai[1] >= ChargeDuration + 1f) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; + NPC.netSpam = 0; + } + } + } + else + { + if (lookAt.X > 0f) + { + NPC.spriteDirection = 1; + NPC.rotation = (float)Math.Atan2(lookAt.Y, lookAt.X); + } + if (lookAt.X < 0f) + { + NPC.spriteDirection = -1; + NPC.rotation = (float)Math.Atan2(lookAt.Y, lookAt.X) + MathHelper.Pi; + } + } + + if (phase2) + { + NPC.damage = (int)Math.Round(NPC.defDamage * 1.3); + + if (NPC.ai[0] < ChargeGateValue && !targetDead) + { + NPC.ai[0] += 1f; + if (NPC.ai[0] == ChargeGateValue) + { + NPC.netUpdate = true; + NPC.netSpam = 0; + } + } + } + else + NPC.damage = NPC.defDamage; + + if (targetDead) { NPC.velocity.Y -= 0.04f; if (NPC.timeLeft > 10) NPC.timeLeft = 10; } - else + else if (!attemptingToCharge) + { DemonEyeAI.DemonEyeBatMovement(NPC, maxSpeedX, maxSpeedY, xAccel, xAccelBoost1, xAccelBoost2, yAccel, yAccelBoost1, yAccelBoost2); - if (phase2) - NPC.damage = (int)Math.Round(NPC.defDamage * 1.3); - else - NPC.damage = NPC.defDamage; - - if (!target.dead) NPC.ai[3] += enrageScale; - - float projectileShootGateValue = CalamityWorld.death ? 180f : 270f; - if (Main.getGoodWorld) - projectileShootGateValue *= 0.5f; - - bool shootProjectile = Collision.CanHitLine(NPC.Center, 1, 1, target.Center, 1, 1) && Vector2.Distance(NPC.Center, target.Center) > 240f; - if (NPC.ai[3] >= projectileShootGateValue && shootProjectile) - { - NPC.ai[3] = 0f; - float projectileSpeed = CalamityWorld.death ? 16f : 12f; - Vector2 projectileVelocity = NPC.SafeDirectionTo(target.Center) * projectileSpeed; - if (Main.netMode != NetmodeID.MultiplayerClient) + bool shootProjectile = Collision.CanHitLine(NPC.Center, 1, 1, target.Center, 1, 1) && Vector2.Distance(NPC.Center, target.Center) > 240f; + if (NPC.ai[3] >= projectileShootGateValue && shootProjectile) { - int projType = ProjectileID.BloodShot; - int projDamage = NPC.GetProjectileDamage(projType); - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 10f, projectileVelocity, projType, projDamage, 0f, Main.myPlayer); - Main.projectile[proj].timeLeft = 600; + NPC.ai[3] = 0f; + float projectileSpeed = CalamityWorld.death ? 16f : 12f; + Vector2 projectileVelocity = NPC.SafeDirectionTo(target.Center) * projectileSpeed; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int projType = ProjectileID.BloodShot; + int projDamage = NPC.GetProjectileDamage(projType); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 10f, projectileVelocity, projType, projDamage, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = 600; + } + + NPC.netUpdate = true; + NPC.netSpam = 0; } - NPC.netUpdate = true; + float pushVelocity = 0.2f * enrageScale; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active) + { + if (i != NPC.whoAmI && Main.npc[i].type == NPC.type) + { + if (Vector2.Distance(NPC.Center, Main.npc[i].Center) < 48f * NPC.scale) + { + if (NPC.position.X < Main.npc[i].position.X) + NPC.velocity.X -= pushVelocity; + else + NPC.velocity.X += pushVelocity; + + if (NPC.position.Y < Main.npc[i].position.Y) + NPC.velocity.Y -= pushVelocity; + else + NPC.velocity.Y += pushVelocity; + } + } + } + } + } + else if (!charging) + { + Vector2 destination = target.Center + new Vector2(-280f * NPC.spriteDirection, -280f); + Vector2 desiredVelocity = NPC.SafeDirectionTo(destination, -Vector2.UnitY) * chargeVelocity; + NPC.SimpleFlyMovement(desiredVelocity, enrageScale); } if (Main.rand.NextBool(20)) @@ -127,29 +222,6 @@ namespace CalamityMod.NPCs.NormalNPCs blood.velocity.X *= 0.5f; blood.velocity.Y *= 0.1f; } - - float pushVelocity = 0.2f * enrageScale; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active) - { - if (i != NPC.whoAmI && Main.npc[i].type == NPC.type) - { - if (Vector2.Distance(NPC.Center, Main.npc[i].Center) < 48f * NPC.scale) - { - if (NPC.position.X < Main.npc[i].position.X) - NPC.velocity.X -= pushVelocity; - else - NPC.velocity.X += pushVelocity; - - if (NPC.position.Y < Main.npc[i].position.Y) - NPC.velocity.Y -= pushVelocity; - else - NPC.velocity.Y += pushVelocity; - } - } - } - } } public override void FindFrame(int frameHeight) @@ -169,6 +241,48 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.frame.Y += frameHeight * 2; } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + if (NPC.ai[0] >= ChargeTelegraphGateValue) + { + Texture2D npcTexture = TextureAssets.Npc[NPC.type].Value; + Color originalColor = NPC.GetAlpha(drawColor); + Color newColor = new Color(255, 128, 128, 255 - NPC.alpha); + Vector2 drawPosition = NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY); + Vector2 origin = NPC.frame.Size() / 2; + + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + float telegraphScalar = MathHelper.Clamp((NPC.ai[0] - ChargeTelegraphGateValue) / ChargeTelegraphGateValue, 0f, 1f); + Color telegraphColor = Color.Lerp(originalColor, newColor, telegraphScalar); + + if (CalamityConfig.Instance.Afterimages && NPC.ai[1] > 0f) + { + int afterimageAmount = 10; + int afterImageIncrement = 2; + for (int j = 0; j < afterimageAmount; j += afterImageIncrement) + { + Color afterimageColor = telegraphColor; + afterimageColor = Color.Lerp(afterimageColor, originalColor, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmount - j) / 15f; + Vector2 afterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2(npcTexture.Width, npcTexture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(npcTexture, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + } + } + + spriteBatch.Draw(npcTexture, drawPosition, NPC.frame, telegraphColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + + return false; + } + + return true; + } + public override Color? GetAlpha(Color drawColor) => new Color(128, 0, 0, 255 - NPC.alpha); public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/NormalNPCs/KingSlimeJewel.cs b/NPCs/NormalNPCs/KingSlimeJewel.cs index 1ed5bfcc29..a6edbdf1f8 100644 --- a/NPCs/NormalNPCs/KingSlimeJewel.cs +++ b/NPCs/NormalNPCs/KingSlimeJewel.cs @@ -181,6 +181,11 @@ namespace CalamityMod.NPCs.NormalNPCs return newColor; } + public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) + { + NPC.lifeMax = (int)(NPC.lifeMax * balance); + } + public override bool CheckActive() => false; public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/NormalNPCs/KingSlimeJewel2.cs b/NPCs/NormalNPCs/KingSlimeJewel2.cs index 058d0baf4d..d1df10f218 100644 --- a/NPCs/NormalNPCs/KingSlimeJewel2.cs +++ b/NPCs/NormalNPCs/KingSlimeJewel2.cs @@ -150,6 +150,11 @@ namespace CalamityMod.NPCs.NormalNPCs return newColor; } + public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) + { + NPC.lifeMax = (int)(NPC.lifeMax * balance); + } + public override bool CheckActive() => false; public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/NormalNPCs/KingSlimeJewel3.cs b/NPCs/NormalNPCs/KingSlimeJewel3.cs index 5f4f6eb15c..df9125952b 100644 --- a/NPCs/NormalNPCs/KingSlimeJewel3.cs +++ b/NPCs/NormalNPCs/KingSlimeJewel3.cs @@ -230,6 +230,11 @@ namespace CalamityMod.NPCs.NormalNPCs return newColor; } + public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) + { + NPC.lifeMax = (int)(NPC.lifeMax * balance); + } + public override bool CheckActive() => false; public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/NormalNPCs/PlanterasFreeTentacle.cs b/NPCs/NormalNPCs/PlanterasFreeTentacle.cs index b93dd4078f..0cbf988952 100644 --- a/NPCs/NormalNPCs/PlanterasFreeTentacle.cs +++ b/NPCs/NormalNPCs/PlanterasFreeTentacle.cs @@ -207,6 +207,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { + NPC.lifeMax = (int)(NPC.lifeMax * balance); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs index 5f4e5b99b6..e3c8676753 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs @@ -425,7 +425,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; int numProj = calamityGlobalNPC.newAI[0] % 60f == 0f ? (masterMode ? 9 : 7) : (masterMode ? 6 : 4); - int spread = masterMode ? 75 : 54; + int spread = masterMode ? 38 : 26; float rotation = MathHelper.ToRadians(spread); for (int i = 0; i < numProj; i++) { diff --git a/Projectiles/Boss/DesertScourgeDiveSplash.cs b/Projectiles/Boss/DesertScourgeDiveSplash.cs new file mode 100644 index 0000000000..39d9946a5f --- /dev/null +++ b/Projectiles/Boss/DesertScourgeDiveSplash.cs @@ -0,0 +1,50 @@ +using System; +using System.IO; +using CalamityMod.Dusts; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class DesertScourgeDiveSplash : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Boss"; + + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 14; + } + + public override void SetDefaults() + { + Projectile.width = 84; + Projectile.height = 84; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + } + + public override void AI() + { + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.Kill(); + } + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + return false; + } + } +} diff --git a/Projectiles/Boss/DesertScourgeDiveSplash.png b/Projectiles/Boss/DesertScourgeDiveSplash.png new file mode 100644 index 0000000000..cbb230d694 Binary files /dev/null and b/Projectiles/Boss/DesertScourgeDiveSplash.png differ diff --git a/Projectiles/Boss/DesertScourgeSpit.cs b/Projectiles/Boss/DesertScourgeSpit.cs index 7abf1b3053..a73e39caac 100644 --- a/Projectiles/Boss/DesertScourgeSpit.cs +++ b/Projectiles/Boss/DesertScourgeSpit.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame >= Main.projFrames[Projectile.type]) Projectile.frame = 0; - Projectile.tileCollide = Projectile.timeLeft < 540; + Projectile.tileCollide = Projectile.timeLeft < (Projectile.aiStyle == ProjAIStyleID.Arrow ? 540 : 300); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) diff --git a/Projectiles/DraedonsArsenal/PulseRifleShot.cs b/Projectiles/DraedonsArsenal/PulseRifleShot.cs index aabdd2c12e..1f7f997a7a 100644 --- a/Projectiles/DraedonsArsenal/PulseRifleShot.cs +++ b/Projectiles/DraedonsArsenal/PulseRifleShot.cs @@ -4,6 +4,7 @@ using System.Net.Sockets; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Particles; using CalamityMod.Projectiles.Ranged; +using Humanizer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -123,8 +124,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { distance = 3000; - SoundStyle fire = new("CalamityMod/Sounds/Item/OpalFire"); - SoundEngine.PlaySound(fire with { Volume = 0.35f, Pitch = 1f }, Projectile.Center); + SoundStyle fire = new("CalamityMod/Sounds/Item/PulseSound"); + SoundEngine.PlaySound(fire with { Volume = 0.35f, Pitch = 0.3f, MaxInstances = -1 }, Projectile.Center); Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, mainColor, new Vector2(1f, 1f), Main.rand.NextFloat(12f, 25f), 0f, 0.5f, 15); @@ -242,9 +243,10 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // These should do a large fraction of the beam's damage so they will easily kill even some decently bulky enemies regular enemies in one hit // This is so it can better proc its on kill effect int numProj = 4; + int projectileDamage = (int)(Projectile.damage * 0.5f); for (int i = 0; i < numProj; i++) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.Zero) * (14f - i * 0.7f)) * ((i + 1) * 0.25f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 1f + i); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.Zero) * (14f - i * 0.7f)) * ((i + 1) * 0.25f), ModContent.ProjectileType(), projectileDamage, Projectile.knockBack, Projectile.owner, 0f, 1f + i); } } // Split projectile on hit effects diff --git a/Projectiles/Magic/BigBeamofDeath.cs b/Projectiles/Magic/BigBeamofDeath.cs deleted file mode 100644 index f6c36830ee..0000000000 --- a/Projectiles/Magic/BigBeamofDeath.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BigBeamofDeath : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 12; - Projectile.height = 12; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.tileCollide = false; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 6; - Projectile.penetrate = -1; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 80; - } - - public override void OnKill(int timeLeft) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(20); - if (Projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - } - } - } - - public override void AI() - { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 9f) - { - Vector2 projPos = Projectile.position; - projPos -= Projectile.velocity * 0.25f; - int beamDust = Dust.NewDust(projPos, 1, 1, DustID.UnusedWhiteBluePurple, 0f, 0f, 0, default, 3f); - Main.dust[beamDust].position = projPos; - Main.dust[beamDust].velocity *= 0.1f; - } - } - } -} diff --git a/Projectiles/Magic/BigBeamofDeath2.cs b/Projectiles/Magic/BigBeamofDeath2.cs deleted file mode 100644 index c8d231ada7..0000000000 --- a/Projectiles/Magic/BigBeamofDeath2.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BigBeamofDeath2 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 12; - Projectile.height = 12; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.tileCollide = false; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 6; - Projectile.penetrate = -1; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 80; - } - - public override void AI() - { - Vector2 projPos = Projectile.position; - projPos -= Projectile.velocity * 0.25f; - int beamDust = Dust.NewDust(projPos, 1, 1, DustID.UnusedWhiteBluePurple, 0f, 0f, 0, default, 3f); - Main.dust[beamDust].position = projPos; - Main.dust[beamDust].velocity *= 0.1f; - } - } -} diff --git a/Projectiles/Magic/GenesisBeam.cs b/Projectiles/Magic/GenesisBeam.cs new file mode 100644 index 0000000000..d18c26c832 --- /dev/null +++ b/Projectiles/Magic/GenesisBeam.cs @@ -0,0 +1,117 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class GenesisBeam : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + + public Color mainColor = Color.MediumSlateBlue; + public override void SetDefaults() + { + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 31; + Projectile.penetrate = -1; + Projectile.extraUpdates = 75; + Projectile.timeLeft = 20; + } + public override void AI() + { + if (time == 0) + { + if (Projectile.ai[1] == 0) + Projectile.penetrate = 1; + else + Projectile.timeLeft = 50; + } + + if (Projectile.timeLeft % 2 == 0 && (Projectile.ai[1] == 1 && time > 2 || (Projectile.ai[1] == 0 && time > 3 && Projectile.timeLeft > 2))) + { + Particle spark = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 17, 0.06f, mainColor, new Vector2(0.5f, 1.3f)); + GeneralParticleHandler.SpawnParticle(spark); + } + + Vector2 dustVel = new Vector2(2, 2).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.8f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel, Main.rand.NextBool(4) ? 264 : 66, dustVel, 0, default, Main.rand.NextFloat(0.9f, 1.2f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor; + + time++; + } + public override void OnKill(int timeLeft) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(20); + if (Projectile.ai[1] == 0) + { + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 1f); + for (int k = 0; k < 3; k++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.5f, 0.4f, 35); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.4f, 0.3f, 35); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + } + + for (int i = 0; i < 20; i++) + { + Vector2 dustVel = new Vector2(13, 13).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.8f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel, Main.rand.NextBool(4) ? 264 : 66, dustVel, 0, default, Main.rand.NextFloat(0.9f, 1.2f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor; + } + } + else + { + for (int i = 0; i < 18; i++) + { + Vector2 dustVel = Projectile.velocity * Main.rand.NextFloat(0.1f, 1.5f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel + Main.rand.NextVector2Circular(6, 6), Main.rand.NextBool(4) ? 264 : 66, dustVel, 0, default, Main.rand.NextFloat(0.9f, 1.2f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor; + } + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.ai[1] == 0) // This is the sweet spot + { + modifiers.SourceDamage *= 1.5f; + + int points = 10; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + float rotRando = Main.rand.NextFloat(0.1f, 2.5f); + for (int k = 0; k < points; k++) + { + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f * rotRando); + Particle subTrail = new GlowSparkParticle(Projectile.Center + velocity * 10.5f, velocity * 5, false, 10, 0.045f, mainColor, new Vector2(2, 0.4f), true); + GeneralParticleHandler.SpawnParticle(subTrail); + } + + SoundStyle fire = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeImpact"); + SoundEngine.PlaySound(fire with { Volume = 1.25f, Pitch = 0.4f, PitchVariance = 0.15f }, Projectile.Center); + } + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.95f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + } +} diff --git a/Projectiles/Magic/GenesisHoldout.cs b/Projectiles/Magic/GenesisHoldout.cs new file mode 100644 index 0000000000..5f25eaeac0 --- /dev/null +++ b/Projectiles/Magic/GenesisHoldout.cs @@ -0,0 +1,160 @@ +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class GenesisHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override Vector2 GunTipPosition => base.GunTipPosition - Vector2.UnitY.RotatedBy(Projectile.rotation) * 2.5f * Projectile.spriteDirection; + public override float MaxOffsetLengthFromArm => 10f; + public override float OffsetXUpwards => -5f; + public override float BaseOffsetY => -5f; + public override float OffsetYDownwards => 5f; + + public Color StaticEffectsColor = Color.MediumSlateBlue; + + public float FiringTime = 15; + public float Windup = 60; + public bool WindingUp = false; + public int time = 0; + public bool fireYBeam = false; + public int maxFirerateShots = 0; + + private ref float ShootingTimer => ref Projectile.ai[0]; + + public override void KillHoldoutLogic() + { + if (HeldItem.type != Owner.ActiveItem().type || Owner is null || !Owner.active || Owner.CCed || Owner.dead || Owner.noItems) + { + Projectile.Kill(); + Projectile.netUpdate = true; + } + } + + public override void HoldoutAI() + { + Item heldItem = Owner.ActiveItem(); + // Fire if the owner stops channeling or otherwise cannot use the weapon. + if (Owner.CantUseHoldout()) + { + Projectile.Kill(); + } + else if (ShootingTimer >= FiringTime) + { + if (Owner.CheckMana(Owner.ActiveItem(), -1, true, false)) + { + maxFirerateShots++; + + if (maxFirerateShots == 6) + { + fireYBeam = true; + Windup = 60; + } + + if (fireYBeam) + { + Shoot(heldItem, true); + maxFirerateShots = 0; + } + else + Shoot(heldItem, false); + + ShootingTimer = 0; + + if (Windup > 10) + { + if (!fireYBeam) + Windup -= 12; + } + else + { + Windup = 10; + } + + fireYBeam = false; + } + else + { + SoundEngine.PlaySound(SoundID.MaxMana with { Pitch = -0.5f }, Projectile.Center); + Projectile.Kill(); + } + + } + ShootingTimer++; + } + private void Shoot(Item item, bool yBeam) + { + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); + + // Spawns the projectile. + + Vector2 firingVelocity1 = (shootDirection * 8).RotatedBy(0.1f * Utils.GetLerpValue(10, 55, Windup, true)); + Vector2 firingVelocity2 = (shootDirection * 8).RotatedBy(-0.1f * Utils.GetLerpValue(10, 55, Windup, true)); + Vector2 firingVelocity3 = (shootDirection * 10); + + if (yBeam) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/LanceofDestinyStrong"); + SoundEngine.PlaySound(fire with { Volume = 0.35f, Pitch = 1f, PitchVariance = 0.15f }, Projectile.Center); + + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, firingVelocity3, ModContent.ProjectileType(), Projectile.damage * 9, Projectile.knockBack, Projectile.owner, 0, 0); + + Particle pulse3 = new GlowSparkParticle(GunTipPosition, shootDirection * 18, false, 6, 0.057f, StaticEffectsColor, new Vector2(1.7f, 0.8f), true); + GeneralParticleHandler.SpawnParticle(pulse3); + for (int i = 0; i < 8; i++) + { + SparkParticle spark2 = new SparkParticle(GunTipPosition + Main.rand.NextVector2Circular(10, 10), firingVelocity3 * Main.rand.NextFloat(0.7f, 1.3f), false, Main.rand.Next(20, 30), Main.rand.NextFloat(0.4f, 0.55f), StaticEffectsColor); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + else + { + SoundStyle fire = new("CalamityMod/Sounds/Item/MagnaCannonShot"); + SoundEngine.PlaySound(fire with { Volume = 0.25f, Pitch = 1f, PitchVariance = 0.35f }, Projectile.Center); + + for (int i = 0; i < 4; i++) + { + firingVelocity3 = (shootDirection * 10).RotatedBy((0.05f * (i + 1)) * Utils.GetLerpValue(0, 55, Windup, true)); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, firingVelocity3 * (1 - i * 0.1f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 1); + } + for (int i = 0; i < 4; i++) + { + firingVelocity3 = (shootDirection * 10).RotatedBy((-0.05f * (i + 1)) * Utils.GetLerpValue(0, 55, Windup, true)); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, firingVelocity3 * (1 - i * 0.1f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 1); + } + + Particle pulse3 = new GlowSparkParticle(GunTipPosition, shootDirection * 18, false, 6, 0.057f, StaticEffectsColor, new Vector2(1.7f, 0.8f), true); + GeneralParticleHandler.SpawnParticle(pulse3); + } + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + for (int k = 0; k < 10; k++) + { + Vector2 shootVel = (shootDirection * 15).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 1.8f); + + Dust dust2 = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(4) ? 267 : 66, shootVel); + dust2.scale = Main.rand.NextFloat(1.15f, 1.45f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Lerp(StaticEffectsColor, Color.White, 0.5f) : StaticEffectsColor; + } + + // By decreasing the offset length of the gun from the arms, we give an effect of recoil. + if (yBeam) + OffsetLengthFromArm -= 27f; + else + OffsetLengthFromArm -= 5f; + } + } +} diff --git a/Projectiles/Magic/OmicronBeam.cs b/Projectiles/Magic/OmicronBeam.cs new file mode 100644 index 0000000000..ab72615ff1 --- /dev/null +++ b/Projectiles/Magic/OmicronBeam.cs @@ -0,0 +1,140 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class OmicronBeam : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + + public Color mainColor = Color.MediumVioletRed; + public bool HitDirect = false; + public override void SetDefaults() + { + Projectile.width = 50; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 75; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 91; + } + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (Projectile.timeLeft % 2 == 0 && time > 2 && targetDist < 1400f) + { + Particle spark = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 25, MathHelper.Clamp(0.34f - time * 0.07f, 0.085f, 0.34f), mainColor, new Vector2(0.5f, 1.3f)); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Main.rand.NextBool()) + { + Vector2 trailPos = Projectile.Center; + float trailScale = Main.rand.NextFloat(1.9f, 2.3f); + Particle Trail = new SparkParticle(trailPos, Projectile.velocity * Main.rand.NextFloat(0.2f, 0.9f), false, Main.rand.Next(40, 50 + 1), trailScale, mainColor); + GeneralParticleHandler.SpawnParticle(Trail); + } + Vector2 dustVel = new Vector2(2, 2).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.8f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel, Main.rand.NextBool(4) ? 264 : 66, dustVel, 0, default, Main.rand.NextFloat(0.9f, 1.2f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor; + + time++; + } + public override void OnKill(int timeLeft) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(10); + if (Projectile.ai[1] == 0 && time < 250 && !HitDirect) + { + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 1f); + for (int k = 0; k < 3; k++) + { + Particle blastRing = new CustomPulse(Projectile.Center + Projectile.velocity * 2, Vector2.Zero, mainColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.8f, 0.4f, 35); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center + Projectile.velocity * 2, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.7f, 0.3f, 35); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + } + + for (int i = 0; i <= 6; i++) + { + Particle energy = new GlowSparkParticle(Projectile.Center, (Projectile.velocity * 15).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 0.4f), false, 10, Main.rand.NextFloat(0.02f, 0.04f), mainColor, new Vector2(2, 0.7f), true); + GeneralParticleHandler.SpawnParticle(energy); + } + for (int i = 0; i <= 9; i++) + { + Particle energy = new SparkParticle(Projectile.Center, (Projectile.velocity * 5).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 0.4f), false, 25, Main.rand.NextFloat(0.7f, 0.9f), mainColor); + GeneralParticleHandler.SpawnParticle(energy); + } + } + for (int i = 0; i < 28; i++) + { + Vector2 dustVel = Projectile.velocity * Main.rand.NextFloat(0.1f, 1.5f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel + Main.rand.NextVector2Circular(6, 6), Main.rand.NextBool(4) ? 264 : 66, dustVel, 0, default, Main.rand.NextFloat(0.9f, 1.2f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor; + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.ai[1] == 0 && time > 7 && !HitDirect) + Projectile.Kill(); + + Player Owner = Main.player[Projectile.owner]; + for (int i = 0; i <= 8; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(4) ? 264 : 66, (Projectile.velocity.SafeNormalize(Vector2.UnitY) * 15f).RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(1.2f, 1.6f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor; + } + if (time <= 7 && Projectile.ai[1] == 0) // This is the sweet spot + { + modifiers.SourceDamage *= 5; + + if (!HitDirect) + { + Owner.velocity += -Projectile.velocity; + for (int i = 0; i <= 9; i++) + { + Particle energy = new GlowSparkParticle(Projectile.Center, (Projectile.velocity * 15).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 0.4f), false, 11, Main.rand.NextFloat(0.05f, 0.07f), mainColor, new Vector2(2, 0.5f), true); + GeneralParticleHandler.SpawnParticle(energy); + } + for (int i = 0; i <= 13; i++) + { + Particle energy = new SparkParticle(Projectile.Center, (Projectile.velocity * 10).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 0.4f), false, 25, Main.rand.NextFloat(0.7f, 0.9f), mainColor); + GeneralParticleHandler.SpawnParticle(energy); + } + for (int k = 0; k < 20; k++) + { + Vector2 shootVel = (Projectile.velocity * 20).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 1.8f); + + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(4) ? 267 : 66, shootVel); + dust2.scale = Main.rand.NextFloat(1.15f, 1.45f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor; + } + + SoundStyle fire = new("CalamityMod/Sounds/Custom/ExoMechs/ArtemisApolloDash"); + SoundEngine.PlaySound(fire with { Volume = 1.25f, Pitch = 0.6f }, Projectile.Center); + } + + HitDirect = true; + } + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, time <= 7 ? 90 : 20, targetHitbox); + } +} diff --git a/Projectiles/Magic/OmicronHoldout.cs b/Projectiles/Magic/OmicronHoldout.cs new file mode 100644 index 0000000000..98e9b76c57 --- /dev/null +++ b/Projectiles/Magic/OmicronHoldout.cs @@ -0,0 +1,199 @@ +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class OmicronHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override Vector2 GunTipPosition => base.GunTipPosition - Vector2.UnitY.RotatedBy(Projectile.rotation) * 4f * Projectile.spriteDirection; + public override float MaxOffsetLengthFromArm => 10f; + public override float OffsetXUpwards => -5f; + public override float BaseOffsetY => -5f; + public override float OffsetYDownwards => 5f; + + public Color StaticEffectsColor = Color.MediumVioletRed; + + public float FiringTime = 15; + public float Windup = 60; + public bool WindingUp = false; + public int time = 0; + public int PostFireCooldown = 0; + public bool fireYBeam = false; + public int maxFirerateShots = 0; + + private ref float ShootingTimer => ref Projectile.ai[0]; + + public override void KillHoldoutLogic() + { + if (HeldItem.type != Owner.ActiveItem().type || Owner is null || !Owner.active || Owner.CCed || Owner.dead || Owner.noItems) + { + if (PostFireCooldown <= 0) + Projectile.Kill(); + Projectile.netUpdate = true; + } + } + + public override void HoldoutAI() + { + Item heldItem = Owner.ActiveItem(); + + // Fire if the owner stops channeling or otherwise cannot use the weapon. + if (Owner.CantUseHoldout() || heldItem.type != ModContent.ItemType()) + { + if (PostFireCooldown <= 0) + Projectile.Kill(); + } + + if (PostFireCooldown > 0) + { + PostFiringCooldown(); + } + + if (Owner.Calamity().mouseRight && PostFireCooldown <= 0) + { + if (Owner.CheckMana(Owner.ActiveItem(), (int)(heldItem.mana * Owner.manaCost) * 16, true, false)) + { + PostFireCooldown = 100; + Shoot(heldItem, true); + ShootingTimer = 0; + } + else + { + if (Projectile.soundDelay <= 0) + { + SoundEngine.PlaySound(SoundID.MaxMana with { Pitch = -0.5f }, Projectile.Center); + Projectile.soundDelay = 50; + ShootingTimer = 0; + } + } + } + else if (ShootingTimer >= FiringTime) + { + if (Owner.CheckMana(Owner.ActiveItem(), -1, true, false) && PostFireCooldown <= 0) + { + maxFirerateShots++; + + if (maxFirerateShots == 5) + { + Windup = 60; + maxFirerateShots = 0; + } + + Shoot(heldItem, false); + + ShootingTimer = 0; + + if (Windup > 10) + { + if (maxFirerateShots > 0) + Windup -= 12; + } + else + { + Windup = 10; + } + } + else if (PostFireCooldown <= 0) + { + SoundEngine.PlaySound(SoundID.MaxMana with { Pitch = -0.5f }, Projectile.Center); + Projectile.Kill(); + } + + } + ShootingTimer++; + } + private void Shoot(Item item, bool yBeam) + { + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); + + // Spawns the projectile. + + Vector2 firingVelocity1 = (shootDirection * 8).RotatedBy(0.1f * Utils.GetLerpValue(10, 55, Windup, true)); + Vector2 firingVelocity2 = (shootDirection * 8).RotatedBy(-0.1f * Utils.GetLerpValue(10, 55, Windup, true)); + Vector2 firingVelocity3 = (shootDirection * 10); + + if (yBeam) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/OmicronBeam"); + SoundEngine.PlaySound(fire with { Volume = 0.9f }, Projectile.Center); + + for (int k = 0; k < 6; k++) + { + Particle pulse2 = new GlowSparkParticle(GunTipPosition, shootDirection * 28, false, 8, 0.087f, StaticEffectsColor, new Vector2(2.3f, 0.9f), true); + GeneralParticleHandler.SpawnParticle(pulse2); + } + + Owner.Calamity().GeneralScreenShakePower = 6.5f; + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, firingVelocity3, ModContent.ProjectileType(), Projectile.damage * 32, Projectile.knockBack, Projectile.owner, 0, 0); + + for (int i = 0; i < 8; i++) + { + SparkParticle spark2 = new SparkParticle(GunTipPosition + Main.rand.NextVector2Circular(10, 10), firingVelocity3 * Main.rand.NextFloat(0.7f, 1.3f), false, Main.rand.Next(20, 30), Main.rand.NextFloat(0.4f, 0.55f), StaticEffectsColor); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + else + { + SoundStyle fire = new("CalamityMod/Sounds/Item/ArcNovaDiffuserBigShot"); + SoundEngine.PlaySound(fire with { Volume = 0.2f, Pitch = 0.9f }, Projectile.Center); + + for (int i = 0; i < 5; i++) + { + firingVelocity3 = (shootDirection * 10).RotatedBy((0.04f * (i + 1)) * Utils.GetLerpValue(0, 55, Windup, true)); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, firingVelocity3 * (1 - i * 0.1f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 2); + } + for (int i = 0; i < 5; i++) + { + firingVelocity3 = (shootDirection * 10).RotatedBy((-0.04f * (i + 1)) * Utils.GetLerpValue(0, 55, Windup, true)); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, firingVelocity3 * (1 - i * 0.1f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 2); + } + + Particle pulse3 = new GlowSparkParticle(GunTipPosition, shootDirection * 18, false, 6, 0.057f, StaticEffectsColor, new Vector2(1.7f, 0.8f), true); + GeneralParticleHandler.SpawnParticle(pulse3); + } + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + for (int k = 0; k < 10; k++) + { + Vector2 shootVel = (shootDirection * 15).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 1.8f); + + Dust dust2 = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(4) ? 267 : 66, shootVel); + dust2.scale = Main.rand.NextFloat(1.15f, 1.45f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Lerp(StaticEffectsColor, Color.White, 0.5f) : StaticEffectsColor; + } + + // By decreasing the offset length of the gun from the arms, we give an effect of recoil. + if (yBeam) + OffsetLengthFromArm -= 32f; + else + OffsetLengthFromArm -= 6f; + } + private void PostFiringCooldown() + { + if (PostFireCooldown > 0 && Main.rand.NextBool()) + { + Vector2 smokeVel = new Vector2(0, -8) * Main.rand.NextFloat(0.1f, 1.1f); + Particle smoke = new HeavySmokeParticle(GunTipPosition, smokeVel, StaticEffectsColor, Main.rand.Next(30, 50 + 1), Main.rand.NextFloat(0.1f, 0.4f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + + Dust dust = Dust.NewDustPerfect(GunTipPosition, 303, smokeVel.RotatedByRandom(0.1f), 80, default, Main.rand.NextFloat(0.2f, 0.8f)); + dust.noGravity = false; + dust.color = StaticEffectsColor; + } + ShootingTimer = 0; + PostFireCooldown--; + } + } +} diff --git a/Projectiles/Magic/OmicronWingman.cs b/Projectiles/Magic/OmicronWingman.cs new file mode 100644 index 0000000000..350e8007ce --- /dev/null +++ b/Projectiles/Magic/OmicronWingman.cs @@ -0,0 +1,298 @@ +using System; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using Humanizer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Graphics.Renderers; + +namespace CalamityMod.Projectiles.Magic +{ + public class OmicronWingman : ModProjectile + { + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Magic/Wingman"; + + public Color StaticEffectsColor = Color.MediumVioletRed; + private ref float ShootingTimer => ref Projectile.ai[0]; + private float FiringTime = 10; + private float PostFireCooldown = 0; + private Vector2 MovementOffset; + public bool MovingUp = true; + public float xOffset = 1; + public float yOffset = 0; + public int time = 0; + public int firingDelay = 15; + public int launchDelay = 0; + + private ref float OffsetLength => ref Projectile.localAI[0]; + + private Player Owner; + + private float MaxOffsetLength = 5f; + + public bool recharging = false; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 142; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.netImportant = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 9; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + Projectile.hide = true; + } + + public override void AI() + { + if (time > 1 && Owner.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && PostFireCooldown <= 0) + Projectile.Kill(); + Lighting.AddLight(Projectile.Center, StaticEffectsColor.ToVector3() * 0.2f); + if (time == 0) + { + MovingUp = Projectile.ai[2] == 1 ? true : false; + } + firingDelay--; + Item heldItem = Owner.ActiveItem(); + + // Update damage based on curent magic damage stat (so Mana Sickness affects it) + Projectile.damage = heldItem is null ? 0 : Owner.GetWeaponDamage(heldItem); + + Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(-0.05f * Projectile.direction) * 12f; + // If there's no player, or the player is the server, or the owner's stunned, there'll be no holdout. + if (PostFireCooldown == 0 && launchDelay == 0 && Owner.CantUseHoldout() || heldItem.type != ModContent.ItemType()) + { + NetUpdate(); + if (PostFireCooldown <= 0) + Projectile.Kill(); + } + + if (PostFireCooldown > 0) + { + PostFiringCooldown(); + } + + if (launchDelay > 0 || (PostFireCooldown <= 0 && (Owner.Calamity().mouseRight || (firingDelay <= 0 && Projectile.ai[2] == 1 || Projectile.ai[2] == -1)))) + { + // If the player's pressing RMB, it'll shoot the grenade. + if (launchDelay > 0 || Owner.Calamity().mouseRight) + { + if (launchDelay < 50) + launchDelay++; + + if (launchDelay >= 50 && (Owner.CheckMana(Owner.ActiveItem(), (int)(heldItem.mana * Owner.manaCost) * 2, true, false))) + { + Shoot(heldItem, true); + PostFireCooldown = 50; + ShootingTimer = 0; + launchDelay = 0; + } + } + else if (ShootingTimer >= FiringTime) + { + if (Owner.CheckMana(Owner.ActiveItem(), -1, false, false)) + { + Shoot(heldItem, false); + ShootingTimer = 0; + } + else if (PostFireCooldown <= 0) + { + Projectile.Kill(); + } + } + } + + // The center of the player, taking into account if they have a mount or not. + Vector2 ownerPosition = Owner.MountedCenter; + + // The vector between the player and the mouse. + Vector2 ownerToMouse = Owner.Calamity().mouseWorld - ownerPosition; + + // Deals with the holdout's rotation and direction, the owner's arms, etc. + ManageHoldout(ownerPosition, ownerToMouse); + + // When we change the distance of the gun from the arms for the recoil, + // recover to the original position smoothly. + if (OffsetLength != MaxOffsetLength) + OffsetLength = MathHelper.Lerp(OffsetLength, MaxOffsetLength, 0.1f); + + ShootingTimer++; + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero) * 20; + time++; + Projectile.soundDelay--; + } + + private void ManageHoldout(Vector2 mountedCenter, Vector2 ownerToMouse) + { + Vector2 rotationVector = Projectile.rotation.ToRotationVector2(); + float velocityRotation = Projectile.velocity.ToRotation(); + float proximityLookingUpwards = Vector2.Dot(ownerToMouse.SafeNormalize(Vector2.Zero), -Vector2.UnitY); + int direction = MathF.Sign(ownerToMouse.X); + + Vector2 armPosition = Owner.RotatedRelativePoint(mountedCenter, true); + Vector2 lengthOffset = rotationVector * OffsetLength; + Vector2 armOffset = new Vector2(Utils.Remap(proximityLookingUpwards, -1f, 1f, 0f, -12f) * direction, -10f + Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? 15f : 0f)); + + if (time % 30 == 0) + { + MovingUp = !MovingUp; + } + + //xOffset = MathHelper.Lerp(xOffset, placementOffset.X, 0.01f); + yOffset = MathHelper.Lerp(yOffset, 150 * (MovingUp ? -1 : 1), (0.085f - (FiringTime * 0.0012f))); + + Vector2 placementOffset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * (yOffset); + + Vector2 location = Owner.MountedCenter + placementOffset; + Projectile.Center = lengthOffset + location; + + + Projectile.velocity = velocityRotation.AngleTowards(ownerToMouse.ToRotation(), 0.2f).ToRotationVector2(); + Projectile.rotation = (Main.MouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX).ToRotation(); + Projectile.timeLeft = 2; + + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = Owner.itemAnimation = 2; + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); + + Projectile.spriteDirection = Projectile.direction = direction; + } + + private void Shoot(Item item, bool isGrenade) + { + Vector2 shootDirection = (Main.MouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX); + + // The position of the tip of the gun. + Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(-0.05f * Projectile.direction) * 12f; + + // Spawns the projectile. + + Vector2 firingVelocity = shootDirection * 10; + if (isGrenade) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/DeadSunExplosion"); + SoundEngine.PlaySound(fire with { Volume = 0.2f, Pitch = -0.4f, PitchVariance = 0.2f }, Projectile.Center); + Projectile bomb = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, firingVelocity, ModContent.ProjectileType(), Projectile.damage * 20, Projectile.knockBack * 5, Projectile.owner, 0, 2); + bomb.timeLeft = 530; + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, firingVelocity * 1.2f, ModContent.ProjectileType(), Projectile.damage * 20, Projectile.knockBack * 5, Projectile.owner, 0, 2); + } + else + { + SoundStyle fire = new("CalamityMod/Sounds/Item/MagnaCannonShot"); + SoundEngine.PlaySound(fire with { Volume = 0.25f, Pitch = 1f, PitchVariance = 0.35f }, Projectile.Center); + + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, firingVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 2); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, firingVelocity.RotatedBy(-0.05) * 0.85f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 2); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, firingVelocity.RotatedBy(0.05) * 0.85f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 2); + } + + NetUpdate(); + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + for (int k = 0; k < 6; k++) + { + Vector2 shootVel = (shootDirection * 10).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 1.8f); + + Dust dust2 = Dust.NewDustPerfect(tipPosition, Main.rand.NextBool(4) ? 264 : 66, shootVel); + dust2.scale = Main.rand.NextFloat(1.15f, 1.45f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Lerp(StaticEffectsColor, Color.White, 0.5f) : StaticEffectsColor; + } + Particle pulse = new GlowSparkParticle((tipPosition - shootDirection * 14), shootDirection * 20, false, Main.rand.Next(7, 11 + 1), 0.035f, StaticEffectsColor, new Vector2(1.5f, 0.9f), true); + GeneralParticleHandler.SpawnParticle(pulse); + + // By decreasing the offset length of the gun from the arms, we give an effect of recoil. + if (isGrenade) + OffsetLength -= 27f; + else + OffsetLength -= 5f; + } + private void PostFiringCooldown() + { + Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(-0.05f * Projectile.direction) * 12f; + + if (PostFireCooldown > 0 && Main.rand.NextBool()) + { + Vector2 smokeVel = new Vector2(0, -8) * Main.rand.NextFloat(0.1f, 1.1f); + Particle smoke = new HeavySmokeParticle(tipPosition, smokeVel, StaticEffectsColor, Main.rand.Next(30, 50 + 1), Main.rand.NextFloat(0.1f, 0.4f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + + Dust dust = Dust.NewDustPerfect(tipPosition, 303, smokeVel.RotatedByRandom(0.1f), 80, default, Main.rand.NextFloat(0.2f, 0.8f)); + dust.noGravity = false; + dust.color = StaticEffectsColor; + } + ShootingTimer = 0; + firingDelay = 15; + PostFireCooldown--; + } + + private void NetUpdate() + { + Projectile.netUpdate = true; + if (Projectile.netSpam >= 10) + Projectile.netSpam = 9; + } + + public override void OnSpawn(IEntitySource source) + { + Owner = Main.player[Projectile.owner]; + OffsetLength = MaxOffsetLength; + } + + // Because we use the velocity as a direction, we don't need it to change its position. + public override bool ShouldUpdatePosition() => false; + + public override bool? CanDamage() => false; + + public override bool PreDraw(ref Color lightColor) + { + if (time <= 0) + return false; + + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Magic/Wingman").Value; + + if (Projectile.ai[2] == 1) + texture = ModContent.Request("CalamityMod/Projectiles/Magic/OmicronWingman").Value; + else + texture = ModContent.Request("CalamityMod/Projectiles/Magic/OmicronWingmanAlt").Value; + + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + if (Projectile.spriteDirection == -1 ? MovingUp : !MovingUp) + flipSprite |= SpriteEffects.FlipVertically; + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Lerp(StaticEffectsColor, Color.White, 0.5f) * 0.2f, 1, texture); + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); + + return false; + } + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + behindNPCs.Add(index); + } + } +} diff --git a/Projectiles/Magic/OmicronWingman.png b/Projectiles/Magic/OmicronWingman.png new file mode 100644 index 0000000000..d1aa882f83 Binary files /dev/null and b/Projectiles/Magic/OmicronWingman.png differ diff --git a/Projectiles/Magic/OmicronWingmanAlt.png b/Projectiles/Magic/OmicronWingmanAlt.png new file mode 100644 index 0000000000..5fc22bc984 Binary files /dev/null and b/Projectiles/Magic/OmicronWingmanAlt.png differ diff --git a/Projectiles/Magic/ParticleBeamofDoom.cs b/Projectiles/Magic/ParticleBeamofDoom.cs deleted file mode 100644 index d59301c19e..0000000000 --- a/Projectiles/Magic/ParticleBeamofDoom.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ParticleBeamofDoom : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 6; - Projectile.height = 6; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 100; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 30; - } - - public override void AI() - { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 9f) - { - Vector2 projPos = Projectile.position; - projPos -= Projectile.velocity * 0.25f; - int particleDust = Dust.NewDust(projPos, 1, 1, DustID.UnusedWhiteBluePurple, 0f, 0f, 0, default, 2.5f); - Main.dust[particleDust].position = projPos; - Main.dust[particleDust].velocity *= 0.1f; - } - } - } -} diff --git a/Projectiles/Magic/WingmanGrenade.cs b/Projectiles/Magic/WingmanGrenade.cs new file mode 100644 index 0000000000..c3c40281ad --- /dev/null +++ b/Projectiles/Magic/WingmanGrenade.cs @@ -0,0 +1,147 @@ +using CalamityMod.Particles; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class WingmanGrenade : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int BounceHits = 0; + public Color mainColor = Color.White; + public bool exploding = false; + public float sizeBonus = 1; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 14; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 20; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 480; + Projectile.DamageType = DamageClass.Magic; + Projectile.extraUpdates = 4; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + if (mainColor == Color.White) + { + Projectile.scale = 0.4f; + if (Projectile.ai[1] == 0) + mainColor = Color.HotPink; + + if (Projectile.ai[1] == 2) + { + mainColor = Color.MediumVioletRed; + Projectile.scale = 0.5f; + sizeBonus = 1.5f; + } + } + + if (Projectile.timeLeft % 2 == 0) + Projectile.scale = Main.rand.NextFloat(0.35f, 0.5f); + + if (Projectile.timeLeft <= 65) + exploding = true; + + if (exploding) + { + Projectile.velocity = Vector2.Zero; + if (Projectile.timeLeft > 65) + Projectile.timeLeft = 65; + if (Projectile.timeLeft == 65) + { + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor, "CalamityMod/Particles/HighResHollowCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.12f * sizeBonus, 15); + GeneralParticleHandler.SpawnParticle(blastRing2); + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(mainColor, Color.White, 0.5f), "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 3f * sizeBonus, 0f, 25); + GeneralParticleHandler.SpawnParticle(blastRing); + SoundStyle fire = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeImpact"); + SoundEngine.PlaySound(fire with { Volume = 1.25f, Pitch = -0.2f, PitchVariance = 0.15f }, Projectile.Center); + } + if (Projectile.timeLeft == 65) + { + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor, "CalamityMod/Particles/HighResHollowCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10, 10), 0.12f * sizeBonus, 0.135f * sizeBonus, 50); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + + if (Projectile.timeLeft % 4 == 0) + { + Particle blastRing2 = new CustomPulse(Projectile.Center + new Vector2(95, 95).RotatedByRandom(100) * sizeBonus * Main.rand.NextFloat(0.7f, 1.1f), Vector2.Zero, mainColor, "CalamityMod/Particles/HighResHollowCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, Main.rand.NextFloat(0.04f, 0.07f) * sizeBonus, 13); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + } + Lighting.AddLight(Projectile.Center, mainColor.ToVector3() * 0.7f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + Projectile.velocity *= 0.988f; + if (Projectile.timeLeft % 2 == 0) + { + if (!exploding && Main.rand.NextBool() || exploding) + { + Vector2 dustVel = new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.8f) * (exploding ? sizeBonus : 1); + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel * (exploding ? 5 : 1), Main.rand.NextBool(4) ? 264 : 66, dustVel * (exploding ? 5 : 1), 0, default, Main.rand.NextFloat(0.9f, 1.2f) * (exploding ? 1.5f : 1)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor; + } + } + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request("CalamityMod/Particles/Light").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation; + Vector2 rotationPoint = texture.Size() * 0.5f; + + if (!exploding) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Lerp(mainColor, Color.White, 0.5f) * 0.6f, 1); + Main.EntitySpriteDraw(texture, drawPosition, null, mainColor with { A = 0 }, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(texture, drawPosition, null, Color.White with { A = 0 }, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + + } + return false; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (!exploding) + { + exploding = true; + } + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.95f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 5; i++) + { + //Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(4) ? 264 : 66, (Projectile.velocity.SafeNormalize(Vector2.UnitY) * 15f).RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(1.2f, 1.6f)); + //dust.noGravity = true; + //dust.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor; + } + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.tileCollide = false; + exploding = true; + return false; + } + public override bool? CanDamage() => null; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, exploding ? 120 * sizeBonus : 20 * sizeBonus, targetHitbox); + } +} diff --git a/Projectiles/Magic/WingmanHoldout.cs b/Projectiles/Magic/WingmanHoldout.cs new file mode 100644 index 0000000000..82cbf1761d --- /dev/null +++ b/Projectiles/Magic/WingmanHoldout.cs @@ -0,0 +1,316 @@ +using System; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using Humanizer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Graphics.Renderers; + +namespace CalamityMod.Projectiles.Magic +{ + public class WingmanHoldout : ModProjectile + { + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Magic/Wingman"; + + public Color StaticEffectsColor = Color.HotPink; + private ref float ShootingTimer => ref Projectile.ai[0]; + private float FiringTime = 40; + private float PostFireCooldown = 0; + private Vector2 MovementOffset; + public bool MovingUp = true; + public float xOffset = 1; + public float yOffset = 0; + public int time = 0; + public int firingDelay = 45; + + private ref float OffsetLength => ref Projectile.localAI[0]; + + private Player Owner; + + private float MaxOffsetLength = 5f; + + public bool recharging = false; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 142; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.netImportant = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 9; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + Projectile.hide = true; + } + + public override void AI() + { + Lighting.AddLight(Projectile.Center, StaticEffectsColor.ToVector3() * 0.2f); + if (time == 0) + { + MovingUp = Projectile.ai[2] == 1 ? true : false; + } + firingDelay--; + Item heldItem = Owner.ActiveItem(); + + // Update damage based on curent magic damage stat (so Mana Sickness affects it) + Projectile.damage = heldItem is null ? 0 : Owner.GetWeaponDamage(heldItem); + + if (PostFireCooldown > 0) + { + PostFiringCooldown(); + } + + Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(-0.05f * Projectile.direction) * 12f; + // If there's no player, or the player is the server, or the owner's stunned, there'll be no holdout. + if (Owner.CantUseHoldout() || heldItem.type != ModContent.ItemType() ) + { + NetUpdate(); + if (PostFireCooldown <= 0) + Projectile.Kill(); + } + else if (PostFireCooldown <= 0 && (Owner.Calamity().mouseRight || (firingDelay <= 0 && Projectile.ai[2] == 1 || Projectile.ai[2] == -1))) + { + // If the player's pressing RMB, it'll shoot the grenade. + if (Owner.Calamity().mouseRight) + { + if ((Owner.CheckMana(Owner.ActiveItem(), (int)(heldItem.mana * Owner.manaCost) * 5, true, false))) + { + Shoot(heldItem, true); + PostFireCooldown = 35 + 55 * Utils.GetLerpValue(10, 40, FiringTime, true); + ShootingTimer = 0; + FiringTime = 40; + } + else + { + if (Projectile.soundDelay <= 0) + { + SoundEngine.PlaySound(SoundID.MaxMana with { Pitch = -0.5f }, Projectile.Center); + Projectile.soundDelay = 50; + } + ShootingTimer = 0; + } + } + else if (ShootingTimer >= FiringTime) + { + if (Owner.CheckMana(Owner.ActiveItem(), -1, true, false)) + { + Shoot(heldItem, false); + ShootingTimer = 0; + + if (FiringTime > 10) + FiringTime -= 5; + else + FiringTime = 10; + } + else + { + if (Projectile.soundDelay <= 0) + { + SoundEngine.PlaySound(SoundID.MaxMana with { Pitch = -0.5f }, Projectile.Center); + Projectile.soundDelay = 50; + } + ShootingTimer = 0; + } + + } + } + + // The center of the player, taking into account if they have a mount or not. + Vector2 ownerPosition = Owner.MountedCenter; + + // The vector between the player and the mouse. + Vector2 ownerToMouse = Owner.Calamity().mouseWorld - ownerPosition; + + // Deals with the holdout's rotation and direction, the owner's arms, etc. + ManageHoldout(ownerPosition, ownerToMouse); + + // When we change the distance of the gun from the arms for the recoil, + // recover to the original position smoothly. + if (OffsetLength != MaxOffsetLength) + OffsetLength = MathHelper.Lerp(OffsetLength, MaxOffsetLength, 0.1f); + + ShootingTimer++; + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero) * 20; + time++; + Projectile.soundDelay--; + } + + private void ManageHoldout(Vector2 mountedCenter, Vector2 ownerToMouse) + { + Vector2 rotationVector = Projectile.rotation.ToRotationVector2(); + float velocityRotation = Projectile.velocity.ToRotation(); + float proximityLookingUpwards = Vector2.Dot(ownerToMouse.SafeNormalize(Vector2.Zero), -Vector2.UnitY); + int direction = MathF.Sign(ownerToMouse.X); + + Vector2 armPosition = Owner.RotatedRelativePoint(mountedCenter, true); + Vector2 lengthOffset = rotationVector * OffsetLength; + Vector2 armOffset = new Vector2(Utils.Remap(proximityLookingUpwards, -1f, 1f, 0f, -12f) * direction, -10f + Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? 15f : 0f)); + + if (time % 40 == 0) + { + MovingUp = !MovingUp; + } + + //xOffset = MathHelper.Lerp(xOffset, placementOffset.X, 0.01f); + yOffset = MathHelper.Lerp(yOffset, 150 * (MovingUp ? -1 : 1), (0.085f - (FiringTime * 0.0012f))); + + Vector2 placementOffset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * (yOffset); + + Vector2 location = Owner.MountedCenter + placementOffset; + Projectile.Center = lengthOffset + location; + + + Projectile.velocity = velocityRotation.AngleTowards(ownerToMouse.ToRotation(), 0.2f).ToRotationVector2(); + Projectile.rotation = (Main.MouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX).ToRotation(); + Projectile.timeLeft = 2; + + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = Owner.itemAnimation = 2; + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); + + Projectile.spriteDirection = Projectile.direction = direction; + Owner.ChangeDir(direction); + + float armRotation = (Projectile.rotation - MathHelper.PiOver2); // -Pi/2 because the arms rotation starts with arms pointing down. + if (Projectile.ai[2] == 1) + { + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Quarter, armRotation); + } + else + { + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, armRotation); + } + } + + private void Shoot(Item item, bool isGrenade) + { + Vector2 shootDirection = (Main.MouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX); + + // The position of the tip of the gun. + Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(-0.05f * Projectile.direction) * 12f; + + // Spawns the projectile. + + Vector2 firingVelocity = shootDirection * 10; + if (isGrenade) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/DeadSunExplosion"); + SoundEngine.PlaySound(fire with { Volume = 0.35f, Pitch = -0.4f, PitchVariance = 0.2f }, Projectile.Center); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, firingVelocity * Utils.GetLerpValue(60, 10, FiringTime, true), ModContent.ProjectileType(), (int)(Projectile.damage * 4.5), Projectile.knockBack * 5, Projectile.owner, 0); + } + else + { + SoundStyle fire = new("CalamityMod/Sounds/Item/MagnaCannonShot"); + SoundEngine.PlaySound(fire with { Volume = 0.25f, Pitch = 1f, PitchVariance = 0.35f }, Projectile.Center); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, firingVelocity * Utils.GetLerpValue(80, 10, FiringTime, true), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0); + } + + NetUpdate(); + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + for (int k = 0; k < 6; k++) + { + Vector2 shootVel = (shootDirection * 10).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 1.8f); + + Dust dust2 = Dust.NewDustPerfect(tipPosition, Main.rand.NextBool(4) ? 264 : 66, shootVel); + dust2.scale = Main.rand.NextFloat(1.15f, 1.45f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Lerp(StaticEffectsColor, Color.White, 0.5f) : StaticEffectsColor; + } + Particle pulse = new GlowSparkParticle((tipPosition - shootDirection * 14), shootDirection * 20, false, Main.rand.Next(7, 11 + 1), 0.035f, StaticEffectsColor, new Vector2(1.5f, 0.9f), true); + GeneralParticleHandler.SpawnParticle(pulse); + + // By decreasing the offset length of the gun from the arms, we give an effect of recoil. + if (isGrenade) + OffsetLength -= 27f; + else + OffsetLength -= 5f; + } + private void PostFiringCooldown() + { + Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(-0.05f * Projectile.direction) * 12f; + + if (PostFireCooldown > 0 && Main.rand.NextBool()) + { + Vector2 smokeVel = new Vector2(0, -8) * Main.rand.NextFloat(0.1f, 1.1f); + Particle smoke = new HeavySmokeParticle(tipPosition, smokeVel, StaticEffectsColor, Main.rand.Next(30, 50 + 1), Main.rand.NextFloat(0.1f, 0.4f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + + Dust dust = Dust.NewDustPerfect(tipPosition, 303, smokeVel.RotatedByRandom(0.1f), 80, default, Main.rand.NextFloat(0.2f, 0.8f)); + dust.noGravity = false; + dust.color = StaticEffectsColor; + } + ShootingTimer = 0; + firingDelay = 45; + PostFireCooldown--; + } + + private void NetUpdate() + { + Projectile.netUpdate = true; + if (Projectile.netSpam >= 10) + Projectile.netSpam = 9; + } + + public override void OnSpawn(IEntitySource source) + { + Owner = Main.player[Projectile.owner]; + OffsetLength = MaxOffsetLength; + } + + // Because we use the velocity as a direction, we don't need it to change its position. + public override bool ShouldUpdatePosition() => false; + + public override bool? CanDamage() => false; + + public override bool PreDraw(ref Color lightColor) + { + if (time <= 0) + return false; + + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Magic/Wingman").Value; + + if (Projectile.ai[2] == 1) + texture = ModContent.Request("CalamityMod/Items/Weapons/Magic/Wingman").Value; + else + texture = ModContent.Request("CalamityMod/Items/Weapons/Magic/WingmanAlt").Value; + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + if (Projectile.spriteDirection == -1 ? MovingUp : !MovingUp) + flipSprite |= SpriteEffects.FlipVertically; + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Lerp(StaticEffectsColor, Color.White, 0.5f) * 0.2f, 1, texture); + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); + + return false; + } + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + behindNPCs.Add(index); + } + } +} diff --git a/Projectiles/Magic/WingmanShot.cs b/Projectiles/Magic/WingmanShot.cs new file mode 100644 index 0000000000..d964fb366e --- /dev/null +++ b/Projectiles/Magic/WingmanShot.cs @@ -0,0 +1,104 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class WingmanShot : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int BounceHits = 0; + public Color mainColor = Color.White; + public int time = 0; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 14; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 5; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = 2; + Projectile.timeLeft = 240; + Projectile.DamageType = DamageClass.Magic; + Projectile.extraUpdates = 4; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + if (mainColor == Color.White) + { + if (Projectile.ai[1] == 0) + mainColor = Color.HotPink; + if (Projectile.ai[1] == 1) + mainColor = Color.MediumSlateBlue; + if (Projectile.ai[1] == 2) + { + mainColor = Color.MediumVioletRed; + Projectile.scale = 1.25f; + Projectile.extraUpdates = 5; + Projectile.penetrate = 3; + } + + } + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + //Dust dust = Dust.NewDustPerfect(Projectile.Center, 107); // + Main.rand.NextVector2Circular(-3, 3) + //dust.noGravity = true; + //dust.scale = 0.5f; + if (time < 180) + Projectile.velocity *= 0.995f; + if (time % 2 == 0 && Projectile.timeLeft > 15) + { + SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitY) * 3.5f, Projectile.velocity * 0.01f, false, 5, 1f * Projectile.scale, mainColor * 0.4f); + GeneralParticleHandler.SpawnParticle(spark); + } + time++; + } + public override bool PreDraw(ref Color lightColor) + { + if (time == 0) + return false; + Texture2D texture = ModContent.Request("CalamityMod/Particles/GlowSpark").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation; + Vector2 rotationPoint = texture.Size() * 0.5f; + + //CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Lerp(Color.Cyan, Color.White, 0.7f) * 0.6f, 1); + Main.EntitySpriteDraw(texture, drawPosition, null, mainColor with { A = 0 }, drawRotation, rotationPoint, new Vector2(0.5f, 1.4f) * 0.025f * Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(texture, drawPosition, null, Color.White with { A = 0 }, drawRotation, rotationPoint, new Vector2(0.5f, 1.4f) * 0.02f * Projectile.scale, SpriteEffects.None); + return false; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.ai[1] != 2) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.9f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 2; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(4) ? 264 : 66, (Projectile.velocity.SafeNormalize(Vector2.UnitY) * 15f).RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(1.2f, 1.6f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor; + dust.noLightEmittence = true; + dust.noLight = true; + } + } + } +} diff --git a/Projectiles/Melee/StygianShieldAttack.cs b/Projectiles/Melee/StygianShieldAttack.cs index 02116fd16a..775bbf5d0c 100644 --- a/Projectiles/Melee/StygianShieldAttack.cs +++ b/Projectiles/Melee/StygianShieldAttack.cs @@ -31,9 +31,6 @@ namespace CalamityMod.Projectiles.Melee public ref float DashTime => ref Projectile.ai[1]; public Vector2 DashDestination = Vector2.Zero; - // Rawest placeholder sound - public static readonly SoundStyle DashSound = new("CalamityMod/Sounds/Custom/ExoMechs/ApolloMissileLaunch") { Volume = 0.6f }; - public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; @@ -59,7 +56,8 @@ namespace CalamityMod.Projectiles.Melee Owner.heldProj = Projectile.whoAmI; - // TODO -- Windup sound (definitely requires a custom looping sound) + if (Charge == 0f) + SoundEngine.PlaySound(StygianShield.DashChargeSound, Owner.Center); // Dashing behavior Projectile.Opacity = Utils.GetLerpValue(0f, DashDuration * 0.7f, DashTime, true); @@ -119,7 +117,7 @@ namespace CalamityMod.Projectiles.Melee // Has to be within world bounds if (intendedDestination.X >= 660f && intendedDestination.Y >= 660f && intendedDestination.X <= Main.maxTilesX * 16f - 680f && intendedDestination.Y <= Main.maxTilesY * 16f - 680f) { - SoundEngine.PlaySound(DashSound, Owner.Center); + SoundEngine.PlaySound(StygianShield.DashSound, Owner.Center); // Give immunity frames Owner.immune = true; @@ -173,6 +171,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { Projectile.damage = (int)(Projectile.damage * PiercingDamageMult); + SoundEngine.PlaySound(StygianShield.DashHitSound, Owner.Center); // Spawn a violent slash through the target that is hit float rotation = Projectile.velocity.ToRotation() - MathHelper.Pi; diff --git a/Projectiles/Melee/StygianShieldThrown.cs b/Projectiles/Melee/StygianShieldThrown.cs index 27236e8d5b..48aa964265 100644 --- a/Projectiles/Melee/StygianShieldThrown.cs +++ b/Projectiles/Melee/StygianShieldThrown.cs @@ -1,8 +1,9 @@ -using System; -using System.Collections.Generic; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using CalamityMod.Sounds; using Microsoft.Xna.Framework; +using ReLogic.Utilities; +using System.Collections.Generic; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -23,10 +24,9 @@ namespace CalamityMod.Projectiles.Melee private List PreviousNPCs = new List() { -1 }; public Player Owner => Main.player[Projectile.owner]; public ref float AirTime => ref Projectile.ai[0]; + SlotId LoopSoundSlot; public const float TotalTrailLength = 35f; - public static readonly SoundStyle ThrowSound = CommonCalamitySounds.LouderSwingWoosh; - public static readonly SoundStyle CollisionSound = CommonCalamitySounds.ExoHitSound; public override void SetStaticDefaults() { @@ -49,7 +49,12 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { if (AirTime == 0f) - SoundEngine.PlaySound(ThrowSound, Projectile.Center); + SoundEngine.PlaySound(StygianShield.ShieldThrowSound, Projectile.Center); + if ((AirTime + 40) % 60 == 0) + LoopSoundSlot = SoundEngine.PlaySound(StygianShield.ThrowLoopSound, Projectile.Center); + if (SoundEngine.TryGetActiveSound(LoopSoundSlot, out var LoopSound) && LoopSound.IsPlaying) + LoopSound.Position = Projectile.Center; + // Boomerang rotation Projectile.rotation += Projectile.direction * 0.4f; @@ -82,7 +87,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - SoundEngine.PlaySound(CollisionSound, Projectile.Center); + SoundEngine.PlaySound(StygianShield.ShieldThrowHitSound, Projectile.Center); // Disallow the NPC to be targeted again PreviousNPCs.Add(target.whoAmI); @@ -96,7 +101,7 @@ namespace CalamityMod.Projectiles.Melee public override bool OnTileCollide(Vector2 oldVelocity) { - SoundEngine.PlaySound(CollisionSound, Projectile.Center); + SoundEngine.PlaySound(StygianShield.ShieldThrowHitSound, Projectile.Center); if (SeekNPC() == -1) ReturnToOwner(); @@ -150,7 +155,12 @@ namespace CalamityMod.Projectiles.Melee // Delete the projectile if it touches its owner or too far away. if (Projectile.Hitbox.Intersects(Owner.Hitbox) || Vector2.Distance(Projectile.Center, Owner.Center) >= 3000f) + { + SoundEngine.PlaySound(StygianShield.ShieldCatchSound, Owner.Center); + if (SoundEngine.TryGetActiveSound(LoopSoundSlot, out var LoopSound)) + LoopSound?.Stop(); Projectile.Kill(); + } } // Preventing unintended collisions with the floor diff --git a/Projectiles/Ranged/CinderArrowProj.cs b/Projectiles/Ranged/CinderArrowProj.cs index 95557a92c8..e4bef88e38 100644 --- a/Projectiles/Ranged/CinderArrowProj.cs +++ b/Projectiles/Ranged/CinderArrowProj.cs @@ -62,15 +62,20 @@ namespace CalamityMod.Projectiles.Ranged } else { + Lighting.AddLight(Projectile.Center, Color.Red.ToVector3() * 0.3f); if (Projectile.ai[1] > 4 && Main.rand.NextBool(3)) { float velMulti = Main.rand.NextFloat(0.1f, 0.75f); Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity * 2, 90, -Projectile.velocity.RotatedBy(0.45) * velMulti); dust.noGravity = true; dust.scale = Main.rand.NextFloat(0.45f, 0.75f); + dust.noLight = true; + dust.noLightEmittence = true; Dust dust2 = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity * 2, 90, -Projectile.velocity.RotatedBy(-0.45) * velMulti); dust2.noGravity = true; dust2.scale = Main.rand.NextFloat(0.45f, 0.75f); + dust2.noLight = true; + dust2.noLightEmittence = true; } } } diff --git a/Projectiles/Ranged/ExoLightningBolt.cs b/Projectiles/Ranged/ExoLightningBolt.cs index 9bf2ca9680..1a3338f0af 100644 --- a/Projectiles/Ranged/ExoLightningBolt.cs +++ b/Projectiles/Ranged/ExoLightningBolt.cs @@ -86,6 +86,10 @@ namespace CalamityMod.Projectiles.Ranged HasPlayedSound = true; } + // This projectile is forced to critically strike. + // This technically is a nerf, as it makes DSO's crits deal less damage. + Projectile.Calamity().forcedCrit = true; + Lighting.AddLight(Projectile.Center, Color.White.ToVector3()); if (Projectile.frameCounter >= Projectile.extraUpdates * 2) { diff --git a/Projectiles/Ranged/PhotovisceratorHoldout.cs b/Projectiles/Ranged/PhotovisceratorHoldout.cs index 14ddf60640..2b5d81ed2c 100644 --- a/Projectiles/Ranged/PhotovisceratorHoldout.cs +++ b/Projectiles/Ranged/PhotovisceratorHoldout.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -269,5 +270,16 @@ namespace CalamityMod.Projectiles.Ranged Sound?.Stop(); PhotoTimer = 90; } + + public override void PostDraw(Color lightColor) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Vector2 origin = new Vector2(85f, 33f); + SpriteEffects spriteEffects = SpriteEffects.None; + if (Projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Ranged/PhotovisceratorHoldoutGlow").Value, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); + } } } diff --git a/Projectiles/Ranged/PhotovisceratorHoldoutGlow.png b/Projectiles/Ranged/PhotovisceratorHoldoutGlow.png new file mode 100644 index 0000000000..5ad78c0e7e Binary files /dev/null and b/Projectiles/Ranged/PhotovisceratorHoldoutGlow.png differ diff --git a/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs b/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs index 1b8beb43bd..2916cc6b65 100644 --- a/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs +++ b/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs @@ -30,14 +30,14 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ignoreWater = true; Projectile.netImportant = true; Projectile.penetrate = 1; - Projectile.timeLeft = 300; + Projectile.timeLeft = 150; Projectile.DamageType = RogueDamageClass.Instance; } public override void AI() { - if (Projectile.Calamity().stealthStrike && Projectile.timeLeft % 5f == 4f) // every 5 frames - CalamityUtils.ProjectileRain(Projectile.GetSource_FromThis(), Projectile.Center, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); + if (Projectile.Calamity().stealthStrike && Projectile.timeLeft % 20f == 4f) // every 5 frames + CalamityUtils.ProjectileRain(Projectile.GetSource_FromThis(), Projectile.Center, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), Projectile.damage / 6, Projectile.knockBack * 0.5f, Projectile.owner); if (Projectile.alpha > 0) { @@ -63,9 +63,6 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation += 0.5f; - if (Owner.position.Y != Owner.oldPosition.Y && Projectile.ai[0] == 0f) - Projectile.ai[1]++; - Projectile.ai[0]++; if (Main.myPlayer == Projectile.owner && Projectile.ai[0] == 20f) @@ -158,12 +155,12 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[dusty].velocity *= 0f; } - if (Projectile.owner == Main.myPlayer && Projectile.ai[1] > 0) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < 5; i++) { Vector2 velocity = ((MathHelper.TwoPi * i / 5f) - MathHelper.PiOver2).ToRotationVector2() * 4f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, 0f, 1f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack * 0.5f, Projectile.owner, 0f, 1f); } } } diff --git a/Projectiles/Rogue/SupernovaBoom.cs b/Projectiles/Rogue/SupernovaBoom.cs index 7f78a46fb7..843a0c0e48 100644 --- a/Projectiles/Rogue/SupernovaBoom.cs +++ b/Projectiles/Rogue/SupernovaBoom.cs @@ -1,10 +1,12 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; +using CalamityMod.NPCs.Crags; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; using static Humanizer.In; @@ -178,7 +180,8 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < Main.maxNPCs; i++) { NPC target = Main.npc[i]; - if (!target.boss && target.IsAnEnemy(true, true) && !CalamityPlayer.areThereAnyDamnBosses) + bool isAPillar = target.type == NPCID.LunarTowerSolar || target.type == NPCID.LunarTowerVortex || target.type == NPCID.LunarTowerNebula || target.type == NPCID.LunarTowerStardust; + if (!isAPillar && !target.boss && target.IsAnEnemy(true, true) && !CalamityPlayer.areThereAnyDamnBosses && target.CanBeChasedBy(Projectile, false)) { if (Vector2.Distance(target.Center, Projectile.Center) > 40 && Vector2.Distance(target.Center, Projectile.Center) < 600) target.Center += target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX) * 22; @@ -224,7 +227,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (!target.boss && target.IsAnEnemy(true, true) && !CalamityPlayer.areThereAnyDamnBosses && target != null) + if (!target.boss && target.IsAnEnemy(true, true) && !CalamityPlayer.areThereAnyDamnBosses && target.CanBeChasedBy(Projectile, false) && target != null) { Vector2 velToApply = target.Center.DirectionFrom(Projectile.Center).SafeNormalize(Vector2.UnitX) * 30; target.velocity = velToApply + (velToApply.Y <= 0 ? new Vector2(0, -5) : Vector2.Zero); diff --git a/Projectiles/Rogue/SupernovaStealthBoom.cs b/Projectiles/Rogue/SupernovaStealthBoom.cs index de19b18d30..aaa399a2cc 100644 --- a/Projectiles/Rogue/SupernovaStealthBoom.cs +++ b/Projectiles/Rogue/SupernovaStealthBoom.cs @@ -9,6 +9,7 @@ using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.Audio; +using Terraria.ID; using Terraria.ModLoader; using static Humanizer.In; @@ -284,7 +285,7 @@ namespace CalamityMod.Projectiles.Rogue _ => Color.LawnGreen, }; - Particle pulse2 = new CustomPulse(Projectile.Center, Vector2.Zero, randomColor * 0.7f, "CalamityMod/Particles/HighResHollowCircleHardEdge", new Vector2(1f, 1f), 0f, 0f, 4f - i * 0.28f, 50); + Particle pulse2 = new CustomPulse(Projectile.Center, Vector2.Zero, randomColor * 0.7f, "CalamityMod/Particles/FlameExplosion", new Vector2(1f, 1f), Main.rand.NextFloat(-20, 20), 0f, 4f - i * 0.28f, 50); GeneralParticleHandler.SpawnParticle(pulse2); } @@ -304,7 +305,8 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < Main.maxNPCs; i++) { NPC target = Main.npc[i]; - if (!target.boss && target.IsAnEnemy(true, true)) + bool isAPillar = target.type == NPCID.LunarTowerSolar || target.type == NPCID.LunarTowerVortex || target.type == NPCID.LunarTowerNebula || target.type == NPCID.LunarTowerStardust; + if (!isAPillar && !target.boss && target.IsAnEnemy(true, true) && target.CanBeChasedBy(Projectile, false)) { if (target != null && !CalamityPlayer.areThereAnyDamnBosses) { @@ -363,7 +365,7 @@ namespace CalamityMod.Projectiles.Rogue dust2.color = Color.Lerp(Color.White, randomColor, 0.9f); } - if (!target.boss && target.IsAnEnemy(true, true) && !CalamityPlayer.areThereAnyDamnBosses && target != null) + if (!target.boss && target.IsAnEnemy(true, true) && !CalamityPlayer.areThereAnyDamnBosses && target.CanBeChasedBy(Projectile, false) && target != null) { Vector2 velToApply = target.Center.DirectionFrom(Projectile.Center).SafeNormalize(Vector2.UnitX) * 40; target.velocity = velToApply + (velToApply.Y <= 0 ? new Vector2(0, -5) : Vector2.Zero); diff --git a/Projectiles/Summon/AquasScepterCloud.cs b/Projectiles/Summon/AquasScepterCloud.cs index 11418e07b5..1d8af26757 100644 --- a/Projectiles/Summon/AquasScepterCloud.cs +++ b/Projectiles/Summon/AquasScepterCloud.cs @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 glowPos = Projectile.position - Main.screenPosition + (glowTex.Size() * 0.5f); Main.EntitySpriteDraw(glowTex, glowPos, null, dd.color, 0f, glowTex.Size() * 0.5f, 1f, SpriteEffects.None); Main.spriteBatch.End(); - Main.spriteBatch.Begin(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); if (Main.rand.NextBool(240)) { diff --git a/Sounds/Item/EnergyRifleFire.ogg b/Sounds/Item/EnergyRifleFire.ogg new file mode 100644 index 0000000000..855a605b46 Binary files /dev/null and b/Sounds/Item/EnergyRifleFire.ogg differ diff --git a/Sounds/Item/OmicronBeam.ogg b/Sounds/Item/OmicronBeam.ogg new file mode 100644 index 0000000000..605f551f00 Binary files /dev/null and b/Sounds/Item/OmicronBeam.ogg differ diff --git a/Sounds/Item/PulseRifleFire.ogg b/Sounds/Item/PulseRifleFire.ogg index 855a605b46..3e5ef5cd27 100644 Binary files a/Sounds/Item/PulseRifleFire.ogg and b/Sounds/Item/PulseRifleFire.ogg differ diff --git a/Sounds/Item/PulseSound.ogg b/Sounds/Item/PulseSound.ogg new file mode 100644 index 0000000000..4941b20973 Binary files /dev/null and b/Sounds/Item/PulseSound.ogg differ diff --git a/Sounds/Item/StygianBonk1.ogg b/Sounds/Item/StygianBonk1.ogg new file mode 100644 index 0000000000..5b0653b69c Binary files /dev/null and b/Sounds/Item/StygianBonk1.ogg differ diff --git a/Sounds/Item/StygianBonk2.ogg b/Sounds/Item/StygianBonk2.ogg new file mode 100644 index 0000000000..a165ef9428 Binary files /dev/null and b/Sounds/Item/StygianBonk2.ogg differ diff --git a/Sounds/Item/StygianBonk3.ogg b/Sounds/Item/StygianBonk3.ogg new file mode 100644 index 0000000000..0cf933d81e Binary files /dev/null and b/Sounds/Item/StygianBonk3.ogg differ diff --git a/Sounds/Item/StygianCatch.ogg b/Sounds/Item/StygianCatch.ogg new file mode 100644 index 0000000000..1bde0d3709 Binary files /dev/null and b/Sounds/Item/StygianCatch.ogg differ diff --git a/Sounds/Item/StygianDash.ogg b/Sounds/Item/StygianDash.ogg new file mode 100644 index 0000000000..6ec191dcc2 Binary files /dev/null and b/Sounds/Item/StygianDash.ogg differ diff --git a/Sounds/Item/StygianDashCharge.ogg b/Sounds/Item/StygianDashCharge.ogg new file mode 100644 index 0000000000..44e0a00196 Binary files /dev/null and b/Sounds/Item/StygianDashCharge.ogg differ diff --git a/Sounds/Item/StygianThrow.ogg b/Sounds/Item/StygianThrow.ogg new file mode 100644 index 0000000000..b7973fb09a Binary files /dev/null and b/Sounds/Item/StygianThrow.ogg differ diff --git a/Sounds/Item/StygianThrowLoop.ogg b/Sounds/Item/StygianThrowLoop.ogg new file mode 100644 index 0000000000..279ecb75dd Binary files /dev/null and b/Sounds/Item/StygianThrowLoop.ogg differ diff --git a/Tiles/Furniture/BossRelics/PerforatorsRelic.png b/Tiles/Furniture/BossRelics/PerforatorsRelic.png index 0dfc66b2e6..8f51d70f22 100644 Binary files a/Tiles/Furniture/BossRelics/PerforatorsRelic.png and b/Tiles/Furniture/BossRelics/PerforatorsRelic.png differ diff --git a/UI/FlightBar/FlightBar.cs b/UI/FlightBar/FlightBar.cs index 40c5d6bf8c..b78ed67fcd 100644 --- a/UI/FlightBar/FlightBar.cs +++ b/UI/FlightBar/FlightBar.cs @@ -53,9 +53,10 @@ namespace CalamityMod.UI else { bool ridingLimitedFlightMount = player.mount.Active && player.mount._data.flightTimeMax > 0; + bool ridingCarpet = player.carpet && !player.canCarpet; - int currentFlight = ridingLimitedFlightMount ? player.mount._flyTime + (int)(player.mount._data.fatigueMax - player.mount._fatigue) : (int)player.wingTime; - int maxFlight = ridingLimitedFlightMount ? player.mount._data.flightTimeMax + (int)player.mount._data.fatigueMax : player.wingTimeMax; + int currentFlight = ridingCarpet ? player.carpetTime : ridingLimitedFlightMount ? player.mount._flyTime + (int)(player.mount._data.fatigueMax - player.mount._fatigue) : (int)player.wingTime; + int maxFlight = ridingCarpet ? 300 : ridingLimitedFlightMount ? player.mount._data.flightTimeMax + (int)player.mount._data.fatigueMax : player.wingTimeMax; return (Math.Min(100f * currentFlight / maxFlight, 100f)).ToString("0.00"); // why the FUCK can wingtime be higher than max wingtime????????? } @@ -105,7 +106,7 @@ namespace CalamityMod.UI CalamityPlayer modPlayer = player.Calamity(); // If not drawing the flight bar, save its latest position to config and leave. - if (CalamityConfig.Instance.FlightBar && (player.wingsLogic > 0 || (player.mount.Active && player.mount._data.flightTimeMax > 0))) + if (CalamityConfig.Instance.FlightBar && (player.wingsLogic > 0 || (player.mount.Active && player.mount._data.flightTimeMax > 0) || player.carpet && !player.canCarpet)) { DrawFlightBar(spriteBatch, modPlayer, screenPos); } @@ -140,7 +141,7 @@ namespace CalamityMod.UI if (!CalamityConfig.Instance.MeterPosLock) Main.LocalPlayer.mouseInterface = true; - if (modPlayer.Player.equippedWings != null && modPlayer.Player.wingTimeMax > 0 || (player.mount.Active && modPlayer.Player.mount._data.flightTimeMax > 0)) //equipped wings or riding a flying mount and max wingtime/flighttime above 0 (so not disabled bar) + if (modPlayer.Player.equippedWings != null && modPlayer.Player.wingTimeMax > 0 || (player.mount.Active && modPlayer.Player.mount._data.flightTimeMax > 0) || player.carpet && !player.canCarpet) //equipped wings or riding a flying mount and max wingtime/flighttime above 0 (so not disabled bar) { string textToDisplay = CalamityUtils.GetText("UI.Flight").Format((GetFlightTime(modPlayer).ToString() + (modPlayer.infiniteFlight ? "" : "%"))); //the percent is here and not in localisation otherwise it looks like a dick when it's infinite flight Main.instance.MouseText(textToDisplay, 0, 0, -1, -1, -1, -1); @@ -192,7 +193,7 @@ namespace CalamityMod.UI Player player = modPlayer.Player; float flightRatio = 1; if (!modPlayer.infiniteFlight && !RidingInfiniteFlightMount(player)) - flightRatio = player.mount.Active && player.mount._data.flightTimeMax > 0 ? Math.Min((float)(player.mount._flyTime + (player.mount._data.fatigueMax - player.mount._fatigue)) / (player.mount._data.flightTimeMax + player.mount._data.fatigueMax), 1f) : Math.Min(player.wingTime / player.wingTimeMax, 1f); // why the FUCK can wingtime be higher than max wingtime????????? + flightRatio = player.carpet && !player.canCarpet ? Math.Min((float)player.carpetTime / 300f, 1f) : player.mount.Active && player.mount._data.flightTimeMax > 0 ? Math.Min((float)(player.mount._flyTime + (player.mount._data.fatigueMax - player.mount._fatigue)) / (player.mount._data.flightTimeMax + player.mount._data.fatigueMax), 1f) : Math.Min(player.wingTime / player.wingTimeMax, 1f); // why the FUCK can wingtime be higher than max wingtime????????? if (!completedAnimation && FlightAnimFrame == -1 && (modPlayer.infiniteFlight || RidingInfiniteFlightMount(modPlayer.Player))) FlightAnimFrame++; if (FlightAnimFrame > -1) //animation started, complete it.