diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 22b5425f4c..47c8e3c0cd 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -2564,7 +2564,7 @@ namespace CalamityMod.CalPlayer if (CalamityKeybinds.SandCloakHotkey.JustPressed && sandCloak && Main.myPlayer == Player.whoAmI && rogueStealth >= rogueStealthMax * 0.1f && wearingRogueArmor && rogueStealthMax > 0 && !Player.HasCooldown(Cooldowns.SandCloak.ID)) { - Player.AddCooldown(Cooldowns.SandCloak.ID, CalamityUtils.SecondsToFrames(25)); + Player.AddCooldown(Cooldowns.SandCloak.ID, CalamityUtils.SecondsToFrames(30)); var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); rogueStealth -= rogueStealthMax * 0.1f; @@ -6102,7 +6102,7 @@ namespace CalamityMod.CalPlayer var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); if (Player.whoAmI == Main.myPlayer && !Player.HasCooldown(Cooldowns.InkBomb.ID)) { - Player.AddCooldown(Cooldowns.InkBomb.ID, CalamityUtils.SecondsToFrames(25)); + Player.AddCooldown(Cooldowns.InkBomb.ID, CalamityUtils.SecondsToFrames(20)); rogueStealth += 0.5f; for (int i = 0; i < 3; i++) { @@ -6614,26 +6614,27 @@ namespace CalamityMod.CalPlayer // Update Dark God's Sheath and Eclipse Mirror's stealth acceleration /* * T = frame counter - * DGS = (100% + 1% * T) - * EM = (100% + 1% * T) * 1.0084^T - * BOTH = (100% + 1.5% * T) * 1.0084^T + * DGS = (100% + 0.7% * T) + * EM = (100% + 0.7% * T) * 1.006^T + * BOTH = (100% + 1% * T) * 1.006^T * - * DGS alone caps in 100 frames - * EM alone caps in 41 frames - * Both together caps in 32 frames + * DGS alone caps in 143 frames + * EM alone caps in 59 frames + * Both together caps in 50 frames */ if (darkGodSheath && eclipseMirror) { - stealthAcceleration += 0.015f; - stealthAcceleration *= 1.0084f; + stealthAcceleration += 0.01f; + stealthAcceleration *= 1.006f; } else if (eclipseMirror) { - stealthAcceleration += 0.01f; - stealthAcceleration *= 1.0084f; + stealthAcceleration += 0.007f; + stealthAcceleration *= 1.006f; } else if (darkGodSheath) - stealthAcceleration += 0.01f; + stealthAcceleration += 0.007f; + stealthAcceleration = MathHelper.Clamp(stealthAcceleration, 1f, StealthAccelerationCap); // You get 100% stealth regen while standing still and not on a mount. Otherwise, you get your stealth regeneration while moving. diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index da8c352bb1..bdaafe0761 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -1070,7 +1070,7 @@ namespace CalamityMod.CalPlayer break; } } - int damage = (int)Player.GetTotalDamage().ApplyTo(550); + int damage = (int)Player.GetTotalDamage().ApplyTo(300); int projectileIndex = Projectile.NewProjectile(spawnSource, projTileX * 16 + 8, projTileY * 16 - 24, 0f, 0f, ProjectileType(), damage, 15f, Main.myPlayer, 16f, 16f); if (projectileIndex.WithinBounds(Main.maxProjectiles)) { diff --git a/Events/BossRushEvent.cs b/Events/BossRushEvent.cs index 6795d152f5..0e5ed2465d 100644 --- a/Events/BossRushEvent.cs +++ b/Events/BossRushEvent.cs @@ -104,7 +104,25 @@ namespace CalamityMod.Events public static int CurrentlyFoughtBoss => Bosses[BossRushStage].EntityID; public static int NextBossToFight => Bosses[BossRushStage + 1].EntityID; - public static readonly SoundStyle EndSound = new("CalamityMod/Sounds/Custom/BossRushEnd"); + public static readonly SoundStyle BossSummonSound = new("CalamityMod/Sounds/Custom/BossRush/BossRushSummon", 2); + + public static readonly SoundStyle TeleportSound = new("CalamityMod/Sounds/Custom/BossRush/BossRushTeleport"); + + public static readonly SoundStyle TerminusActivationSound = new("CalamityMod/Sounds/Custom/BossRush/BossRushTerminusActivate"); + + public static readonly SoundStyle StartBuildupSound = new("CalamityMod/Sounds/Custom/BossRush/BossRushTerminusCharge"); + + public static readonly SoundStyle TerminusDeactivationSound = new("CalamityMod/Sounds/Custom/BossRush/BossRushTerminusDeactivate"); + + public static readonly SoundStyle Tier2TransitionSound = new("CalamityMod/Sounds/Custom/BossRush/BossRushTier2Transition"); + + public static readonly SoundStyle Tier3TransitionSound = new("CalamityMod/Sounds/Custom/BossRush/BossRushTier3Transition"); + + public static readonly SoundStyle Tier4TransitionSound = new("CalamityMod/Sounds/Custom/BossRush/BossRushTier4Transition"); + + public static readonly SoundStyle Tier5TransitionSound = new("CalamityMod/Sounds/Custom/BossRush/BossRushTier5Transition"); + + public static readonly SoundStyle VictorySound = new("CalamityMod/Sounds/Custom/BossRush/BossRushVictory"); #region Loading and Unloading public static void Load() @@ -476,9 +494,9 @@ namespace CalamityMod.Events if (Bosses[BossRushStage].ToChangeTimeTo != TimeChangeContext.None) CalamityUtils.ChangeTime(Bosses[BossRushStage].ToChangeTimeTo == TimeChangeContext.Day); - // Play the typical boss roar sound. + // Play a special boss roar sound by default. if (!Bosses[BossRushStage].UsesSpecialSound) - SoundEngine.PlaySound(SoundID.Roar, Main.player[ClosestPlayerToWorldCenter].position); + SoundEngine.PlaySound(BossSummonSound, Main.player[ClosestPlayerToWorldCenter].position); // And spawn the boss. Bosses[BossRushStage].SpawnContext.Invoke(CurrentlyFoughtBoss); diff --git a/Items/Accessories/AbyssalMirror.cs b/Items/Accessories/AbyssalMirror.cs index 16767ac5a8..c0db5f2781 100644 --- a/Items/Accessories/AbyssalMirror.cs +++ b/Items/Accessories/AbyssalMirror.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Abyssal Mirror"); Tooltip.SetDefault("Light does not reach the depths of the ocean\n" + "Significantly reduces enemy aggression, even in the abyss\n" + - "Stealth generates 30% faster when standing still and 20% faster while moving\n" + + "Stealth generates 25% faster when standing still and 12% faster while moving\n" + "Grants the ability to evade attacks, releasing a cloud of lumenyl fluid which damages and stuns nearby enemies\n" + "Evading an attack grants a lot of stealth but has a 90 second cooldown\n" + "This cooldown is shared with all other dodges and reflects"); @@ -33,8 +33,8 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.stealthGenStandstill += 0.3f; - modPlayer.stealthGenMoving += 0.2f; + modPlayer.stealthGenStandstill += 0.25f; + modPlayer.stealthGenMoving += 0.12f; modPlayer.abyssalMirror = true; player.aggro -= 450; } diff --git a/Items/Accessories/EclipseMirror.cs b/Items/Accessories/EclipseMirror.cs index 6e31178ea2..587f7bc8c7 100644 --- a/Items/Accessories/EclipseMirror.cs +++ b/Items/Accessories/EclipseMirror.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories "+10 maximum stealth\n" + "6% increased rogue damage, and 6% increased rogue crit chance\n" + "Vastly reduces enemy aggression, even in the abyss\n" + - "Stealth generates 20% faster when standing still\n" + + "Stealth generates 25% faster when standing still\n" + "Mobile stealth generation exponentially accelerates while not attacking\n" + "Stealth strikes only expend 50% of your max stealth\n" + "Grants the ability to evade attacks in a blast of darksun light, which inflicts extreme damage in a wide area\n" + @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.stealthGenStandstill += 0.2f; + modPlayer.stealthGenStandstill += 0.25f; modPlayer.rogueStealthMax += 0.1f; modPlayer.eclipseMirror = true; modPlayer.stealthStrikeHalfCost = true; diff --git a/Items/Accessories/InkBomb.cs b/Items/Accessories/InkBomb.cs index 4dc3b44658..889b96b37c 100644 --- a/Items/Accessories/InkBomb.cs +++ b/Items/Accessories/InkBomb.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Ink Bomb"); Tooltip.SetDefault("Throws several ink bombs when hit that explode in a confusing cloud of ink\n" + "Gain a lot of stealth when struck\n" + - "This effect has a 25 second cooldown before it can occur again"); + "This effect has a 20 second cooldown before it can occur again"); } public override void SetDefaults() diff --git a/Items/Accessories/MirageMirror.cs b/Items/Accessories/MirageMirror.cs index 52fca4b559..e0ce04bef0 100644 --- a/Items/Accessories/MirageMirror.cs +++ b/Items/Accessories/MirageMirror.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Mirage Mirror"); Tooltip.SetDefault("Bend light around you\n" + "Reduces enemy aggression outside of the abyss\n" + - "Stealth generates 30% faster when standing still and 20% faster while moving"); + "Stealth generates 25% faster when standing still and 12% faster while moving"); } public override void SetDefaults() @@ -28,8 +28,8 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.stealthGenStandstill += 0.3f; - modPlayer.stealthGenMoving += 0.2f; + modPlayer.stealthGenStandstill += 0.25f; + modPlayer.stealthGenMoving += 0.12f; player.aggro -= 200; } diff --git a/Items/Accessories/SandCloak.cs b/Items/Accessories/SandCloak.cs index 9abaa49f93..7123ae2451 100644 --- a/Items/Accessories/SandCloak.cs +++ b/Items/Accessories/SandCloak.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Sand Cloak"); Tooltip.SetDefault("+2 defense and 5% increased movement speed\n" + "TOOLTIP LINE HERE\n" + - "This effect has a 25 second cooldown before it can be used again"); + "This effect has a 30 second cooldown before it can be used again"); } public override void SetDefaults() diff --git a/Items/Accessories/SpectralVeil.cs b/Items/Accessories/SpectralVeil.cs index f83ab1d297..2186fe7079 100644 --- a/Items/Accessories/SpectralVeil.cs +++ b/Items/Accessories/SpectralVeil.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories "TOOLTIP LINE HERE\n" + "If you dodge something while invulnerable, you instantly gain full stealth\n" + "Teleportation is disabled while Chaos State is active\n" + - "Stealth generates 20% faster while moving"); + "Stealth generates 15% faster"); } public override void SetDefaults() @@ -42,7 +42,8 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().spectralVeil = true; - player.Calamity().stealthGenMoving += 0.2f; + player.Calamity().stealthGenMoving += 0.15f; + player.Calamity().stealthGenStandstill += 0.15f; } } } diff --git a/Items/Armor/Aerospec/AerospecHeadgear.cs b/Items/Armor/Aerospec/AerospecHeadgear.cs index e6b3d249d7..bac06dd3dc 100644 --- a/Items/Armor/Aerospec/AerospecHeadgear.cs +++ b/Items/Armor/Aerospec/AerospecHeadgear.cs @@ -41,12 +41,12 @@ namespace CalamityMod.Items.Armor.Aerospec public override void UpdateArmorSet(Player player) { player.setBonus = "5% increased movement speed and rogue critical strike chance\n" + - "+100 maximum stealth\n" + + "+80 maximum stealth\n" + "Taking over 25 damage in one hit will cause a spread of homing feathers to fall\n" + "Allows you to fall more quickly and disables fall damage"; var modPlayer = player.Calamity(); modPlayer.aeroSet = true; - modPlayer.rogueStealthMax += 1f; + modPlayer.rogueStealthMax += 0.8f; player.noFallDmg = true; player.moveSpeed += 0.05f; player.GetCritChance() += 5; diff --git a/Items/Armor/Statigel/StatigelHeadRogue.cs b/Items/Armor/Statigel/StatigelHeadRogue.cs index 0dcf52cd4e..1c01e3add3 100644 --- a/Items/Armor/Statigel/StatigelHeadRogue.cs +++ b/Items/Armor/Statigel/StatigelHeadRogue.cs @@ -38,11 +38,11 @@ namespace CalamityMod.Items.Armor.Statigel player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + "Grants an extra jump and increased jump height\n" + "12% increased jump speed\n" + - "+100 maximum stealth"; + "+90 maximum stealth"; var modPlayer = player.Calamity(); modPlayer.statigelSet = true; modPlayer.statigelJump = true; - modPlayer.rogueStealthMax += 1f; + modPlayer.rogueStealthMax += 0.9f; modPlayer.wearingRogueArmor = true; Player.jumpHeight += 5; player.jumpSpeedBoost += 0.6f; diff --git a/Items/Armor/Sulphurous/SulphurousHelmet.cs b/Items/Armor/Sulphurous/SulphurousHelmet.cs index 22bd008848..7eac2f2c10 100644 --- a/Items/Armor/Sulphurous/SulphurousHelmet.cs +++ b/Items/Armor/Sulphurous/SulphurousHelmet.cs @@ -37,14 +37,14 @@ namespace CalamityMod.Items.Armor.Sulphurous public override void UpdateArmorSet(Player player) { - player.setBonus = "+95 maximum stealth\n" + + player.setBonus = "+70 maximum stealth\n" + "Attacking and being attacked by enemies inflicts poison\n" + "Grants an additional jump that summons a sulphurous bubble\n" + "Provides increased underwater mobility and reduces the severity of the sulphuric waters"; var modPlayer = player.Calamity(); modPlayer.sulfurSet = true; modPlayer.sulfurJump = true; - modPlayer.rogueStealthMax += 0.95f; + modPlayer.rogueStealthMax += 0.7f; modPlayer.wearingRogueArmor = true; player.ignoreWater = true; } diff --git a/Items/Armor/Victide/VictideHeadRogue.cs b/Items/Armor/Victide/VictideHeadRogue.cs index 526904b85c..538c811e9f 100644 --- a/Items/Armor/Victide/VictideHeadRogue.cs +++ b/Items/Armor/Victide/VictideHeadRogue.cs @@ -37,10 +37,10 @@ namespace CalamityMod.Items.Armor.Victide "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + "This seashell does true damage and does not benefit from any damage class\n" + "Provides increased underwater mobility and slightly reduces breath loss in the abyss\n" + - "+90 maximum stealth"; + "+60 maximum stealth"; var modPlayer = player.Calamity(); modPlayer.victideSet = true; - modPlayer.rogueStealthMax += 0.9f; + modPlayer.rogueStealthMax += 0.6f; modPlayer.wearingRogueArmor = true; player.ignoreWater = true; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 382035d30e..28fae78c60 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -291,7 +291,7 @@ namespace CalamityMod.Items { ItemID.MaceWhip, autoReuse }, { ItemID.MagicalHarp, Do(DamageExact(50), ShootSpeedExact(12f)) }, { ItemID.MagicDagger, Do(AutoReuse, DamageExact(77), UseExact(16), ShootSpeedExact(30)) }, - { ItemID.MagicMissile, Do(DamageExact(20), ManaExact(10), UseAnimationExact(20), UseTimeExact(10)) }, + { ItemID.MagicMissile, Do(DamageExact(23), ManaExact(10), UseAnimationExact(20), UseTimeExact(10)) }, { ItemID.MagnetSphere, Do(DamageRatio(1.1f)) }, { ItemID.ManaCrystal, autoReuse }, { ItemID.Marrow, Do(PointBlank, AutoReuse, DamageExact(69)) }, diff --git a/Items/Materials/WulfrumMetalScrap.cs b/Items/Materials/WulfrumMetalScrap.cs index ccc5ff865c..8729a2c0d7 100644 --- a/Items/Materials/WulfrumMetalScrap.cs +++ b/Items/Materials/WulfrumMetalScrap.cs @@ -47,6 +47,11 @@ namespace CalamityMod.Items.Materials Item.ammo = Item.type; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Material; + } + public override void OnSpawn(IEntitySource source) { if (source is EntitySource_Loot) diff --git a/Items/Potions/Baguette.cs b/Items/Potions/Baguette.cs index 7964052dda..9a5ed0fe08 100644 --- a/Items/Potions/Baguette.cs +++ b/Items/Potions/Baguette.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.Buffs.Potions; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.Potions; namespace CalamityMod.Items.Potions { @@ -36,6 +36,11 @@ namespace CalamityMod.Items.Potions Item.buffTime = CalamityUtils.SecondsToFrames(300f); } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Food; + } + public override void OnConsumeItem(Player player) { //5 minutes for both diff --git a/Items/TreasureBags/CrabulonBag.cs b/Items/TreasureBags/CrabulonBag.cs index 4c7d8285dc..e86cdec6ed 100644 --- a/Items/TreasureBags/CrabulonBag.cs +++ b/Items/TreasureBags/CrabulonBag.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.Crabulon; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -71,6 +72,7 @@ namespace CalamityMod.Items.TreasureBags ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), + ModContent.ItemType(), })); // Equipment diff --git a/Items/VanillaArmorChanges/GladiatorArmorSetChange.cs b/Items/VanillaArmorChanges/GladiatorArmorSetChange.cs index 25ce3a0b2f..8ce17c7ecd 100644 --- a/Items/VanillaArmorChanges/GladiatorArmorSetChange.cs +++ b/Items/VanillaArmorChanges/GladiatorArmorSetChange.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.VanillaArmorChanges public override void UpdateSetBonusText(ref string setBonusText) { setBonusText += "\n+3 defense\n" + - "+70 maximum stealth\n" + + "+60 maximum stealth\n" + "5% increased rogue damage and 10% increased velocity"; } @@ -42,7 +42,7 @@ namespace CalamityMod.Items.VanillaArmorChanges public override void ApplyArmorSetBonus(Player player) { - player.Calamity().rogueStealthMax += 0.7f; + player.Calamity().rogueStealthMax += 0.6f; player.Calamity().wearingRogueArmor = true; player.GetDamage() += 0.05f; player.Calamity().rogueVelocity += 0.1f; diff --git a/Items/Weapons/Summon/AtlasMunitionsBeacon.cs b/Items/Weapons/Summon/AtlasMunitionsBeacon.cs index ddc00b373d..808f155beb 100644 --- a/Items/Weapons/Summon/AtlasMunitionsBeacon.cs +++ b/Items/Weapons/Summon/AtlasMunitionsBeacon.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Summon public const int HeatDissipationTime = 180; // This shouldn't be too high. If it is, the overdrive mode will be frustratingly inconsistent to use. - public const float OverdriveProjectileAngularRandomness = 0.15f; + public const float OverdriveProjectileAngularRandomness = 0.1f; public static readonly Color HeatGlowColor = Color.OrangeRed with { A = 64 }; @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 640; + Item.damage = 150; Item.mana = 10; Item.width = 40; Item.height = 38; diff --git a/Items/Weapons/Summon/InfectedRemote.cs b/Items/Weapons/Summon/InfectedRemote.cs index 3eacc2e001..013cb73652 100644 --- a/Items/Weapons/Summon/InfectedRemote.cs +++ b/Items/Weapons/Summon/InfectedRemote.cs @@ -1,7 +1,6 @@ using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,16 +9,37 @@ namespace CalamityMod.Items.Weapons.Summon { public class InfectedRemote : ModItem { - int viruliSlots; + public const int DefaultIframes = 10; + + public const int ChargeIframes = 2; + + public const int RocketShootRate = 6; + + public const int BeeShootRate = 22; + + public const int MaxUpdatesWhenCharging = 2; + + public const float RegularChargeSpeed = 40f; + + public const float HorizontalRocketChargeSpeed = 22f; + + public const float RocketDamageFactor = 0.7f; + + public const float BeeDamageFactor = 0.65f; + + public const float MinionSlotRequirement = 3f; + + public const float EnemyTargetingRange = 1300f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Infected Remote"); - Tooltip.SetDefault("There’s a faded note written on it in green\n" + - "Only the first line is readable: 'She won’t afflict you, I promise!'\n" + - "Summons the harbinger of the plague...?\n" + - "Consumes all of the remaining minion slots on use\n" + - "Must be used from the hotbar\n" + - "Increased power based on the number of minion slots used"); + Tooltip.SetDefault("Summons a humanoid-hybrid Plaguebringer, codenamed 'Virili', to aid you in battle\n" + + $"Virili requires {MinionSlotRequirement} minion slots to summon, and can only be summoned once\n" + + "Virili uses a variety of attacks which she cycles through on a timer\n" + + "All attacks spread the plague, as was her original design intention\n" + + "'A single note graces the back:'\n" + + "'WARNING: Subject is extremely corrosive and contagious. Avoid direct contact.'"); SacrificeTotal = 1; } @@ -43,35 +63,15 @@ namespace CalamityMod.Items.Weapons.Summon Item.Calamity().donorItem = true; } - public override void HoldItem(Player player) - { - double minionCount = 0; - for (int j = 0; j < Main.projectile.Length; j++) - { - Projectile projectile = Main.projectile[j]; - if (projectile.active && projectile.owner == player.whoAmI && projectile.minion && projectile.type != ModContent.ProjectileType()) - { - minionCount += projectile.minionSlots; - } - } - viruliSlots = (int)((double)player.maxMinions - minionCount); - } - - public override bool CanUseItem(Player player) - { - return viruliSlots >= 1 && player.ownedProjectileCounts[Item.shoot] <= 0; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityUtils.KillShootProjectiles(true, type, player); - float damageMult = ((float)Math.Log(viruliSlots, 10f)) + 1f; - position = Main.MouseWorld; - velocity.X = 0; - velocity.Y = 0; - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, (int)(damage * damageMult), knockback, player.whoAmI, viruliSlots, 1f); + + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = (int)(Item.damage * damageMult); + Main.projectile[p].originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/WarloksMoonFist.cs b/Items/Weapons/Summon/WarloksMoonFist.cs index a44faf09ea..b9df367bea 100644 --- a/Items/Weapons/Summon/WarloksMoonFist.cs +++ b/Items/Weapons/Summon/WarloksMoonFist.cs @@ -1,10 +1,12 @@ -using Terraria.DataStructures; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Rarities; namespace CalamityMod.Items.Weapons.Summon { @@ -57,5 +59,16 @@ namespace CalamityMod.Items.Weapons.Summon } return false; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.GolemFist). + AddIngredient(10). + AddIngredient(5). + AddIngredient(5). + AddTile(TileID.LunarCraftingStation). + Register(); + } } } diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index cf8d8d720b..cc387e93b8 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -1057,6 +1057,7 @@ namespace CalamityMod RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); @@ -1101,6 +1102,7 @@ namespace CalamityMod RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 1ad795043b..a30e65604a 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -836,7 +836,6 @@ namespace CalamityMod.NPCs if (npc.daybreak) { int projAmt = 0; - int num7 = 4; for (int k = 0; k < Main.maxProjectiles; k++) { if (Main.projectile[k].active && Main.projectile[k].type == ProjectileID.Daybreak && Main.projectile[k].ai[0] == 1f && Main.projectile[k].ai[1] == npc.whoAmI) diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index d2f162039e..0aaadbba51 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -11,6 +11,7 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -823,6 +824,7 @@ namespace CalamityMod.NPCs.Crabulon ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), + ModContent.ItemType(), }; normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, weapons)); diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs index 921ce1d868..aab330c164 100644 --- a/NPCs/ExoMechs/Ares/AresGaussNuke.cs +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -35,36 +35,37 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); public AresCannonChargeParticleSet EnergyDrawer = new AresCannonChargeParticleSet(-1, 15, 40f, Color.Yellow); + public Vector2 CoreSpritePosition => NPC.Center + NPC.spriteDirection * NPC.rotation.ToRotationVector2() * 35f + (NPC.rotation + MathHelper.PiOver2).ToRotationVector2() * 5f; + // This stores the sound slot of the telegraph sound it makes, so it may be properly updated in terms of position. + public SlotId TelegraphSoundSlot; + // Number of frames on the X and Y axis - private const int maxFramesX = 9; - private const int maxFramesY = 12; + public const int maxFramesX = 9; + public const int maxFramesY = 12; // Counters for frames on the X and Y axis - private int frameX = 0; - private int frameY = 0; + public int frameX = 0; + public int frameY = 0; // Frame limit per animation, these are the specific frames where each animation ends - private const int normalFrameLimit = 11; - private const int firstStageGaussNukeChargeFrameLimit = 23; - private const int secondStageGaussNukeChargeFrameLimit = 35; - private const int finalStageGaussNukeChargeFrameLimit = 47; - private const int reloadFrameLimit = 107; + public const int normalFrameLimit = 11; + public const int firstStageGaussNukeChargeFrameLimit = 23; + public const int secondStageGaussNukeChargeFrameLimit = 35; + public const int finalStageGaussNukeChargeFrameLimit = 47; + public const int reloadFrameLimit = 107; // Default life ratio for the other mechs - private const float defaultLifeRatio = 5f; + public const float defaultLifeRatio = 5f; // Total duration of the gauss nuke telegraph - private const float gaussNukeTelegraphDuration = 216f; + public const float gaussNukeTelegraphDuration = 216f; // Total duration of the gauss nuke firing phase - private const float gaussNukeReloadDuration = 360f; + public const float gaussNukeReloadDuration = 360f; - //This stores the sound slot of the telegraph sound it makes, so it may be properly updated in terms of position. - private SlotId TelegraphSoundSlot; - - //Telegraph sound + // Telegraph sound. public static readonly SoundStyle TelSound = new("CalamityMod/Sounds/Custom/AresGaussNukeArmCharge"); public override void SetStaticDefaults() diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index f2834d054c..0be9087a40 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -35,35 +35,36 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); public AresCannonChargeParticleSet EnergyDrawer = new AresCannonChargeParticleSet(-1, 15, 40f, Color.OrangeRed); + public Vector2 CoreSpritePosition => NPC.Center + NPC.spriteDirection * NPC.rotation.ToRotationVector2() * 30f + (NPC.rotation + MathHelper.PiOver2).ToRotationVector2() * 15f; // Number of frames on the X and Y axis - private const int maxFramesX = 6; - private const int maxFramesY = 8; + public const int maxFramesX = 6; + public const int maxFramesY = 8; // Counters for frames on the X and Y axis - private int frameX = 0; - private int frameY = 0; + public int frameX = 0; + public int frameY = 0; // Frame limit per animation, these are the specific frames where each animation ends - private const int normalFrameLimit = 11; - private const int firstStageDeathrayChargeFrameLimit = 23; - private const int secondStageDeathrayChargeFrameLimit = 35; - private const int finalStageDeathrayChargeFrameLimit = 47; + public const int normalFrameLimit = 11; + public const int firstStageDeathrayChargeFrameLimit = 23; + public const int secondStageDeathrayChargeFrameLimit = 35; + public const int finalStageDeathrayChargeFrameLimit = 47; // Default life ratio for the other mechs - private const float defaultLifeRatio = 5f; + public const float defaultLifeRatio = 5f; // Total duration of the deathray telegraph - private const float deathrayTelegraphDuration = 144f; + public const float deathrayTelegraphDuration = 144f; // Total duration of the deathray - private const float deathrayDuration = 60f; + public const float deathrayDuration = 60f; - //This stores the sound slot of the telegraph sound it makes, so it may be properly updated in terms of position. - private SlotId DeathraySoundSlot; + // This stores the sound slot of the telegraph sound it makes, so it may be properly updated in terms of position. + public SlotId DeathraySoundSlot; - //Telegraph sound + // Telegraph sound. public static readonly SoundStyle TelSound = new("CalamityMod/Sounds/Custom/AresLaserArmCharge"); public override void SetStaticDefaults() diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index 7aa242ab8d..9746aab762 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -34,35 +34,36 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); public AresCannonChargeParticleSet EnergyDrawer = new AresCannonChargeParticleSet(-1, 15, 40f, Color.GreenYellow); + public Vector2 CoreSpritePosition => NPC.Center + NPC.spriteDirection * NPC.rotation.ToRotationVector2() * 30f + (NPC.rotation + MathHelper.PiOver2).ToRotationVector2() * 15f; // Number of frames on the X and Y axis - private const int maxFramesX = 6; - private const int maxFramesY = 8; + public const int maxFramesX = 6; + public const int maxFramesY = 8; // Counters for frames on the X and Y axis - private int frameX = 0; - private int frameY = 0; + public int frameX = 0; + public int frameY = 0; // Frame limit per animation, these are the specific frames where each animation ends - private const int normalFrameLimit = 11; - private const int firstStagePlasmaBoltChargeFrameLimit = 23; - private const int secondStagePlasmaBoltChargeFrameLimit = 35; - private const int finalStagePlasmaBoltChargeFrameLimit = 47; + public const int normalFrameLimit = 11; + public const int firstStagePlasmaBoltChargeFrameLimit = 23; + public const int secondStagePlasmaBoltChargeFrameLimit = 35; + public const int finalStagePlasmaBoltChargeFrameLimit = 47; // Default life ratio for the other mechs - private const float defaultLifeRatio = 5f; + public const float defaultLifeRatio = 5f; // Total duration of the plasma bolt telegraph - private const float plasmaBoltTelegraphDuration = 144f; + public const float plasmaBoltTelegraphDuration = 144f; // Total duration of the plasma bolt firing phase - private const float plasmaBoltDuration = 120f; + public const float plasmaBoltDuration = 120f; - //This stores the sound slot of the telegraph sound it makes, so it may be properly updated in terms of position. - private SlotId TelegraphSoundSlot; + // This stores the sound slot of the telegraph sound it makes, so it may be properly updated in terms of position. + public SlotId TelegraphSoundSlot; - //Telegraph sound + // Telegraph sound. public static readonly SoundStyle TelSound = new("CalamityMod/Sounds/Custom/AresPlasmaArmCharge"); public override void SetStaticDefaults() diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index e559c86509..b02b243099 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -34,35 +34,36 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); public AresCannonChargeParticleSet EnergyDrawer = new AresCannonChargeParticleSet(-1, 15, 40f, Color.Aqua); + public Vector2 CoreSpritePosition => NPC.Center + NPC.spriteDirection * NPC.rotation.ToRotationVector2() * 35f + (NPC.rotation + MathHelper.PiOver2).ToRotationVector2() * 5f; // Number of frames on the X and Y axis - private const int maxFramesX = 6; - private const int maxFramesY = 8; + public const int maxFramesX = 6; + public const int maxFramesY = 8; // Counters for frames on the X and Y axis - private int frameX = 0; - private int frameY = 0; + public int frameX = 0; + public int frameY = 0; // Frame limit per animation, these are the specific frames where each animation ends - private const int normalFrameLimit = 11; - private const int firstStageTeslaOrbChargeFrameLimit = 23; - private const int secondStageTeslaOrbChargeFrameLimit = 35; - private const int finalStageTeslaOrbChargeFrameLimit = 47; + public const int normalFrameLimit = 11; + public const int firstStageTeslaOrbChargeFrameLimit = 23; + public const int secondStageTeslaOrbChargeFrameLimit = 35; + public const int finalStageTeslaOrbChargeFrameLimit = 47; // Default life ratio for the other mechs - private const float defaultLifeRatio = 5f; + public const float defaultLifeRatio = 5f; // Total duration of the tesla orb telegraph - private const float teslaOrbTelegraphDuration = 144f; + public const float teslaOrbTelegraphDuration = 144f; // Total duration of the tesla orb firing phase - private const float teslaOrbDuration = 120f; + public const float teslaOrbDuration = 120f; - //This stores the sound slot of the telegraph sound it makes, so it may be properly updated in terms of position. - private SlotId TelegraphSoundSlot; + // This stores the sound slot of the telegraph sound it makes, so it may be properly updated in terms of position. + public SlotId TelegraphSoundSlot; - //Telegraph sound + // Telegraph sound. public static readonly SoundStyle TelSound = new("CalamityMod/Sounds/Custom/AresTeslaArmCharge"); public override void SetStaticDefaults() diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index b3d2eb1f35..120b21ee90 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -2585,7 +2585,7 @@ namespace CalamityMod.Projectiles if (modPlayer.scuttlersJewel && stealthStrike && modPlayer.scuttlerCooldown <= 0) { - int damage = (int)player.GetTotalDamage().ApplyTo(20); + int damage = (int)player.GetTotalDamage().ApplyTo(15); int spike = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileType(), damage, projectile.knockBack, projectile.owner); Main.projectile[spike].frame = 4; if (spike.WithinBounds(Main.maxProjectiles)) diff --git a/Projectiles/Summon/AtlasMunitionsAutocannon.cs b/Projectiles/Summon/AtlasMunitionsAutocannon.cs index 9f2bb9455d..386f7e1504 100644 --- a/Projectiles/Summon/AtlasMunitionsAutocannon.cs +++ b/Projectiles/Summon/AtlasMunitionsAutocannon.cs @@ -310,5 +310,11 @@ namespace CalamityMod.Projectiles.Summon // Don't die on tile collision. public override bool OnTileCollide(Vector2 oldVelocity) => false; + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = false; + return true; + } } } diff --git a/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs b/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs index 74d4e3fb7b..2e87f05568 100644 --- a/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs +++ b/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs @@ -109,8 +109,8 @@ namespace CalamityMod.Projectiles.Summon SmokeDrawer.BaseMoveRotation = MathHelper.PiOver2 + Projectile.spriteDirection * (Projectile.position.X - Projectile.oldPosition.X) * 0.04f; SmokeDrawer.Update(); - // Cool down if not being fired. - if (!IsFiring) + // Cool down if not being held. + if (!BeingHeld) HeatInterpolant = MathHelper.Clamp(HeatInterpolant - 1f / AtlasMunitionsBeacon.HeatDissipationTime, 0f, 1f); if (BeingHeld) @@ -186,7 +186,8 @@ namespace CalamityMod.Projectiles.Summon // Be picked up by nearby players if they right click and are holding the appropriate item. bool rightClick = Main.mouseRight && Main.mouseRightRelease; - if (Main.LocalPlayer.WithinRange(Projectile.Center, AtlasMunitionsBeacon.PickupRange) && rightClick && Main.LocalPlayer.ActiveItem().type == ModContent.ItemType()) + bool correctItem = Main.LocalPlayer.ActiveItem().type == ModContent.ItemType(); + if (Main.LocalPlayer.WithinRange(Projectile.Center, AtlasMunitionsBeacon.PickupRange) && rightClick && correctItem && HeatInterpolant < 0.5f) { BeingHeld = true; Projectile.owner = Main.myPlayer; @@ -257,9 +258,9 @@ namespace CalamityMod.Projectiles.Summon int laserCount = 3; int laserDamage = Projectile.damage; int laserID = ModContent.ProjectileType(); - Vector2 laserVelocity = Projectile.velocity.RotatedBy(AtlasMunitionsBeacon.OverdriveProjectileAngularRandomness) * 9.25f; for (int i = 0; i < laserCount; i++) { + Vector2 laserVelocity = Projectile.velocity.RotatedByRandom(AtlasMunitionsBeacon.OverdriveProjectileAngularRandomness) * 9.25f; Vector2 laserSpawnOffset = Projectile.velocity * 66f + (MathHelper.TwoPi * i / laserCount + MathHelper.PiOver2 / laserCount).ToRotationVector2() * 10f; Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center + laserSpawnOffset, laserVelocity, laserID, laserDamage, 0f, Projectile.owner); } diff --git a/Projectiles/Summon/AtlasMunitionsDropPod.cs b/Projectiles/Summon/AtlasMunitionsDropPod.cs index bd6cf5cb24..6ea7986bf0 100644 --- a/Projectiles/Summon/AtlasMunitionsDropPod.cs +++ b/Projectiles/Summon/AtlasMunitionsDropPod.cs @@ -140,6 +140,12 @@ namespace CalamityMod.Projectiles.Summon public override bool OnTileCollide(Vector2 oldVelocity) => false; + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = false; + return true; + } + public override bool PreDraw(ref Color lightColor) { Texture2D texture = ModContent.Request(Texture).Value; diff --git a/Projectiles/Summon/BabyPlaguebringer.cs b/Projectiles/Summon/BabyPlaguebringer.cs index 416f676473..fe6465b90a 100644 --- a/Projectiles/Summon/BabyPlaguebringer.cs +++ b/Projectiles/Summon/BabyPlaguebringer.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 15; - Projectile.extraUpdates = 0; + Projectile.MaxUpdates = 2; Projectile.minionSlots = 0f; Projectile.timeLeft = 360; Projectile.penetrate = 3; diff --git a/Projectiles/Summon/BrimstoneDartSummon.cs b/Projectiles/Summon/BrimstoneDartSummon.cs index 15c8b04ed8..f469afcd1e 100644 --- a/Projectiles/Summon/BrimstoneDartSummon.cs +++ b/Projectiles/Summon/BrimstoneDartSummon.cs @@ -28,8 +28,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.minionSlots = 0f; Projectile.penetrate = 1; Projectile.timeLeft = 120; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; + Projectile.Opacity = 0.5f; Projectile.DamageType = DamageClass.Summon; } diff --git a/Projectiles/Summon/LostSoulGiant.cs b/Projectiles/Summon/LostSoulGiant.cs index b4f5df8a06..77b5c50114 100644 --- a/Projectiles/Summon/LostSoulGiant.cs +++ b/Projectiles/Summon/LostSoulGiant.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Summon public static void HomeInOnTarget(Projectile projectile, NPC target) { - float speed = MathHelper.Lerp(11f, 21f, (float)Math.Sin(projectile.identity % 7f / 7f * MathHelper.TwoPi) * 0.5f + 0.5f); + float speed = MathHelper.Lerp(21f, 31f, (float)Math.Sin(projectile.identity % 7f / 7f * MathHelper.TwoPi) * 0.5f + 0.5f); projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(target.Center) * speed, 0.075f); } diff --git a/Projectiles/Summon/PlagueBeeSmall.cs b/Projectiles/Summon/PlagueBeeSmall.cs index 057c740773..69ca975068 100644 --- a/Projectiles/Summon/PlagueBeeSmall.cs +++ b/Projectiles/Summon/PlagueBeeSmall.cs @@ -25,6 +25,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 420; Projectile.ignoreWater = true; Projectile.minion = true; + Projectile.MaxUpdates = 2; Projectile.DamageType = DamageClass.Summon; } @@ -101,7 +102,7 @@ namespace CalamityMod.Projectiles.Summon center.X = Projectile.Center.X + Projectile.velocity.X * 100f; center.Y = Projectile.Center.Y + Projectile.velocity.Y * 100f; } - float speed = 10f; + float speed = 15f; float velocityTweak = 0.14f; Vector2 projPos = Projectile.Center; Vector2 velocity = center - projPos; diff --git a/Projectiles/Summon/PlaguePrincess.cs b/Projectiles/Summon/PlaguePrincess.cs index 4aaa572e7a..7d0c16ecd6 100644 --- a/Projectiles/Summon/PlaguePrincess.cs +++ b/Projectiles/Summon/PlaguePrincess.cs @@ -6,22 +6,45 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items.Weapons.Summon; +using Microsoft.Xna.Framework.Graphics; +using Terraria.Audio; +using CalamityMod.Sounds; +using CalamityMod.Particles; +using CalamityMod.NPCs.PlaguebringerGoliath; namespace CalamityMod.Projectiles.Summon { public class PlaguePrincess : ModProjectile { - private bool dust = true; - private int mode = 0; //0 missiles, 1 mini bees, 2 charging - private int modeCounter = 0; - private int AIint = 0; + public enum ViriliAIState + { + HoverNearOwner, + ChargeAtEnemies, + BombardEnemiesWithRockets, + SummonPlagueBeesOnEnemies + } + + public bool UseAfterimages; + + public ViriliAIState CurrentState + { + get => (ViriliAIState)Projectile.ai[0]; + set => Projectile.ai[0] = (int)value; + } + + public Player Owner => Main.player[Projectile.owner]; + + public ref float AITimer => ref Projectile.ai[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Virili"); Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -31,336 +54,347 @@ namespace CalamityMod.Projectiles.Summon Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.minionSlots = 1f; - Projectile.timeLeft = 18000; + Projectile.minionSlots = InfectedRemote.MinionSlotRequirement; + Projectile.timeLeft = 90000; Projectile.penetrate = -1; Projectile.tileCollide = false; - Projectile.timeLeft *= 5; Projectile.minion = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = InfectedRemote.DefaultIframes; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Summon; } public override void AI() { - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); + // Decide whether the minion should still exist. + HandleMinionBools(); - Projectile.minionSlots = Projectile.ai[0]; + // Decide frames. + DecideFrames(); - //bools and crap - bool correctMinion = Projectile.type == ModContent.ProjectileType(); - player.AddBuff(ModContent.BuffType(), 3600); - if (correctMinion) + // Reset afterimages, extra updates, and i-frames. + UseAfterimages = false; + Projectile.MaxUpdates = 1; + Projectile.localNPCHitCooldown = InfectedRemote.DefaultIframes; + + NPC potentialTarget = Projectile.Center.MinionHoming(InfectedRemote.EnemyTargetingRange, Owner); + switch (CurrentState) { - if (player.dead) - { - modPlayer.virili = false; - } - if (modPlayer.virili) - { + case ViriliAIState.HoverNearOwner: + DoBehavior_HoverNearOwner(potentialTarget); + break; + case ViriliAIState.ChargeAtEnemies: + DoBehavior_ChargeAtEnemies(potentialTarget); + break; + case ViriliAIState.BombardEnemiesWithRockets: + DoBehavior_BombardEnemiesWithRockets(potentialTarget); + break; + case ViriliAIState.SummonPlagueBeesOnEnemies: + DoBehavior_SummonPlagueBeesOnEnemies(potentialTarget); + break; + } + AITimer++; + } + + public void HandleMinionBools() + { + Owner.AddBuff(ModContent.BuffType(), 3600); + if (Projectile.type == ModContent.ProjectileType()) + { + if (Owner.dead) + Owner.Calamity().virili = false; + + if (Owner.Calamity().virili) Projectile.timeLeft = 2; - } } + } - //dust and flexible damage - if (dust) - { - int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) - { - int num503 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 89, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - dust = false; - } - - //framing + public void DecideFrames() + { Projectile.frameCounter++; - if (Projectile.frameCounter > 6) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame >= Main.projFrames[Projectile.type]) - { - Projectile.frame = 0; - } + Projectile.frame = Projectile.frameCounter / 6 % Main.projFrames[Projectile.type]; + } - //direction - if ((double)Math.Abs(Projectile.velocity.X) > 0.2) - { - Projectile.spriteDirection = -Projectile.direction; - } + public void DoBehavior_HoverNearOwner(NPC potentialTarget) + { + if (Projectile.WithinRange(Owner.Center, 160f)) + return; - //Lighting - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(Projectile.Center, 0f * num, 1.25f * num, 0f * num); + // Hover near the owner. + Projectile.velocity = (Projectile.velocity * 34f + Projectile.SafeDirectionTo(Owner.Center) * 17f) / 35f; - //change modes every 10 seconds - modeCounter++; - if (modeCounter >= 600) + // Teleport to the owner if sufficiently far away. + if (!Projectile.WithinRange(Owner.Center, 2500f)) { - modeCounter = 0; - mode++; - if (mode > 2) - mode = 0; - } - - //anti sticking movement - Projectile.MinionAntiClump(); - //anti-sticking also applies to the player - float antiStickFloat = 0.05f; - if (Projectile.position.X < player.position.X) - { - Projectile.velocity.X -= antiStickFloat; - } - else - { - Projectile.velocity.X += antiStickFloat; - } - if (Projectile.position.Y < player.position.Y) - { - Projectile.velocity.Y -= antiStickFloat; - } - else - { - Projectile.velocity.Y += antiStickFloat; - } - - bool cancelAttack = false; - if (mode == 2) - { - if (AIint == 2) - { - Projectile.ai[1] += 1f; - Projectile.extraUpdates = 2; - if (Projectile.ai[1] > 30f) - { - Projectile.ai[1] = 1f; - AIint = 0; - Projectile.extraUpdates = 1; - Projectile.numUpdates = 0; - Projectile.netUpdate = true; - } - else - { - cancelAttack = true; - } - } - else - { - Projectile.extraUpdates = 1; - } - if (cancelAttack) - { - return; - } - } - if (mode == 0 || mode == 1) - { - Projectile.extraUpdates = 1; - if (AIint == 2) - AIint = 0; - } - - float num633 = 1040f; - float num636 = 400f; //150 - Vector2 targetLocation = Projectile.position; - bool targetFound = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(Projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, Projectile.Center); - if ((!targetFound && num646 < num633) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - targetLocation = npc.Center; - targetFound = true; - } - } - } - if (!targetFound) - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(Projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, Projectile.Center); - if ((!targetFound && num646 < num633) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = num646; - targetLocation = nPC2.Center; - targetFound = true; - } - } - } - } - - //head back to player if too far - if (Vector2.Distance(player.Center, Projectile.Center) > 1200f) - { - AIint = 1; + Projectile.Center = Owner.Center; + Projectile.velocity *= 0.3f; Projectile.netUpdate = true; } - if (targetFound && AIint == 0) - { - Vector2 targetVector = targetLocation - Projectile.Center; - float targetDist = targetVector.Length(); - targetVector.Normalize(); - if (targetDist > 200f) - { - float scaleFactor2 = 8f; - targetVector *= scaleFactor2; - Projectile.velocity = (Projectile.velocity * 40f + targetVector) / 41f; - } - else if (mode == 2) //charging - { - float scaleFactor3 = 4f; - targetVector *= -scaleFactor3; - Projectile.velocity = (Projectile.velocity * 40f + targetVector) / 41f; - } - else if (Projectile.velocity.Y > -1f) - Projectile.velocity.Y -= 0.1f; - } - else //idle movement - { - bool returningToPlayer = false; - if (!returningToPlayer) - { - returningToPlayer = AIint == 1; - } + if (Math.Abs(Projectile.velocity.X) > 0.2f) + Projectile.spriteDirection = Math.Sign(Projectile.velocity.X); - //set minion speed - float speedFloat = 5f; //6 - if (returningToPlayer) - { - speedFloat = 12f; //15 - } - Vector2 projVector = Projectile.Center; - Vector2 playerVector = player.Center - projVector + new Vector2(0, -60f); //-60 - float playerDist = playerVector.Length(); - if (playerDist > 200f && speedFloat < 6.5f) //200 and 8 - { - speedFloat = 6.5f; //8 - } - if (playerDist < num636 && returningToPlayer && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) - { - AIint = 0; - Projectile.netUpdate = true; - } - if (playerDist > 2000f) //if too far, teleport to player - { - Projectile.position.X = Main.player[Projectile.owner].Center.X - (float)(Projectile.width / 2); - Projectile.position.Y = Main.player[Projectile.owner].Center.Y - (float)(Projectile.height / 2); - Projectile.netUpdate = true; - } - if (playerDist > 70f) - { - playerVector.Normalize(); - playerVector *= speedFloat; - Projectile.velocity = (Projectile.velocity * 40f + playerVector) / 41f; - } - else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) - { - Projectile.velocity.X = -0.18f; - Projectile.velocity.Y = -0.08f; - } - } - - //increment attack cooldown - float cooldown = 100f; - if (mode == 0) - cooldown = 200f; - else if (mode == 1) - cooldown = 110f; - else if (mode == 2) - cooldown = 80f; - - if (Projectile.ai[1] > 0f) + if (potentialTarget is not null) { - Projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (Projectile.ai[1] > cooldown) - { - Projectile.ai[1] = 0f; + CurrentState = ViriliAIState.ChargeAtEnemies; + AITimer = 0f; Projectile.netUpdate = true; } - if (AIint == 0) + + // Stop rotating. + Projectile.rotation = Projectile.rotation.AngleTowards(0f, 0.1f); + } + + public void DoBehavior_ChargeAtEnemies(NPC target) + { + int hoverTime = 18; + int chargeTime = 16; + int slowdownTime = 15; + int chargeCount = 6; + float hoverSpeed = 17f; + + // Exit the attack state if Virili no longer has a valid target. + if (target is null) { - if (mode == 0) + ReturnToIdleState(); + return; + } + + // Use more extra updates and less i-frames. + Projectile.MaxUpdates = InfectedRemote.MaxUpdatesWhenCharging; + Projectile.localNPCHitCooldown = InfectedRemote.ChargeIframes; + + float wrappedAttackTimer = AITimer % (hoverTime + chargeTime + slowdownTime); + + // Hover into position, to the top left/right of the target. + if (wrappedAttackTimer < hoverTime) + { + // Look at the target. + Projectile.spriteDirection = (target.Center.X > Projectile.Center.X).ToDirectionInt(); + HoverToPosition(target.Center + new Vector2(Projectile.spriteDirection * -270f, -150f), hoverSpeed); + } + else + { + UseAfterimages = true; + if (wrappedAttackTimer < hoverTime + chargeTime) { - if (targetFound && Projectile.ai[1] == 0f) + // Create anime-esque streaks during the dash. + if (wrappedAttackTimer % 2f == 1f && wrappedAttackTimer >= hoverTime + 3f) { - Projectile.ai[1] += 1f; - float scaleFactor4 = 14f; - int projType = ModContent.ProjectileType(); - if (Main.myPlayer == Projectile.owner && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, targetLocation, 0, 0)) - { - Vector2 projVect = targetLocation - Projectile.Center; - projVect.Normalize(); - projVect *= scaleFactor4; - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, projVect, projType, (int)(Projectile.damage * 0.6f), 0f, Main.myPlayer, 0f, 0f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = (int)(Projectile.originalDamage * 0.6); - Projectile.netUpdate = true; - } + Vector2 particleVelocity = -Projectile.velocity.SafeNormalize(Vector2.UnitY) * Main.rand.NextFloat(6f, 10f); + var energyLeak = new SquishyLightParticle(Projectile.Center + Main.rand.NextVector2Circular(50f, 50f) + Projectile.velocity * 5f, particleVelocity, Main.rand.NextFloat(0.45f, 0.87f), Color.ForestGreen, 30, 3.4f, 4.5f); + GeneralParticleHandler.SpawnParticle(energyLeak); } + + if (Projectile.velocity.Length() < InfectedRemote.RegularChargeSpeed) + Projectile.velocity *= 1.1f; } - else if (mode == 1) + } + + // Dash extremely quickly at the target. + if (wrappedAttackTimer == hoverTime) + { + SoundEngine.PlaySound(CommonCalamitySounds.ELRFireSound, Projectile.Center); + Projectile.velocity = CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, target, InfectedRemote.RegularChargeSpeed * 0.55f, 8); + Projectile.netUpdate = true; + } + + // Slow down rapidly to a crawl after the charge. + if (wrappedAttackTimer >= hoverTime + chargeTime) + Projectile.velocity *= 0.825f; + + // Determine rotation. + Projectile.rotation = Projectile.velocity.X * 0.014f; + + // Transition to the next attack state once enough charges have happened. + if (AITimer >= (hoverTime + chargeTime + slowdownTime) * chargeCount) + { + AITimer = 0f; + Projectile.velocity *= 0.3f; + CurrentState = ViriliAIState.BombardEnemiesWithRockets; + Projectile.netUpdate = true; + } + } + + public void DoBehavior_BombardEnemiesWithRockets(NPC target) + { + int hoverTime = 50; + int chargeTime = 50; + int chargeCount = 6; + float hoverSpeed = 17f; + float rocketShootSpeed = 7f; + + // Exit the attack state if Virili no longer has a valid target. + if (target is null) + { + ReturnToIdleState(); + return; + } + + // Use more extra updates. + Projectile.MaxUpdates = InfectedRemote.MaxUpdatesWhenCharging; + + float wrappedAttackTimer = AITimer % (hoverTime + chargeTime); + + // Hover into position, to the top left/right of the target. + if (wrappedAttackTimer < hoverTime) + { + // Look at the target. + Projectile.spriteDirection = (target.Center.X > Projectile.Center.X).ToDirectionInt(); + + Vector2 hoverDestination = target.Center + new Vector2(Projectile.spriteDirection * -480f, -280f); + HoverToPosition(hoverDestination, hoverSpeed); + if (Projectile.WithinRange(hoverDestination, 150f)) { - if (targetFound && Projectile.ai[1] == 0f) + Projectile.velocity *= 0.85f; + Projectile.Center = Vector2.Lerp(Projectile.Center, hoverDestination, 0.03f); + } + } + else + { + UseAfterimages = true; + if (wrappedAttackTimer < hoverTime + chargeTime) + { + // Create anime-esque streaks during the dash. + if (wrappedAttackTimer % 2f == 1f && wrappedAttackTimer >= hoverTime + 3f) { - Projectile.ai[1] += 1f; - int smallBee = ModContent.ProjectileType(); - int bigBee = ModContent.ProjectileType(); - int projType = smallBee; - if (player.ownedProjectileCounts[bigBee] < 1 && Main.rand.NextBool(3)) - projType = bigBee; - if (Main.myPlayer == Projectile.owner && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, targetLocation, 0, 0)) + Vector2 particleVelocity = -Projectile.velocity.SafeNormalize(Vector2.UnitY) * Main.rand.NextFloat(6f, 10f); + var energyLeak = new SquishyLightParticle(Projectile.Center + Main.rand.NextVector2Circular(50f, 50f) + Projectile.velocity * 5f, particleVelocity, Main.rand.NextFloat(0.45f, 0.87f), Color.ForestGreen, 30, 3.4f, 4.5f); + GeneralParticleHandler.SpawnParticle(energyLeak); + } + + // Release rockets. + if (Main.myPlayer == Projectile.owner && wrappedAttackTimer % InfectedRemote.RocketShootRate == InfectedRemote.RocketShootRate - 1f) + { + Vector2 rocketSpawnPosition = Projectile.Center + Vector2.UnitY * Projectile.scale * 48f; + Vector2 rocketVelocity = (target.Center - rocketSpawnPosition).SafeNormalize(Vector2.UnitY) * rocketShootSpeed; + int rocket = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, rocketVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * InfectedRemote.RocketDamageFactor), 3f, Projectile.owner); + if (Main.projectile.IndexInRange(rocket)) + Main.projectile[rocket].originalDamage = (int)(Projectile.originalDamage * InfectedRemote.RocketDamageFactor); + } + + if (Projectile.velocity.Length() < InfectedRemote.HorizontalRocketChargeSpeed) + Projectile.velocity *= 1.1f; + } + } + + // Dash extremely quickly above the target. + if (wrappedAttackTimer == hoverTime) + { + SoundEngine.PlaySound(PlaguebringerGoliath.BarrageLaunchSound, Projectile.Center); + Projectile.velocity = Vector2.UnitX * InfectedRemote.HorizontalRocketChargeSpeed * Projectile.spriteDirection * 0.55f; + Projectile.netUpdate = true; + } + + // Transition to the next attack state once enough charges have happened. + if (AITimer >= (hoverTime + chargeTime) * chargeCount) + { + AITimer = 0f; + Projectile.velocity *= 0.3f; + CurrentState = ViriliAIState.SummonPlagueBeesOnEnemies; + Projectile.netUpdate = true; + } + } + + public void DoBehavior_SummonPlagueBeesOnEnemies(NPC target) + { + int shootTime = 300; + float hoverSpeed = 23f; + + // Exit the attack state if Virili no longer has a valid target. + if (target is null) + { + ReturnToIdleState(); + return; + } + + // Hover above the target. + Vector2 hoverDestination = target.Center - Vector2.UnitY * 350f; + HoverToPosition(hoverDestination, hoverSpeed); + if (Projectile.WithinRange(hoverDestination, 240f)) + { + Projectile.velocity *= 0.7f; + Projectile.Center = Vector2.Lerp(Projectile.Center, hoverDestination, 0.04f); + + // Release bees. + if (Main.myPlayer == Projectile.owner && AITimer % InfectedRemote.BeeShootRate == InfectedRemote.BeeShootRate - 1f) + { + int smallBee = ModContent.ProjectileType(); + int bigBee = ModContent.ProjectileType(); + int projType = smallBee; + if (Owner.ownedProjectileCounts[bigBee] <= 0 && Main.rand.NextBool(2)) + projType = bigBee; + + if (Main.myPlayer == Projectile.owner && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, target.Center, 0, 0)) + { + int beeCount = projType == bigBee ? 1 : 4; + for (int i = 0; i < beeCount; i++) { - for (int beeIndex = 0; beeIndex < (projType == bigBee ? 1 : Main.rand.Next(1,5)); beeIndex++) + Vector2 beeVelocity = Projectile.SafeDirectionTo(target.Center) * 6f; + int bee = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, beeVelocity, projType, (int)(Projectile.damage * InfectedRemote.BeeDamageFactor), 0f, Projectile.owner); + if (Main.projectile.IndexInRange(bee)) { - Vector2 projVect2 = targetLocation - Projectile.Center; - projVect2.Normalize(); - float SpeedX = projVect2.X + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = projVect2.Y + (float)Main.rand.Next(-30, 31) * 0.05f; - int bee = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, SpeedX, SpeedY, projType, (int)(Projectile.damage * 0.8f), 0f, Main.myPlayer, 0f, 0f); if (projType == bigBee) - { Main.projectile[bee].frame = 2; - } - if (Main.projectile.IndexInRange(bee)) - Main.projectile[bee].originalDamage = (int)(Projectile.originalDamage * 0.8f); - Projectile.netUpdate = true; + Main.projectile[bee].originalDamage = (int)(Projectile.originalDamage * InfectedRemote.BeeDamageFactor); } - } - } - } - else if (mode == 2) - { - if (Projectile.ai[1] == 0f && targetFound && num633 < 500f) - { - Projectile.ai[1] += 1f; - if (Main.myPlayer == Projectile.owner) - { - AIint = 2; - Vector2 targetVect = targetLocation - Projectile.Center; - targetVect.Normalize(); - Projectile.velocity = targetVect * 8f; Projectile.netUpdate = true; } } } } + + if (AITimer >= shootTime) + { + AITimer = 0f; + Projectile.velocity *= 0.3f; + CurrentState = ViriliAIState.ChargeAtEnemies; + Projectile.netUpdate = true; + } + } + + public void HoverToPosition(Vector2 hoverDestination, float hoverSpeed) + { + Vector2 baseHoverVelocity = Projectile.SafeDirectionTo(hoverDestination) * hoverSpeed; + + // If not close to the hover destination, rapidly zoom towards it. Otherwise, hover in place. + if (!Projectile.WithinRange(hoverDestination, 150f)) + { + float hyperspeedInterpolant = Utils.GetLerpValue(Projectile.Distance(hoverDestination), 500f, 960f, true); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Vector2.Lerp(baseHoverVelocity * 1.4f, (hoverDestination - Projectile.Center) * 0.1f, hyperspeedInterpolant), 0.2f); + } + else + { + Projectile.velocity = (Projectile.velocity * 29f + baseHoverVelocity) / 30f; + Projectile.velocity = Projectile.velocity.MoveTowards(baseHoverVelocity, hoverSpeed / 11f); + } + } + + public void ReturnToIdleState() + { + CurrentState = ViriliAIState.HoverNearOwner; + Projectile.netUpdate = true; + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request(Texture).Value; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + if (UseAfterimages) + { + for (int i = 0; i < Projectile.oldPos.Length; i++) + { + Color afterimageDrawColor = Color.ForestGreen with { A = 25 } * Projectile.Opacity * (1f - i / (float)Projectile.oldPos.Length); + Vector2 afterimageDrawPosition = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition; + Main.EntitySpriteDraw(texture, afterimageDrawPosition, frame, afterimageDrawColor, Projectile.rotation, origin, Projectile.scale, direction, 0); + } + } + Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -373,6 +407,6 @@ namespace CalamityMod.Projectiles.Summon target.AddBuff(ModContent.BuffType(), 180); } - public override bool? CanDamage() => mode == 2; + public override bool? CanDamage() => CurrentState == ViriliAIState.ChargeAtEnemies ? null : false; } } diff --git a/Projectiles/Summon/PuffCloud.cs b/Projectiles/Summon/PuffCloud.cs index d5cf51400d..9a43358d21 100644 --- a/Projectiles/Summon/PuffCloud.cs +++ b/Projectiles/Summon/PuffCloud.cs @@ -18,11 +18,10 @@ namespace CalamityMod.Projectiles.Summon { Projectile.width = Projectile.height = 16; Projectile.friendly = true; - Projectile.minion = true; - Projectile.minionSlots = 0f; Projectile.ignoreWater = true; Projectile.penetrate = 1; Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Summon; } public override void AI() diff --git a/Projectiles/Summon/PuffWarrior.cs b/Projectiles/Summon/PuffWarrior.cs index 4908f63cd8..69d0da7ca9 100644 --- a/Projectiles/Summon/PuffWarrior.cs +++ b/Projectiles/Summon/PuffWarrior.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Summon { public Player Owner => Main.player[Projectile.owner]; - public Tile GroundTile => CalamityUtils.ParanoidTileRetrieval((int)(Projectile.Bottom.X / 16), (int)(Projectile.Bottom.Y / 16) + 1); + public Tile GroundTile => CalamityUtils.ParanoidTileRetrieval((int)Projectile.Bottom.X / 16, (int)Projectile.Bottom.Y / 16); public bool Jumping => !GroundTile.IsTileSolidGround() || Math.Abs(Projectile.velocity.Y) > 5f; @@ -41,6 +41,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 18; Projectile.tileCollide = true; + Projectile.DamageType = DamageClass.Summon; } public override void AI() @@ -57,7 +58,9 @@ namespace CalamityMod.Projectiles.Summon else HopToTarget(potentialTarget); - Projectile.spriteDirection = (Projectile.velocity.X > 0).ToDirectionInt(); + if (Math.Abs(Projectile.velocity.X) > 0.02f) + Projectile.spriteDirection = -Projectile.direction; + Projectile.rotation = Jumping ? Projectile.rotation + MathHelper.Pi / 10f * Projectile.spriteDirection : 0f; while (Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) diff --git a/Projectiles/Summon/SeekerSummonProj.cs b/Projectiles/Summon/SeekerSummonProj.cs index c25bf531c6..bcf389d7ea 100644 --- a/Projectiles/Summon/SeekerSummonProj.cs +++ b/Projectiles/Summon/SeekerSummonProj.cs @@ -98,9 +98,20 @@ namespace CalamityMod.Projectiles.Summon internal void FlyNearOwner() { - // Make an imp laugh sound every so often. + // Make an imp laugh sound every so often if you're the first seeker in the projectile array. if (Main.rand.NextBool(1600)) - SoundEngine.PlaySound(SoundID.DD2_KoboldFlyerHurt); + { + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile seeker = Main.projectile[i]; + if (seeker.type == Projectile.type) + { + if (seeker == Projectile) + SoundEngine.PlaySound(SoundID.DD2_KoboldFlyerHurt); + break; + } + } + } Vector2 destination = Owner.Center + (MathHelper.TwoPi * CircleAngleRatio / Owner.ownedProjectileCounts[Type] - MathHelper.PiOver2).ToRotationVector2() * 310f; Projectile.Center = Vector2.Lerp(Projectile.Center, destination, 0.03f); diff --git a/Projectiles/Typeless/BossRushEndEffectThing.cs b/Projectiles/Typeless/BossRushEndEffectThing.cs index a6c7059a7e..4f2b289538 100644 --- a/Projectiles/Typeless/BossRushEndEffectThing.cs +++ b/Projectiles/Typeless/BossRushEndEffectThing.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { if (Time == 25f) - SoundEngine.PlaySound(BossRushEvent.EndSound, Main.LocalPlayer.Center); + SoundEngine.PlaySound(BossRushEvent.VictorySound, Main.LocalPlayer.Center); Projectile.Center = Owner.Center; BossRushEvent.SyncEndTimer((int)Time); diff --git a/Projectiles/Typeless/BossRushTierAnimation.cs b/Projectiles/Typeless/BossRushTierAnimation.cs index 94a3e49fed..7d64a9b08a 100644 --- a/Projectiles/Typeless/BossRushTierAnimation.cs +++ b/Projectiles/Typeless/BossRushTierAnimation.cs @@ -2,6 +2,8 @@ using Terraria.ModLoader; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria.Audio; +using static CalamityMod.Events.BossRushEvent; namespace CalamityMod.Projectiles.Typeless { @@ -35,6 +37,28 @@ namespace CalamityMod.Projectiles.Typeless Projectile.frame = Projectile.frameCounter / FrameChangeRate; if (Projectile.frame >= TotalFrames) Projectile.frame = TotalFrames; + + // Play tier transition sounds on the first frame. + if (Projectile.localAI[0] == 0f) + { + float volume = 1.8f; + switch (Tier) + { + case 2: + SoundEngine.PlaySound(Tier2TransitionSound with { Volume = volume }, Main.LocalPlayer.Center); + break; + case 3: + SoundEngine.PlaySound(Tier3TransitionSound with { Volume = volume }, Main.LocalPlayer.Center); + break; + case 4: + SoundEngine.PlaySound(Tier4TransitionSound with { Volume = volume }, Main.LocalPlayer.Center); + break; + case 5: + SoundEngine.PlaySound(Tier5TransitionSound with { Volume = volume }, Main.LocalPlayer.Center); + break; + } + Projectile.localAI[0] = 1f; + } } public override Color? GetAlpha(Color lightColor) => Color.White * Projectile.Opacity; diff --git a/Projectiles/Typeless/TerminusHoldout.cs b/Projectiles/Typeless/TerminusHoldout.cs index b9d8479e49..14ab0a8fa3 100644 --- a/Projectiles/Typeless/TerminusHoldout.cs +++ b/Projectiles/Typeless/TerminusHoldout.cs @@ -7,15 +7,22 @@ using Terraria.GameContent.Events; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using ReLogic.Utilities; namespace CalamityMod.Projectiles.Typeless { public class TerminusHoldout : ModProjectile { + public SlotId ActivationSoundSlot; + public Player Owner => Main.player[Projectile.owner]; + public ref float Time => ref Projectile.ai[0]; + public const int Lifetime = 300; + public override string Texture => "CalamityMod/Items/SummonItems/Terminus"; + public override void SetDefaults() { Projectile.width = 50; @@ -35,6 +42,8 @@ namespace CalamityMod.Projectiles.Typeless // Reset the boss rush timer to what it would normally be if disabling is done prematurely. if (BossRushEvent.BossRushActive || BossRushEvent.StartTimer > 0) BossRushEvent.SyncStartTimer(BossRushEvent.StartEffectTotalTime); + if (SoundEngine.TryGetActiveSound(ActivationSoundSlot, out var t) && t.IsPlaying) + t.Stop(); CreateMysticDeathDust(); Projectile.Kill(); @@ -42,8 +51,13 @@ namespace CalamityMod.Projectiles.Typeless } UpdatePlayerFields(); + + // Turn off boss rush mode. if (BossRushEvent.BossRushActive || BossRushEvent.StartTimer > 0) { + if (Time == 2f) + SoundEngine.PlaySound(BossRushEvent.TerminusDeactivationSound, Main.LocalPlayer.Center); + float lifetime = Utils.GetLerpValue(0f, 30f, Time, true); if (Time % 5f == 4f) BossRushEvent.SyncStartTimer((int)MathHelper.Lerp(0f, BossRushEvent.StartEffectTotalTime, 1f - lifetime)); @@ -51,8 +65,6 @@ namespace CalamityMod.Projectiles.Typeless MoonlordDeathDrama.RequestLight(Utils.GetLerpValue(0f, 15f, Time, true), Main.LocalPlayer.Center); if (Time >= 45f) { - SoundEngine.PlaySound(SoundID.DD2_EtherianPortalOpen, Main.LocalPlayer.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) BossRushEvent.End(); @@ -62,6 +74,14 @@ namespace CalamityMod.Projectiles.Typeless return; } + // Play the activation sound. + if (Time == 2f) + ActivationSoundSlot = SoundEngine.PlaySound(BossRushEvent.TerminusActivationSound, Main.LocalPlayer.Center); + + // Update the activation sound. + if (SoundEngine.TryGetActiveSound(ActivationSoundSlot, out var t2) && t2.IsPlaying) + t2.Position = Projectile.Center; + if (Projectile.timeLeft == 1) { Projectile.Kill(); @@ -77,7 +97,7 @@ namespace CalamityMod.Projectiles.Typeless public void CreateEffectsHandler() { - SoundEngine.PlaySound(SoundID.DD2_EtherianPortalDryadTouch, Main.LocalPlayer.Center); + SoundEngine.PlaySound(BossRushEvent.StartBuildupSound, Main.LocalPlayer.Center); Main.LocalPlayer.Calamity().GeneralScreenShakePower = 16f; if (Main.myPlayer == Projectile.owner) Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Projectile.owner); diff --git a/Sounds/Custom/BossRush/BossRushSummon1.ogg b/Sounds/Custom/BossRush/BossRushSummon1.ogg new file mode 100644 index 0000000000..5a0d1a354f Binary files /dev/null and b/Sounds/Custom/BossRush/BossRushSummon1.ogg differ diff --git a/Sounds/Custom/BossRush/BossRushSummon2.ogg b/Sounds/Custom/BossRush/BossRushSummon2.ogg new file mode 100644 index 0000000000..6820a12c59 Binary files /dev/null and b/Sounds/Custom/BossRush/BossRushSummon2.ogg differ diff --git a/Sounds/Custom/BossRush/BossRushTeleport.ogg b/Sounds/Custom/BossRush/BossRushTeleport.ogg new file mode 100644 index 0000000000..606b79a914 Binary files /dev/null and b/Sounds/Custom/BossRush/BossRushTeleport.ogg differ diff --git a/Sounds/Custom/BossRush/BossRushTerminusActivate.ogg b/Sounds/Custom/BossRush/BossRushTerminusActivate.ogg new file mode 100644 index 0000000000..ccbe97d279 Binary files /dev/null and b/Sounds/Custom/BossRush/BossRushTerminusActivate.ogg differ diff --git a/Sounds/Custom/BossRush/BossRushTerminusCharge.ogg b/Sounds/Custom/BossRush/BossRushTerminusCharge.ogg new file mode 100644 index 0000000000..825e873010 Binary files /dev/null and b/Sounds/Custom/BossRush/BossRushTerminusCharge.ogg differ diff --git a/Sounds/Custom/BossRush/BossRushTerminusDeactivate.ogg b/Sounds/Custom/BossRush/BossRushTerminusDeactivate.ogg new file mode 100644 index 0000000000..46df8297f1 Binary files /dev/null and b/Sounds/Custom/BossRush/BossRushTerminusDeactivate.ogg differ diff --git a/Sounds/Custom/BossRush/BossRushTier2Transition.ogg b/Sounds/Custom/BossRush/BossRushTier2Transition.ogg new file mode 100644 index 0000000000..7abce00325 Binary files /dev/null and b/Sounds/Custom/BossRush/BossRushTier2Transition.ogg differ diff --git a/Sounds/Custom/BossRush/BossRushTier3Transition.ogg b/Sounds/Custom/BossRush/BossRushTier3Transition.ogg new file mode 100644 index 0000000000..12109612cb Binary files /dev/null and b/Sounds/Custom/BossRush/BossRushTier3Transition.ogg differ diff --git a/Sounds/Custom/BossRush/BossRushTier4Transition.ogg b/Sounds/Custom/BossRush/BossRushTier4Transition.ogg new file mode 100644 index 0000000000..f9673b607b Binary files /dev/null and b/Sounds/Custom/BossRush/BossRushTier4Transition.ogg differ diff --git a/Sounds/Custom/BossRush/BossRushTier5Transition.ogg b/Sounds/Custom/BossRush/BossRushTier5Transition.ogg new file mode 100644 index 0000000000..ec8768ee1e Binary files /dev/null and b/Sounds/Custom/BossRush/BossRushTier5Transition.ogg differ diff --git a/Sounds/Custom/BossRush/BossRushVictory.ogg b/Sounds/Custom/BossRush/BossRushVictory.ogg new file mode 100644 index 0000000000..3c3133d8f2 Binary files /dev/null and b/Sounds/Custom/BossRush/BossRushVictory.ogg differ diff --git a/Sounds/Custom/BossRushEnd.ogg b/Sounds/Custom/BossRushEnd.ogg deleted file mode 100644 index e0978b3069..0000000000 Binary files a/Sounds/Custom/BossRushEnd.ogg and /dev/null differ diff --git a/Tiles/ScoriaBrick.cs b/Tiles/ScoriaBrick.cs index 0e0933ed20..4a5659aa1b 100644 --- a/Tiles/ScoriaBrick.cs +++ b/Tiles/ScoriaBrick.cs @@ -11,8 +11,6 @@ namespace CalamityMod.Tiles [LegacyName("ChaoticBrick")] public class ScoriaBrick : ModTile { - int subsheetHeight = 72; - int subsheetWidth = 216; internal static Texture2D GlowTexture; public override void SetStaticDefaults() { diff --git a/UI/AstralArcanumUI.cs b/UI/AstralArcanumUI.cs index f86695a739..3de66924d8 100644 --- a/UI/AstralArcanumUI.cs +++ b/UI/AstralArcanumUI.cs @@ -123,7 +123,7 @@ namespace CalamityMod.UI Main.mouseLeftRelease = false; Main.mouseLeft = false; - DoTeleportation(current); + DoTeleportation(current, forceOpenAndTeleport); } } @@ -151,18 +151,22 @@ namespace CalamityMod.UI Utils.DrawBorderStringFourWay(sb, FontAssets.MouseText.Value, text, CenterPoint.X - size.X / 2f, CenterPoint.Y + CircleOffset + CircleTextureSize / 2 + 4, Color.White, Color.Black, default); } - public static void DoTeleportation(int circle) + public static void DoTeleportation(int circle, bool forcedByBossRush) { Open = false; Player p = Main.LocalPlayer; + if (forcedByBossRush) + SoundEngine.PlaySound(BossRushEvent.TeleportSound with { Volume = 1.6f }, p.position); + if (circle == 3) { if (Main.netMode == NetmodeID.SinglePlayer) { p.TeleportationPotion(); - SoundEngine.PlaySound(SoundID.Item6, p.position); + if (!forcedByBossRush) + SoundEngine.PlaySound(SoundID.Item6, p.position); } else if (Main.netMode == NetmodeID.MultiplayerClient) {