diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 03a1819d1b..064a534dba 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -176,9 +176,6 @@ namespace CalamityMod.Balancing // 35% resist to Flying Dragon. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ravager, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2SquireSonicBoom)))); - // 25% resist to Lucrecia. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ravager, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); - // 20% resist to Aurora Blazer. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ravager, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); diff --git a/Buffs/Summon/AqueousHunterDroneBuff.cs b/Buffs/Summon/AqueousHunterDroneBuff.cs new file mode 100644 index 0000000000..292d0df8e0 --- /dev/null +++ b/Buffs/Summon/AqueousHunterDroneBuff.cs @@ -0,0 +1,12 @@ +using CalamityMod.Projectiles.DraedonsArsenal; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class AqueousHunterDroneBuff : BaseSummonBuff + { + protected override int MinionProjectileType => ModContent.ProjectileType(); + + protected override ref bool MinionBool => ref BuffModdedOwner.aqueousHunterDrone; + } +} diff --git a/Buffs/Summon/AqueousHunterDroneBuff.png b/Buffs/Summon/AqueousHunterDroneBuff.png new file mode 100644 index 0000000000..728c691251 Binary files /dev/null and b/Buffs/Summon/AqueousHunterDroneBuff.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index aa354013f5..1e43caf7eb 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -178,7 +178,20 @@ namespace CalamityMod.CalPlayer public int momentumCapacitorTime = 0; /// A multiplier on the player's movement speed applied while using Momentum Capacitor. public float momentumCapacitorBoost = 0f; - + public enum FishingMinigames + { + None, + WulfrumRod, + NavyFishingRod, + HeronRod, + SlurperPole, + VerstaltiteFishingRod, + FeralDoubleRod, + RiftReeler, + EarlyBloomRod, + TheDevourerOfCods + } + public FishingMinigames SelectedFishingMinigame = FishingMinigames.None; public bool countsAsAnyWet => (Player.armor[0].type == ItemID.FishBowl || Player.wetCount > 0 || Player.wet || Player.honeyWet || Player.lavaWet); public StatModifier TypelessDebuffMultiplier = new(); @@ -275,6 +288,11 @@ namespace CalamityMod.CalPlayer public int deadSunCounter = 6; public int DragonsBreathAudioCooldown = 0; public int DragonsBreathAudioCooldown2 = 0; + public int lucreciaEnergy = 0; + public int lucreciaEnergyTimer = 0; + public bool lucreciaEnergyPaused = false; + public bool lucreciaEnergyMaxSFXPlayed = false; + private int lucreciaParticleTimer = 0; public int PhotoAudioCooldown = 0; public int PhotoTimer = 90; /// Cooldown variable used to add a delay between Anahita's Arpeggio uses. @@ -396,6 +414,7 @@ namespace CalamityMod.CalPlayer public bool canFireBloodflareMageProjectile = false; public bool canFireBloodflareRangedProjectile = false; + public int consecutiveCaughtFish = 0; public float WeakTimeFreezeUseTimer = 0; public bool WeakTimeFreezeInUse = false; #endregion @@ -458,10 +477,10 @@ namespace CalamityMod.CalPlayer /// public bool stealthStrike75Cost = false; /// - /// If true, stealth strikes only require 85% of the player's max stealth to perform.
+ /// If true, stealth strikes only require 90% of the player's max stealth to perform.
/// Used by Coin of Deceit. ///
- public bool stealthStrike85Cost = false; + public bool stealthStrike90Cost = false; /// If true, this player is wearing a rogue or all-class armor set. This bool is required in order to use rogue stealth. public bool wearingRogueArmor = false; /// The sum of the player's stealth generation boosts from accessory modifiers. @@ -1515,6 +1534,7 @@ namespace CalamityMod.CalPlayer public bool starSwallowerPetFroge = false; public bool snakeEyes = false; public bool poleWarper = false; + public bool aqueousHunterDrone = false; public bool causticDragon = false; public bool plaguebringerPatronSummon = false; public bool howlTrio = false; @@ -2565,6 +2585,8 @@ namespace CalamityMod.CalPlayer pinkCandle = false; yellowCandle = false; + SelectedFishingMinigame = FishingMinigames.None; + #region Minion Reset Effects wDroid = false; resButterfly = false; @@ -2664,6 +2686,7 @@ namespace CalamityMod.CalPlayer starSwallowerPetFroge = false; snakeEyes = false; poleWarper = false; + aqueousHunterDrone = false; causticDragon = false; plaguebringerPatronSummon = false; howlTrio = false; @@ -2822,6 +2845,8 @@ namespace CalamityMod.CalPlayer #endregion #region Buffs, Debuffs, Counters, and Nonsense + if (Player.HeldItem.IsAir || Player.HeldItem.fishingPole == 0) + consecutiveCaughtFish = 0; heldGaelsLastFrame = false; gaelSwipes = 0; whitewaterHeal = 0; @@ -3211,6 +3236,7 @@ namespace CalamityMod.CalPlayer burningSeaBurnOut = 0; flareGunOverheat = 0; hellbornShots = 0; + lucreciaEnergy = 0; garandShots = 0; searedPanCounter = 0; searedPanTimer = 0; @@ -5300,7 +5326,7 @@ namespace CalamityMod.CalPlayer stealthStrikeThisFrame = false; stealthStrikeHalfCost = false; stealthStrike75Cost = false; - stealthStrike85Cost = false; + stealthStrike90Cost = false; // stealthAcceleration only resets if you don't have either of the accelerator accessories equipped if (!darkGodSheath && !eclipseMirror) @@ -5495,8 +5521,8 @@ namespace CalamityMod.CalPlayer consumptionMult = 0.5f; else if (stealthStrike75Cost) consumptionMult = 0.75f; - else if (stealthStrike85Cost) - consumptionMult = 0.85f; + else if (stealthStrike90Cost) + consumptionMult = 0.9f; return rogueStealth >= rogueStealthMax * consumptionMult; } @@ -5523,7 +5549,7 @@ namespace CalamityMod.CalPlayer if (rogueStealth <= 0f) rogueStealth = 0f; } - else if (stealthStrike85Cost) + else if (stealthStrike90Cost) { rogueStealth -= 0.9f * stealthToLose; if (rogueStealth <= 0f) @@ -5656,5 +5682,29 @@ namespace CalamityMod.CalPlayer } } #endregion + + #region Controls + // These are used to entirely disable player directional inputs while being able to read them for other features + public bool ShouldHideControls = false; + public bool pressedRight = false; + public bool pressedLeft = false; + public bool pressedUp = false; + public bool pressedDown = false; + public override void SetControls() + { + pressedRight = Player.controlRight; + pressedLeft = Player.controlLeft; + pressedUp = Player.controlUp; + pressedDown = Player.controlDown; + if (ShouldHideControls) + { + Player.controlLeft = false; + Player.controlUp = false; + Player.controlDown = false; + Player.controlRight = false; + } + ShouldHideControls = false; + } + #endregion } } diff --git a/CalPlayer/CalamityPlayerDashEffects.cs b/CalPlayer/CalamityPlayerDashEffects.cs index 7a911dbef1..03d45ac712 100644 --- a/CalPlayer/CalamityPlayerDashEffects.cs +++ b/CalPlayer/CalamityPlayerDashEffects.cs @@ -66,6 +66,17 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI != Main.myPlayer) return; + if ((HasCustomDash && Player.dashDelay < 0 && UsedDash.dashTime < UsedDash.dashStartup)) + { + UsedDash.DashStartupEffects(Player); + UsedDash.dashTime++; + return; + } else if (HasCustomDash && UsedDash.dashStartup > 0 && Player.dashDelay < 0 && UsedDash.dashTime == UsedDash.dashStartup ) + { + if (DoADash(UsedDash.CalculateDashSpeed(Player),true)) + UsedDash.OnDashEffects(Player); + } + var source = new ProjectileSource_PlayerDashHit(Player); // Handle collision slam-through effects. @@ -102,6 +113,7 @@ namespace CalamityMod.CalPlayer } } } + UsedDash.dashTime++; } if (Player.dashDelay > 0) @@ -187,7 +199,8 @@ namespace CalamityMod.CalPlayer } // Dash delay depends on the type of dash used. - Player.dashDelay = dashDelayToApply; + if (!(HasCustomDash && UsedDash.dashStartup > 0 && Player.dashDelay < 0 && UsedDash.dashTime <= UsedDash.dashStartup+10)) + Player.dashDelay = dashDelayToApply; if (UsedDash.IsOmnidirectional) { @@ -223,12 +236,16 @@ namespace CalamityMod.CalPlayer // Handle first-frame effects. else if (HasCustomDash && !Player.mount.Active) { + UsedDash.dashTime = 0; if (DoADash(UsedDash.CalculateDashSpeed(Player))) - UsedDash.OnDashEffects(Player); + if (UsedDash.dashStartup <= 0) + UsedDash.OnDashEffects(Player); + else + UsedDash.OnDashStartupEffects(Player); } } - public bool HandleHorizontalDash(out DashDirection direction) + public bool HandleHorizontalDash(out DashDirection direction, bool forceDash = false) { direction = DashDirection.Directionless; bool dashWasExecuted = false; @@ -236,7 +253,7 @@ namespace CalamityMod.CalPlayer // If the manual hotkey is bound, standard Terraria dashes cannot be triggered by double tapping. var manualDashHotkeys = CalamityKeybinds.DashHotkey.GetAssignedKeys(); bool manualHotkeyBound = (manualDashHotkeys?.Count ?? 0) > 0; - bool pressedManualHotkey = manualHotkeyBound && CalamityKeybinds.DashHotkey.JustPressed; + bool pressedManualHotkey = manualHotkeyBound && (CalamityKeybinds.DashHotkey.JustPressed || forceDash); int dashDirectionToUse = 0; @@ -418,9 +435,9 @@ namespace CalamityMod.CalPlayer return justDashed; } - public bool DoADash(float dashSpeed) + public bool DoADash(float dashSpeed, bool forceDash = false) { - bool justDashed; + bool justDashed = forceDash; bool omnidirectionalDash = UsedDash?.IsOmnidirectional ?? false; DashDirection direction; @@ -434,7 +451,14 @@ namespace CalamityMod.CalPlayer else if (omnidirectionalDash) justDashed = HandleOmnidirectionalDash(out direction); else - justDashed = HandleHorizontalDash(out direction); + justDashed = HandleHorizontalDash(out direction, forceDash); + + if (justDashed && !forceDash && UsedDash.dashStartup > 0) + { + Player.timeSinceLastDashStarted = 0; + Player.dashDelay = -1; + return justDashed; + } // Make dash movements happen if ready. if (justDashed) diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index 870e37d592..4f0c2b0d76 100644 --- a/CalPlayer/CalamityPlayerFishing.cs +++ b/CalPlayer/CalamityPlayerFishing.cs @@ -10,6 +10,7 @@ using CalamityMod.Items.Fishing.BrimstoneCragCatches; using CalamityMod.Items.Fishing.FishingRods; using CalamityMod.Items.Fishing.SulphurCatches; using CalamityMod.Items.Fishing.SunkenSeaCatches; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Items.SummonItems; using CalamityMod.Items.Weapons.Melee; @@ -173,6 +174,20 @@ namespace CalamityMod.CalPlayer return; } + if (attempt.playerFishingConditions.PoleItemType == ModContent.ItemType()) + { + if (Main.rand.NextBool(5)) + { + itemDrop = ModContent.ItemType(); + return; + } + if (Main.rand.NextBool(15)) + { + itemDrop = ModContent.ItemType(); + return; + } + } + // Ignore catches if it's junk if (itemDrop == ItemID.OldShoe || itemDrop == ItemID.FishingSeaweed || itemDrop == ItemID.TinCan || itemDrop == ItemID.JojaCola) return; @@ -415,6 +430,8 @@ namespace CalamityMod.CalPlayer if (fishList.Contains(fish.type)) fish.stack += Main.rand.Next(1, 3 + 1); } + if (fish.type == ModContent.ItemType()) + fish.stack = Main.rand.Next(1, 6); } #endregion } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 8f2056546b..8aae292bb8 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -167,6 +167,9 @@ namespace CalamityMod.CalPlayer // Drawing parameters UpdateDrawingParameters(); + // Handle Lucrecia's passive energy effects + HandleLucreciaEffects(); + // Update all particle sets for items. // This must be done here instead of in the item logic because these sets are not properly instanced // in the global classes. Attempting to update them there will cause multiple updates to one set for multiple items. @@ -282,7 +285,7 @@ namespace CalamityMod.CalPlayer } // First Frame dash effects - bool dashStart = (Player.dashDelay == -1 && IsFirstDashFrame); + bool dashStart = (Player.dashDelay == -1 && ((!HasCustomDash && IsFirstDashFrame) || (HasCustomDash && UsedDash.DashTimeAdjustedForStartup == 1))); int dir = MathF.Sign(Player.velocity.X); if (dashStart) @@ -381,6 +384,51 @@ namespace CalamityMod.CalPlayer Lighting.AddLight(Player.Center, Color.MediumOrchid.ToVector3()); } + if (Player.HeldItem.type == ModContent.ItemType() && lucreciaEnergy > 0) + { + if (lucreciaEnergy == Lucrecia.MaxEnergy && !lucreciaEnergyPaused) + { + lucreciaEnergyPaused = true; + lucreciaEnergyTimer = 0; + } + + lucreciaEnergyTimer++; + + // If the energy is at max, pause for 180 ticks + if (lucreciaEnergyPaused) + { + if (lucreciaEnergyTimer >= 1 && !lucreciaEnergyMaxSFXPlayed) + { + SoundEngine.PlaySound(SoundID.Item79 with { Volume = 1.6f, Pitch = 0.4f }, Player.Center); + lucreciaEnergyMaxSFXPlayed = true; + + } + // If the pause is Done, resume decrementing. + if (lucreciaEnergyTimer >= 180) + { + lucreciaEnergyPaused = false; + lucreciaEnergyTimer = 0; + lucreciaEnergy--; + } + } + else // Decrementing + { + lucreciaEnergyMaxSFXPlayed = false; + // Once every 8 ticks + if (lucreciaEnergyTimer >= 8) + { + lucreciaEnergy--; + lucreciaEnergyTimer = 0; + } + } + } + else + { + // Reset the timer and pause state if the player isn't holding the weapon. + lucreciaEnergyTimer = 0; + lucreciaEnergyPaused = false; + } + if (lAmbergris) { if (dashStart) @@ -393,7 +441,7 @@ namespace CalamityMod.CalPlayer if (Player.miscCounter % 3 == 2 && Player.dashDelay > 0) // Reduced dash cooldown by 33% Player.dashDelay--; - if (Player.dashDelay == -1) + if (Player.dashDelay == -1 && !(HasCustomDash && UsedDash.DashTimeAdjustedForStartup < 1)) Player.velocity.X *= 0.9f; } @@ -3925,42 +3973,6 @@ namespace CalamityMod.CalPlayer } } - // Navy Fishing Rod's electric aura when in-use - if (Player.ActiveItem().type == ModContent.ItemType() && Player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) - { - const int FramesPerHit = 120; - - // Constantly increment the timer every frame. - navyRodAuraTimer = (navyRodAuraTimer + 1) % FramesPerHit; - - // If the timer rolls over, it's time to deal damage. Only run this code for the client which is holding the fishing rod, - if (navyRodAuraTimer == 0 && Player.whoAmI == Main.myPlayer) - { - const int BaseDamage = 10; - int damage = (int)Player.GetBestClassDamage().ApplyTo(BaseDamage); - var source = Player.GetSource_ItemUse(Player.ActiveItem()); - float range = 200f; - - foreach (NPC npc in Main.ActiveNPCs) - { - if (npc.friendly || npc.damage <= 0 || npc.dontTakeDamage) - continue; - - if (Vector2.Distance(Player.Center, npc.Center) <= range) - Projectile.NewProjectile(source, npc.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI, npc.whoAmI); - - // Occasionally spawn cute sparks so it looks like an electrical aura - if (Main.rand.NextBool(10)) - { - Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); - Projectile spark = Projectile.NewProjectileDirect(source, npc.Center, velocity, ModContent.ProjectileType(), damage / 2, 0f, Player.whoAmI); - spark.localNPCHitCooldown = -2; - spark.timeLeft = 30; - } - } - } - } - // Inferno potion boost if (ataxiaBlaze && Player.inferno) { @@ -4457,6 +4469,47 @@ namespace CalamityMod.CalPlayer } #endregion + #region Lucrecia Effects + + public void HandleLucreciaEffects() + { + int lucreciaItemID = ModContent.ItemType(); + if (Player.HeldItem.type == lucreciaItemID && lucreciaEnergy > 0) + { + lucreciaParticleTimer--; + + // If the timer is at or below zero, spawn a particle. + if (lucreciaParticleTimer <= 0) + { + // Reset the timer (spawn rate depends on energy) + lucreciaParticleTimer = (int)(20 - 15 * (lucreciaEnergy / 60)); + + float radius = Main.rand.NextFloat(160f, 190f); // Distance from center + float spawnAngle = Main.rand.NextFloat(MathHelper.TwoPi); // Random angle along the whole radius + + Vector2 spawnPosition = Player.Center + spawnAngle.ToRotationVector2() * radius; + + // Scale opacity with energy + float opacity = lucreciaEnergy / (float)Lucrecia.MaxEnergy; + Color color = Main.rand.NextBool() ? Color.MediumPurple : Color.CornflowerBlue; + color *= opacity; + + if (lucreciaEnergy >= 100) + { + color *= 1.6f; // Brighter + } + + Vector2 dummyVelocity = Vector2.Zero; // We dont want the argument where this is used to have influence on the actual path + float rotationSpeed = 0.04f; + + var particle = new RoundedStarParticle(spawnPosition, dummyVelocity, color, Main.rand.NextFloat(0.05f, 0.065f), Main.rand.Next(30, 60), rotationSpeed, 1f, true, Player.Center, Player.whoAmI); + GeneralParticleHandler.SpawnParticle(particle); + } + } + } + #endregion + + #region Energy Shields private void EnergyShields() { diff --git a/CalPlayer/Dashes/AsgardianAegisDash.cs b/CalPlayer/Dashes/AsgardianAegisDash.cs index e3797e4f2d..a96ce8fa39 100644 --- a/CalPlayer/Dashes/AsgardianAegisDash.cs +++ b/CalPlayer/Dashes/AsgardianAegisDash.cs @@ -8,6 +8,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.Graphics.Shaders; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.CalPlayer.Dashes @@ -29,26 +30,39 @@ namespace CalamityMod.CalPlayer.Dashes PostHit = false; } + public override void DashStartupEffects(Player player) + { + player.velocity *= 0.9f; + } + public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) { Time += 2; float radiusFactor = MathHelper.Lerp(0f, 1f, Utils.GetLerpValue(2f, 2.5f, Time, true)); - for (int i = 0; i < 3; i++) + if (DashTimeAdjustedForStartup <= 18) { - float offsetRotationAngle = player.velocity.ToRotation() + Time / 5f; - float radius = (15f + (float)Math.Cos(Time / 3f) * 12f) * radiusFactor; - Vector2 dustPosition = player.Center - player.velocity * 2; - dustPosition += offsetRotationAngle.ToRotationVector2().RotatedBy(i / 5f * MathHelper.TwoPi) * radius; - Dust dust = Dust.NewDustPerfect(dustPosition, Main.rand.NextBool(5) ? 181 : 295); - dust.alpha = 220; - dust.noGravity = true; - dust.velocity = player.velocity * 0.8f; - dust.scale = Main.rand.NextFloat(1.7f, 2.0f); - dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); - Dust dust2 = Dust.NewDustPerfect(player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) + (player.velocity * 1.5f), Main.rand.NextBool(8) ? 180 : 295, -player.velocity.RotatedByRandom(MathHelper.ToRadians(30f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(1.7f, 1.9f)); - dust2.alpha = 170; - dust2.noGravity = true; - dust2.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); + for (int d = 0; d < 2; d++) + { + Dust hFlameDust = Dust.NewDustPerfect(player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) - (player.velocity * 1.2f), Main.rand.NextBool(8) ? 180 : 295, -player.velocity.RotatedByRandom(MathHelper.ToRadians(10f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(1.8f, 2.8f)); + hFlameDust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); + hFlameDust.noGravity = hFlameDust.type == 180 ? false : true; + hFlameDust.fadeIn = 0.5f; + if (hFlameDust.type == 180) + { + hFlameDust.scale = Main.rand.NextFloat(0.8f, 1.2f); + hFlameDust.velocity += new Vector2(0, -2.5f) * Main.rand.NextFloat(0.8f, 1.2f); + } + + Dust dust = Dust.NewDustPerfect(player.Center + Main.rand.NextVector2Circular(6, 6) - player.velocity * 2, DustID.FrostStaff); + dust.velocity = -player.velocity * Main.rand.NextFloat(0.6f, 1.4f); + dust.scale = Main.rand.NextFloat(0.9f, 1.4f); + dust.noGravity = true; + if (d < 1) + { + Particle spark = new CustomSpark(player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) - (player.velocity * 1.2f), -player.velocity.RotatedByRandom(MathHelper.ToRadians(10f)) * Main.rand.NextFloat(0.1f, 0.8f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 17, Main.rand.NextFloat(1.15f, 1.25f), Main.rand.NextBool() ? Color.Fuchsia : Color.Cyan, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.4f, 0.5f)); + GeneralParticleHandler.SpawnParticle(spark); + } + } } // Dash at a faster speed than the default value. @@ -57,6 +71,8 @@ namespace CalamityMod.CalPlayer.Dashes public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext) { + if (DashTimeAdjustedForStartup > 18) + return; if (!PostHit) { player.Calamity().GeneralScreenShakePower = 5f; diff --git a/CalPlayer/Dashes/AsgardsValorDash.cs b/CalPlayer/Dashes/AsgardsValorDash.cs index 34262feeae..f73fb8ca42 100644 --- a/CalPlayer/Dashes/AsgardsValorDash.cs +++ b/CalPlayer/Dashes/AsgardsValorDash.cs @@ -8,6 +8,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent.UI.States; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -24,35 +25,39 @@ namespace CalamityMod.CalPlayer.Dashes public override float CalculateDashSpeed(Player player) => 16.9f; - public override void OnDashEffects(Player player) + public override void DashStartupEffects(Player player) { - // Nothing + player.velocity *= 0.9f; } public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) { + + // Dash at a faster speed than the default value. + dashSpeed = 12.5f; // Spawn fire dust around the player's body. - for (int d = 0; d < 4; d++) - { - Dust holyFireDashDust = Dust.NewDustDirect(player.position + Vector2.UnitY * 4f, player.width, player.height - 8, Main.rand.NextBool() ? 296 : 158, 0f, 0f, 0, default, 1.2f); - holyFireDashDust.velocity = -player.velocity * Main.rand.NextFloat(0.1f, 0.75f); - holyFireDashDust.scale *= Main.rand.NextFloat(1f, 1.2f); - holyFireDashDust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); - holyFireDashDust.noGravity = true; - if (Main.rand.NextBool()) - holyFireDashDust.fadeIn = 0.1f; - } - if (Main.rand.NextBool(3)) - { + if (DashTimeAdjustedForStartup > 14) + return; + for (int d = 0; d < 3; d++) + { + Dust holyFireDashDust = Dust.NewDustDirect(player.position + Vector2.UnitY * 4f, player.width, player.height - 8, Main.rand.NextBool() ? 296 : 158, 0f, 0f, 0, default, 1.2f); + holyFireDashDust.velocity = -player.velocity * Main.rand.NextFloat(0.1f, 0.75f); + holyFireDashDust.scale *= Main.rand.NextFloat(2f, 2.4f); + holyFireDashDust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); + holyFireDashDust.noGravity = true; + if (Main.rand.NextBool()) + holyFireDashDust.fadeIn = 0.1f; + } Vector2 dustPosition = player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) - (player.velocity * 1.7f); Dust dust = Dust.NewDustPerfect(dustPosition, 222, -player.velocity * Main.rand.NextFloat(0.15f, 0.4f), 0, default, 0.5f); dust.noGravity = false; dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); - } } public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext) { + if (DashTimeAdjustedForStartup > 14) + return; // Define hit context variables. int hitDirection = player.direction; if (player.velocity.X != 0f) diff --git a/CalPlayer/Dashes/ElysianAegisDash.cs b/CalPlayer/Dashes/ElysianAegisDash.cs index 8ff41a5806..36fca673b6 100644 --- a/CalPlayer/Dashes/ElysianAegisDash.cs +++ b/CalPlayer/Dashes/ElysianAegisDash.cs @@ -27,8 +27,15 @@ namespace CalamityMod.CalPlayer.Dashes PostHit = false; } + public override void DashStartupEffects(Player player) + { + player.velocity *= 0.9f; + } + public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) { + + if (DashTimeAdjustedForStartup <= 16) for (int d = 0; d < 4; d++) { Dust hFlameDust = Dust.NewDustPerfect(player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) - (player.velocity * 1.2f), Main.rand.NextBool(8) ? 222 : 162, -player.velocity.RotatedByRandom(MathHelper.ToRadians(10f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(1.8f, 2.8f)); @@ -59,6 +66,8 @@ namespace CalamityMod.CalPlayer.Dashes public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext) { + if (DashTimeAdjustedForStartup > 16) + return; if (!PostHit) { player.Calamity().GeneralScreenShakePower = 3.5f; diff --git a/CalPlayer/Dashes/OrnateShieldDash.cs b/CalPlayer/Dashes/OrnateShieldDash.cs index 9c94df600a..4dc1749dca 100644 --- a/CalPlayer/Dashes/OrnateShieldDash.cs +++ b/CalPlayer/Dashes/OrnateShieldDash.cs @@ -17,16 +17,16 @@ namespace CalamityMod.CalPlayer.Dashes public override DashCollisionType CollisionType => DashCollisionType.ShieldSlam; public override bool IsOmnidirectional => false; - public override float CalculateDashSpeed(Player player) => 16.9f; - public override void OnDashEffects(Player player) + public override void DashStartupEffects(Player player) { - //nothing left, could add a sound or other effect if we want later + player.velocity *= 0.9f; } public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) { + if (DashTimeAdjustedForStartup <= 12) for (int d = 0; d < 3; d++) { Dust iceDashDust = Dust.NewDustPerfect(player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) - (player.velocity * 1.7f), Main.rand.NextBool(8) ? 223 : 180, -player.velocity.RotatedByRandom(MathHelper.ToRadians(10f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(0.6f, 0.8f)); @@ -43,6 +43,8 @@ namespace CalamityMod.CalPlayer.Dashes public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext) { + if (DashTimeAdjustedForStartup > 12) + return; // Define hit context variables. int hitDirection = player.direction; if (player.velocity.X != 0f) diff --git a/CalPlayer/Dashes/PlayerDashEffect.cs b/CalPlayer/Dashes/PlayerDashEffect.cs index 4ea5d0a336..e57802a47d 100644 --- a/CalPlayer/Dashes/PlayerDashEffect.cs +++ b/CalPlayer/Dashes/PlayerDashEffect.cs @@ -9,14 +9,34 @@ namespace CalamityMod.CalPlayer.Dashes // For the sake of easy access without the need for stored instances, this property is defined as static instead of abstract. // Derived classes should use the new keyword on this member to define their own version of it. public static string ID { get; } + public int dashTime { get; set; } + public virtual int dashStartup => 0; + + public int DashTimeAdjustedForStartup => dashTime - dashStartup; public abstract DashCollisionType CollisionType { get; } public abstract bool IsOmnidirectional { get; } public abstract float CalculateDashSpeed(Player player); - + /// + /// Effects that happen once when the main dash starts + /// + /// public virtual void OnDashEffects(Player player) { } + /// + /// Effects that happen once when the dash startup starts + /// This does not run on dashes without set startup + /// + /// + + public virtual void OnDashStartupEffects(Player player) { } + /// + /// Effects that run during the dash startup time + /// This does not run on dashes without set startup + /// + /// + public virtual void DashStartupEffects(Player player) { } public virtual void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) { } diff --git a/Cooldowns/LucreciaEnergy.cs b/Cooldowns/LucreciaEnergy.cs new file mode 100644 index 0000000000..23a6f489a9 --- /dev/null +++ b/Cooldowns/LucreciaEnergy.cs @@ -0,0 +1,75 @@ +using System; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Melee.Shortswords; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria.Audio; +using Terraria; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; +using Terraria.Localization; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Cooldowns +{ + public class LucreciaEnergy : CooldownHandler + { + private float AdjustedCompletion => instance.timeLeft / (float)Lucrecia.MaxEnergy; + private Color TextColor => Color.MediumPurple; + private Color TextBorderColor = Color.AntiqueWhite; + + public static new string ID => "LucreciaEnergy"; + public override bool CanTickDown => false; + public override bool ShouldDisplay => instance.player.HeldItem.type == ItemType(); + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + public override string Texture => $"CalamityMod/Cooldowns/{ID}"; + public override string OutlineTexture => $"CalamityMod/Cooldowns/{ID}Outline"; + public override string OverlayTexture => $"CalamityMod/Cooldowns/{ID}Overlay"; + + public override Color OutlineColor => Color.SlateGray; + public override Color CooldownStartColor => Color.Lerp(Color.Purple, Color.SlateGray, instance.Completion); + public override Color CooldownEndColor => Color.Lerp(Color.DarkBlue, Color.SlateGray, instance.Completion); + + public override void ApplyBarShaders(float opacity) + { + // Use the adjusted completion + GameShaders.Misc["CalamityMod:CircularBarShader"].UseOpacity(opacity); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseSaturation(AdjustedCompletion); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseColor(CooldownStartColor); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseSecondaryColor(CooldownEndColor); + GameShaders.Misc["CalamityMod:CircularBarShader"].Apply(); + } + + public override void DrawExpanded(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + base.DrawExpanded(spriteBatch, position, opacity, scale); + + Vector2 textOffset = new Vector2(instance.timeLeft > 9 ? -11f : -6f, 10f); + DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, instance.timeLeft.ToString(), position + textOffset * scale, TextColor, TextBorderColor, scale); + } + + public override void DrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + Texture2D sprite = Request(Texture).Value; + Texture2D outline = Request(OutlineTexture).Value; + Texture2D overlay = Request(OverlayTexture).Value; + + // Draw the outline + spriteBatch.Draw(outline, position, null, OutlineColor * opacity, 0, outline.Size() * 0.5f, scale, SpriteEffects.None, 0f); + + // Draw the icon + spriteBatch.Draw(sprite, position, null, Color.White * opacity, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f); + + // Draw the small overlay + int lostHeight = (int)Math.Ceiling(overlay.Height * AdjustedCompletion); + Rectangle crop = new Rectangle(0, lostHeight, overlay.Width, overlay.Height - lostHeight); + spriteBatch.Draw(overlay, position + Vector2.UnitY * lostHeight * scale, crop, OutlineColor * opacity * 0.9f, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f); + + Vector2 textOffset = new Vector2(instance.timeLeft > 9 ? -11f : -6f, 10f); + DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, instance.timeLeft.ToString(), position + textOffset * scale, TextColor, TextBorderColor, scale); + } + } +} diff --git a/Cooldowns/LucreciaEnergy.png b/Cooldowns/LucreciaEnergy.png new file mode 100644 index 0000000000..9891d6fd0b Binary files /dev/null and b/Cooldowns/LucreciaEnergy.png differ diff --git a/Cooldowns/LucreciaEnergyOutline.png b/Cooldowns/LucreciaEnergyOutline.png new file mode 100644 index 0000000000..247f332da8 Binary files /dev/null and b/Cooldowns/LucreciaEnergyOutline.png differ diff --git a/Cooldowns/LucreciaEnergyOverlay.png b/Cooldowns/LucreciaEnergyOverlay.png new file mode 100644 index 0000000000..851597883b Binary files /dev/null and b/Cooldowns/LucreciaEnergyOverlay.png differ diff --git a/Effects/ArsenalEffects.cs b/Effects/ArsenalEffects.cs index 41ecff817f..c0a21645a7 100644 --- a/Effects/ArsenalEffects.cs +++ b/Effects/ArsenalEffects.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Effects // Plasma public static int ArsenalPlasmaDust = ModContent.DustType(); - public static Color ArsenalPlasmaColor = Color.Lerp(Color.Green, Color.Chartreuse, 0.45f); + public static Color ArsenalPlasmaColor = new Color(154, 255, 0); // Laser public static int ArsenalLaserDust = ModContent.DustType(); public static Color ArsenalLaserColor = Color.Lerp(Color.Crimson, Color.Red, 0.45f); diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index 9ba8791b8d..c8e65d2c08 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -13,7 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { [AutoloadEquip(EquipType.Shield)] - public class AsgardianAegis : ModItem, ILocalizedModType, IHoldShiftTooltipItem + public class AsgardianAegis : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; @@ -39,56 +39,9 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - - // Asgardian Aegis ram dash modPlayer.DashID = AsgardianAegisDash.ID; player.dashType = 0; - - // Inherited Ankh Shield effects player.noKnockback = true; - player.fireWalk = true; - player.buffImmune[BuffID.Weak] = true; - player.buffImmune[BuffID.BrokenArmor] = true; - player.buffImmune[BuffID.Bleeding] = true; - player.buffImmune[BuffID.Poisoned] = true; - player.buffImmune[BuffID.Slow] = true; - player.buffImmune[BuffID.Confused] = true; - player.buffImmune[BuffID.Silenced] = true; - player.buffImmune[BuffID.Cursed] = true; - player.buffImmune[BuffID.Darkness] = true; - player.buffImmune[BuffID.WindPushed] = true; - player.buffImmune[BuffID.Stoned] = true; - - // Additional debuff immunities (Counterparts, similar debuffs to vanilla Ankh Shield debuffs, or upgrades thereof) - player.buffImmune[ModContent.BuffType()] = true; // "Stronger" Broken Armor - player.buffImmune[ModContent.BuffType()] = true; // Counterpart to Burning Blood - player.buffImmune[ModContent.BuffType()] = true; // "Stronger" Bleeding - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[BuffID.Venom] = true; // "Stronger" Poisoned - player.buffImmune[ModContent.BuffType()] = true; // "Stronger" Poisoned - player.buffImmune[BuffID.Webbed] = true; // "Stronger" Slow - player.buffImmune[BuffID.Blackout] = true; // "Stronger" Darkness - - // Additional debuff immunities (Everything from Ornate Shield + Asgard's Valor) - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.OnFire3] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[BuffID.Chilled] = true; - player.buffImmune[BuffID.Frozen] = true; - player.buffImmune[BuffID.Frostburn] = true; - player.buffImmune[BuffID.Frostburn2] = true; - - // Additional debuff immunities (Everything from Elysian Aegis + thematic counterparts) - player.buffImmune[BuffID.CursedInferno] = true; - player.buffImmune[BuffID.ShadowFlame] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[ModContent.BuffType()] = true; - - // Immune to God Slayer Inferno itself - player.buffImmune[ModContent.BuffType()] = true; } public override void AddRecipes() diff --git a/Items/Accessories/AsgardsValor.cs b/Items/Accessories/AsgardsValor.cs index 3f7bff607d..7ceab1566b 100644 --- a/Items/Accessories/AsgardsValor.cs +++ b/Items/Accessories/AsgardsValor.cs @@ -10,7 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { [AutoloadEquip(EquipType.Shield)] - public class AsgardsValor : ModItem, ILocalizedModType, IHoldShiftTooltipItem + public class AsgardsValor : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; @@ -33,42 +33,17 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - - // Asgard's Valor ram dash modPlayer.DashID = AsgardsValorDash.ID; player.dashType = 0; - - // Inherited Ankh Shield effects player.noKnockback = true; - player.fireWalk = true; - player.buffImmune[BuffID.Weak] = true; - player.buffImmune[BuffID.BrokenArmor] = true; - player.buffImmune[BuffID.Bleeding] = true; - player.buffImmune[BuffID.Poisoned] = true; - player.buffImmune[BuffID.Slow] = true; - player.buffImmune[BuffID.Confused] = true; - player.buffImmune[BuffID.Silenced] = true; - player.buffImmune[BuffID.Cursed] = true; - player.buffImmune[BuffID.Darkness] = true; - player.buffImmune[BuffID.WindPushed] = true; - player.buffImmune[BuffID.Stoned] = true; - - // Additional debuff immunities (Everything from Ornate Shield + fiery stuff) - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.OnFire3] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[BuffID.Chilled] = true; - player.buffImmune[BuffID.Frozen] = true; - player.buffImmune[BuffID.Frostburn] = true; - player.buffImmune[BuffID.Frostburn2] = true; } public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.AnkhShield). AddIngredient(). AddIngredient(). + AddIngredient(ItemID.HallowedBar, 5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/CoinofDeceit.cs b/Items/Accessories/CoinofDeceit.cs index 694429bc96..1b9ac86cd6 100644 --- a/Items/Accessories/CoinofDeceit.cs +++ b/Items/Accessories/CoinofDeceit.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.Calamity().stealthStrike85Cost = true; + player.Calamity().stealthStrike90Cost = true; player.GetCritChance() += 6; } diff --git a/Items/Accessories/ElysianAegis.cs b/Items/Accessories/ElysianAegis.cs index c941a263df..babe4c2a83 100644 --- a/Items/Accessories/ElysianAegis.cs +++ b/Items/Accessories/ElysianAegis.cs @@ -10,7 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { [AutoloadEquip(EquipType.Shield)] - public class ElysianAegis : ModItem, ILocalizedModType, IHoldShiftTooltipItem + public class ElysianAegis : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; public bool HasFlavorTooltip => true; @@ -36,23 +36,9 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - - // Elysian Aegis ram dash modPlayer.DashID = ElysianAegisDash.ID; player.dashType = 0; - - // Vaguely inherited Ankh Shield effects I guess player.noKnockback = true; - player.fireWalk = true; - - // Debuff immunities - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.OnFire3] = true; - player.buffImmune[BuffID.CursedInferno] = true; - player.buffImmune[BuffID.ShadowFlame] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[ModContent.BuffType()] = true; } } } diff --git a/Items/Accessories/OrnateShield.cs b/Items/Accessories/OrnateShield.cs index 40d0834c14..30e331049d 100644 --- a/Items/Accessories/OrnateShield.cs +++ b/Items/Accessories/OrnateShield.cs @@ -20,21 +20,14 @@ namespace CalamityMod.Items.Accessories Item.height = 32; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.defense = 2; // This has a ram dash, it should give a bit less defense due to how good it is + Item.defense = 2; Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - // Ornate Shield ram dash player.Calamity().DashID = OrnateShieldDash.ID; player.dashType = 0; - - // Cold debuff immunities (Do not fear, this accessory is post Cryogen!) - player.buffImmune[BuffID.Chilled] = true; - player.buffImmune[BuffID.Frozen] = true; - player.buffImmune[BuffID.Frostburn] = true; - player.buffImmune[BuffID.Frostburn2] = true; } public override void AddRecipes() diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 3f20df2b6a..f9987ef183 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -6,7 +6,9 @@ using CalamityMod.Items.PermanentBoosters; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Items.Weapons.Typeless; +using CalamityMod.Physics; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -1350,6 +1352,80 @@ namespace CalamityMod.Items //Calamity Permanent Upgrades shimmerTransmute[ItemID.FrogLeg] = ModContent.ItemType(); + + + // -- Vanilla Boss Shimmer Drop Cycles -- + // These cycles follow the order of: Melee Weapons A to Z -> Ranged Weapons A to Z -> Magic Weapons A to Z -> Summon Weapons A to Z -> Rogue Weapons A to Z (Based off of their in-game names) + // Note that only a select amount of vanilla bosses have an array of equally-likely weapon drops, so the amount of drop pools affected may seem odd at first glance. + + // Queen Bee + shimmerTransmute[ItemID.BeeKeeper] = ItemID.BeesKnees; + shimmerTransmute[ItemID.BeesKnees] = ItemID.BeeGun; + shimmerTransmute[ItemID.BeeGun] = ItemID.BeeKeeper; + + // Deerclops + shimmerTransmute[ItemID.LucyTheAxe] = ItemID.PewMaticHorn; + shimmerTransmute[ItemID.PewMaticHorn] = ItemID.WeatherPain; + shimmerTransmute[ItemID.WeatherPain] = ItemID.HoundiusShootius; + shimmerTransmute[ItemID.HoundiusShootius] = ItemID.LucyTheAxe; + + // Wall of Flesh + shimmerTransmute[ItemID.BreakerBlade] = ItemID.ClockworkAssaultRifle; + shimmerTransmute[ItemID.ClockworkAssaultRifle] = ModContent.ItemType(); + shimmerTransmute[ModContent.ItemType()] = ItemID.LaserRifle; + shimmerTransmute[ItemID.LaserRifle] = ModContent.ItemType(); + shimmerTransmute[ModContent.ItemType()] = ItemID.FireWhip; + shimmerTransmute[ItemID.FireWhip] = ModContent.ItemType(); + shimmerTransmute[ModContent.ItemType()] = ItemID.BreakerBlade; + + // Plantera + shimmerTransmute[ItemID.FlowerPow] = ItemID.Seedler; + shimmerTransmute[ItemID.Seedler] = ItemID.GrenadeLauncher; + shimmerTransmute[ItemID.GrenadeLauncher] = ItemID.VenusMagnum; + shimmerTransmute[ItemID.VenusMagnum] = ItemID.LeafBlower; + shimmerTransmute[ItemID.LeafBlower] = ItemID.NettleBurst; + shimmerTransmute[ItemID.NettleBurst] = ItemID.WaspGun; + shimmerTransmute[ItemID.WaspGun] = ItemID.FlowerPow; + + // Golem + shimmerTransmute[ItemID.EyeoftheGolem] = ItemID.SunStone; + shimmerTransmute[ItemID.SunStone] = ItemID.GolemFist; + shimmerTransmute[ItemID.GolemFist] = ItemID.PossessedHatchet; + shimmerTransmute[ItemID.PossessedHatchet] = ItemID.Stynger; + shimmerTransmute[ItemID.Stynger] = ItemID.HeatRay; + shimmerTransmute[ItemID.HeatRay] = ItemID.StaffofEarth; + shimmerTransmute[ItemID.StaffofEarth] = ItemID.EyeoftheGolem; + + // Duke Fishron + shimmerTransmute[ItemID.FishronWings] = ItemID.Flairon; + shimmerTransmute[ItemID.Flairon] = ItemID.Tsunami; + shimmerTransmute[ItemID.Tsunami] = ItemID.BubbleGun; + shimmerTransmute[ItemID.BubbleGun] = ItemID.RazorbladeTyphoon; + shimmerTransmute[ItemID.RazorbladeTyphoon] = ItemID.TempestStaff; + shimmerTransmute[ItemID.TempestStaff] = ModContent.ItemType(); + shimmerTransmute[ModContent.ItemType()] = ItemID.FishronWings; + + // Empress of Light (Yes these are actually the IDs) + shimmerTransmute[ItemID.RainbowWings] = ItemID.PiercingStarlight; + shimmerTransmute[ItemID.PiercingStarlight] = ItemID.FairyQueenRangedItem; + shimmerTransmute[ItemID.FairyQueenRangedItem] = ItemID.FairyQueenMagicItem; + shimmerTransmute[ItemID.FairyQueenMagicItem] = ItemID.SparkleGuitar; + shimmerTransmute[ItemID.SparkleGuitar] = ItemID.RainbowWhip; + shimmerTransmute[ItemID.RainbowWhip] = ItemID.EmpressBlade; + shimmerTransmute[ItemID.EmpressBlade] = ItemID.RainbowWings; + + // Moon Lord + shimmerTransmute[ItemID.Meowmere] = ItemID.StarWrath; + shimmerTransmute[ItemID.StarWrath] = ItemID.Terrarian; + shimmerTransmute[ItemID.Terrarian] = ItemID.Celeb2; + shimmerTransmute[ItemID.Celeb2] = ItemID.SDMG; + shimmerTransmute[ItemID.SDMG] = ItemID.LastPrism; + shimmerTransmute[ItemID.LastPrism] = ItemID.LunarFlareBook; + shimmerTransmute[ItemID.LunarFlareBook] = ItemID.MoonlordTurretStaff; + shimmerTransmute[ItemID.MoonlordTurretStaff] = ItemID.RainbowCrystalStaff; + shimmerTransmute[ItemID.RainbowCrystalStaff] = ModContent.ItemType(); + shimmerTransmute[ModContent.ItemType()] = ItemID.Meowmere; + } #endregion } diff --git a/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs b/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs index 3af6d8f825..105dd1799c 100644 --- a/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs +++ b/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Items.DraedonMisc mageDisplay.OverrideColor = new Color(201, 41, 255); list.Insert(insertIndex + 3, mageDisplay); - int summonItem = ModContent.ItemType(); + int summonItem = ModContent.ItemType(); TooltipLine summonDisplay = new TooltipLine(this.Mod, "CalamityMod:SummonDisplay", $"[i:{summonItem}] {CalamityUtils.GetItemName(summonItem)}"); summonDisplay.OverrideColor = new Color(149, 243, 43); list.Insert(insertIndex + 4, summonDisplay); diff --git a/Items/Fishing/FishingRods/EarlyBloomRod.cs b/Items/Fishing/FishingRods/EarlyBloomRod.cs index ea7cbacd81..276056f757 100644 --- a/Items/Fishing/FishingRods/EarlyBloomRod.cs +++ b/Items/Fishing/FishingRods/EarlyBloomRod.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -25,11 +26,30 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); + Item.accessory = true; } + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } public override void HoldItem(Player player) { player.accFishingLine = true; + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.EarlyBloomRod; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.EarlyBloomRod; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Fishing/FishingRods/FeralDoubleRod.cs b/Items/Fishing/FishingRods/FeralDoubleRod.cs index cf8ad0dc8e..d57ea7d818 100644 --- a/Items/Fishing/FishingRods/FeralDoubleRod.cs +++ b/Items/Fishing/FishingRods/FeralDoubleRod.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -24,6 +25,31 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; + Item.accessory = true; + } + + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } + public override void HoldItem(Player player) + { + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.FeralDoubleRod; + Item.fishingPole = 40 +(int)((1f + (player.statLifeMax2 - player.statLife) * 0.25f)); + + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.FeralDoubleRod; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Fishing/FishingRods/HeronRod.cs b/Items/Fishing/FishingRods/HeronRod.cs index 2e15e436bf..de061ab965 100644 --- a/Items/Fishing/FishingRods/HeronRod.cs +++ b/Items/Fishing/FishingRods/HeronRod.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -28,6 +29,29 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; + Item.accessory = true; + } + + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } + public override void HoldItem(Player player) + { + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.HeronRod; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.HeronRod; } public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) diff --git a/Items/Fishing/FishingRods/NavyFishingRod.cs b/Items/Fishing/FishingRods/NavyFishingRod.cs index 686b065a72..3aec86c486 100644 --- a/Items/Fishing/FishingRods/NavyFishingRod.cs +++ b/Items/Fishing/FishingRods/NavyFishingRod.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; @@ -24,6 +25,29 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; + Item.accessory = true; + } + + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } + public override void HoldItem(Player player) + { + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.NavyFishingRod; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.NavyFishingRod; } public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) diff --git a/Items/Fishing/FishingRods/RiftReeler.cs b/Items/Fishing/FishingRods/RiftReeler.cs index 4de6da68e1..f8f84d98f1 100644 --- a/Items/Fishing/FishingRods/RiftReeler.cs +++ b/Items/Fishing/FishingRods/RiftReeler.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -30,13 +31,35 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; + Item.accessory = true; + } + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } + public override void HoldItem(Player player) + { + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.RiftReeler; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.RiftReeler; } 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 < Main.rand.Next(3, 6); i++) //3 to 5 bobbers + for (int i = 0; i < 4; i++) //4 bobbers { - Projectile.NewProjectile(source, position, velocity.RotatedByRandom(MathHelper.ToRadians(18f)), type, 0, 0f, player.whoAmI, ai2: Main.rand.Next(2)); + Projectile.NewProjectile(source, position, velocity.RotatedByRandom(MathHelper.ToRadians(45f)), type, 10, 1f, player.whoAmI, ai2: Main.rand.Next(2)); } return false; } @@ -47,7 +70,7 @@ namespace CalamityMod.Items.Fishing.FishingRods if (bobber.ai[2] == 0f) lineColor = new Color(255, 165, 0, 100); else - lineColor = new Color(0, 206, 209, 100); + lineColor = new Color(200, 206, 209, 100); } public override void AddRecipes() diff --git a/Items/Fishing/FishingRods/SlurperPole.cs b/Items/Fishing/FishingRods/SlurperPole.cs index cac04d7307..5f853c3c89 100644 --- a/Items/Fishing/FishingRods/SlurperPole.cs +++ b/Items/Fishing/FishingRods/SlurperPole.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Typeless; +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -27,6 +28,29 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; + Item.accessory = true; + } + + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } + public override void HoldItem(Player player) + { + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.SlurperPole; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.SlurperPole; } public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) diff --git a/Items/Fishing/FishingRods/TheDevourerofCods.cs b/Items/Fishing/FishingRods/TheDevourerofCods.cs index 9ab034fd53..bbbc0ba65a 100644 --- a/Items/Fishing/FishingRods/TheDevourerofCods.cs +++ b/Items/Fishing/FishingRods/TheDevourerofCods.cs @@ -1,4 +1,9 @@ -using CalamityMod.Items.Materials; +using System.Collections.Generic; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Fishing.AstralCatches; +using CalamityMod.Items.Fishing.BrimstoneCragCatches; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -12,6 +17,24 @@ namespace CalamityMod.Items.Fishing.FishingRods { public class TheDevourerofCods : ModItem, ILocalizedModType { + public static List FishToEat = new List() + { + ItemID.Bass, + ItemID.AtlanticCod, + ItemID.Flounder, + ItemID.NeonTetra, + ItemID.RedSnapper, + ItemID.RockLobster, + ItemID.Salmon, + ItemID.Shrimp, + ItemID.Trout, + ItemID.Tuna, + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + }; public new string LocalizationCategory => "Items.Fishing"; public override void SetStaticDefaults() { @@ -31,13 +54,32 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); + Item.accessory = true; } + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } public override void HoldItem(Player player) { + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.TheDevourerOfCods; player.accFishingLine = true; } + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.TheDevourerOfCods; + } + 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 < 10; i++) diff --git a/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs b/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs index 74ef5cc142..7781598667 100644 --- a/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs +++ b/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -28,6 +29,30 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; + Item.accessory = true; + } + + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } + public override void HoldItem(Player player) + { + player.accFishingLine = true; + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.VerstaltiteFishingRod; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.VerstaltiteFishingRod; } public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) diff --git a/Items/Fishing/FishingRods/WulfrumRod.cs b/Items/Fishing/FishingRods/WulfrumRod.cs index c004f3137f..237c0fbe50 100644 --- a/Items/Fishing/FishingRods/WulfrumRod.cs +++ b/Items/Fishing/FishingRods/WulfrumRod.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -23,12 +24,35 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shootSpeed = 10f; Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.accessory = true; + } + + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } + public override void HoldItem(Player player) + { + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.WulfrumRod; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.WulfrumRod; } public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) { lineOriginOffset = new Vector2(35f, -27f); - lineColor = new Color(200, 200, 200, 100); + lineColor = Color.Lerp(Color.GreenYellow, Color.DeepSkyBlue, Main.player[bobber.owner].Calamity().consecutiveCaughtFish / 5f); } public override void AddRecipes() diff --git a/Items/Placeables/SunkenSea/TableCoralLeft.cs b/Items/Placeables/SunkenSea/TableCoralLeft.cs index 835a1e43df..2d75ce2b27 100644 --- a/Items/Placeables/SunkenSea/TableCoralLeft.cs +++ b/Items/Placeables/SunkenSea/TableCoralLeft.cs @@ -5,6 +5,7 @@ namespace CalamityMod.Items.Placeables.SunkenSea { public class TableCoralLeft : ModItem, ILocalizedModType { + public new string LocalizationCategory => "Items.Placeables"; public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; diff --git a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs b/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.cs similarity index 69% rename from Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs rename to Items/Weapons/DraedonsArsenal/AqueousHunterDrone.cs index 15fda0cf58..8ab0339f1c 100644 --- a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs +++ b/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.cs @@ -6,23 +6,29 @@ using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class StarSwallowerContainmentUnit : ModItem, ILocalizedModType + public class AqueousHunterDrone : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; + public static readonly SoundStyle Fire = new("CalamityMod/Sounds/Item/ShrimpFire"); + public static readonly SoundStyle Hit = new("CalamityMod/Sounds/Item/ShrimpMissileHit"); + public static readonly SoundStyle Sound1 = new("CalamityMod/Sounds/Item/ShrimpSound1"); + public static readonly SoundStyle Sound2 = new("CalamityMod/Sounds/Item/ShrimpSound2"); + public static readonly SoundStyle Surprise = new("CalamityMod/Sounds/Item/ShrimpSurprise"); public override void SetDefaults() { CalamityGlobalItem modItem = Item.Calamity(); - Item.width = 18; - Item.height = 28; + Item.width = 34; + Item.height = 32; Item.shootSpeed = 10f; - Item.damage = 24; + Item.damage = 30; Item.mana = 10; Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.HoldUp; @@ -30,33 +36,25 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.knockBack = 2.25f; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; - Item.UseSound = SoundID.Item15; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; - - modItem.UsesCharge = true; - modItem.MaxCharge = 50f; - modItem.ChargePerUse = 0.8f; - modItem.ChargePerAltUse = 0f; } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 mouse = player.ClampedMouseWorld(); Point mouseTileCoords = mouse.ToTileCoordinates(); if (!CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).HasTile) { - int p = Projectile.NewProjectile(source, mouse, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, new Vector2(mouse.X, player.Center.Y - 600), Vector2.Zero, type, damage, knockback, player.whoAmI); + Main.projectile[p].localAI[2] = player.ownedProjectileCounts[Item.shoot]; if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } return false; } - public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1); - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.png b/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.png new file mode 100644 index 0000000000..4c5c16cd38 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.png differ diff --git a/Items/Weapons/DraedonsArsenal/AqueousHunterDroneGlow.png b/Items/Weapons/DraedonsArsenal/AqueousHunterDroneGlow.png new file mode 100644 index 0000000000..b069a6dde7 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/AqueousHunterDroneGlow.png differ diff --git a/Items/Weapons/Melee/Lucrecia.cs b/Items/Weapons/Melee/Lucrecia.cs index e9a0937621..b42c097c68 100644 --- a/Items/Weapons/Melee/Lucrecia.cs +++ b/Items/Weapons/Melee/Lucrecia.cs @@ -1,41 +1,68 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee.Shortswords; +using CalamityMod.Cooldowns; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee.Spears; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class Lucrecia : ModItem, ILocalizedModType + public class Lucrecia : BaseSwordHoldoutItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public static int MaxEnergy = 100; + + public override int ProjectileType => ModContent.ProjectileType(); + public override void SetDefaults() { Item.width = 54; Item.height = 54; - Item.noMelee = true; - Item.noUseGraphic = true; - Item.autoReuse = true; - Item.useStyle = ItemUseStyleID.Rapier; - Item.damage = 90; + Item.useStyle = ItemUseStyleID.Shoot; + Item.damage = 170; Item.DamageType = DamageClass.Melee; - Item.useAnimation = Item.useTime = 30; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 4.2f; + Item.useAnimation = Item.useTime = 34; + Item.shootSpeed = 10f; Item.knockBack = 8.25f; - Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; + + Item.autoReuse = true; + Item.channel = true; + // Item.noMelee = true; + // Item.noUseGraphic = true; + base.SetDefaults(); + } - public override bool MeleePrefix() => true; + public override bool AltFunctionUse(Player player) + { + return true; + } + + + public override void HoldItem(Player player) + { + if (player.Calamity().cooldowns.TryGetValue(LucreciaEnergy.ID, out var cooldown)) + { + cooldown.timeLeft = player.Calamity().lucreciaEnergy; + } + else + { + player.AddCooldown(LucreciaEnergy.ID, 0); + } + } + + // public override bool MeleePrefix() => true; public override void AddRecipes() { CreateRecipe(). AddIngredient(5). - AddIngredient(). + AddIngredient(ItemID.FallenStar, 10). AddIngredient(ItemID.SoulofLight, 5). AddIngredient(ItemID.SoulofNight, 5). AddTile(TileID.MythrilAnvil). diff --git a/Items/Weapons/Melee/Murasama.cs b/Items/Weapons/Melee/Murasama.cs index 8faa8dac75..b7a00a61d5 100644 --- a/Items/Weapons/Melee/Murasama.cs +++ b/Items/Weapons/Melee/Murasama.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 90; Item.height = 134; - Item.damage = 2000; + Item.damage = 2001; Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index ed14a54750..5920e13c94 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -1073,6 +1073,11 @@ AquaticStar: { Description: The aquatic star will protect you } +AqueousHunterDroneBuff: { + DisplayName: Aqueous Hunter Drone Buff + Description: Unfortunately incapable of producing fried rice +} + AstralProbeBuff: { DisplayName: Astral Probe Description: The astral probe will protect you diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 0c10d1af98..ca9417e492 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -229,15 +229,7 @@ AsgardianAegis: { ''' Allows the ability to dash, empowered by a cosmic inferno This dash can ram through enemies without taking damage - Grants immunity to knockback and fire blocks, as well as multiple debuffs - ''' - HoldShiftTooltip: - ''' - On Fire!, Hellfire, Burning, Chilled, Frozen, Frostburn, Frostbite, Weak, - Broken Armor, Bleeding, Poisoned, Acid Venom, Sulphuric Poisoning, Slow, Confused, - Silenced, Cursed, Darkness, Webbed, Mighty Wind, Stoned, Armor Crunch, Blackout, - Brain Rot, Burning Blood, Heavy Bleeding, Laceration, Cursed Inferno, Brimstone Flames, - Shadowflame, Daybroken, Nightwither, Holy Flames, Voidfrost, God Slayer Inferno + Grants immunity to knockback ''' } @@ -247,13 +239,7 @@ AsgardsValor: { ''' Allows the ability to ram dash This dash can ram through enemies without taking damage - Grants immunity to knockback and fire blocks, as well as multiple debuffs - ''' - HoldShiftTooltip: - ''' - On Fire!, Hellfire, Chilled, Frozen, Frostburn, Frostbite, Weak, - Broken Armor, Bleeding, Poisoned, Slow, Confused, Silenced, Cursed, - Darkness, Mighty Wind, Stoned, Brimstone Flames, Burning + Grants immunity to knockback ''' } @@ -438,7 +424,7 @@ CoinofDeceit: { DisplayName: Coin of Deceit Tooltip: ''' - Stealth strikes only expend 85% of your max stealth + Stealth strikes only expend 90% of your max stealth 6% increased rogue crit chance ''' } @@ -734,14 +720,9 @@ ElysianAegis: { ''' Allows the ability to dash, empowered by holy fire This dash can ram through enemies without taking damage - Grants immunity to knockback, fire blocks, as well as multiple debuffs + Grants immunity to knockback + 'Blessed by the Profaned Flame' ''' - HoldShiftTooltip: - ''' - On Fire!, Hellfire, Cursed Inferno, Shadowflame, Daybroken, - Holy Flames, Brimstone Flames, Burning - ''' - FlavorTooltip: "'Blessed by the Profaned Flame'" } EnchantedPearl: { @@ -1281,7 +1262,6 @@ OrnateShield: { ''' Allows the ability to dash This dash can ram through enemies without taking damage - Grants immunity to Chilled, Frostburn, Frostbite, and Frozen ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson index 75375242bb..075b4cea5c 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson @@ -282,6 +282,7 @@ EarlyBloomRod: { Tooltip: ''' Fires six lines at once. Line never snaps + Equip this as an accessory to disable fishing minigames 'The early bird catches the fish' ''' } @@ -291,7 +292,12 @@ FeralDoubleRod: { Tooltip: ''' Fires two lines at once - Just as you have tamed the jungle monster, you can now tame the fish in the sea + Gains fishing power the more life you have lost + Provides a fishing minigame + Press to drain life + Draining life speeds up catches + Bobbers can hook onto enemies, dealing damage when life is drained + Equip this as an accessory to use this minigame for other rods ''' } @@ -300,8 +306,12 @@ HeronRod: { Tooltip: ''' Increases fishing power by {0}x when in space - 'A silent head and beak lanced down and plucked it out by the head, - and the beak swallowed the little fish while its tail waved frantically.' + Provides a fishing minigame + Moving while fishing instead moves your bobbers + Rings appear over time above the water's surface + Touching a ring hooks an item onto the bobber + Bobbers will automatically reel in hooked items upon landing back in the water + Equip this as an accessory to use this minigame for other rods ''' } @@ -309,9 +319,11 @@ NavyFishingRod: { DisplayName: Navy Fishing Rod Tooltip: ''' - While held, slowly electrifies nearby enemies - 'The sea is a city. - Just below are highways, boulevards, streets and roundabouts bustling with submarine traffic.' + Fires bobbers that inflict Static Discharge on nearby enemies + Provides a fishing minigame + The bobber will float at your height underwater, allowing underwater fishing + Move in the indicated direction while fishing to catch items + Equip this as an accessory to use this minigame for other rods ''' } @@ -319,10 +331,13 @@ RiftReeler: { DisplayName: Rift Reeler Tooltip: ''' - Fires three to five lines at once + Fires four lines at once Can fish in lava - 'The battlefield is a scene of constant chaos. - The winner will be the one who controls that chaos, both the pole and the fish.' + Provides a fishing minigame + Moving while fishing instead moves your bobbers + Rifts appear over time in liquids, containing an item + When bobbers touch a rift, they automatically reel in the item within + Equip this as an accessory to use this minigame for other rods ''' } @@ -331,6 +346,7 @@ SlurperPole: { Tooltip: ''' Can fish in lava + Equip this as an accessory to disable fishing minigames 'It is the burning lava of the soul that has a furnace within--a very volcano of grief and sorrow.' ''' } @@ -340,6 +356,11 @@ TheDevourerofCods: { Tooltip: ''' Fires ten lines at once. Line never snaps and can fish from lava + Provides a fishing minigame + Hooked items stay hooked forever + Common fish are automatically consumed while fishing + Consuming fish allows a bobber to hook a new item and feeds the user + Equip this as an accessory to use this minigame for other rods 'The devourer was once just an Eater of Shoals' ''' } @@ -349,13 +370,22 @@ VerstaltiteFishingRod: { Tooltip: ''' Increases fishing power by {0}x when in the tundra + Equip this as an accessory to disable fishing minigames The ancient alloy's prismatic qualities are perfect for attracting fish ''' } WulfrumRod: { DisplayName: Wulfrum Fishing Pole - Tooltip: "'This barely works, but it's better than nothing...'" + Tooltip: + ''' + Can fish up Wulfrum Metal Scrap and Wulfrum Energy Cores + Provides a fishing minigame + Move in the indicated direction while fishing to catch items + The rod empowers the longer you go without a mistake, speeding it up + Equip this as an accessory to use this minigame for other rods + 'This barely works, but it's better than nothing...' + ''' } // Bait diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson index a1ee116328..d0cbc0922e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson @@ -10,6 +10,19 @@ AerialTracker: { ''' } +AqueousHunterDrone: { + DisplayName: P-PMA: Aqueous Hunter Drone + Tooltip: + ''' + Summons a shrimp drone that fires bursts of homing plasma missiles + while holding any summon weapon to command the shrimp to launch a vertical missile barrage + Vertical missiles aim towards your cursor and leave a lingering blast if they hit solid ground + Each shrimp uses 4 minion slots + [c/1FBFF:'When pursuing the adherents of Gods, Yharim believed no stone should be left unturned.] + [c/1FBFF:Weaponry for underwater contingencies was an unusually heavy focus, but no models ever saw deployment.'] + ''' +} + Auger: { DisplayName: P-GSS: Auger Tooltip: @@ -223,16 +236,6 @@ SnakeEyes: { ''' } -StarSwallowerContainmentUnit: { - DisplayName: Star Swallower Containment Unit - Tooltip: - ''' - Summons a biomechanical frog that vomits plasma onto enemies - [c/1FFBFF:'These simplistic creatures were mechanized to autonomously transport plasma.] - [c/1FFBFF:They are vastly more servicable than their mundane organic counterparts.'] - ''' -} - SystemBane: { DisplayName: System Bane Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 12dfdc08ba..b1ec177391 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -800,8 +800,10 @@ Lucrecia: { DisplayName: Lucrecia Tooltip: ''' - Fires a DNA chain - Finesse + [c/9370db:Fires a spiraling darklight shard when swung] + [c/837ce4:Hits with the blade itself build energy] + [c/7489ee:Energy is lost over time but briefly stops depleting after reaching its maximum] + [c/6495f7:Press with maximum energy to fire a double helix comet] ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index cf9b90ba21..ce21c9c89f 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -147,6 +147,7 @@ GrandGuardianBoom.DisplayName: Cosmic Burst GreenWater.DisplayName: Greentide Tooth GrovetendersEntanglingVines.DisplayName: Entangling Growth GrovetendersTouch.DisplayName: Grovetender's Touch +GildedProboscisProj.DisplayName: Gilded Proboscis HeavensMight.DisplayName: Heaven's Might HeavensMonolith.DisplayName: Heaven's Monolith HellionSpike.DisplayName: Hellion Spike @@ -159,15 +160,23 @@ LamentationsOfTheChained.DisplayName: Lamentations of the Chained LifeScythe.DisplayName: Lifehunt Scythe LightBeam.DisplayName: Light Beam LightningThing.DisplayName: Lightning +LucreciaProj.DisplayName: Lucrecia +LucreciaDNATrailCreator.DisplayName: Lucrecia DNA +LucreciaDoubleHelix.DisplayName: Lucrecia Helix Comet +LucreciaSmallProjectile.DisplayName: Lucrecia LuxorsGiftMelee.DisplayName: Luxor's Melee MantisClawHoldout.DisplayName: Mantis Claw MantisClawJet.DisplayName: Mantis Claw Jet MantisClawSlash.DisplayName: Mantis Claw Slash MicrowaveAura.DisplayName: Microwave Radiation MirrorBlast.DisplayName: Mirror Blast +MirrorBladeProjectile.DisplayName: Mirror Blade +MirrorBladeSlash.DisplayName: Mirror Blade Slash +MirrorBladeSlashCreator.DisplayName: Mirror Blade Slash Creator MonstrousKnife.DisplayName: Monstrous Knife MourningSkull.DisplayName: Mourning Skull MourningstarFlail.DisplayName: Mourningstar +MutilatorSwordProj.DisplayName: The Mutilator Nebudust.DisplayName: Nebulash Dust NebulashFlail.DisplayName: Nebulash NebulaShot.DisplayName: Nebula Shot @@ -301,8 +310,3 @@ WulfrumScrew.DisplayName: Wulfrum Screw WulfrumScrewdriverProj.DisplayName: Wulfrum Screwdriver YinYoDark.DisplayName: Dark Shard YinYoLight.DisplayName: Light Shard -MutilatorSwordProj.DisplayName: The Mutilator -MirrorBladeProjectile.DisplayName: Mirror Blade -MirrorBladeSlash.DisplayName: Mirror Blade Slash -MirrorBladeSlashCreator.DisplayName: Mirror Blade Slash Creator -GildedProboscisProj.DisplayName: Gilded Proboscis diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson index 9dc5d84ee5..da430c0950 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson @@ -8,6 +8,7 @@ AnomalysNanogunHoldout.DisplayName: The Anomaly's Nanogun AnomalysNanogunMPFBBoom.DisplayName: MPFB Explosion AnomalysNanogunMPFBDevastator.DisplayName: MPFB Devastator AnomalysNanogunPlasmaBeam.DisplayName: Plasma Beam +AqueousHunterDroneSummon.DisplayName: Plasma Shrimp AugerHoldout.DisplayName: P-GSS Auger AugerSlash.DisplayName: Auger Slash AugerPull.DisplayName: Auger Pull @@ -40,6 +41,7 @@ PulseRifleShot.DisplayName: Pulse Bolt PulseTurret.DisplayName: Pulse Turret PulseTurretShot.DisplayName: Pulse Bolt ShortCircuitHook.DisplayName: Short Circuit Hook +ShrimpPlasmaMissile.DisplayName: Plasma Shrimp Missile SnakeEyesSummon.DisplayName: Snake Eyes SnakeEyesProjectile.DisplayName: Inescapable Bolt StarSwallowerAcid.DisplayName: Acid @@ -55,6 +57,7 @@ WavePounderBoom.DisplayName: Explosion WavePounderProjectile.DisplayName: Wave Pounder // Environmental AcidDrop.DisplayName: Acid +BarrelCactusProjectile.DisplayName: Barrel Cactus BrimstoneGeyser.DisplayName: Smoke GeyserTelegraph.DisplayName: Geyser HotSteam.DisplayName: Steam diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index 5d270374d2..a8074892b0 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -1,4 +1,4 @@ -SmallWorldWarning: "[c/FF0000:SMALL WORLDS NOT SUPPORTED BY CALAMITY]" +SmallWorldWarning: "[c/FF0000:SMALL WORLDS NOT SUPPORTED BY CALAMITY]" // Main Menu Name MainMenu: Calamity Style MainMenuClassic: Calamity Style - Classic @@ -119,6 +119,7 @@ Cooldowns: { KillModeCooldown: Kill Mode Cooldown LifeSteal: Life Steal Cooldown LionHeartShield: Energy Shell Cooldown + LucreciaEnergy: Lucrecia Energy M1GarandShots: Chambered Rounds MasterChefShieldDurability: MJOLNIR Shield Level MasterChefShieldRecharge: MJOLNIR Shield Recharge @@ -132,7 +133,7 @@ Cooldowns: { PrismaticLaser: Prismatic Laser Barrage Cooldown ProfanedSoulShieldDurability: Profaned Soul Shield Durability ProfanedSoulShieldRecharge: Profaned Soul Shield Recharge - RaidersBoost: Extra Critical Chance + RaidersBoost: Extra Critical Strike Chance RelicOfResilienceCooldown: Relic of Resilience Cooldown RogueBooster: Rogue Booster Cooldown SandCloak: Sand Cloak Cooldown diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 51133250cd..93d249ce38 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -1167,7 +1167,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()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); @@ -1335,8 +1335,8 @@ namespace CalamityMod return tagData.ContainsKey("RevengeanceMode") && tagData.GetBool("RevengeanceMode") && !(tagData.ContainsKey("DeathMode") && tagData.GetBool("DeathMode")); }; - RegisterWorldInfoIcon(luminance, "CalamityMod/UI/ModeIndicator/ModeIndicator_Death", "Mods.CalamityMod.UI.DeathEnabled", deathEnabled, 50); - RegisterWorldInfoIcon(luminance, "CalamityMod/UI/ModeIndicator/ModeIndicator_Rev", "Mods.CalamityMod.UI.RevengeanceEnabled", revengeanceEnabled, 50); + RegisterWorldInfoIcon(luminance, "CalamityMod/UI/ModeIndicator/ModeIndicator_Death", "Mods.CalamityMod.UI.Death", deathEnabled, 50); + RegisterWorldInfoIcon(luminance, "CalamityMod/UI/ModeIndicator/ModeIndicator_Rev", "Mods.CalamityMod.UI.Revengeance", revengeanceEnabled, 50); } #endregion } diff --git a/NPCs/BaseWormNPC.cs b/NPCs/BaseWormNPC.cs new file mode 100644 index 0000000000..6a7bd0bfe3 --- /dev/null +++ b/NPCs/BaseWormNPC.cs @@ -0,0 +1,569 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs +{ + #region Animations + public class WormAnimation + { + + + public Dictionary AnimationKeyframes = new(); + + /// + /// The rigidity of segments + /// + public float segmentRigidity = 0.75f; + /// + /// Should this animation mirror to match the worm's X direction? + /// + public bool mirror = true; + /// + /// Should this animation apply the animation's rotation values? + /// + public bool applyRotation = true; + public class WormKeyframe + { + public float[] segmentOffsets = new float[1]; + /// + /// Creates the segment rotation offsets for the given keyframe. + /// Everything to NaN, which will inherit the rotation offset of the frame before it. + /// + public WormKeyframe(params (float, float)[] parameters) + { + segmentOffsets = new float[200]; + var off = new List(); + for (var i = 0; i < 200; i++) + { + bool broken = false; + for (var i2 = 0; i2 < parameters.Length; i2++) + { + if (parameters[i2].Item1 == i) + { + segmentOffsets[i] = parameters[i2].Item2; + broken = true; + break; + } + } + if (!broken) + segmentOffsets[i] = float.NaN; + } + } + + public static WormKeyframe GetCurrent(BaseWormNPC HeadNPC) + { + WormKeyframe kf = new(); + for (var i = 0; i < HeadNPC.Segments.Count(); i++) + { + if (i == 0) + { + + var dif = ShortestAngle(HeadNPC.NPC.rotation, HeadNPC.Segments[i].rotation); + kf.segmentOffsets[i] = dif; + //Main.NewText((HeadNPC.NPC.rotation, HeadNPC.Segments[i].DirectionFrom(HeadNPC.NPC.Center).ToRotation())); + } + else + { + var dif = ShortestAngle(HeadNPC.Segments[i - 1].rotation, HeadNPC.Segments[i].rotation); + kf.segmentOffsets[i] = dif; + } + } + return kf; + } + static float ShortestAngle(float from, float to) + { + float difference = to - from; + + while (difference < -MathHelper.Pi) + difference += MathHelper.TwoPi; + while (difference > MathHelper.Pi) + difference -= MathHelper.TwoPi; + + return difference; + } + /// + /// Converts this keyframe into a usable array. + /// + /// + public float[] ClearTheNaNs() + { + float[] offsets = new float[segmentOffsets.Length]; + for (var i = 0; i < segmentOffsets.Length; i++) + { + if (float.IsNaN(segmentOffsets[i])) + { + if (i == 0) + offsets[i] = 0; + else + offsets[i] = offsets[i - 1]; + } + else + { + offsets[i] = segmentOffsets[i]; + } + } + return offsets; + } + } + + /// + /// Applies this animation for the given frame + /// + /// + /// + public void ApplyAnimationFrame(BaseWormNPC HeadNPC, float frame) + { + var orderedKeyframes = AnimationKeyframes.OrderBy(x => x.Key); + (int, float[], float)? prev = null; + (int, float[], float)? next = null; + float[] goalSegmentRotOffsets = new float[200]; + float goalRotation = float.NaN; + foreach (var item in orderedKeyframes) + { + if (item.Key < frame) + { + prev = (item.Key, item.Value.Item1.ClearTheNaNs(), item.Value.Item2); + } + else + { + next = (item.Key, item.Value.Item1.ClearTheNaNs(), item.Value.Item2); + break; + } + } + if (next.HasValue && prev.HasValue) + { + float completion = (frame - prev.Value.Item1) / (next.Value.Item1 - prev.Value.Item1); + for (var i = 0; i < goalSegmentRotOffsets.Length; i++) + { + goalSegmentRotOffsets[i] = MathHelper.Lerp(prev.Value.Item2[i], next.Value.Item2[i], completion); + } + if (float.IsNaN(next.Value.Item3) && frame == next.Value.Item1) + AnimationKeyframes[next.Value.Item1] = (AnimationKeyframes[next.Value.Item1].Item1, next.Value.Item3); + if (!float.IsNaN(prev.Value.Item3)) + { + goalRotation = MathHelper.Lerp(prev.Value.Item3, next.Value.Item3, completion); + } + } + else + { + if (prev.HasValue) + goalSegmentRotOffsets = prev.Value.Item2; + if (next.HasValue) + { + goalSegmentRotOffsets = next.Value.Item2; + if (float.IsNaN(next.Value.Item3) && frame == next.Value.Item1) + AnimationKeyframes[next.Value.Item1] = (AnimationKeyframes[next.Value.Item1].Item1, next.Value.Item3); + } + } + if (HeadNPC.Segments.Count > 0) + { + if (applyRotation && !(float.IsNaN(goalRotation))) + { + HeadNPC.NPC.rotation = goalRotation * (mirror ? HeadNPC.NPC.velocity.X.DirectionalSign() : 1); + } + for (int i = 0; i < HeadNPC.Segments.Count; i++) + { + + Vector2 pos1 = HeadNPC.NPC.Center; + float dist = HeadNPC.SegmentTypePositionOffsets[0]; + if (i != 0) + { + dist = HeadNPC.SegmentTypePositionOffsets[HeadNPC.Segments[i - 1].segmentType + 1]; + } + dist *= HeadNPC.NPC.scale; + Vector2 rot = (HeadNPC.NPC.rotation - MathHelper.PiOver2).ToRotationVector2(); + if (rot == Vector2.Zero) + rot = HeadNPC.Segments[0].Center.AngleTo(HeadNPC.NPC.Center).ToRotationVector2(); + if (i >= 1) + { + pos1 = HeadNPC.Segments[i - 1].Center; + rot = HeadNPC.Segments[i - 1].velocity.SafeNormalize(Vector2.Zero); + } + rot = rot.RotatedBy(goalSegmentRotOffsets[i] * (mirror ? HeadNPC.NPC.velocity.X.DirectionalSign() : 1)); + var dir = HeadNPC.Segments[i].Center.DirectionFrom(pos1); + HeadNPC.Segments[i].Center = pos1 + Vector2.Lerp(dir, -(rot), segmentRigidity) * dist; + HeadNPC.Segments[i].velocity = HeadNPC.Segments[i].Center.DirectionTo(pos1); + HeadNPC.Segments[i].rotation = HeadNPC.Segments[i].velocity.ToRotation() + MathHelper.PiOver2; + } + + for (int i = 1; i < HeadNPC.Segments.Count - 1; i++) + { + HeadNPC.Segments[i].rotation = HeadNPC.Segments[i + 1].Center.DirectionTo(HeadNPC.Segments[i - 1].Center).ToRotation() + MathHelper.PiOver2; + } + } + } + } + #endregion + public abstract class BaseWormNPC : ModNPC + { + #region Abstracts & Commonly Overriden Fields + /// + /// The amount of segments of this worm. This does not include the head + /// + public abstract int SegmentCount { get; } + /// + /// A list of the offsets to the next segment in the worm from this segment + /// DOES include the head + /// + public abstract List SegmentTypePositionOffsets { get; } + /// + /// A list of all textures for the segments to draw with + /// does NOT include the head + /// + public abstract List SegmentTextures { get; } + /// + /// The type of the worm hitbox NPC + /// Make sure that NPC is a child of BaseWormHitboxNPC! + /// + public abstract int WormHitboxNpcType { get; } + /// + /// Offsets for drawing each segment + /// + public List SegmentTypeDrawOffsets = new List(); + + + /// + /// How far through the current animation this worm is + /// + public float AnimationFrame = 0; + /// + /// The active animation for the worm + /// + public WormAnimation ActiveAnimation = null; + #endregion + + #region Segments + /// + /// The list of all segments of this worm + /// + public List Segments = new(); + + /// + /// The textures for each segment type of this worm. Works like getting a texture from TextureAssets + /// + public List> SegmentTextureAssets + { + get + { + if (internalTexAssets.Count == 0) + for (var i = 0; i < SegmentTextures.Count; i++) + { + internalTexAssets.Add(ModContent.Request(SegmentTextures[i])); + if (SegmentTypeDrawOffsets.Count <= i) + { + SegmentTypeDrawOffsets.Add(Vector2.Zero); + } + } + return internalTexAssets; + } + } + + /// + /// Internal list that stores the textureassets. + /// Use SegmentTextureAssets to get the data stored here. + /// + private List> internalTexAssets = new List>(); + + /// + /// This class is used to store the information of each segment's location, size, and texture path + /// Due to the amount of segments, there is only one actual NPC for this boss + /// + public class Segment + { + /// + /// The type of segment this is. Segment type is used to determine spacing and textures. + /// + public int segmentType = 0; + + /// + /// The position of the center of this segment + /// + public Vector2 Center = Vector2.Zero; + + /// + /// The rotation of this segment in radians + /// + public float rotation = 0; + + /// + /// The velocity this segment has. + /// Currently doesn't actually do anything besides be a token value if needed to be read by something + /// + public Vector2 velocity = Vector2.Zero; + public Segment(ModNPC Head, int segmentStyle = 0) + { + Center = Head.NPC.Center; + rotation = Head.NPC.rotation; + velocity = Head.NPC.velocity; + segmentType = segmentStyle; + } + } + public enum SegmentFollowLogic + { + Regular = 0, //Traditional worm segment logic + Exact = 1, //Follows the path the head took exactly + // In the future, add a segment logic that supports solid tile collisions and forces applied to *any* segment + } + + /// + /// Which type of segment following logic this worm should currently use + /// + public SegmentFollowLogic SegmentFollowType; + + /// + /// How rigid the segment should be when using default segment logic + /// + public float SegmentRigidity = 0.2f; + + /// + /// The points used by ExactSegmentLogic to exactly follow the head + /// + private List segmentPoints = new List(); + + /// + /// Updates the positions of the segments based on the value set in SegmentFollowType + /// + public void UpdateSegments() + { + NPC.position += NPC.velocity; //Update this segment's movement so that all other segments use this as the base. This is undone at the end of the method. + if (ActiveAnimation is not null) + { + ActiveAnimation.ApplyAnimationFrame(this, AnimationFrame); + AnimationFrame++; + if (AnimationFrame > ActiveAnimation.AnimationKeyframes.Keys.Max()) + { + AnimationFrame = 0; + ActiveAnimation = null; + } + } + else + { + if (segmentPoints.Count < 1 || segmentPoints[0].Distance(NPC.Center) > 8) + { + segmentPoints.Insert(0, NPC.Center); + } + while (segmentPoints.Count > 300) + { + segmentPoints.RemoveAt(segmentPoints.Count - 1); + } + switch (SegmentFollowType) + { + case (SegmentFollowLogic.Regular): + RegularSegmentLogic(); + break; + case (SegmentFollowLogic.Exact): + ExactSegmentLogic(); + break; + } + } + NPC.position -= NPC.velocity; + + //Spawning hitboxes for all the segments near the player + SpawnHitboxes(); + + } + + private void RegularSegmentLogic() + { + for (int i = 0; i < Segments.Count; i++) + { + float segmentDistance = SegmentTypePositionOffsets[0]; + var thisSeg = Segments[i]; + var aheadSeg = new Segment(this); + if (i != 0) + { + aheadSeg = Segments[i - 1]; + segmentDistance = SegmentTypePositionOffsets[Segments[i - 1].segmentType + 1]; + } + segmentDistance *= NPC.scale; + Vector2 nexSegDir = aheadSeg.Center - thisSeg.Center; + if (aheadSeg.rotation != thisSeg.rotation) + { + nexSegDir = nexSegDir.RotatedBy(MathHelper.WrapAngle(aheadSeg.rotation - thisSeg.rotation) * SegmentRigidity); + nexSegDir = nexSegDir.MoveTowards((aheadSeg.rotation - thisSeg.rotation).ToRotationVector2(), 1f); + } + thisSeg.rotation = nexSegDir.ToRotation() + MathHelper.PiOver2; + thisSeg.Center = aheadSeg.Center - nexSegDir.SafeNormalize(Vector2.Zero) * segmentDistance; + + } + } + + private void ExactSegmentLogic() + { + float dist = 40f; + int segmentPointInUse = 0; + for (int i = 0; i < Segments.Count; i++) + { + var thisSeg = Segments[i]; + var aheadSeg = new Segment(this); + if (i != 0) + aheadSeg = Segments[i - 1]; + bool hasMoved = false; + while (segmentPointInUse < segmentPoints.Count) + { + if (segmentPointInUse == 0) + { + if (aheadSeg.Center.Distance(segmentPoints[0]) >= dist) + { + thisSeg.Center = aheadSeg.Center + aheadSeg.Center.DirectionTo(segmentPoints[0]) * dist; + Segments[i].velocity = Segments[i].Center.DirectionTo(aheadSeg.Center); + Segments[i].rotation = Segments[i].velocity.ToRotation() + MathHelper.PiOver2; + hasMoved = true; + break; + } + else + { + segmentPointInUse++; + } + } + else + { + if (aheadSeg.Center.Distance(segmentPoints[segmentPointInUse]) >= dist) + { + thisSeg.Center = aheadSeg.Center + aheadSeg.Center.DirectionTo(segmentPoints[segmentPointInUse]) * dist; + Segments[i].velocity = Segments[i].Center.DirectionTo(aheadSeg.Center); + Segments[i].rotation = Segments[i].velocity.ToRotation() + MathHelper.PiOver2; + hasMoved = true; + break; + } + else + { + segmentPointInUse++; + } + } + } + if (!hasMoved && segmentPointInUse >= segmentPoints.Count) + { + thisSeg.Center = segmentPoints[segmentPoints.Count - 1]; + Segments[i].velocity = Segments[i].Center.DirectionTo(aheadSeg.Center); + Segments[i].rotation = Segments[i].velocity.ToRotation() + MathHelper.PiOver2; + hasMoved = true; + hasMoved = true; + break; + } + } + } + + /// + /// Spawns the hitboxes for the worm's segments. + /// Won't spawn hitboxes if there's less than 5 avaliable NPC slots + /// + public virtual void SpawnHitboxes() + { + if (Main.netMode != NetmodeID.MultiplayerClient) + for (int i = 0; i < Segments.Count; i++) + { + if (Main.npc.Count(x => x.active) >= Main.maxNPCs - 5) + break; + if (Main.player.Any(x => x.active && Segments[i].Center.Distance(x.Center) < 1200)) + { + if (Main.npc.Any(x => x.active && x.type == WormHitboxNpcType && x.ai[1] == i && x.ai[0] == NPC.whoAmI)) + { + Main.npc.First(x => x.active && x.type == WormHitboxNpcType && x.ai[1] == i && x.ai[0] == NPC.whoAmI).ai[2] = 0; + } + else + NPC.NewNPC(NPC.GetSource_Misc("Hitbox"), (int)Segments[i].Center.X, (int)Segments[i].Center.Y + 100, WormHitboxNpcType, ai0: NPC.whoAmI, ai1: i); + } + } + } + #endregion + + #region Defaults + + public override void SetStaticDefaults() + { + NPCID.Sets.MustAlwaysDraw[Type] = true; + } + public override void SetDefaults() + { + for (var i = 0; i < SegmentCount - 1; i++) + { + Segments.Add(new Segment(this, 0)); + } + Segments.Add(new Segment(this, 1)); + } + + #endregion + + #region Draw + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + for (int i = Segments.Count - 1; i >= 0; i--) + { + DrawSegment(spriteBatch, screenPos, drawColor, Segments[i]); + } + spriteBatch.Draw(TextureAssets.Npc[Type].Value, NPC.Center - Main.screenPosition, null, drawColor, NPC.rotation, TextureAssets.Npc[Type].Value.Size() / 2, NPC.scale, SpriteEffects.None, 1); + return false; + } + + public virtual void DrawSegment(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor, Segment segment) + { + var color = Lighting.GetColor(segment.Center.ToTileCoordinates()); + if (!SegmentTextureAssets.IndexInRange(segment.segmentType)) + { + return; + } + var tex = SegmentTextureAssets[segment.segmentType].Value; + spriteBatch.Draw(tex, segment.Center - Main.screenPosition, null, color, segment.rotation, tex.Size() / 2 + (SegmentTypeDrawOffsets[segment.segmentType]), NPC.scale, SpriteEffects.None, 1); + } + #endregion + } + + //The segments near a player spawn a hitbox NPC to allow damaging players and taking damage + public abstract class BaseWormHitboxNPC : ModNPC + { + public override void SetDefaults() + { + NPC.width = 200; + NPC.height = 200; + NPC.lifeMax = 10000; + NPC.knockBackResist = 0; + NPC.noTileCollide = true; + NPC.aiStyle = -1; + } + + public override bool? CanBeHitByItem(Player player, Item item) + { + var canhit = Main.npc[(int)NPC.ai[0]].ModNPC.CanBeHitByItem(player, item); + if (canhit.HasValue && !canhit.Value) + return false; + return base.CanBeHitByItem(player, item); + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + var canhit = Main.npc[(int)NPC.ai[0]].ModNPC.CanBeHitByProjectile(projectile); + if (canhit.HasValue && !canhit.Value) + return false; + return base.CanBeHitByProjectile(projectile); + } + + public override void AI() + { + var headNPC = Main.npc[(int)NPC.ai[0]]; + if (!(headNPC.ModNPC is BaseWormNPC && headNPC.active)) + { + NPC.active = false; + return; + } + NPC.realLife = (int)NPC.ai[0]; + NPC.damage = headNPC.damage; + NPC.lifeMax = headNPC.lifeMax; + NPC.life = headNPC.life; + NPC.Center = (headNPC.ModNPC as BaseWormNPC).Segments[(int)NPC.ai[1]].Center; + } + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + return false; + } + } +} diff --git a/Particles/RoundedStar.png b/Particles/RoundedStar.png new file mode 100644 index 0000000000..f88faa5601 Binary files /dev/null and b/Particles/RoundedStar.png differ diff --git a/Particles/RoundedStarParticle.cs b/Particles/RoundedStarParticle.cs new file mode 100644 index 0000000000..fbb55e8e3b --- /dev/null +++ b/Particles/RoundedStarParticle.cs @@ -0,0 +1,82 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using CalamityMod.Particles; +using Terraria.ModLoader; +using System; + +namespace CalamityMod.Particles +{ + public class RoundedStarParticle : Particle + { + public override string Texture => "CalamityMod/Particles/RoundedStar"; + + public float RotationSpeed; + public float Deceleration; + + public bool UseSpiralAI; + private int OwnerIndex; + private float InitialRadius; + private float OrbitalAngle; + + public override bool UseCustomDraw => true; + public RoundedStarParticle(Vector2 position, Vector2 velocity, Color color, float scale, int lifetime, float rotationSpeed, float deceleration, bool useSpiralAI, Vector2 spiralTarget, int ownerIndex) + { + Position = position; + Velocity = velocity; + Color = color; + Scale = scale; + Lifetime = lifetime; + RotationSpeed = rotationSpeed; + Deceleration = deceleration; + UseSpiralAI = useSpiralAI; + OwnerIndex = ownerIndex; + + if (UseSpiralAI) + { + // Store the initial radius and angle relative to the player + Vector2 directionToPlayer = Position - Main.player[OwnerIndex].Center; + InitialRadius = directionToPlayer.Length(); + OrbitalAngle = directionToPlayer.ToRotation(); + } + } + + public override void Update() + { + if (UseSpiralAI) + { + OrbitalAngle += RotationSpeed; + + float fadeScale = 1f - (Time / (float)Lifetime); + float currentRadius = InitialRadius * fadeScale; + + Vector2 playerCenter = Main.player[OwnerIndex].Center; + + Vector2 newRelativePosition = OrbitalAngle.ToRotationVector2() * currentRadius; + + // Update the particle's position. + Position = playerCenter + newRelativePosition; + } + else + { + // If not using the spiral AI, apply deceleration + Velocity *= Deceleration; + Position += Velocity; + } + + Rotation += RotationSpeed; + Time++; + if (Time >= Lifetime) + Kill(); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + float fade = 1f - (Time / (float)Lifetime); + float scaleFade = Scale * fade; + + Texture2D tex = ModContent.Request(Texture).Value; + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * fade, Rotation, tex.Size() / 2f, Scale, SpriteEffects.None, 0f); + } + } +} diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 4a119a31f7..6e944b0b01 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -13,6 +13,7 @@ using CalamityMod.Events; using CalamityMod.ExtraTextures; using CalamityMod.Items.Accessories; using CalamityMod.Items.Ammo; +using CalamityMod.Items.Fishing.FishingRods; using CalamityMod.Items.Armor.Daedalus; using CalamityMod.Items.Armor.Reaver; using CalamityMod.Items.Potions.Alcohol; @@ -364,6 +365,8 @@ namespace CalamityMod.Projectiles #region Pre AI public override bool PreAI(Projectile projectile) { + if (projectile.bobber && projectile.type != ModContent.ProjectileType() && RunFishingMinigames(projectile)) + return false; #region Vanilla Summons AI Changes // @@ -2849,6 +2852,727 @@ namespace CalamityMod.Projectiles } #endregion + #region Fishing Minigames + // All these fields are exclusively used for fishing minigames, so I declared them in this region for organization + /// + /// Reel state of bobber.
+ /// ai[0] in bobber AI. + ///
+ private float isReelingIn = 0; + /// + /// How long you have to catch a fish when bitten.
+ /// ai[1] in bobber AI. + ///
+ private float CatchTime = 0; + /// + /// How long until a fish bites.
+ /// LocalAI[1] in bobber AI. + ///
+ private float TimerToCatch = 0; + /// Item ID of hooked item for fishing minigames. + public int CaughtItemID = -1; + /// What this does depends on the fishing minigame. Used to store data between updates. + public float PersistentFishingData = -1; + /// + public Vector2 PersistentFishingDataVector2 = Vector2.Zero; + public bool RunFishingMinigames(Projectile projectile) + { + var owner = Main.player[projectile.owner]; + var cplayer = owner.Calamity(); + + //Make sure Victide Snail actually fishes when using a minigame rod + foreach (var item in Main.ActiveProjectiles) + { + if (item.type == ModContent.ProjectileType() && item.owner == projectile.owner) + item.ModProjectile().PlayerFishingTimer = 600; + } + #region Utilities + void SmallSplashAtOffset(Vector2 offset) + { + int num = Dust.NewDust(new Vector2(projectile.position.X - 6f, projectile.position.Y - 10f) + offset, projectile.width + 12, 24, Dust.dustWater()); + Main.dust[num].velocity.Y -= 4f; + Main.dust[num].velocity.X *= 2.5f; + Main.dust[num].scale = 0.8f; + Main.dust[num].alpha = 100; + Main.dust[num].noGravity = true; + } + void SmallDustAtOffset(Vector2 offset, int dustID) + { + int num = Dust.NewDust(new Vector2(projectile.position.X - 6f, projectile.position.Y - 10f) + offset, projectile.width + 12, 24, dustID); + Main.dust[num].velocity.Y -= 4f; + Main.dust[num].velocity.X *= 2.5f; + Main.dust[num].scale = 0.8f; + Main.dust[num].alpha = 100; + Main.dust[num].noGravity = true; + } + void Splash() + { + for (int i = 0; i < 100; i++) + { + int num = Dust.NewDust(new Vector2(projectile.position.X - 6f, projectile.position.Y - 10f), projectile.width + 12, 24, Dust.dustWater()); + Main.dust[num].velocity.Y -= 4f; + Main.dust[num].velocity.X *= 2.5f; + Main.dust[num].scale = 0.8f; + Main.dust[num].alpha = 100; + Main.dust[num].noGravity = true; + } + + SoundEngine.PlaySound(SoundID.SplashWeak, projectile.Center); + } + void ReelTheBobberChecks() + { + if (projectile.localAI[1] == 1) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.SpawnOnPlayer(owner.whoAmI, 370); + } + projectile.ai[0] = 2f; + } + else if (projectile.localAI[1] < 1) + { + Point point = default(Point); + point = new Point((int)projectile.position.X, (int)projectile.position.Y); + int num = (int)(0f - projectile.localAI[1]); + if (num == 618) + { + point.Y += 64; + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendData(MessageID.FishOutNPC, -1, -1, null, point.X / 16, point.Y / 16, num); + } + else + { + if (num == 682) + { + NPC.unlockedSlimeRedSpawn = true; + } + NPC.NewNPC(new EntitySource_FishedOut(owner), point.X, point.Y, num); + projectile.ai[0] = 2f; + WorldGen.CheckAchievement_RealEstateAndTownSlimes(); + } + } + else if (Main.rand.NextBool(7) && !owner.accFishingLine) + { + projectile.ai[0] = 2f; + projectile.ai[1] = 0; + projectile.localAI[1] = 0; + } + else + { + projectile.ai[1] = projectile.localAI[1]; + } + projectile.netUpdate = true; + } + + Vector2 GetWaterLine() + { + Vector2 FoundWaterline = projectile.Center; + var tilePos = projectile.Center.ToTileCoordinates(); + if (Main.tile[tilePos.X, tilePos.Y].LiquidAmount > 0) + { + for (var i = 0; i < 1000; i++) + { + if (i <= 0 || i >= Main.maxTilesY || Main.tile[tilePos.X, tilePos.Y - i].LiquidAmount > 0) + continue; + FoundWaterline.Y = (tilePos.Y - i + 1) * 16f; + FoundWaterline.Y += (1 - Main.tile[tilePos.X, tilePos.Y - i + 1].LiquidAmount / 255f) * 16f; + break; + } + } + else + { + for (var i = 0; i < 1000; i++) + { + if (i <= 0 || i >= Main.maxTilesY || Main.tile[tilePos.X, tilePos.Y + i].LiquidAmount == 0) + continue; + FoundWaterline.Y = (tilePos.Y + i) * 16f; + FoundWaterline.Y += (1 - Main.tile[tilePos.X, tilePos.Y + i].LiquidAmount / 255f) * 16f; + break; + } + } + return FoundWaterline; + } + #endregion + //Doze's notes on bobber AI + + //ai[0] - Bobber state. 0: thrown/idle/bitten, 1: reeling in, 2: snapped + //ai[1] - Amount of time to reel in the bobber once a bite happens. Is negative and counts up + //When reeled in, this becomes the value of localAI[1] (ID of item/NPC) + //At 0, the bobber is just floating waiting for a bite + //localAI[1] - The timer for fish to try and bite the hook. When it exceeds 660, it resets to 0. + //If ai[1] is not 0, this is set to the item ID of the hooked item/NPC + //If hooking an NPC, this is set to the NPC ID but negative. Still need to find how this gets treated upon reeling in. + switch (owner.Calamity().SelectedFishingMinigame) + { + case CalamityPlayer.FishingMinigames.WulfrumRod: + { + if (CatchTime < 0 || (isReelingIn == 1 && CaughtItemID > 0)) + { + owner.Calamity().ShouldHideControls = true; + } + if (isReelingIn != projectile.ai[0]) + return false; + + if (CatchTime < 0) + CatchTime++; + if (projectile.wet || (projectile.lavaWet && owner.accLavaFishing) || projectile.honeyWet) + TimerToCatch++; + var speedup = Math.Min(owner.Calamity().consecutiveCaughtFish * 5, 25); + var totalTime = 60 - speedup; + if (TimerToCatch + 90 >= 160 - owner.HeldItem.fishingPole && CatchTime >= 0) + { + if (PersistentFishingData == 0) + PersistentFishingData = Main.rand.NextBool() ? 1 : -1; + var timer = TimerToCatch - 160 - owner.HeldItem.fishingPole; + SmallSplashAtOffset(new Vector2(200 * PersistentFishingData * (timer / 90f), 0)); + } + if (TimerToCatch >= 160 - owner.HeldItem.fishingPole && CatchTime >= 0) + { + PersistentFishingData = 0; + projectile.FishingCheck(); + if (projectile.ai[1] < 0) + { + CatchTime = -totalTime * 4; + CaughtItemID = (int)projectile.localAI[1]; + } + TimerToCatch = 0; + } + if (CatchTime < 0 && CatchTime % totalTime == 0) + { + Splash(); + PersistentFishingData = Main.rand.Next(0, 4); + var particle = new CustomSpark(projectile.Center, Vector2.UnitX.RotatedBy(PersistentFishingData * MathHelper.PiOver2) * 10, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 45 - speedup, 0.04f, Color.Blue, new(1, 2), shrinkSpeed: -0.2f); + GeneralParticleHandler.SpawnParticle(particle); + } + if (CatchTime < 0 && CatchTime % totalTime == -15) + { + var playerDir = -1; + if (owner.Calamity().pressedUp) + { + playerDir = 3; + } + if (owner.Calamity().pressedLeft) + { + playerDir = 2; + } + if (owner.Calamity().pressedDown) + { + playerDir = 1; + } + if (owner.Calamity().pressedRight) + { + playerDir = 0; + } + if (playerDir == PersistentFishingData) + { + + } + else + { + + if (playerDir >= 0) + { + var particle = new CustomSpark(projectile.Center, Vector2.UnitX.RotatedBy(playerDir * MathHelper.PiOver2) * 10, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 15, 0.04f, Color.Red, new(1, 2), shrinkSpeed: -0.2f); + GeneralParticleHandler.SpawnParticle(particle); + } + else + { + var particle = new CustomSpark(projectile.Center, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 15, 0.06f, Color.Red, Vector2.One); + GeneralParticleHandler.SpawnParticle(particle); + } + TimerToCatch = 0; + CatchTime = 0; + CaughtItemID = -1; + PersistentFishingData = 0; + owner.Calamity().consecutiveCaughtFish = 0; + } + } + if (CatchTime == -1) + { + projectile.localAI[1] = CaughtItemID; + ReelTheBobberChecks(); + owner.Calamity().consecutiveCaughtFish++; + if (projectile.ai[0] == 2) + return false; + isReelingIn = 1; + CatchTime = (float)CaughtItemID; + TimerToCatch = 0; + } + if (projectile.ai[0] == 0) + { + + + projectile.ai[1] = CatchTime; + projectile.localAI[1] = TimerToCatch; + if (CaughtItemID != -1 && isReelingIn == 0) + { + projectile.localAI[1] = 0; + projectile.ai[1] = 0; + } + projectile.ai[0] = isReelingIn; + } + return false; + } + + + case CalamityPlayer.FishingMinigames.RiftReeler: + { + if (PersistentFishingData == -1) + { + PersistentFishingData = 1; + TimerToCatch = 300; + } + var Waterline = GetWaterLine(); + if (Waterline.Y >= projectile.Center.Y) + { + TimerToCatch = 300; + projectile.velocity.Y += 0.4f; + } + else if (projectile.ai[0] == 0) + { + owner.Calamity().ShouldHideControls = true; + if (owner.Calamity().pressedUp) + projectile.velocity.Y -= 0.125f; + if (owner.Calamity().pressedDown) + projectile.velocity.Y += 0.125f; + if (owner.Calamity().pressedLeft) + projectile.velocity.X -= 0.125f; + if (owner.Calamity().pressedRight) + projectile.velocity.X += 0.125f; + } + projectile.velocity *= 0.975f; + + if (Waterline.Y <= projectile.Center.Y && projectile.ai[0] == 0 && !(projectile.lavaWet && !owner.accLavaFishing)) + { + TimerToCatch -= Main.rand.Next(1, 5); + if (TimerToCatch <= 0) + { + projectile.FishingCheck(); + if (projectile.ai[1] < 0) + { + + CaughtItemID = (int)projectile.localAI[1]; + projectile.ai[1] = 0; + projectile.localAI[1] = 0; + for (var i = 0; i < 1000; i++) + { + var vectorToCheck = projectile.Center + new Vector2(Main.rand.Next(-200, 201), Main.rand.Next(-200, 201)); + var tileCoordsToCheck = vectorToCheck.ToSafeTileCoordinates(); + if (new Rectangle((int)Main.screenPosition.X, (int)Main.screenPosition.Y, Main.screenWidth, Main.screenHeight).Contains((int)vectorToCheck.X, (int)vectorToCheck.Y) && !Main.tile[tileCoordsToCheck.X, tileCoordsToCheck.Y].IsTileSolid() && Main.tile[tileCoordsToCheck.X, tileCoordsToCheck.Y].LiquidAmount > 0) + { + if (projectile.localAI[2] >= 1) + { + int customSonarText = (int)(projectile.localAI[2] - 1); + if (Main.popupText[customSonarText].sonar) + { + Main.popupText[customSonarText].position = vectorToCheck - FontAssets.MouseText.Value.MeasureString(Main.popupText[customSonarText].name) / 2f; + } + } + PersistentFishingDataVector2 = vectorToCheck; + TimerToCatch = 600; + break; + } + } + } + } + if (PersistentFishingDataVector2 != Vector2.Zero) + { + Dust.NewDustPerfect(PersistentFishingDataVector2, DustID.Smoke); + if (Main.rand.NextBool(3)) + { + Dust.NewDustPerfect(PersistentFishingDataVector2, DustID.Torch); + } + var particle = new HeavySmokeParticle(PersistentFishingDataVector2, Vector2.One.RotatedByRandom(6.28) * Main.rand.NextFloat(1f, 4f), Color.Lerp(Color.DarkOrange, Color.DarkGray, Main.rand.NextFloat()), 15, 0.2f, 1); + GeneralParticleHandler.SpawnParticle(particle); + } + + //When in lava, give the bobber a particle over it to show its location + if (projectile.lavaWet) + { + var particle = new CustomSpark(projectile.Center, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 2, 0.01f, Color.DarkGray, Vector2.One); + GeneralParticleHandler.SpawnParticle(particle); + } + List<(Vector2, int)> validRifts = new(); + + foreach (var item in Main.ActiveProjectiles) + { + if (item.bobber && projectile.type != ModContent.ProjectileType() && item.owner == projectile.owner && item.ai[0] == 0 && item.Calamity().PersistentFishingDataVector2 != Vector2.Zero) + { + validRifts.Add((item.Calamity().PersistentFishingDataVector2, item.whoAmI)); + } + } + foreach (var item in validRifts) + { + if (projectile.Distance(item.Item1) < 16) + { + projectile.localAI[1] = Main.projectile[item.Item2].Calamity().CaughtItemID; + ReelTheBobberChecks(); + if (projectile.ai[0] < 2) + projectile.ai[0] = 1; + Main.projectile[item.Item2].Calamity().PersistentFishingDataVector2 = PersistentFishingDataVector2; + Main.projectile[item.Item2].Calamity().CaughtItemID = CaughtItemID; + break; + } + + } + } + if (projectile.ai[0] == 0) + return true; + break; + } + + + case CalamityPlayer.FishingMinigames.FeralDoubleRod: + if (projectile.ai[0] == 0) + { + if (projectile.wet) //Fishing in water + { + + projectile.extraUpdates = 0; + if (cplayer.mouseRight && projectile.ai[1] == 0) + { + projectile.localAI[1] += 2; + owner.lifeRegenCount -= 60; // -0.5 health per tick + } + } + else //Attached to an enemy + { + if (PersistentFishingData >= 0 && Main.npc[(int)PersistentFishingData].active && projectile.Distance(Main.npc[(int)PersistentFishingData].Center + PersistentFishingDataVector2) < 128) + { + projectile.Center = Main.npc[(int)PersistentFishingData].Center + PersistentFishingDataVector2; + projectile.velocity = Vector2.Zero; + if (cplayer.mouseRight && projectile.ai[1] == 0 && owner.miscCounter % 10 == 0) + { + owner.lifeRegenCount -= 600; // -5 health per 10 ticks + var projID = Projectile.NewProjectile(projectile.GetSource_FromThis(), Main.npc[(int)PersistentFishingData].Center, Vector2.Zero, ModContent.ProjectileType(), (int)owner.GetBestClassDamage().ApplyTo(owner.HeldItem.fishingPole + owner.fishingSkill + owner.ChooseAmmo(owner.HeldItem).bait), 0f, owner.whoAmI, Main.npc[(int)PersistentFishingData].whoAmI); + if (Main.projectile.IndexInRange(projID)) + { + Main.projectile[projID].ArmorPenetration = 100; //This should ignore almost all armor + } + } + projectile.timeLeft++; + + projectile.extraUpdates = 0; + return true; + } + else if (PersistentFishingData >= 0) + { + PersistentFishingData = -1; + projectile.velocity.Y -= 3; + } + foreach (var item in Main.ActiveNPCs) + { + if (item.friendly || item.dontTakeDamage) + continue; + if (projectile.Colliding(projectile.Hitbox, item.Hitbox)) + { + PersistentFishingDataVector2 = projectile.Center - item.Center; + PersistentFishingData = item.whoAmI; + break; + } + } + if (PersistentFishingData == -1) + projectile.extraUpdates = 1; + else + projectile.extraUpdates = 0; + + } + } + else if (projectile.ai[0] == 1) + projectile.extraUpdates = 3; + break; + + + case CalamityPlayer.FishingMinigames.NavyFishingRod: + { + if (CatchTime < 0 || (isReelingIn == 1 && CaughtItemID > 0)) + { + owner.Calamity().ShouldHideControls = true; + } + if (isReelingIn != projectile.ai[0]) + return false; + var waterline = GetWaterLine(); + var AdjustedOwnerWaterline = waterline; + if (AdjustedOwnerWaterline.Y < owner.Center.Y) + AdjustedOwnerWaterline.Y = owner.Center.Y; + if (AdjustedOwnerWaterline.Y >= projectile.Center.Y) + { + projectile.velocity.Y += 0.4f; + } + else + { + projectile.velocity.Y -= 0.1f; + } + projectile.velocity *= 0.975f; + if (CatchTime < 0) + CatchTime++; + if (projectile.wet || (projectile.lavaWet && owner.accLavaFishing) || projectile.honeyWet) + TimerToCatch++; + var speedup = 15; + var totalTime = 60 - speedup; + if (TimerToCatch + 90 >= 300 && CatchTime >= 0) + { + if (PersistentFishingData == 0) + PersistentFishingData = Main.rand.NextBool() ? 1 : -1; + var timer = TimerToCatch - 300; + SmallSplashAtOffset(new Vector2(200 * PersistentFishingData * (timer / 90f), 0)); + + SmallDustAtOffset(new Vector2(200 * PersistentFishingData * (timer / 90f), 0), DustID.BlueCrystalShard); + } + if (TimerToCatch >= 300 && CatchTime >= 0) + { + PersistentFishingData = 0; + projectile.FishingCheck(); + if (projectile.ai[1] < 0) + { + CatchTime = -totalTime * 4; + CaughtItemID = (int)projectile.localAI[1]; + } + TimerToCatch = 0; + } + if (CatchTime < 0 && CatchTime % totalTime == 0) + { + Splash(); + PersistentFishingData = Main.rand.Next(0, 2); + var particle = new CustomSpark(projectile.Center, Vector2.UnitX.RotatedBy(PersistentFishingData * MathHelper.Pi) * 10, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 45 - speedup, 0.04f, Color.Blue, new(1, 2), shrinkSpeed: -0.2f); + GeneralParticleHandler.SpawnParticle(particle); + } + if (CatchTime < 0 && CatchTime % totalTime == -15) + { + var playerDir = -1; + if (owner.Calamity().pressedLeft) + { + playerDir = 1; + } + if (owner.Calamity().pressedRight) + { + playerDir = 0; + } + if (playerDir == PersistentFishingData) + { + + } + else + { + + if (playerDir >= 0) + { + var particle = new CustomSpark(projectile.Center, Vector2.UnitX.RotatedBy(playerDir * MathHelper.Pi) * 10, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 15, 0.04f, Color.Red, new(1, 2), shrinkSpeed: -0.2f); + GeneralParticleHandler.SpawnParticle(particle); + } + else + { + var particle = new CustomSpark(projectile.Center, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 15, 0.06f, Color.Red, Vector2.One); + GeneralParticleHandler.SpawnParticle(particle); + } + TimerToCatch = 0; + CatchTime = 0; + CaughtItemID = -1; + PersistentFishingData = 0; + owner.Calamity().consecutiveCaughtFish = 0; + } + } + if (CatchTime == -1) + { + projectile.localAI[1] = CaughtItemID; + ReelTheBobberChecks(); + owner.Calamity().consecutiveCaughtFish++; + if (projectile.ai[0] == 2) + return false; + isReelingIn = 1; + CatchTime = (float)CaughtItemID; + TimerToCatch = 0; + } + if (projectile.ai[0] == 0) + { + + + projectile.ai[1] = CatchTime; + projectile.localAI[1] = TimerToCatch; + if (CaughtItemID != -1 && isReelingIn == 0) + { + projectile.localAI[1] = 0; + projectile.ai[1] = 0; + } + projectile.ai[0] = isReelingIn; + } + if (projectile.ai[0] == 0) + return true; + break; + } + + + case CalamityPlayer.FishingMinigames.TheDevourerOfCods: + var fishToEat = TheDevourerofCods.FishToEat; + if (projectile.ai[1] < -1) + { + //Coonsuming a fish provides/increases the player's food buffs. + if (fishToEat.Contains((int)projectile.localAI[1])) + { + projectile.ai[1] = 0; + projectile.localAI[1] = 0; + SoundEngine.PlaySound(SoundID.Item2, projectile.Center); + //If the player doesn't have Ex. Stuffed, either give them Plenty Satisfied or inrease existing Plenty Satisfied duration + if (!owner.HasBuff(BuffID.WellFed3)) + { + + if (owner.HasBuff(BuffID.WellFed2)) + { + var bIndex = owner.FindBuffIndex(BuffID.WellFed2); + if (owner.buffTime[bIndex] < CalamityUtils.MinutesToFrames(24)) + { + owner.buffTime[bIndex] += 300; + } + } + else + { + + owner.AddBuff(BuffID.WellFed2, 300); + } + } + else //If the player DOES have Ex. Stuffed, increase the duration of it + { + var bIndex = owner.FindBuffIndex(BuffID.WellFed3); + if (owner.buffTime[bIndex] < CalamityUtils.MinutesToFrames(24)) //Requires fishing once per day if you'd like to keep free ExStuffed forever + { + owner.buffTime[bIndex] += 300; + } + } + } + else //If the hooked item isn't consumable, make it stay hooked forever. + { + projectile.ai[1] = -30; + } + } + + return false; + + + case CalamityPlayer.FishingMinigames.HeronRod: + { + if (CatchTime < 0 || (isReelingIn == 1 && CaughtItemID > 0)) + { + owner.Calamity().ShouldHideControls = true; + } + if (PersistentFishingData == -1) + { + PersistentFishingData = 1; + TimerToCatch = 300; + } + var Waterline = GetWaterLine(); + if (Waterline.Y >= projectile.Center.Y) + { + projectile.velocity.Y += 0.4f; + } + else if (projectile.ai[0] <= 0) + { + projectile.velocity.Y -= 0.1f; + } + if (projectile.ai[0] <= 1) + { + owner.Calamity().ShouldHideControls = true; + } + projectile.velocity *= 0.975f; + if (projectile.wet) + projectile.velocity *= 0.99f; + + //When in lava, give the bobber a particle over it to show its location + if (projectile.lavaWet) + { + var particle = new CustomSpark(projectile.Center, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 2, 0.01f, Color.DarkGray, Vector2.One); + GeneralParticleHandler.SpawnParticle(particle); + } + if (projectile.ai[0] == 0) + { + + if (owner.Calamity().pressedUp && projectile.velocity.Y < 0) + projectile.velocity.Y -= 0.3f; + if (owner.Calamity().pressedUp && Waterline.Y < projectile.Center.Y) + projectile.velocity.Y -= 0.3f; + if (owner.Calamity().pressedDown) + projectile.velocity.Y += 0.25f; + if (owner.Calamity().pressedLeft) + projectile.velocity.X -= 0.25f; + if (owner.Calamity().pressedRight) + projectile.velocity.X += 0.25f; + if (Waterline.Y <= projectile.Center.Y - 8) + TimerToCatch -= Main.rand.Next(1, 5); + if (TimerToCatch <= 0) + { + projectile.FishingCheck(); + if (projectile.ai[1] < 0 && !(projectile.lavaWet && !owner.accLavaFishing)) + { + + CaughtItemID = (int)projectile.localAI[1]; + projectile.ai[1] = 0; + projectile.localAI[1] = 0; + for (var i = 0; i < 1000; i++) + { + var vectorToCheck = Waterline + new Vector2(Main.rand.Next(-200, 201), Main.rand.Next(-200, 32)); + var tileCoordsToCheck = vectorToCheck.ToSafeTileCoordinates(); + if (new Rectangle((int)Main.screenPosition.X, (int)Main.screenPosition.Y, Main.screenWidth, Main.screenHeight).Contains((int)vectorToCheck.X, (int)vectorToCheck.Y) && !Main.tile[tileCoordsToCheck.X, tileCoordsToCheck.Y].IsTileSolid() && Main.tile[tileCoordsToCheck.X, tileCoordsToCheck.Y].LiquidAmount == 0) + { + if (projectile.localAI[2] >= 1) + { + int customSonarText = (int)(projectile.localAI[2] - 1); + if (Main.popupText[customSonarText].sonar) + { + Main.popupText[customSonarText].position = vectorToCheck - FontAssets.MouseText.Value.MeasureString(Main.popupText[customSonarText].name) / 2f; + } + } + PersistentFishingDataVector2 = vectorToCheck; + TimerToCatch = 600; + break; + } + } + } + } + if (PersistentFishingDataVector2 != Vector2.Zero && owner.miscCounter % 15 == 0) + { + + var particle = new CustomSpark(PersistentFishingDataVector2, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 25, 0.02f, Color.Green, Vector2.One); + GeneralParticleHandler.SpawnParticle(particle); + } + List<(Vector2, int)> validRifts = new(); + + foreach (var item in Main.ActiveProjectiles) + { + if (item.bobber && projectile.type != ModContent.ProjectileType() && item.owner == projectile.owner && item.ai[0] == 0 && item.Calamity().PersistentFishingDataVector2 != Vector2.Zero) + { + validRifts.Add((item.Calamity().PersistentFishingDataVector2, item.whoAmI)); + } + } + foreach (var item in validRifts) + { + if (projectile.Distance(item.Item1) < 16) + { + projectile.localAI[1] = Main.projectile[item.Item2].Calamity().CaughtItemID; + projectile.ai[0] = -1; + Main.projectile[item.Item2].Calamity().PersistentFishingDataVector2 = PersistentFishingDataVector2; + Main.projectile[item.Item2].Calamity().CaughtItemID = CaughtItemID; + break; + } + + } + } + if (projectile.ai[0] == -1 && (Waterline.Y <= projectile.Center.Y || projectile.velocity.Length() < 0.5f)) + { + ReelTheBobberChecks(); + if (projectile.ai[0] < 2) + projectile.ai[0] = 1; + } + if (projectile.ai[0] == 0) + return true; + break; + } + + } + return false; + } + #endregion + #region AI public override void AI(Projectile projectile) { diff --git a/Projectiles/DraedonsArsenal/AqueousHunterDroneSummon.cs b/Projectiles/DraedonsArsenal/AqueousHunterDroneSummon.cs new file mode 100644 index 0000000000..49af06b549 --- /dev/null +++ b/Projectiles/DraedonsArsenal/AqueousHunterDroneSummon.cs @@ -0,0 +1,428 @@ +using System; +using CalamityMod.Buffs.Summon; +using CalamityMod.Cooldowns; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.DraedonsArsenal; +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.DraedonsArsenal +{ + public class AqueousHunterDroneSummon : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public int time = 0; + public ref float attackTimer => ref Projectile.ai[0]; + public ref float interactionTimer => ref Projectile.ai[1]; + public int interactionPoint = 600; // The time needed before shimps do their idle animation + public int cooldownGiven = 450; + public bool pressedRight => Projectile.ai[2] == 5; + public bool doingSpecialAttack = false; + public float moveSpeed = 30; // Lower is actually faster + public NPC targetedNPC; // The NPC being targeted + public float tailRot = 0; // Extra rotation on the tail + public float tailRecoil = 0; // Recoil for the tail after firing + public int facingDir = 0; + public Vector2 headPlace; + public Vector2 tailPlace; + public float lastFirePositionX; // Used for some of the movement + public Vector2 chillSpot; // Stored position for intro animation and some movement + public Vector2 spawnAnimStart; // Second stored position for the spawn animation + public Vector2 lastTargetCenter; + public int attackDowntime = 0; // Timer used for post attack effects + public int surpriseTimer = 0; // Used for the jump animation when surprized + public float slidingDirection = 0; // Value that lerps from left to right + public int animationClickTime = 70; // Time before body and tail click together in spawn anim + public bool doSpin = false; // If the shrimp will spin for it's attack + public float specialAttackfx = 0; // spinnning effect opacity mult + public override void SetStaticDefaults() + { + Main.projPet[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.SummonTagDamageMultiplier[Type] = 0f; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + } + public override void SetDefaults() + { + Projectile.width = 1; + Projectile.height = 1; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 4f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.minion = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; + Projectile.DamageType = DamageClass.Summon; + } + + public override void AI() + { + int shrimpNum = Owner.ownedProjectileCounts[Projectile.type]; + facingDir = Math.Sign(Projectile.velocity.X); + GrantBuffs(Owner); + if ((targetedNPC == null || targetedNPC.life <= 0 || !targetedNPC.CanBeChasedBy() || attackDowntime == 20) && attackDowntime < 30) + targetedNPC = Projectile.Center.MinionHoming(2000f, Owner); + + // All the stuff for the spawn animation + if (time < animationClickTime + 20) + { + if (time == 0) + { + chillSpot = Projectile.Center; + spawnAnimStart = Projectile.Center; + int chosenDir = Math.Sign(Projectile.Center.DirectionTo(Owner.Center).X); + Projectile.velocity.X = (chosenDir * 16); + tailRot = -2f * chosenDir; + attackTimer += 8 * Projectile.localAI[2]; + } + SpawnAnim(); + facingDir = Math.Sign(Projectile.velocity.X); + time++; + return; + } + + slidingDirection = MathHelper.Lerp(slidingDirection, Owner.direction, 0.03f); + + bool isSummonWeapon = Owner.HeldItem.DamageType.CountsAsClass(DamageClass.Summon); + if (Owner.Calamity().mouseRight && Owner.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse && Owner.Calamity().arsenalCooldown <= 0 && isSummonWeapon) + { + Projectile.ai[2] = 5; + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.type == Projectile.type && p.owner == Projectile.owner) + { + p.ai[2] = 5; + } + } + } + + if (doingSpecialAttack) + { + SpecialAttack(); + } + else + { + specialAttackfx = MathHelper.Lerp(specialAttackfx, 0, 0.15f); + if (targetedNPC != null || attackDowntime > 0) + { + lastTargetCenter = (targetedNPC == null ? Owner.Center : targetedNPC.Center); + Attacking(); + } + else + { + Passive(); + CheckForSpecialAttack(); + } + } + + if (tailRecoil > 0) + tailRecoil = MathHelper.Lerp(tailRecoil, 0, 0.2f); + if (attackDowntime > 0) + attackDowntime--; + time++; + SetVisualPlacement(); + } + public void CheckForSpecialAttack() + { + if (pressedRight) + { + Projectile.ai[2] = 0; + doingSpecialAttack = true; + attackTimer = 0; + if (Projectile.velocity.Length() < 5) + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 12; + else + Projectile.velocity *= 1.3f; + Owner.Calamity().arsenalCooldown = cooldownGiven; + Owner.AddCooldown(ArsenalPower.ID, cooldownGiven); + } + } + public void SpecialAttack() + { + interactionTimer = 0; + int length = 33; + specialAttackfx = MathHelper.Lerp(specialAttackfx, 1, 0.2f); + + facingDir = Math.Sign(Projectile.Center.DirectionTo(Owner.Center).X); + Projectile.velocity *= 0.98f; + Projectile.rotation += ((MathHelper.TwoPi * 3) / length) * facingDir; + + tailRot = MathHelper.Lerp(tailRot, 0.75f * -facingDir, 0.2f); + for (int i = -1; i <= 1; i += 2) + { + bool noFall = !Main.rand.NextBool(5); + Vector2 vel = Vector2.UnitY.RotatedBy(Projectile.rotation * -5) * i; + int dustStyle = noFall ? ModContent.DustType() : Effects.ArsenalEffects.ArsenalPlasmaDust; + Dust dust = Dust.NewDustPerfect(Projectile.Center + vel * 43 * specialAttackfx, dustStyle); + dust.scale = Main.rand.NextFloat(0.8f, 1.1f) + (noFall ? 0 : 0.5f); + dust.velocity = vel.RotatedBy(Main.rand.NextFloat(-0.2f, 0.2f) - MathHelper.PiOver4 * facingDir) * Main.rand.NextFloat(4, 5.5f); + dust.noGravity = noFall; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + dust.fadeIn = noFall ? 0 : 0.7f; + } + + if (attackTimer % 3 == 0) + { + int usedTimer = (int)(facingDir == -1 ? (length - attackTimer) : attackTimer); + SoundEngine.PlaySound(AqueousHunterDrone.Fire with { Volume = 0.7f, Pitch = 0.0f, PitchVariance = 0.3f, MaxInstances = 10 }, Projectile.Center); + Vector2 shootVel = (MathHelper.PiOver2 / 10 * (int)(usedTimer / 3 - 1)).ToRotationVector2().RotatedBy(-MathHelper.PiOver2 - MathHelper.PiOver4); + Vector2 shootPlace = Projectile.Center + shootVel * 10; + + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), shootPlace, shootVel * 8, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner, 0, 0, attackTimer + 1); + } + attackTimer++; + if (attackTimer > length) + { + attackTimer = 8 * Projectile.localAI[2]; + doingSpecialAttack = false; + } + } + public void SpawnAnim() + { + Vector2 tailDist = new Vector2((30 - Math.Abs(tailRot) * 15) * (-facingDir), 7 - Math.Abs(tailRot) * 3).RotatedBy(Projectile.rotation); + Vector2 headDist = new Vector2(0, 0); + headPlace = Projectile.Center + headDist; + if (time < animationClickTime) + { + tailRot += 0.05f * Projectile.direction; + Projectile.velocity *= 0.98f; + Projectile.Center -= Projectile.velocity; + spawnAnimStart = new Vector2(spawnAnimStart.X, Owner.Center.Y - 700); + + tailPlace = chillSpot + tailDist + (Vector2.UnitY * ((float)Math.Pow(time, 2.05f) * 0.085f) + Vector2.UnitX * (16 - Math.Abs(Projectile.velocity.X)) * 10 * Projectile.direction); + } + else + tailPlace = Projectile.Center + tailDist; + + if (time > animationClickTime - 40) + { + if (time == animationClickTime - 1) + { + Projectile.velocity = Projectile.velocity.RotatedBy(MathHelper.PiOver4 * Projectile.direction) * 3; + SoundStyle click = new("CalamityMod/Sounds/Item/DudFire"); + SoundEngine.PlaySound(click with { Pitch = 0.4f }, Projectile.Center); + SoundEngine.PlaySound((Main.rand.NextBool() ? AqueousHunterDrone.Sound1 : AqueousHunterDrone.Sound2) with { Volume = 0.6f, Pitch = 0.3f, MaxInstances = 10 }, Projectile.Center); + + for (int i = -9; i <= 9; i++) + { + int dustStyle = Effects.ArsenalEffects.ArsenalPlasmaDust; + Dust dust = Dust.NewDustPerfect(tailPlace + Main.rand.NextVector2Circular(5, 5), dustStyle); + dust.scale = Main.rand.NextFloat(0.7f, 1.3f); + dust.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.Pi * (Math.Sign(i) == 1 ? 0 : 1)) * Main.rand.NextFloat(1, 5); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + dust.fadeIn = 0.1f; + if (i == -1) + i++; + } + for (int i = 0; i < 2; i++) + { + Particle spark = new CustomSpark(tailPlace, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 15, 0.4f, Effects.ArsenalEffects.ArsenalPlasmaColor, new Vector2(1, 1), true, true, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + } + if (time > animationClickTime - 1) + { + Projectile.velocity *= 0.97f; + tailRot = MathHelper.Lerp(tailRot, 0, 0.1f); + } + else + { + Projectile.Center = Vector2.Lerp(spawnAnimStart, tailPlace, Utils.GetLerpValue(animationClickTime - 40, animationClickTime, time, true)); + } + } + } + public void Passive() + { + float sine = (float)Math.Sin((time + Projectile.localAI[2] * 3) * 0.075f / MathHelper.Pi); + float sine2 = (float)Math.Sin(((time + Projectile.localAI[2] * 3) * 0.075f / MathHelper.Pi) * 2); + + TailRotationBasedOnMovement(); + + attackTimer = 8 * Projectile.localAI[2]; + + if (interactionTimer == interactionPoint) + { + chillSpot = Owner.Center + Main.rand.NextVector2CircularEdge(190, 190); + } + Projectile.rotation = Projectile.rotation.AngleLerp(0, 0.04f); + Vector2 destination = interactionTimer > interactionPoint ? (chillSpot + new Vector2(220 * sine, -90 + 130 * sine2)) : Owner.Center + new Vector2((-50 + -85 * Projectile.localAI[2]) * slidingDirection, -80 + 30 * sine); + + if (surpriseTimer == 0) + Projectile.velocity = (destination - Projectile.Center) / (moveSpeed + (interactionTimer > interactionPoint ? 20 : 0) - 9 + 9 * sine2); + else + surpriseTimer--; + if (interactionTimer > interactionPoint) + { + if (time % 25 == 0) + { + Particle spark2 = new CustomSpark(Projectile.Center + Main.rand.NextVector2Circular(5, 5) - Vector2.UnitY * 20, -Vector2.UnitY.RotatedByRandom(0.1f) * Main.rand.NextFloat(3.3f, 5.5f), "CalamityMod/Projectiles/Magic/MelterNote1", false, 32, Main.rand.NextFloat(1.2f, 1.3f), Color.Lerp(Color.Green, Color.Chartreuse, Main.rand.NextFloat(0, 0.7f)), new Vector2(1, 1), true, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (time % (480 + Projectile.localAI[2] * 120) == 0 && Owner.miscCounter != 0) + { + SoundEngine.PlaySound((Main.rand.NextBool() ? AqueousHunterDrone.Sound1 : AqueousHunterDrone.Sound2) with { Volume = 0.3f, Pitch = 0f + Projectile.localAI[2] * 0.1f * (Projectile.localAI[2] % 2 == 0 ? -1 : 1), MaxInstances = 10 }, Projectile.Center); + } + } + if (Owner.Center.Distance(Projectile.Center) > 450 && interactionTimer > interactionPoint && Owner.velocity.Length() > 5) + { + CombatText.NewText(Projectile.Hitbox, Effects.ArsenalEffects.ArsenalPlasmaColor, "!", true); + SoundEngine.PlaySound(AqueousHunterDrone.Surprise with { Volume = 0.6f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + Projectile.velocity = Projectile.Center.DirectionTo(Owner.Center); + surpriseTimer = 25; + interactionTimer = 0; + } + if (Projectile.velocity.Length() < 5) + interactionTimer++; + else if (interactionTimer > 0 && interactionTimer < interactionPoint) + interactionTimer -= 2; + } + public void Attacking() + { + interactionTimer = 0; + facingDir = Math.Sign(Projectile.Center.DirectionTo(lastTargetCenter).X); + if (tailRecoil > 1 && doSpin) // Little spin + { + Projectile.rotation += 0.35f * facingDir; + } + else + Projectile.rotation = (Projectile.rotation).AngleLerp(tailPlace.DirectionTo(lastTargetCenter).ToRotation() + (facingDir == -1 ? MathHelper.Pi : 0) + (MathHelper.PiOver4 * -facingDir), 0.18f); + if (Utils.Distance(Projectile.Center, lastTargetCenter) > 250 && Projectile.velocity.Length() < 15) + Projectile.velocity += tailPlace.DirectionTo(lastTargetCenter) * 0.3f; + else + Projectile.velocity *= 0.96f; + if (lastTargetCenter.Y - 80 < tailPlace.Y) + Projectile.velocity.Y -= 0.7f; + + Projectile.velocity *= 0.99f; + if (attackDowntime > 35) // Reposition to somewhere on the other side of the target + { + Projectile.velocity.X += 0.8f * Math.Sign(lastTargetCenter.X - lastFirePositionX); + TailRotationBasedOnMovement(); + } + else + { + CheckForSpecialAttack(); + tailRot = MathHelper.Lerp(tailRot, 0, 0.1f); + } + if (attackTimer > 60) // Fire the missiles + { + Vector2 shootVel = tailPlace.DirectionTo(lastTargetCenter); + Vector2 shootPlace = tailPlace + shootVel * 10; + + lastFirePositionX = Projectile.Center.X; + SoundEngine.PlaySound(AqueousHunterDrone.Fire with { Volume = 0.7f, Pitch = 0.0f, PitchVariance = 0.3f, MaxInstances = 10 }, Projectile.Center); + + for (int i = 0; i < 13; i++) + { + bool noFall = !Main.rand.NextBool(5); + float variance = Main.rand.NextFloat(-0.7f, 0.7f); + int dustStyle = noFall ? ModContent.DustType() : Effects.ArsenalEffects.ArsenalPlasmaDust; + Dust dust = Dust.NewDustPerfect(tailPlace, dustStyle); + dust.scale = Main.rand.NextFloat(1.4f, 1.8f) - Math.Abs(variance); + dust.velocity = shootVel.RotatedBy(variance) * Main.rand.NextFloat(9, 9.5f) * (1 - Math.Abs(variance)); + dust.noGravity = noFall; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + dust.fadeIn = noFall ? 0 : 1.1f; + } + + Particle bolt2 = new CustomPulse(shootPlace, shootVel * 0.2f, Effects.ArsenalEffects.ArsenalPlasmaColor, "CalamityMod/Particles/BloomRing", new Vector2(0.5f, 1f), shootVel.ToRotation(), 0f, 0.6f, 23); + GeneralParticleHandler.SpawnParticle(bolt2); + for (int i = 0; i < 2; i++) + { + Particle spark = new CustomSpark(shootPlace, shootVel * 0.2f, "CalamityMod/Particles/BloomCircle", false, 28, 0.6f, Effects.ArsenalEffects.ArsenalPlasmaColor, new Vector2(1f, 0.5f), true, true, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + + for (int i = -1; i <= 1; i++) + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), shootPlace, shootVel.RotatedBy(0.5f * i) * 8, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner, 0, 0, 0); + + doSpin = Main.rand.NextBool(5); + if (doSpin) + SoundEngine.PlaySound((Main.rand.NextBool() ? AqueousHunterDrone.Sound1 : AqueousHunterDrone.Sound2) with { Volume = 0.4f, Pitch = 0.2f, MaxInstances = 10 }, Projectile.Center); + tailRecoil = 25f; + Projectile.velocity += shootVel * (doSpin ? -18 : -9); + attackTimer = 0; + attackDowntime = 60; + } + attackTimer++; + } + public void TailRotationBasedOnMovement() + { + float sine = (float)Math.Sin(time * 0.1f / MathHelper.Pi); + tailRot = (sine * 0.2f) + 1.2f * (float)Math.Pow(Utils.GetLerpValue(0, 12 * facingDir, Projectile.velocity.X, true), 1.5f) * facingDir; + } + public void SetVisualPlacement() + { + float sine = (float)Math.Sin(time * 0.35f / MathHelper.Pi); + float sine2 = (float)Math.Sin(time * 0.05f / MathHelper.Pi); + Vector2 shake = new Vector2(3 * sine * (facingDir), 7 * sine2); + Vector2 visualPlace = Projectile.Center + shake + Vector2.UnitY * (surpriseTimer > 20 ? Utils.GetLerpValue(25, 20, surpriseTimer) : 1 - (float)Math.Pow(Utils.GetLerpValue(20, 15, surpriseTimer, true), 2)) * -25; + Vector2 tailDist = new Vector2((30 - Math.Abs(tailRot) * 15) * (-facingDir), 7 - Math.Abs(tailRot) * 3).RotatedBy(Projectile.rotation); + Vector2 headDist = new Vector2(0, 0); + Vector2 recoilPlace = ((Projectile.rotation - (facingDir == -1 ? MathHelper.Pi : 0) - (MathHelper.PiOver4 * -facingDir)).ToRotationVector2() * -tailRecoil); + headPlace = visualPlace + headDist; + tailPlace = visualPlace + tailDist + recoilPlace; + } + public void GrantBuffs(Player player) + { + bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (isCorrectProjectile) + { + if (player.dead) + { + player.Calamity().aqueousHunterDrone = false; + } + if (player.Calamity().aqueousHunterDrone) + { + Projectile.timeLeft = 2; + } + } + } + public override bool MinionContactDamage() => false; + public override bool PreDraw(ref Color lightColor) + { + Texture2D head = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/ShrimpBody").Value; + Texture2D glow = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/ShrimpBodyGlow").Value; + Texture2D tail = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/ShrimpTail").Value; + Texture2D glow2 = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/ShrimpTailGlow").Value; + Texture2D spin = ModContent.Request("CalamityMod/Particles/CircularSmearSmokey").Value; + Color drawColor = Projectile.GetAlpha(lightColor); + bool left = facingDir == -1; + float rotation = Projectile.rotation; + + // Tail + Main.EntitySpriteDraw(tail, tailPlace - Main.screenPosition, null, drawColor, rotation + tailRot, new Vector2(left ? tail.Height : 0, 0), Projectile.scale, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Main.EntitySpriteDraw(glow2, tailPlace - Main.screenPosition, null, Color.White, rotation + tailRot, new Vector2(left ? glow2.Height : 0, 0), Projectile.scale, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + float sine = (float)Math.Sin(time * 0.35f / MathHelper.Pi); + float headFadeIn = (float)Math.Pow(Utils.GetLerpValue(0, animationClickTime - 25, time, true), 8); + // Head + Main.EntitySpriteDraw(head, headPlace - Main.screenPosition, null, drawColor * headFadeIn, rotation + sine * 0.1f, head.Size() * 0.5f, Projectile.scale, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Main.EntitySpriteDraw(glow, headPlace - Main.screenPosition, null, Color.White * headFadeIn, rotation + sine * 0.1f, glow.Size() * 0.5f, Projectile.scale, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + // Spin effect + Main.EntitySpriteDraw(spin, Vector2.Lerp(headPlace, tailPlace, 0f) - Main.screenPosition, null, Effects.ArsenalEffects.ArsenalPlasmaColor with { A = 0 } * specialAttackfx, rotation * 1.8f, spin.Size() * 0.5f, Projectile.scale * 0.53f * specialAttackfx, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + + if (tailRecoil > 0) // Glowing on the gun after firing + { + float fade = Utils.GetLerpValue(0, 15, tailRecoil, true); + for (int i = 0; i < 12; i++) + { + Vector2 vel = (MathHelper.TwoPi * i / 12f).ToRotationVector2() * (2 + 2 * fade); + Main.EntitySpriteDraw(glow2, tailPlace - Main.screenPosition + vel, null, Color.White with { A = 0 } * fade, rotation + tailRot, new Vector2(left ? glow2.Height : 0, 0), Projectile.scale, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + } + } + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/ShrimpBody.png b/Projectiles/DraedonsArsenal/ShrimpBody.png new file mode 100644 index 0000000000..6a9768e1f1 Binary files /dev/null and b/Projectiles/DraedonsArsenal/ShrimpBody.png differ diff --git a/Projectiles/DraedonsArsenal/ShrimpBodyGlow.png b/Projectiles/DraedonsArsenal/ShrimpBodyGlow.png new file mode 100644 index 0000000000..5ddf245160 Binary files /dev/null and b/Projectiles/DraedonsArsenal/ShrimpBodyGlow.png differ diff --git a/Projectiles/DraedonsArsenal/ShrimpPlasmaMissile.cs b/Projectiles/DraedonsArsenal/ShrimpPlasmaMissile.cs new file mode 100644 index 0000000000..b38c669e64 --- /dev/null +++ b/Projectiles/DraedonsArsenal/ShrimpPlasmaMissile.cs @@ -0,0 +1,181 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class ShrimpPlasmaMissile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + public NPC closestNPC; + public Vector2 offset = Vector2.Zero; + public bool hitTile = false; + public float randomRate = 0; + public float randomSize = 0; + public override void SetStaticDefaults() + { + //ProjectileID.Sets.SummonTagDamageMultiplier[Type] = 0f; // The balance people will say if this is needed + } + public override void SetDefaults() + { + Projectile.width = Projectile.height = 10; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Summon; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 3; + Projectile.penetrate = -1; + Projectile.ArmorPenetration = 15; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + if (time == 0) + { + randomRate = Main.rand.NextFloat(1, 3); + randomSize = Main.rand.NextFloat(1, 5); + } + float sine = (float)Math.Sin(time * 0.075f / MathHelper.Pi * randomRate); + + if (time > 0 && Projectile.numHits == 0) + { + if (Utils.Distance(Owner.Center, Projectile.Center) < 1400) + { + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * -0.01f, "CalamityMod/Particles/BloomCircle", false, 12, 0.18f, Effects.ArsenalEffects.ArsenalPlasmaColor, new Vector2(0.3f, 1), true, true, 0, false, false, 0.3f, glowCenterScale: 0.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Projectile.ai[2] == 0) + { + if (time > 10) + { + if (closestNPC == null || closestNPC.life <= 0 || !closestNPC.CanBeChasedBy()) + closestNPC = Projectile.Center.ClosestNPCAt(900); + if (closestNPC != null) + { + Projectile.timeLeft++; + float distMult = ((float)Math.Pow(Utils.GetLerpValue(140, 80, Projectile.Center.Distance(closestNPC.Center), true), 3)); + CalamityUtils.HomeInOnSelectedNPC(Projectile, closestNPC, true, 0.2f + 0.3f * distMult, 8, 0.99f - 0.1f * distMult, accelerate: true); + } + } + } + else + { + Vector2 goalPosition = Owner.Calamity().mouseWorld + offset; + int fallTime = 300 - (int)Projectile.ai[2] * Projectile.extraUpdates; + offset = Vector2.UnitX * sine * 15 * randomSize; + if (time == fallTime) + { + Projectile.timeLeft = 600; + Projectile.extraUpdates = 6; + Projectile.scale = 1.5f; + } + if (time > fallTime) + { + float distMult = (float)Math.Pow(Utils.GetLerpValue(480, 340, time, true), 3); + + Vector2 moveTo = (goalPosition - Projectile.Center).SafeNormalize(Vector2.UnitX); + + if (Projectile.velocity.Y < 8) + Projectile.velocity.Y += 0.1f; + Projectile.velocity.X += moveTo.X * 0.5f; + Projectile.velocity.X *= 0.975f; + } + else + Projectile.timeLeft++; + } + + if (Main.rand.NextBool(5)) + { + int dustStyle = Effects.ArsenalEffects.ArsenalPlasmaDust; + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustStyle); + dust.scale = Main.rand.NextFloat(0.5f, 0.7f); + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.3f); + dust.noGravity = false; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + dust.fadeIn = -0.2f; + } + } + if (Collision.SolidCollision(Projectile.Center, 8, 8) && Projectile.numHits == 0 && Projectile.ai[2] > 0 && Projectile.Center.Y > Owner.Calamity().mouseWorld.Y && Projectile.scale > 1) + { + hitTile = true; + Projectile.numHits = 1; + Explode(); + } + time++; + } + public void Explode() + { + float lifetimeMult = (hitTile ? 5 : 1); + if (hitTile) + Projectile.localNPCHitCooldown = 8; + Projectile.extraUpdates = 0; + Projectile.timeLeft = (int)(12 * lifetimeMult); + Projectile.velocity = Vector2.Zero; + for (int i = 0; i < (int)(12 * Projectile.scale); i++) + { + bool noFall = !Main.rand.NextBool(5); + int dustStyle = noFall ? ModContent.DustType() : Effects.ArsenalEffects.ArsenalPlasmaDust; + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustStyle); + dust.scale = Main.rand.NextFloat(0.9f, 1.7f) * (noFall ? 2 : 0.75f) * Projectile.scale; + dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(6.4f, 7.5f) * (noFall ? 0.7f : 1.2f) * Projectile.scale; + dust.noGravity = noFall; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + dust.fadeIn = (noFall ? 4.5f * Projectile.scale : 1f); + } + SoundEngine.PlaySound(AqueousHunterDrone.Hit with { Volume = 0.4f * Projectile.scale, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = 30 }, Projectile.Center); + Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalPlasmaColor * 0.95f, "CalamityMod/Particles/SmokeExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.1f * Projectile.scale, 14); + GeneralParticleHandler.SpawnParticle(bolt2); + + Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalPlasmaColor * 0.75f, "CalamityMod/Particles/WaterFoam", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.77f * Projectile.scale, (int)(10 * lifetimeMult)); + GeneralParticleHandler.SpawnParticle(bolt3); + + Particle spark = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, (int)(17 * lifetimeMult), 0.6f * Projectile.scale, Effects.ArsenalEffects.ArsenalPlasmaColor, new Vector2(1, 1), true, true, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark); + if (hitTile) + { + Particle spark2 = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, (int)(20 * lifetimeMult), 0.6f * Projectile.scale * lifetimeMult, Effects.ArsenalEffects.ArsenalPlasmaColor * 0.35f, new Vector2(1, 1), true, true, 0, false, false, glowOpacity: 0.35f); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (Projectile.scale > 1) + { + Player Owner = Main.player[Projectile.owner]; + Owner.Calamity().GeneralScreenShakePower = 2.5f; + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Projectile.numHits == 0) + { + Explode(); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + { + float minMult = 0.5f; + int hitsToMinMult = 8; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult * 0.5f; + } + } + public override bool? CanDamage() => ((time > 5 && Projectile.ai[2] == 0) || (Projectile.scale > 1)) ? null : false; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * (Projectile.numHits > 0 ? 10 : 1) * Projectile.scale, targetHitbox); + } + public override bool PreDraw(ref Color lightColor) + { + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/ShrimpTail.png b/Projectiles/DraedonsArsenal/ShrimpTail.png new file mode 100644 index 0000000000..ea5481c028 Binary files /dev/null and b/Projectiles/DraedonsArsenal/ShrimpTail.png differ diff --git a/Projectiles/DraedonsArsenal/ShrimpTailGlow.png b/Projectiles/DraedonsArsenal/ShrimpTailGlow.png new file mode 100644 index 0000000000..0d7d5e8d71 Binary files /dev/null and b/Projectiles/DraedonsArsenal/ShrimpTailGlow.png differ diff --git a/Projectiles/Environment/BarrelCactusProjectile.cs b/Projectiles/Environment/BarrelCactusProjectile.cs new file mode 100644 index 0000000000..1033ada1a9 --- /dev/null +++ b/Projectiles/Environment/BarrelCactusProjectile.cs @@ -0,0 +1,54 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Environment +{ + public class BarrelCactusProjectile : ModProjectile, ILocalizedModType + { //I tried, someone else figure it out I bet YuH could do it + public new string LocalizationCategory => "Projectiles.Misc"; + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 1; + } + + public override void SetDefaults() + { + Projectile.CloneDefaults(ProjectileID.RollingCactus); + + Projectile.width = 32; + Projectile.height = 32; + + Projectile.damage = 70; + Projectile.knockBack = 6f; + + Projectile.friendly = false; + Projectile.hostile = true; + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Rectangle frame = tex.Bounds; + Vector2 origin = frame.Size() * 0.5f; + + Main.EntitySpriteDraw( + tex, + Projectile.Center - Main.screenPosition, + frame, + lightColor, + Projectile.rotation, + origin, + Projectile.scale, + SpriteEffects.None, + 0); + + return false; + } + } +} diff --git a/Projectiles/Environment/BarrelCactusProjectile.png b/Projectiles/Environment/BarrelCactusProjectile.png new file mode 100644 index 0000000000..1530195e19 Binary files /dev/null and b/Projectiles/Environment/BarrelCactusProjectile.png differ diff --git a/Projectiles/Environment/LargeBarrelCactusProjectile.png b/Projectiles/Environment/LargeBarrelCactusProjectile.png new file mode 100644 index 0000000000..0848fd8154 Binary files /dev/null and b/Projectiles/Environment/LargeBarrelCactusProjectile.png differ diff --git a/Projectiles/Melee/DNA.cs b/Projectiles/Melee/DNA.cs deleted file mode 100644 index 671209f27b..0000000000 --- a/Projectiles/Melee/DNA.cs +++ /dev/null @@ -1,86 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class DNA : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - - public static int TotalSegments = 10; - - public override void SetDefaults() - { - Projectile.width = 22; - Projectile.height = 72; - Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = -1; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 6; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.ai[1] == 0f) - { - Projectile.alpha -= 100; - if (Projectile.alpha <= 0) - { - Projectile.alpha = 0; - Projectile.ai[1] = 1f; - - // This projectile normally does not move by itself, so this will manually move it one time only - // This is only for the first segment - if (Projectile.ai[0] == 0f) - { - Projectile.ai[0]++; - Projectile.position += Projectile.velocity; - } - - // Spawn the next segment - if (Main.myPlayer == Projectile.owner && Projectile.ai[0] < TotalSegments) - { - int nextSegment = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Projectile.velocity, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.ai[0] + 1f); - NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, nextSegment); - } - } - } - else // Begin fading out - { - int AlphaPerFrame = 15; - Projectile.alpha += AlphaPerFrame; - if (Projectile.alpha == AlphaPerFrame * 14) - { - for (int i = 0; i < 3; i++) - { - Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.BoneTorch, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f, 200, default, 1f); - dust.noGravity = true; - dust.velocity *= 0.5f; - } - } - - if (Projectile.alpha >= 255) - Projectile.Kill(); - } - if (Main.rand.NextBool(10)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BoneTorch, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f); - } - - // This is essential for Vilethorn-type projectiles, as velocity is a stored parameter and isn't supposed to actually move the projectile - public override bool ShouldUpdatePosition() => false; - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); - - public override void OnKill(int timeLeft) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BoneTorch, Projectile.oldVelocity.X * 0.005f, Projectile.oldVelocity.Y * 0.005f); - } - } -} diff --git a/Projectiles/Melee/DNA.png b/Projectiles/Melee/DNA.png deleted file mode 100644 index 67167a046b..0000000000 Binary files a/Projectiles/Melee/DNA.png and /dev/null differ diff --git a/Projectiles/Melee/LucreciaDNATrailCreator.cs b/Projectiles/Melee/LucreciaDNATrailCreator.cs new file mode 100644 index 0000000000..1e77fd0d0b --- /dev/null +++ b/Projectiles/Melee/LucreciaDNATrailCreator.cs @@ -0,0 +1,117 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class LucreciaDNATrailCreator : ModProjectile, ILocalizedModType + { + private List oldPositionsLeft = new List(); + private List oldPositionsRight = new List(); + private int trailTimer = 0; + // The timer is initialized with a delay. It will reset to 6 after the first shot. + private int middleStreakTimer = 40; + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 200; + Projectile.height = 170; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.hostile = false; + Projectile.friendly = true; + Projectile.extraUpdates = 12; + Projectile.timeLeft = 2400; + Projectile.minion = true; // Scuffed but it prevents the projectile from being culled in a few situations + Projectile.alpha = 255; + } + + public override void AI() + { + Player owner = Main.player[Projectile.owner]; + trailTimer++; + + // Very volatile values... + float amplitude = 86f; + float frequency = 0.039f; + + // Makes a perpendicular/mirrored trail, AKA a double helix + Vector2 perpendicular = Vector2.Normalize(new Vector2(-Projectile.velocity.Y, Projectile.velocity.X)); + + // Calculate the sine wave value. + float sineWave = (float)Math.Cos(trailTimer * frequency); + + // Calculate offset based on the pattern of the sinewave and subtract the proj's dimensions to be accurate + Vector2 offsetLeft = (perpendicular * amplitude * sineWave) - new Vector2(Projectile.width, Projectile.height); + Vector2 offsetRight = (-perpendicular * amplitude * sineWave) - new Vector2(Projectile.width, Projectile.height); + + oldPositionsLeft.Add(Projectile.Center + offsetLeft); + oldPositionsRight.Add(Projectile.Center + offsetRight); + + // The timer will now correctly decrease once per AI update. + middleStreakTimer--; + + if (middleStreakTimer <= 0) + { + // Reset the timer for the next shot. + middleStreakTimer = 6; + + // Spawn the main trail + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.24f, Color.MediumPurple * 1.3f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.25f, glowOpacity: 0.4f); + GeneralParticleHandler.SpawnParticle(spark); + Particle spark2 = new CustomSpark(Projectile.Center + perpendicular, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.24f, Color.CornflowerBlue * 1.3f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.25f, glowOpacity: 0.4f); + GeneralParticleHandler.SpawnParticle(spark2); + } + + + // Remove old positions after 120 + int maxTrailLength = 120; + if (oldPositionsLeft.Count > maxTrailLength) + oldPositionsLeft.RemoveAt(0); + if (oldPositionsRight.Count > maxTrailLength) + oldPositionsRight.RemoveAt(0); + } + + private float WidthFunction(float completionRatio) + { + return MathHelper.Lerp(12f, 0f, completionRatio); + } + + + private Color LeftColorFunction(float completionRatio) + { + Color baseColor = Color.MediumPurple * 1.3f; + + float alphaScaling = -4 * completionRatio * (completionRatio - 1); + return baseColor * alphaScaling; + } + private Color RightColorFunction(float completionRatio) + { + Color baseColor = Color.CornflowerBlue * 1.3f; + + float alphaScaling = -4 * completionRatio * (completionRatio - 1); + return baseColor * alphaScaling; + } + + + public override bool PreDraw(ref Color lightColor) + { + MiscShaderData trailShader = GameShaders.Misc["CalamityMod:TrailStreak"]; + trailShader.SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); + + // Use the separate color functions for each trail + PrimitiveRenderer.RenderTrail(oldPositionsLeft, new PrimitiveSettings(WidthFunction, LeftColorFunction, (_) => Projectile.Size * 1f, pixelate: false, shader: trailShader)); + PrimitiveRenderer.RenderTrail(oldPositionsRight, new PrimitiveSettings(WidthFunction, RightColorFunction, (_) => Projectile.Size * 1f, pixelate: false, shader: trailShader)); + return false; + } + } +} diff --git a/Projectiles/Melee/LucreciaProj.cs b/Projectiles/Melee/LucreciaProj.cs new file mode 100644 index 0000000000..be57981ef4 --- /dev/null +++ b/Projectiles/Melee/LucreciaProj.cs @@ -0,0 +1,323 @@ +using System; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Projectiles.Melee.Shortswords; +using System.Runtime.InteropServices; + +namespace CalamityMod.Projectiles.Melee +{ + public class LucreciaProj : BaseSwordHoldoutProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override bool useMeleeSpeed => true; + public override bool useMeleeSize => false; + public override int swingWidth => 310; + public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; + public override string Texture => "CalamityMod/Items/Weapons/Melee/Lucrecia"; + public override SoundStyle? UseSound => SoundID.Item71 with { Volume = 0.85f }; + public override int StartupTime { get; set; } + public override int CooldownTime { get; set; } + public override int swingTime { get; set; } + public override bool AlternateSwings { get => base.AlternateSwings; set => base.AlternateSwings = value; } + public override float lineCollisionLength => 82; + + // Boolshit + public bool helixFired = false; + public bool gotEnergyThisSwing = false; + public bool trailFXTriggered = false; + public bool particlesSpawned = false; + public bool sparkTriggered = false; + + public int standardStartupTime = 8; + public int standardSwingTime = 14; + public int standardCooldownTime = 7; + private bool IsThrusting => Projectile.localAI[0] == 1; + public bool IsAlternateThrust { get; set; } + public int thrustStartupTime = 33; + public int thrustForwardTime = 7; + public int thrustCooldownTime = 17; + + public override void Defaults() + { + Projectile.extraUpdates = 6; + Projectile.noEnchantmentVisuals = true; + Projectile.Opacity = 0.2f; // Starting point, fades in quickly upon startup + Projectile.width = Projectile.height = 54; + } + + public override void Spawn(IEntitySource source) + { + var player = Main.player[Projectile.owner]; + var modplayer = player.GetModPlayer(); + var calamityPlayer = player.Calamity(); + + // Store the base use time from the item + int baseUseTime = BaseItem.useTime; + + if (player.altFunctionUse == 2) + { + // Check for energy before the projectile exists + if (calamityPlayer.lucreciaEnergy < 100) + { + Projectile.Kill(); + return; + } + + IsAlternateThrust = true; + + // Scale all time vars correctly + StartupTime = (int)(thrustStartupTime * (float)player.itemAnimationMax / baseUseTime); + swingTime = (int)(thrustForwardTime * (float)player.itemAnimationMax / baseUseTime); + CooldownTime = (int)(thrustCooldownTime * (float)player.itemAnimationMax / baseUseTime); + + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 36; + useMeleeSize = true; + UseSound = SoundID.DD2_JavelinThrowersAttack; + OffsetDistance = -30; + RotateInStartup = 0.8f; + RotateInCooldown = 1f; + Projectile.knockBack = 15f; + + calamityPlayer.lucreciaEnergy = 0; // Remove energy for startup + } + else + { + IsAlternateThrust = false; + + // Scale all time vars correctly + StartupTime = (int)(standardStartupTime * (float)player.itemAnimationMax / baseUseTime); + CooldownTime = (int)(standardSwingTime * (float)player.itemAnimationMax / baseUseTime); + swingTime = (int)(standardCooldownTime * (float)player.itemAnimationMax / baseUseTime); + + OffsetDistance = 36; + RotateInStartup = 0.8f; + RotateInCooldown = 0; + } + + if (AlternateSwings) + modplayer.swingNum = (modplayer.swingNum + 1) % 2; + } + + public override void AdditionalAI() + { + if (IsAlternateThrust) + { + if (inStartup) + { + trailFXTriggered = false; // Reset bool just in case + Projectile.Opacity += 0.01f; // Fade in + + // Pullback + float eased = MathF.Pow(StartupCompletion, 0.3f); + OffsetDistance = (int)MathHelper.Lerp(44, 34, eased); + Projectile.scale = baseScale * MathHelper.Lerp(1f, 0.85f, eased); + + + if (!sparkTriggered && Projectile.scale < 0.96f) // Right before thrusting forward + { + // Won't happen again this right-click + sparkTriggered = true; + + GenericSparkle sparker = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.AntiqueWhite, Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, 0.5f) * 0.3f, 2f, 8, Projectile.velocity.ToRotation() + (Main.rand.NextBool() ? -0.25f : 0.25f), 1f); + GeneralParticleHandler.SpawnParticle(sparker); + } + } + + else if (inCooldown) + { + Projectile.Opacity -= 0.0135f; + + // During cooldown, pull back slightly + Projectile.scale = baseScale * MathHelper.Lerp(1.6f, 1.55f, CooldownCompletion); + OffsetDistance = (int)MathHelper.Lerp(68, 42, CooldownCompletion); + } + + else if (inSwing) + { + // Thrust forward + OffsetDistance = (int)MathHelper.Lerp(34, 68, SwingCompletion); + Main.player[Projectile.owner].Calamity().GeneralScreenShakePower = 3.5f; + + // Scaling adjustments + var t = MathHelper.Clamp(SwingCompletion, 0f, 1f); + var eased = MathF.Pow(t, 0.125f); + Projectile.scale = baseScale * MathHelper.Lerp(0.9f, 1.6f, eased); + + // VFX vars + Player player = Main.player[Projectile.owner]; + Vector2 mousePosition = Main.MouseWorld; + Vector2 fireDirection = Vector2.Normalize(mousePosition - player.Center); + + // Fire the bigass projectile + if (!trailFXTriggered) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), player.Center, fireDirection * 5, ModContent.ProjectileType(), Projectile.damage * 8, Projectile.knockBack, Projectile.owner, 0f, 0f); + + SoundStyle swish = new("CalamityMod/Sounds/Custom/MeatySlash"); + SoundEngine.PlaySound(swish with { Volume = 0.45f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + + SoundStyle projectile = new("CalamityMod/Sounds/Item/OmicronBeam"); + SoundEngine.PlaySound(projectile with { Volume = 0.75f, Pitch = Main.rand.NextFloat(0.15f, 0.2f) }, Projectile.Center); + } + + trailFXTriggered = true; + + // Some sparks from the blade + if (!particlesSpawned) + { + for (int i = 0; i < 6; i++) + { + Vector2 particleOrigin = Projectile.Center; + Vector2 particleSpeed = fireDirection.RotatedByRandom(MathHelper.ToRadians(46f)) * Main.rand.NextFloat(20f, 37f); + Particle sparks = new CritSpark(particleOrigin, particleSpeed, Color.Lerp(Color.CornflowerBlue, Color.MediumPurple, Main.rand.NextFloat(0f, 1f)), Color.NavajoWhite * 0.7f, Main.rand.NextFloat(0.9f, 2f), Main.rand.Next(38, 50), 0.1f, 1.5f, hueShift: 0.01f); + GeneralParticleHandler.SpawnParticle(sparks); + } + particlesSpawned = true; + } + + } + } + + else // Primary + { + if (inStartup) + { + AfterImageLength = 0; + + Projectile.Opacity += 0.01f; // Fade in + gotEnergyThisSwing = false; + helixFired = false; + Projectile.scale = baseScale * MathHelper.Lerp(0.625f, 0.8f, StartupCompletion); + } + + else if (inCooldown) + { + AfterImageLength = 0; + + helixFired = false; + Projectile.Opacity -= 0.09f; + Projectile.scale = baseScale * MathHelper.Lerp(0.85f, 0.625f, CooldownCompletion); + } + + else if (inSwing) + { + if (!helixFired) + { + helixFired = true; + var player = Main.player[Projectile.owner]; + var mousePosition = Main.MouseWorld; + var fireDirection = Vector2.Normalize(mousePosition - player.Center); + var helixSpeed = 12f; + var helixVelocity = fireDirection * helixSpeed; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), player.Center + fireDirection * 3, helixVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + + SoundStyle projectile = new("CalamityMod/Sounds/Item/LucreciaBoltFire"); + SoundEngine.PlaySound(projectile with { Volume = 0.8f, Pitch = Main.rand.NextFloat(-0.06f, 0.1f) }, Projectile.Center); + } + + AfterImageLength = 30; + + var t = MathHelper.Clamp(SwingCompletion, 0f, 1f); + var parabola = 1f - MathF.Pow(t - 0.5f, 2f) * 4f; + OffsetDistance = (int)MathHelper.Lerp(36 * 1f, 36 * 1.435f, parabola); + var upPhase = t <= 0.5f ? t / 0.5f : (1f - t) / 0.5f; + var eased = MathF.Pow(upPhase, 2.6f); + Projectile.scale = baseScale * MathHelper.Lerp(0.8f, 1.4f, eased); + + } + } + base.AdditionalAI(); + } + + public override float SwingFunction() + { + var player = Main.player[Projectile.owner]; + + if (IsAlternateThrust) + { + var modplayer = player.GetModPlayer(); + float swingDirection = Projectile.spriteDirection; + + if (inStartup) + { + return 0f; + } + + if (timer < StartupTime + swingTime) + { + return 0f; + } + + else + return 0f; // Just retract and fade out without moving the angle + } + + else // Primary swing + { + var modplayer = player.GetModPlayer(); + float swingDirection = Projectile.spriteDirection; + if (modplayer.swingNum == 1) + swingDirection *= -1; + + var parabolicFactorPrimary = 1f - MathF.Pow(SwingCompletion - 0.5f, 2f) * 4f; + parabolicFactorPrimary = MathHelper.Clamp(parabolicFactorPrimary, 0f, 1f); + Projectile.localAI[0] = parabolicFactorPrimary; + + var startAnglePrimary = -swingWidth / 2.15f; + var endAnglePrimary = swingWidth / 2.15f; + var trueAnglePrimary = MathHelper.Lerp(startAnglePrimary, endAnglePrimary, SwingCompletion); + + return MathHelper.ToRadians(trueAnglePrimary * -swingDirection); + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // Add energy for the primary attack + if (!IsAlternateThrust && !gotEnergyThisSwing) + { + gotEnergyThisSwing = true; + var player = Main.player[Projectile.owner]; + var modPlayer = player.Calamity(); + + // +22 energy on hit + modPlayer.lucreciaEnergy += 22; + modPlayer.lucreciaEnergy = Math.Min(modPlayer.lucreciaEnergy, Lucrecia.MaxEnergy); + + // On-hit cut FX + int points = 2; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)).RotatedByRandom(100); + + var modplayer = player.GetModPlayer(); + Color useColor = modplayer.swingNum == 1 ? Color.CornflowerBlue : Color.MediumPurple; // Alternate each swing + + for (int k = 0; k < points; k++) + { + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f); + Particle spark = new GlowSparkParticle((target.Center + velocity * 7.5f), velocity * 0.5f, false, 9, 0.05f, useColor, new Vector2(0.5f, 0.4f), true, false); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } + + public override bool PreDraw(ref Color lightColor) + { + // Draw fullbright + lightColor = Color.White; + return base.PreDraw(ref lightColor); + } + } +} diff --git a/Projectiles/Melee/LucreciaSmallProjectile.cs b/Projectiles/Melee/LucreciaSmallProjectile.cs new file mode 100644 index 0000000000..f972eb300a --- /dev/null +++ b/Projectiles/Melee/LucreciaSmallProjectile.cs @@ -0,0 +1,158 @@ +using System; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Melee +{ + public class LucreciaSmallProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int TargetIndex = -1; + + public static float MaxWidth = 30; + public ref float Time => ref Projectile.ai[0]; + + public static Asset BloomTex; + public static Asset SlashTex; + public static Asset TrailTex; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 13; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = 19; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.alpha = 255; + Projectile.timeLeft = 420; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 12; + } + + public override void AI() + { + // Little bit of ambient lighting as it travels + Lighting.AddLight(Projectile.Center, Color.WhiteSmoke.ToVector3() * 0.4f); + + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.velocity *= 1.01f; + Projectile.scale = Utils.GetLerpValue(0f, 0.1f, Projectile.timeLeft / 600f, true); + + if (Projectile.FinalExtraUpdate()) + Time++; + + // CRUCIAL so that oldPos isnt initialized incorrectly when drawing + if (Projectile.localAI[0] == 0f) + { + for (int i = 0; i < Projectile.oldPos.Length; i++) + { + Projectile.oldPos[i] = Projectile.position; + } + Projectile.localAI[0] = 1f; + } + } + + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + for (int i = 0; i < 6; i++) + { + float variance = Main.rand.NextFloat(-0.6f, 0.6f); + int dustStyle = ModContent.DustType(); + Dust dust2 = Dust.NewDustPerfect(target.Center, dustStyle); + dust2.scale = Main.rand.NextFloat(1.2f, 1.6f) - Math.Abs(variance); + dust2.velocity = (Projectile.velocity * 1.5f).RotatedBy(variance) * Main.rand.NextFloat(1.2f, 1.5f) * (1 - Math.Abs(variance)); + dust2.noGravity = true; + dust2.color = Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, Main.rand.NextFloat(0f, 1f)); + } + } + + public override void OnKill(int timeLeft) + { + SoundStyle projectile = new("CalamityMod/Sounds/Item/LucreciaBoltImpact"); + SoundEngine.PlaySound(projectile with { Volume = 0.9f, Pitch = Main.rand.NextFloat(-0.06f, 0.1f) }, Projectile.Center); + } + + public override Color? GetAlpha(Color lightColor) => Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, 0.5f) with { A = 0 } * Projectile.Opacity; + + public float TrailWidth(float completionRatio) + { + float width = Utils.GetLerpValue(1f, 0.4f, completionRatio, true) * (float)Math.Sin(Math.Acos(1 - Utils.GetLerpValue(0f, 0.08f, completionRatio, true))); + + width *= Utils.GetLerpValue(0f, 0.1f, Projectile.timeLeft / 600f, true); + + return width * (MaxWidth * .265f); + } + public Color TrailColor(float completionRatio) + { + Color baseColor = Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, completionRatio); + + return baseColor * 0.2f; + } + + public float MiniTrailWidth(float completionRatio) => TrailWidth(completionRatio) * 5.5f; + public Color MiniTrailColor(float completionRatio) => Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, completionRatio); + + public override bool PreDraw(ref Color lightColor) + { + if (Projectile.timeLeft > 412) + return false; + + Color mainColor = Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, ((float)Main.timeForVisualEffects * 0.5f + Projectile.whoAmI * 0.12f) % 1); + Color secondaryColor = Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, ((float)Main.timeForVisualEffects * 0.5f + Projectile.whoAmI * 0.12f + 0.2f) % 1); + + Main.spriteBatch.EnterShaderRegion(); + + if (TrailTex == null) + TrailTex = Request("CalamityMod/ExtraTextures/Trails/BasicTrail"); + + GameShaders.Misc["CalamityMod:ExobladePierce"].SetShaderTexture(TrailTex); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseImage2("Images/Extra_189"); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseColor(mainColor); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseSecondaryColor(secondaryColor); + GameShaders.Misc["CalamityMod:ExobladePierce"].Apply(); + + Vector2 offset = Projectile.Size * 0.5f; + + // Apply the offset to the projectile's old position + Vector2[] oldPosWithOffset = Projectile.oldPos.Select(p => p - offset).ToArray(); + + PrimitiveRenderer.RenderTrail(oldPosWithOffset, new(TrailWidth, TrailColor, (_) => Projectile.Size * 1f, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), 30); + + GameShaders.Misc["CalamityMod:ExobladePierce"].UseColor(mainColor); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseSecondaryColor(secondaryColor); + + PrimitiveRenderer.RenderTrail(oldPosWithOffset, new(MiniTrailWidth, MiniTrailColor, (_) => Projectile.Size * 1f, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), 30); + + Main.spriteBatch.ExitShaderRegion(); + return false; + } + } +} diff --git a/Projectiles/Melee/Shortswords/LucreciaProj.cs b/Projectiles/Melee/Shortswords/LucreciaProj.cs deleted file mode 100644 index 2517332b34..0000000000 --- a/Projectiles/Melee/Shortswords/LucreciaProj.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Projectiles.BaseProjectiles; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee.Shortswords -{ - public class LucreciaProj : BaseShortswordProjectile - { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public override string Texture => "CalamityMod/Items/Weapons/Melee/Lucrecia"; - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 28; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Melee; - Projectile.ownerHitCheck = true; - Projectile.timeLeft = 360; - Projectile.hide = true; - Projectile.ownerHitCheck = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; - } - - public override Action EffectBeforePullback => (proj) => - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 10f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - }; - - - public override void SetVisualOffsets() - { - const int HalfSpriteWidth = 62 / 2; - const int HalfSpriteHeight = 62 / 2; - - int HalfProjWidth = Projectile.width / 2; - int HalfProjHeight = Projectile.height / 2; - - DrawOriginOffsetX = 0; - DrawOffsetX = -(HalfSpriteWidth - HalfProjWidth); - DrawOriginOffsetY = -(HalfSpriteHeight - HalfProjHeight); - } - - public override void ExtraBehavior() - { - if (Main.rand.NextBool(5)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BoneTorch); - } - } -} diff --git a/Projectiles/Typeless/NavyBobber.cs b/Projectiles/Typeless/NavyBobber.cs index 7d45038fbc..cf8952aa1a 100644 --- a/Projectiles/Typeless/NavyBobber.cs +++ b/Projectiles/Typeless/NavyBobber.cs @@ -1,4 +1,6 @@ -using Terraria; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -14,6 +16,23 @@ namespace CalamityMod.Projectiles.Typeless Projectile.bobber = true; } + public override void PostAI() + { + foreach (var item in Main.ActiveNPCs) + { + if (!item.friendly && item.Distance(Projectile.Center) < 160) + { + item.AddBuff(ModContent.BuffType(), 180); + if (Main.rand.NextBool(10)) + { + Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); + Projectile spark = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), item.Center, velocity, ModContent.ProjectileType(), 0, 0f, Projectile.owner); + spark.localNPCHitCooldown = -2; + spark.timeLeft = 30; + } + } + } + } public override bool PreDrawExtras() { Lighting.AddLight(Projectile.Center, 0f, 0.25f, 0.25f); diff --git a/Projectiles/Typeless/PauldronDash.cs b/Projectiles/Typeless/PauldronDash.cs index efc5b8021d..c9e6c42619 100644 --- a/Projectiles/Typeless/PauldronDash.cs +++ b/Projectiles/Typeless/PauldronDash.cs @@ -80,7 +80,9 @@ namespace CalamityMod.Projectiles.Typeless if (visuals) { int dir = MathF.Sign(aimVel.X); - Vector2 safeVel = aimVel.SafeNormalize(Vector2.UnitX); + if (dir == 0) + dir = Owner.direction; + Vector2 safeVel = aimVel.SafeNormalize(Vector2.UnitX * dir); float sparkscale2 = 0.35f * Math.Max(fxFade, 0.5f); for (int i = -1; i <= 1; i += 2) { @@ -100,7 +102,7 @@ namespace CalamityMod.Projectiles.Typeless } } - if (Owner.dead || (!isAlive && fxFade < 0.1f) || Owner.velocity == Vector2.Zero) + if (Owner.dead || (!isAlive && fxFade < 0.1f) || (Owner.velocity == Vector2.Zero && Owner.dashDelay != -1)) Projectile.Kill(); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Typeless/RiftReelerBobber.cs b/Projectiles/Typeless/RiftReelerBobber.cs index f5b3defd39..45bd54bfb3 100644 --- a/Projectiles/Typeless/RiftReelerBobber.cs +++ b/Projectiles/Typeless/RiftReelerBobber.cs @@ -13,6 +13,11 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 14; Projectile.aiStyle = ProjAIStyleID.Bobber; Projectile.bobber = true; + Projectile.friendly = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.penetrate = -1; + Projectile.ArmorPenetration = 100; } public override bool PreDrawExtras() diff --git a/Sounds/Item/LucreciaBoltFire.ogg b/Sounds/Item/LucreciaBoltFire.ogg new file mode 100644 index 0000000000..1f189852b1 Binary files /dev/null and b/Sounds/Item/LucreciaBoltFire.ogg differ diff --git a/Sounds/Item/LucreciaBoltImpact.ogg b/Sounds/Item/LucreciaBoltImpact.ogg new file mode 100644 index 0000000000..ca55683cf1 Binary files /dev/null and b/Sounds/Item/LucreciaBoltImpact.ogg differ diff --git a/Sounds/Item/ShrimpFire.ogg b/Sounds/Item/ShrimpFire.ogg new file mode 100644 index 0000000000..b60d95c9aa Binary files /dev/null and b/Sounds/Item/ShrimpFire.ogg differ diff --git a/Sounds/Item/ShrimpMissileHit.ogg b/Sounds/Item/ShrimpMissileHit.ogg new file mode 100644 index 0000000000..c34fcac6cf Binary files /dev/null and b/Sounds/Item/ShrimpMissileHit.ogg differ diff --git a/Sounds/Item/ShrimpSound1.ogg b/Sounds/Item/ShrimpSound1.ogg new file mode 100644 index 0000000000..38d7eae4ea Binary files /dev/null and b/Sounds/Item/ShrimpSound1.ogg differ diff --git a/Sounds/Item/ShrimpSound2.ogg b/Sounds/Item/ShrimpSound2.ogg new file mode 100644 index 0000000000..f8106c6edf Binary files /dev/null and b/Sounds/Item/ShrimpSound2.ogg differ diff --git a/Sounds/Item/ShrimpSurprise.ogg b/Sounds/Item/ShrimpSurprise.ogg new file mode 100644 index 0000000000..5eb8fbad6d Binary files /dev/null and b/Sounds/Item/ShrimpSurprise.ogg differ diff --git a/Tiles/Merges/DunesandMerge.cs b/Tiles/Merges/DunesandMerge.cs new file mode 100644 index 0000000000..cecb2171e8 --- /dev/null +++ b/Tiles/Merges/DunesandMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.SunkenSea; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class DunesandMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/DunesandMerge.png b/Tiles/Merges/DunesandMerge.png new file mode 100644 index 0000000000..afa839e413 Binary files /dev/null and b/Tiles/Merges/DunesandMerge.png differ diff --git a/Tiles/Rubblemaker/SunkenSea/DriftwoodAmbientEcho.cs b/Tiles/Rubblemaker/SunkenSea/DriftwoodAmbientEcho.cs deleted file mode 100644 index 5cc0e8630a..0000000000 --- a/Tiles/Rubblemaker/SunkenSea/DriftwoodAmbientEcho.cs +++ /dev/null @@ -1,70 +0,0 @@ -using CalamityMod.Items.Placeables.FurnitureDriftwood; -using CalamityMod.Tiles.SunkenSea.Ambient; -using Terraria.GameContent; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles.Rubblemaker.SunkenSea -{ - public class DriftwoodAmbient1Echo : DriftwoodAmbient1 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/DriftwoodAmbient1"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType(), Type, 0); - // TODO: Most of these currently don't work - //FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); - } - } - - public class DriftwoodAmbient2Echo : DriftwoodAmbient2 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/DriftwoodAmbient2"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType(), Type, 0); - //FlexibleTileWand.RubblePlacementMedium.AddVariations(ModContent.ItemType(), Type, 0); - } - } - public class DriftwoodAmbient3Echo : DriftwoodAmbient3 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/DriftwoodAmbient3"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType(), Type, 0); - FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); - } - } - public class DriftwoodAmbient4Echo : DriftwoodAmbient4 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/DriftwoodAmbient4"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType(), Type, 0); - //FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); - } - } - public class DriftwoodAmbient5Echo : DriftwoodAmbient5 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/DriftwoodAmbient5"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType(), Type, 0); - //FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); - } - } - public class DriftwoodAmbient6Echo : DriftwoodAmbient6 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/DriftwoodAmbient6"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType(), Type, 0); - //FlexibleTileWand.RubblePlacementMedium.AddVariations(ModContent.ItemType(), Type, 0); - } - } -} diff --git a/Tiles/Rubblemaker/SunkenSea/DriftwoodMastEcho.cs b/Tiles/Rubblemaker/SunkenSea/DriftwoodMastEcho.cs new file mode 100644 index 0000000000..7143c3c0c4 --- /dev/null +++ b/Tiles/Rubblemaker/SunkenSea/DriftwoodMastEcho.cs @@ -0,0 +1,19 @@ +using CalamityMod.Items.Placeables.FurnitureDriftwood; +using CalamityMod.Tiles.SunkenSea.Ambient; +using Terraria.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Rubblemaker.SunkenSea +{ + public class DriftwoodMastEcho : DriftwoodMast + { + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/DriftwoodMast"; + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + RegisterItemDrop(ModContent.ItemType(), Type, 0); + // TODO: Most of these currently don't work + //FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); + } + } +} diff --git a/Tiles/SunkenSea/Ambient/BarrelCactus.cs b/Tiles/SunkenSea/Ambient/BarrelCactus.cs new file mode 100644 index 0000000000..dd5fc4c3c3 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/BarrelCactus.cs @@ -0,0 +1,36 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class BarrelCactus : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.RandomStyleRange = 2; + TileObjectData.addTile(Type); + AddMapEntry(new Color(85, 143, 46)); + DustType = DustID.Coralstone; + + base.SetStaticDefaults(); + } + //Bro idk how to make a boulder + } +} diff --git a/Tiles/SunkenSea/Ambient/BarrelCactus.png b/Tiles/SunkenSea/Ambient/BarrelCactus.png new file mode 100644 index 0000000000..7263e82a88 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/BarrelCactus.png differ diff --git a/Tiles/SunkenSea/Ambient/BlueCoralTree.cs b/Tiles/SunkenSea/Ambient/BlueCoralTree.cs index d372bdc268..ab1fceaaf6 100644 --- a/Tiles/SunkenSea/Ambient/BlueCoralTree.cs +++ b/Tiles/SunkenSea/Ambient/BlueCoralTree.cs @@ -33,7 +33,6 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - // DON'T DO DIVISION HERE, I DON'T CARE ABOUT HOW EASY IT IS TO READ, IT'S DOING DIVISION CALCS EVERY FRAME r = 0.235f; g = 0.431f; b = 0.573f; diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.cs b/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.cs deleted file mode 100644 index ad72942421..0000000000 --- a/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.cs +++ /dev/null @@ -1,142 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles.SunkenSea.Ambient -{ - public class DriftwoodAmbient1 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.Width = 5; - TileObjectData.newTile.Height = 2; - TileObjectData.newTile.Origin = new Point16(2, 4); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); - AddMapEntry(new Color(146, 123, 127)); - DustType = DustID.Shadewood_Tree; - HitSound = SoundID.Dig; - } - } - - public class DriftwoodAmbient2 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.Width = 3; - TileObjectData.newTile.Height = 2; - TileObjectData.newTile.Origin = new Point16(2, 3); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); - AddMapEntry(new Color(146, 123, 127)); - DustType = DustID.Shadewood_Tree; - HitSound = SoundID.Dig; - } - } - - public class DriftwoodAmbient3 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.Width = 3; - TileObjectData.newTile.Height = 4; - TileObjectData.newTile.Origin = new Point16(2, 3); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); - AddMapEntry(new Color(146, 123, 127)); - DustType = DustID.Shadewood_Tree; - HitSound = SoundID.Dig; - } - } - - public class DriftwoodAmbient4 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.Width = 5; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(2, 3); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); - AddMapEntry(new Color(146, 123, 127)); - DustType = DustID.Shadewood_Tree; - HitSound = SoundID.Dig; - } - } - - public class DriftwoodAmbient5 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.Width = 5; - TileObjectData.newTile.Height = 2; - TileObjectData.newTile.Origin = new Point16(2, 3); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); - AddMapEntry(new Color(146, 123, 127)); - DustType = DustID.Shadewood_Tree; - HitSound = SoundID.Dig; - } - } - - public class DriftwoodAmbient6 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.Width = 3; - TileObjectData.newTile.Height = 2; - TileObjectData.newTile.Origin = new Point16(2, 3); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); - AddMapEntry(new Color(146, 123, 127)); - DustType = DustID.Shadewood_Tree; - HitSound = SoundID.Dig; - } - } -} diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.png deleted file mode 100644 index ed3ac19385..0000000000 Binary files a/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient2.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient2.png deleted file mode 100644 index 4b1ae8d4cc..0000000000 Binary files a/Tiles/SunkenSea/Ambient/DriftwoodAmbient2.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient3.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient3.png deleted file mode 100644 index b786e79bc1..0000000000 Binary files a/Tiles/SunkenSea/Ambient/DriftwoodAmbient3.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient4.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient4.png deleted file mode 100644 index 528c3ab92b..0000000000 Binary files a/Tiles/SunkenSea/Ambient/DriftwoodAmbient4.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient5.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient5.png deleted file mode 100644 index 498e6e8bd4..0000000000 Binary files a/Tiles/SunkenSea/Ambient/DriftwoodAmbient5.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient6.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient6.png deleted file mode 100644 index a723c9116b..0000000000 Binary files a/Tiles/SunkenSea/Ambient/DriftwoodAmbient6.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodMast.cs b/Tiles/SunkenSea/Ambient/DriftwoodMast.cs new file mode 100644 index 0000000000..2828e54ecc --- /dev/null +++ b/Tiles/SunkenSea/Ambient/DriftwoodMast.cs @@ -0,0 +1,36 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class DriftwoodMast : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 3, 0); + TileObjectData.newTile.Origin = new Point16(1, 3); + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 6; + TileObjectData.newTile.RandomStyleRange = 6; + + TileObjectData.addTile(Type); + AddMapEntry(new Color(146, 123, 127)); + DustType = DustID.Shadewood_Tree; + HitSound = SoundID.Dig; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/DriftwoodMast.png b/Tiles/SunkenSea/Ambient/DriftwoodMast.png new file mode 100644 index 0000000000..2965c8e880 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DriftwoodMast.png differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodScraps.cs b/Tiles/SunkenSea/Ambient/DriftwoodScraps.cs new file mode 100644 index 0000000000..1083632c2e --- /dev/null +++ b/Tiles/SunkenSea/Ambient/DriftwoodScraps.cs @@ -0,0 +1,36 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class DriftwoodScraps : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16,}; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 3, 0); + TileObjectData.newTile.Origin = new Point16(1, 2); + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 6; + TileObjectData.newTile.RandomStyleRange = 6; + + TileObjectData.addTile(Type); + AddMapEntry(new Color(146, 123, 127)); + DustType = DustID.Shadewood_Tree; + HitSound = SoundID.Dig; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/DriftwoodScraps.png b/Tiles/SunkenSea/Ambient/DriftwoodScraps.png new file mode 100644 index 0000000000..7eb6e171a3 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DriftwoodScraps.png differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodWreckage.png b/Tiles/SunkenSea/Ambient/DriftwoodWreckage.png new file mode 100644 index 0000000000..503b002088 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DriftwoodWreckage.png differ diff --git a/Tiles/SunkenSea/Ambient/FloweringBarrelCactus.cs b/Tiles/SunkenSea/Ambient/FloweringBarrelCactus.cs new file mode 100644 index 0000000000..7aa5ca14ee --- /dev/null +++ b/Tiles/SunkenSea/Ambient/FloweringBarrelCactus.cs @@ -0,0 +1,35 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Humanizer; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class FloweringBarrelCactus : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(1, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(163, 24, 21)); + DustType = 155; + HitSound = SoundID.Dig; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/FloweringBarrelCactus.png b/Tiles/SunkenSea/Ambient/FloweringBarrelCactus.png new file mode 100644 index 0000000000..fa1ef4ab8c Binary files /dev/null and b/Tiles/SunkenSea/Ambient/FloweringBarrelCactus.png differ diff --git a/Tiles/SunkenSea/Ambient/LargeBarrelCactus.cs b/Tiles/SunkenSea/Ambient/LargeBarrelCactus.cs new file mode 100644 index 0000000000..d93b10fd7b --- /dev/null +++ b/Tiles/SunkenSea/Ambient/LargeBarrelCactus.cs @@ -0,0 +1,36 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class LargeBarrelCactus : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 3, 0); + TileObjectData.newTile.Origin = new Point16(1, 3); + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.RandomStyleRange = 2; + + TileObjectData.addTile(Type); + AddMapEntry(new Color(85, 143, 46)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/LargeBarrelCactus.png b/Tiles/SunkenSea/Ambient/LargeBarrelCactus.png new file mode 100644 index 0000000000..c5a96b33b2 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/LargeBarrelCactus.png differ diff --git a/Tiles/SunkenSea/Ambient/LargeDriftwoodWreckage.cs b/Tiles/SunkenSea/Ambient/LargeDriftwoodWreckage.cs new file mode 100644 index 0000000000..e334d09165 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/LargeDriftwoodWreckage.cs @@ -0,0 +1,36 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class LargeDriftwoodWreckage : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style5x4); + + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 3, 0); + TileObjectData.newTile.Origin = new Point16(1, 4); + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 6; + TileObjectData.newTile.RandomStyleRange = 6; + + TileObjectData.addTile(Type); + AddMapEntry(new Color(146, 123, 127)); + DustType = DustID.Shadewood_Tree; + HitSound = SoundID.Dig; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/LargeDriftwoodWreckage.png b/Tiles/SunkenSea/Ambient/LargeDriftwoodWreckage.png new file mode 100644 index 0000000000..e71f8608c7 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/LargeDriftwoodWreckage.png differ diff --git a/Tiles/SunkenSea/Ambient/LargeFloweringBarrelCactus.cs b/Tiles/SunkenSea/Ambient/LargeFloweringBarrelCactus.cs new file mode 100644 index 0000000000..2562e1c8e9 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/LargeFloweringBarrelCactus.cs @@ -0,0 +1,36 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class LargeFloweringBarrelCactus : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 3, 0); + TileObjectData.newTile.Origin = new Point16(1, 3); + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.RandomStyleRange = 2; + + TileObjectData.addTile(Type); + AddMapEntry(new Color(163, 24, 21)); + DustType = DustID.Shadewood_Tree; + HitSound = SoundID.Dig; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/LargeFloweringBarrelCactus.png b/Tiles/SunkenSea/Ambient/LargeFloweringBarrelCactus.png new file mode 100644 index 0000000000..4796754896 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/LargeFloweringBarrelCactus.png differ diff --git a/Tiles/SunkenSea/Ambient/MediumDriftwoodWreckage.png b/Tiles/SunkenSea/Ambient/MediumDriftwoodWreckage.png new file mode 100644 index 0000000000..3038646c27 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/MediumDriftwoodWreckage.png differ diff --git a/Tiles/SunkenSea/Ambient/TableCoral.cs b/Tiles/SunkenSea/Ambient/TableCoral.cs index fc71856e8d..39dd771da5 100644 --- a/Tiles/SunkenSea/Ambient/TableCoral.cs +++ b/Tiles/SunkenSea/Ambient/TableCoral.cs @@ -10,7 +10,6 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient { public class TableCoral : ModTile { - private const int Variants = 3; public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; @@ -18,8 +17,8 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient Main.tileSolidTop[Type] = true; TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleWrapLimit = Variants; - TileObjectData.newTile.RandomStyleRange = Variants; + TileObjectData.newTile.StyleWrapLimit = 3; + TileObjectData.newTile.RandomStyleRange = 3; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.newTile.AnchorBottom = AnchorData.Empty; TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.SolidTile, 2, 0); diff --git a/Tiles/SunkenSea/Ambient/TableCoralLeft.cs b/Tiles/SunkenSea/Ambient/TableCoralLeft.cs index d483514583..cd59615410 100644 --- a/Tiles/SunkenSea/Ambient/TableCoralLeft.cs +++ b/Tiles/SunkenSea/Ambient/TableCoralLeft.cs @@ -10,7 +10,6 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient { public class TableCoralLeft : ModTile { - private const int Variants = 3; public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; @@ -18,8 +17,8 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient Main.tileSolidTop[Type] = true; TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleWrapLimit = Variants; - TileObjectData.newTile.RandomStyleRange = Variants; + TileObjectData.newTile.StyleWrapLimit = 3; + TileObjectData.newTile.RandomStyleRange = 3; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.newTile.AnchorBottom = AnchorData.Empty; diff --git a/Tiles/SunkenSea/Ambient/WallCoral.cs b/Tiles/SunkenSea/Ambient/WallCoral.cs index a01eefb85c..c76dc9072c 100644 --- a/Tiles/SunkenSea/Ambient/WallCoral.cs +++ b/Tiles/SunkenSea/Ambient/WallCoral.cs @@ -9,7 +9,6 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient { public class WallCoral : ModTile { - private const int Variants = 4; public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; @@ -19,8 +18,8 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleWrapLimit = Variants; - TileObjectData.newTile.RandomStyleRange = Variants; + TileObjectData.newTile.StyleWrapLimit = 4; + TileObjectData.newTile.RandomStyleRange = 4; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); TileObjectData.newTile.AnchorBottom = AnchorData.Empty; TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.SolidTile, 2, 0); diff --git a/Tiles/SunkenSea/Ambient/WallCoralLeft.cs b/Tiles/SunkenSea/Ambient/WallCoralLeft.cs index 377e2b0457..0ccd985a47 100644 --- a/Tiles/SunkenSea/Ambient/WallCoralLeft.cs +++ b/Tiles/SunkenSea/Ambient/WallCoralLeft.cs @@ -10,7 +10,6 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient { public class WallCoralLeft : ModTile { - public const int Variants = 4; public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; @@ -19,8 +18,8 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient Main.tileLighted[Type] = true; TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleWrapLimit = Variants; - TileObjectData.newTile.RandomStyleRange = Variants; + TileObjectData.newTile.StyleWrapLimit = 4; + TileObjectData.newTile.RandomStyleRange = 4; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); TileObjectData.newTile.AnchorBottom = AnchorData.Empty; diff --git a/Tiles/SunkenSea/AridSoil.cs b/Tiles/SunkenSea/AridSoil.cs index 8d6ced2822..8846921ef8 100644 --- a/Tiles/SunkenSea/AridSoil.cs +++ b/Tiles/SunkenSea/AridSoil.cs @@ -34,6 +34,7 @@ namespace CalamityMod.Tiles.SunkenSea //Sand merges this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/PolypSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/DunesandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ScarletSeaGrassTile"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/VolcanicSandMerge"); diff --git a/Tiles/SunkenSea/Mire.cs b/Tiles/SunkenSea/Mire.cs new file mode 100644 index 0000000000..cd3711da53 --- /dev/null +++ b/Tiles/SunkenSea/Mire.cs @@ -0,0 +1,54 @@ +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class Mire : ModTile + { + public override void SetStaticDefaults() + { + TileID.Sets.GeneralPlacementTiles[Type] = false; + + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + Main.tileBlendAll[Type] = true; + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithDesert(Type); + TileID.Sets.ChecksForMerge[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; + Main.tileShine2[Type] = true; + + DustType = DustID.Hive; + AddMapEntry(new Color(71, 38, 30)); + + //Stone merges + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); + + //Sand merges + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/PolypSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ScarletSeaGrassTile"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/VolcanicSandMerge"); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + + //Normal merges + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/SunkenSea/Mire.png b/Tiles/SunkenSea/Mire.png new file mode 100644 index 0000000000..52e651c89f Binary files /dev/null and b/Tiles/SunkenSea/Mire.png differ diff --git a/Tiles/SunkenSea/Runestone.cs b/Tiles/SunkenSea/Runestone.cs index 4730684727..b89e465acd 100644 --- a/Tiles/SunkenSea/Runestone.cs +++ b/Tiles/SunkenSea/Runestone.cs @@ -27,12 +27,26 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.CanBeDugByShovel[Type] = true; + //Stone merges this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); + + //Sand merges + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/PolypSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/DunesandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ScarletSeaGrassTile"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/VolcanicSandMerge"); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); - this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); - this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + + //Normal merges + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index 317f14dd43..76e7fc6757 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -30,13 +30,45 @@ namespace CalamityMod.World public static int BasaltGullyX = 0, BasaltGullyY = 15; public static int GlobalX = 0, GlobalY = -20; } -/* - checklist: + static bool IsAirOrDecor(int x, int y) + { + if (y <= 0 || y >= Main.maxTilesY - 1 || x <= 0 || x >= Main.maxTilesX - 1) + return true; // out-of-bounds above counts as clear - -Add the wall corals properly - -Make sunken sea walls produce water - cut a half oval out of the top of forest in anticipation of structure placement - */ + Tile t = Main.tile[x, y]; + if (!t.HasTile) + return true; + + int type = t.TileType; + + // blockers (full blocks / slopes / platforms) + if (WorldGen.SolidOrSlopedTile(x, y)) return false; // solid/half/sloped + if (Main.tileSolidTop[type]) return false; // platforms & similar + + // ambient stuff + if (Main.tileFrameImportant[type] && !Main.tileSolid[type]) return true; // pots, cactus, decor + if (Main.tileCut[type]) return true; // grass/vines/etc. + if (TileID.Sets.BreakableWhenPlacing[type]) return true; // tiny plants, etc. + + return false; + } + + static bool ColumnClearOrDecor(int x, int groundY, int tilesUp) + { + for (int k = 1; k <= tilesUp; k++) + { + if (!IsAirOrDecor(x, groundY - k)) + return false; + } + return true; + } + /* + checklist: + + -Add the wall corals properly + -Make sunken sea walls produce water + cut a half oval out of the top of forest in anticipation of structure placement + */ public static void ParallelFor(int fromInclusive, int toExclusive, int step, Action action) { @@ -280,49 +312,61 @@ namespace CalamityMod.World { float interpolator = Utils.GetLerpValue(startY - 90, startY - 150, y, true); - // This lerp does absolutely nothing. - float ditherStrength = MathHelper.Lerp(0f, 0f, interpolator); + + WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] { - new Modifiers.OnlyTiles(TileID.Sand, TileID.HardenedSand), - new Modifiers.Dither(ditherStrength + 0f), + new Modifiers.OnlyTiles(TileID.Sand), new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()), })); - // Changing these makes the walls dither higher up than tiles, to prevent the biome from changing earlier than expected. Still looks nice imo :) + WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles(TileID.HardenedSand), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); + + WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles(TileID.DesertFossil), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); + + WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles(TileID.RollingCactus), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); + interpolator = Utils.GetLerpValue(startY - 90, startY - 200, y, true); - ditherStrength = MathHelper.Lerp(0f, 0f, interpolator); WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] { new Modifiers.OnlyWalls(WallID.Sandstone, WallID.HardenedSand), - new Modifiers.Dither(ditherStrength), new Actions.ClearWall(), new Actions.PlaceWall((ushort)ModContent.WallType()), })); - // I forgot to change this one. :peepotired: interpolator = Utils.GetLerpValue(startY - 90, startY - 150, y, true); - ditherStrength = MathHelper.Lerp(0f, 0f, interpolator); WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] { new Modifiers.OnlyTiles(TileID.Sandstone), - new Modifiers.Dither(ditherStrength), new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()), })); interpolator = Utils.GetLerpValue(startY - 90, startY - 150, y, true); - ditherStrength = MathHelper.Lerp(0f, 0f, interpolator); WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] { new Modifiers.OnlyTiles((ushort)ModContent.TileType()), - new Modifiers.Dither(ditherStrength), new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()), })); - + if (Main.tile[x, y].Get().LiquidType == LiquidID.Lava) WorldUtils.Gen(new Point(x, y), new Shapes.Rectangle(5, 5), new Actions.SetLiquid(LiquidID.Lava, 0)); @@ -342,10 +386,8 @@ namespace CalamityMod.World for (int Y = startY - 100; Y <= startY + 100; Y++) { bool canPlaceSand = - Main.tile[X, Y].TileType == ModContent.TileType() && - !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && - !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && - !Main.tile[X, Y - 5].HasTile; + Main.tile[X, Y].TileType == ModContent.TileType() && + ColumnClearOrDecor(X, Y, 5); if (canPlaceSand) PlaceSand(X, Y, 5, ModContent.TileType()); @@ -366,34 +408,12 @@ namespace CalamityMod.World } } - // Slope tiles and Soil Spawn + // Slope tiles for (int X = startX - biomeSize; X < startX + biomeSize; X += 1) { for (int Y = startY - 300; Y <= startY + 200; Y++) { Tile.SmoothSlope(X, Y); - - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - if (WorldGen.genRand.NextBool(25) && !Main.tile[X - 1, Y].HasTile) - { - ushort[] Soil = new ushort[] { (ushort)ModContent.TileType() }; - - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(3, 7)), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles((ushort)ModContent.TileType()), - new Actions.ClearTile(), new Actions.PlaceTile(WorldGen.genRand.Next(Soil)) - })); - - } - } } } }); @@ -1374,6 +1394,22 @@ namespace CalamityMod.World { for (int Y = 20; Y <= Main.maxTilesY - 20; Y++) { + if (WorldGen.genRand.NextBool(200)) + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(2), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles((ushort)ModContent.TileType()), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); + if (WorldGen.genRand.NextBool(200)) + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(2), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles((ushort)ModContent.TileType()), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); + + //place coral blobs in the radiant reefs if (WorldGen.genRand.NextBool(400) && ((Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile) || (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile))) @@ -1397,21 +1433,67 @@ namespace CalamityMod.World if (Main.tile[X, Y].TileType == ModContent.TileType()) { //Driftwood Ambiance - if (WorldGen.genRand.NextBool(50)) + if (WorldGen.genRand.NextBool(60)) { - ushort[] DriftwoodPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + int RandStyle() => WorldGen.genRand.Next(6); + int style = RandStyle(); - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DriftwoodPiles)); + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style); + } + if (WorldGen.genRand.NextBool(30)) + { + int RandStyleScrap() => WorldGen.genRand.Next(6); + int styleScrap = RandStyleScrap(); + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, styleScrap); + } + if (WorldGen.genRand.NextBool(30)) + { + int RandStyleLargeWreck() => WorldGen.genRand.Next(6); + int styleLargeWreck = RandStyleLargeWreck(); + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, styleLargeWreck); } } + + + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + // stay in-bounds + if (Y > 0) + { + Tile above = Main.tile[X, Y - 1]; + + // only if it's open air (no solid tile), and we don't overwrite other special liquids other than lava (just incase) + if (!above.HasTile && + above.Get().LiquidType != LiquidID.Honey && + above.Get().LiquidType != LiquidID.Shimmer) + { + above.Get().LiquidType = LiquidID.Water; + above.LiquidAmount = byte.MaxValue; // 255 + } + } + } + if (Main.tile[X, Y].TileType == ModContent.TileType()) { //Driftwood Ambiance - if (WorldGen.genRand.NextBool(75)) + if (WorldGen.genRand.NextBool(60)) { - ushort[] DriftwoodPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + int RandStyleWall() => WorldGen.genRand.Next(6); + int style = RandStyleWall(); - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DriftwoodPiles)); + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style); + } + if (WorldGen.genRand.NextBool(30)) + { + int RandStyleWall() => WorldGen.genRand.Next(6); + int styleScrap = RandStyleWall(); + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, styleScrap); + } + if (WorldGen.genRand.NextBool(30)) + { + int RandStyleWall() => WorldGen.genRand.Next(6); + int styleLargeWreck = RandStyleWall(); + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, styleLargeWreck); } } //gleaming burrows ambient tiles @@ -1628,11 +1710,23 @@ namespace CalamityMod.World } //Driftwood Ambiance - if (WorldGen.genRand.NextBool(15)) + if (WorldGen.genRand.NextBool(30)) { - ushort[] DriftwoodPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DriftwoodPiles)); + int RandStyleWall() => WorldGen.genRand.Next(6); + int styleMast = RandStyleWall(); + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(),true, styleMast); + } + if (WorldGen.genRand.NextBool(30)) + { + int RandStyleWall() => WorldGen.genRand.Next(6); + int styleScrap = RandStyleWall(); + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, styleScrap); + } + if (WorldGen.genRand.NextBool(30)) + { + int RandStyleWall() => WorldGen.genRand.Next(6); + int styleLargeWreck = RandStyleWall(); + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, styleLargeWreck); } if (!shipPlaced) { @@ -1645,11 +1739,25 @@ namespace CalamityMod.World if (Main.tile[X, Y].TileType == ModContent.TileType()) { //Driftwood Ambiance - if (WorldGen.genRand.NextBool(15)) + if (WorldGen.genRand.NextBool(30)) { - ushort[] DriftwoodPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + int RandStyleWall() => WorldGen.genRand.Next(6); + int style = RandStyleWall(); - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DriftwoodPiles)); + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style); + } + if (WorldGen.genRand.NextBool(30)) + { + int RandStyleWall() => WorldGen.genRand.Next(6); + int style = RandStyleWall(); + + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style); + } + if (WorldGen.genRand.NextBool(30)) + { + int RandStyleWall() => WorldGen.genRand.Next(6); + int styleLargeWreck = RandStyleWall(); + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, styleLargeWreck); } //multi-colored corals if (WorldGen.genRand.NextBool(3))