diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 72a6e8d868..8029a89f37 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -188,6 +188,8 @@ namespace CalamityMod.Balancing #region Astrum Aureus // 30% resist to The Ballista's greatarrows. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + // 30% resist to Whitewater. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), Do(new ProjectileResistBalancingRule(0.7f, ProjectileType(), ProjectileType(), ProjectileType())))); #endregion #region Duke Fishron @@ -216,6 +218,9 @@ namespace CalamityMod.Balancing // 50% resist to Icicle Arrows. NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + // 50% resist to Whitewater. + NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType(), ProjectileType(), ProjectileType())))); + // 35% resist to Flying Dragon. NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2SquireSonicBoom)))); @@ -295,9 +300,6 @@ namespace CalamityMod.Balancing #endregion #region Providence - // 80% resist to Hell's Sun. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.2f, ProjectileType()))); - // 35% resist to Vanishing Point. This thing desperately needs a rework. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.65f, ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType()))); #endregion diff --git a/Buffs/Mounts/ExoTankBuff.cs b/Buffs/Mounts/ExoTankBuff.cs new file mode 100644 index 0000000000..4512f85452 --- /dev/null +++ b/Buffs/Mounts/ExoTankBuff.cs @@ -0,0 +1,21 @@ +using CalamityMod.Items.Mounts; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Mounts +{ + public class ExoTankBuff : ModBuff + { + public override void SetStaticDefaults() + { + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.mount.SetMount(ModContent.MountType(), player); + player.buffTime[buffIndex] = 10; + } + } +} diff --git a/Buffs/Mounts/ExoTankBuff.png b/Buffs/Mounts/ExoTankBuff.png new file mode 100644 index 0000000000..f5986ce912 Binary files /dev/null and b/Buffs/Mounts/ExoTankBuff.png differ diff --git a/Buffs/StatDebuffs/ProfanedWeakness.cs b/Buffs/StatDebuffs/ProfanedWeakness.cs index 4a2a558c3b..e9d61ddd1a 100644 --- a/Buffs/StatDebuffs/ProfanedWeakness.cs +++ b/Buffs/StatDebuffs/ProfanedWeakness.cs @@ -1,5 +1,8 @@ -using Terraria; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Terraria; using Terraria.ModLoader; +using Microsoft.Xna.Framework; namespace CalamityMod.Buffs.StatDebuffs { @@ -11,5 +14,29 @@ namespace CalamityMod.Buffs.StatDebuffs Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; } + public override void Update(NPC npc, ref int buffIndex) + { + if (npc.Calamity().relicOfResilienceWeakness < npc.buffTime[buffIndex]) + npc.Calamity().relicOfResilienceWeakness = npc.buffTime[buffIndex]; + npc.DelBuff(buffIndex); + buffIndex--; + } + internal static void DrawEffects(NPC npc, ref Color drawColor) + { + Vector2 npcSize = npc.Center + new Vector2(Main.rand.NextFloat(-npc.width / 2, npc.width / 2), Main.rand.NextFloat(-npc.height / 2, npc.height / 2)); + + if (Main.rand.NextBool(5)) + { + Particle spark = new CustomSpark(npcSize, Vector2.Zero, "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard" + Main.rand.Next(1, 6 + 1).ToString(), true, Main.rand.Next(9, 22 + 1), Main.rand.NextFloat(0.4f, 0.8f), Color.White * Main.rand.NextFloat(0.4f, 0.9f), new Vector2(1.1f, 0.8f), false, false, Main.rand.NextFloat(-5, 5), false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + + if (Main.rand.NextBool(5)) + { + Dust dust = Dust.NewDustDirect(npc.position - new Vector2(2f), npc.width + 4, npc.height + 4, ModContent.DustType(), npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, Main.rand.NextFloat(0.9f, 1.7f)); + dust.noGravity = Main.rand.NextBool(3); + dust.color = Main.rand.NextBool() ? Color.Sienna : Color.Goldenrod; + } + } } } diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 7aae2af7a9..ad9415740b 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -212,6 +212,10 @@ namespace CalamityMod.CalPlayer public int StellarHammer = 0; public int GalaxyHammer = 0; public bool despoilerNerf = false; + public int amputatorBuff = 0; + public int rOfResilienceCooldown = 0; + public int rOfResilienceEffect = 0; + public int rOfResilienceOrbitOffset = 0; public int NorfleetCounter = 0; public int hideOfDeusMeleeBoostTimer = 0; public int alcoholPoisonLevel = 0; @@ -504,6 +508,8 @@ namespace CalamityMod.CalPlayer public bool unstableGraniteCore = false; public bool regenator = false; public bool theBee = false; + public bool arcFlashRing = false; + public bool arcFlashRingVisual = false; public bool shouldTriggerBeeCooldown = false; public int theBeeCooldown = 0; public bool alluringBait = false; @@ -517,12 +523,14 @@ namespace CalamityMod.CalPlayer public bool stressPills = false; public bool laudanum = false; public bool heartOfDarkness = false; + public bool profanedSoulRelicBuff = false; public bool draedonsHeart = false; public bool vexation = false; public bool dodgeScarf = false; public bool evasionScarf = false; public bool badgeOfBravery = false; - public bool warbannerOfTheSun = false; + public bool WarbanneroftheRighteous = false; + public bool warbannerGlow = false; public bool tesla = false; public bool teslaVisuals = true; public bool cryogenSoul = false; @@ -577,6 +585,7 @@ namespace CalamityMod.CalPlayer public int gSabatonFall = 0; public bool gSabatonFalling = false; public int gSabatonTempJumpSpeed = 0; + public bool rOfDelivarenceRam = false; public bool sGlyph = false; public bool sRegen = false; public bool tracersDust = false; @@ -1751,6 +1760,8 @@ namespace CalamityMod.CalPlayer regenator = false; deepDiver = false; theBee = false; + arcFlashRing = false; + arcFlashRingVisual = false; alluringBait = false; enchantedPearl = false; fishingStation = false; @@ -1758,7 +1769,8 @@ namespace CalamityMod.CalPlayer bloodyWormTooth = false; vexation = false; badgeOfBravery = false; - warbannerOfTheSun = false; + WarbanneroftheRighteous = false; + warbannerGlow = false; aSpark = false; transformer = false; hideOfDeus = false; @@ -1798,6 +1810,7 @@ namespace CalamityMod.CalPlayer nucleogenesis = false; nuclearFuelRod = false; heartOfDarkness = false; + profanedSoulRelicBuff = false; shadowMinions = false; holyMinions = false; alchFlask = false; @@ -2420,6 +2433,7 @@ namespace CalamityMod.CalPlayer gSabatonFall = 0; gSabatonFalling = false; gSabatonTempJumpSpeed = 0; + rOfDelivarenceRam = false; astralStarRainCooldown = 0; AbaddonCooldown = 0; VoidCooldown = 0; @@ -2430,6 +2444,8 @@ namespace CalamityMod.CalPlayer bloodflareMageCooldown = 0; tarraRangedCooldown = 0; hideOfDeusMeleeBoostTimer = 0; + rOfResilienceCooldown = 0; + rOfResilienceEffect = 0; externalAbyssLight = 0; externalBreathLossMultBoost = 0f; @@ -3150,7 +3166,7 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI == Main.myPlayer) { - int mark = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ProjectileType(), damage, kBack, Player.whoAmI); + int mark = Projectile.NewProjectile(source, Player.ClampedMouseWorld(), Vector2.Zero, ProjectileType(), damage, kBack, Player.whoAmI); if (mark.WithinBounds(Main.maxProjectiles)) Main.projectile[mark].DamageType = DamageClass.Generic; } @@ -4252,8 +4268,9 @@ namespace CalamityMod.CalPlayer var MedallionSource = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); int d = (int)Player.GetTotalDamage().ApplyTo(RustyMedallion.AcidDropBaseDamage); - Vector2 startingPosition = Main.MouseWorld - Vector2.UnitY.RotatedByRandom(0.3f) * 1250f; - Vector2 directionToMouse = (Main.MouseWorld - startingPosition).SafeNormalize(Vector2.UnitX); + Vector2 mouse = Player.ClampedMouseWorld(); + Vector2 startingPosition = mouse - Vector2.UnitY.RotatedByRandom(0.3f) * 1250f; + Vector2 directionToMouse = (mouse - startingPosition).SafeNormalize(Vector2.UnitX); int drop = Projectile.NewProjectile(MedallionSource, startingPosition, directionToMouse * 15f, ProjectileType(), d, 0f, Player.whoAmI, 3); if (drop.WithinBounds(Main.maxProjectiles)) { @@ -4784,6 +4801,10 @@ namespace CalamityMod.CalPlayer if ((it.IsAir || !it.CountsAsClass()) && GemTechSet && GemTechState.IsRedGemActive) playerUsingWeapon = false; + // Molten Amputator consumes stealth in a special way + if (it.type == ModContent.ItemType()) + playerUsingWeapon = false; + // Animation check depends on whether the item is "clockwork", like Clockwork Assault Rifle. // "Clockwork" weapons can chain-fire multiple stealth strikes (really only 2 max) until you run out of stealth. bool animationCheck = it.useAnimation == it.useTime diff --git a/CalPlayer/CalamityPlayerDashEffects.cs b/CalPlayer/CalamityPlayerDashEffects.cs index ff488ff264..d8d2a7ba4a 100644 --- a/CalPlayer/CalamityPlayerDashEffects.cs +++ b/CalPlayer/CalamityPlayerDashEffects.cs @@ -397,6 +397,7 @@ namespace CalamityMod.CalPlayer direction = DashDirection.Directionless; // God Slayer armor's dash will dash towards the player's cursor. + // 14NOV2024: Ozzatron: Intentionally does not use clamped mouse position so that player dash direction is not strangely bent on larger screens. Vector2 dashVel = Main.MouseWorld - Player.Center; dashVel = dashVel.SafeNormalize(Vector2.UnitX) * UsedDash.CalculateDashSpeed(Player); @@ -517,6 +518,22 @@ namespace CalamityMod.CalPlayer DoMountDashDamage(damageHitbox, damage, knockback, NPCImmuneTime, playerImmuneTime); } + if (Player.mount.Active && Player.mount.Type == ModContent.MountType() && Math.Abs(Player.velocity.X) > Player.mount.RunSpeed) + { + Rectangle damageHitbox = Player.getRect(); + + if (Player.direction == 1) + damageHitbox.Offset(Player.width - 1, 0); + + damageHitbox.Width = 2; + damageHitbox.Inflate(6, 12); + float damage = Player.GetTotalDamage().ApplyTo(ExoTank.DashDamage); + float knockback = 10f; + int NPCImmuneTime = 30; + int playerImmuneTime = 6; + DoMountDashDamage(damageHitbox, damage, knockback, NPCImmuneTime, playerImmuneTime); + } + if (Player.mount.Active && Player.mount.Type == ModContent.MountType() && Math.Abs(Player.velocity.X) > Player.mount.RunSpeed / 2f) { Rectangle damageHitbox = Player.getRect(); diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index bdcd461999..18051976c0 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -22,7 +22,6 @@ using CalamityMod.Items.Mounts; using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; -using CalamityMod.Items.Tools; using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs; @@ -796,12 +795,6 @@ namespace CalamityMod.CalPlayer if (npc.Calamity().tSad > 0) contactDamageReduction += 0.5; - if (npc.Calamity().relicOfResilienceWeakness > 0) - { - contactDamageReduction += Items.Weapons.Typeless.RelicOfResilience.WeaknessDR; - npc.Calamity().relicOfResilienceWeakness = 0; - } - if (eskimoSet) { if (npc.coldDamage) @@ -1513,6 +1506,16 @@ namespace CalamityMod.CalPlayer theBeeCooldown = TheBee.CooldownLength; } + // TODO: If possible, find a way to make it so parries don't activate the hit + if (rOfResilienceCooldown == 0 && rOfResilienceEffect > 0 && hurtInfo.Damage > 1) + { + int cooldownTime = (Player.Calamity().profanedSoulRelicBuff ? 300 : 600); + rOfResilienceCooldown = cooldownTime; + Player.AddCooldown(Cooldowns.RelicOfResilienceCooldown.ID, cooldownTime); + SoundStyle youGotHit = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRockShieldActivate"); + SoundEngine.PlaySound(youGotHit with { Volume = 0.7f, Pitch = -0.1f }, Player.Center); + } + if (alchFlask) { for (int i = 0; i < 9; i++) @@ -1598,6 +1601,30 @@ namespace CalamityMod.CalPlayer } } + if (rOfDelivarenceRam) + { + foreach (NPC n in Main.ActiveNPCs) + { + // Ignore critters with the Guide to Critter Companionship + if (Player.dontHurtCritters && NPCID.Sets.CountsAsCritter[n.type]) + continue; + + if (!n.dontTakeDamage && !n.friendly && n.Calamity().dashImmunityTime[Player.whoAmI] <= 0) + { + Rectangle npcHitbox = n.getRect(); + if ((Player.getRect()).Intersects(npcHitbox) && (n.noTileCollide || Collision.CanHit(Player.position, Player.width, Player.height, n.position, n.width, n.height))) + { + // 17APR2024: Ozzatron: This item gives iframes when passing through enemies for projectile safety. + // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. + n.Calamity().dashImmunityTime[Player.whoAmI] = 4; + Player.GiveUniversalIFrames(InterstellarStompers.PassthroughIFrames, false); + + return true; + } + } + } + } + // If no other effects occurred, run vanilla code return base.FreeDodge(info); } @@ -1790,6 +1817,35 @@ namespace CalamityMod.CalPlayer } SoundEngine.PlaySound(BlazingCore.ParrySuccessSound, Player.Center); + + float power = 2; + for (int i = 0; i < (int)(20 * power); i++) + { + if (Main.rand.NextBool()) + { + Particle spark = new CustomSpark(Player.Center, ((new Vector2(19, 19) * power).RotatedByRandom(100)) * Main.rand.NextFloat(0.2f, 1f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 47, Main.rand.NextFloat(1.15f, 1.3f) * power, Main.rand.NextBool(4) ? Color.Khaki : Color.Orange, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); + GeneralParticleHandler.SpawnParticle(spark); + } + else + { + bool isSpark = Main.rand.NextBool(5); + Dust dust = Dust.NewDustPerfect(Player.Center, isSpark ? 278 : ModContent.DustType(), ((new Vector2(15, 15) * power).RotatedByRandom(100)) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.85f, 1.15f) * power * (isSpark ? 0.5f : 1); + dust.color = Main.rand.NextBool(5) ? Color.Khaki : Color.Goldenrod; + if (isSpark) + dust.noGravity = false; + else + dust.noLightEmittence = true; + } + } + + Particle orb1 = new CustomPulse(Player.Center, Vector2.Zero, Color.Goldenrod, "CalamityMod/Particles/SoftRoundExplosion", new Vector2(1f, 0.8f), 0, 0, 0.14f * power, 25); + GeneralParticleHandler.SpawnParticle(orb1); + + Particle orb2 = new CustomPulse(Player.Center, Vector2.Zero, Color.Khaki, "CalamityMod/Particles/BloomRing", new Vector2(1f, 0.5f), 0, 0, 2.1f * power, 25); + GeneralParticleHandler.SpawnParticle(orb2); + blazingCoreSuccessfulParry = 60; Player.AddCooldown(ParryCooldown.ID, 60 * 30, false, "blazingcore"); //cooldown is frames in seconds multiplied by the desired amount of seconds } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 22f1238120..3de198a285 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -802,7 +802,15 @@ namespace CalamityMod.CalPlayer if (!blazingCursorDamage) return; - Rectangle sigilHitbox = Utils.CenteredRectangle(Main.MouseWorld, new Vector2(35f, 62f)); + // 14NOV2024: Ozzatron: was not sure whether to let Calamity function outside normal cursor range. decided on no + // + // Check whether the mouse cursor is within the acceptable clamped range. If it's not, don't allow for damage. + Vector2 mouseTruePosition = Player.Calamity().mouseWorld; + Vector2 mouseClampedPosition = Player.ClampedMouseWorld(); + if (mouseTruePosition != mouseClampedPosition) + return; + + Rectangle sigilHitbox = Utils.CenteredRectangle(mouseClampedPosition, new Vector2(35f, 62f)); int sigilDamage = (int)Player.GetBestClassDamage().ApplyTo(Calamity.BaseDamage); bool brightenedSigil = false; @@ -819,7 +827,7 @@ namespace CalamityMod.CalPlayer // Draw an expanding orb effect on the cursor based on the cursor focus value. float cursorFocusRatio = target.Calamity().cursorFocus / (float)CalamityGlobalNPC.cursorFocusMax; - StrongBloom indicator = new(Main.MouseWorld, Vector2.Zero, Color.Lerp(Color.Magenta, Color.Red, cursorFocusRatio), cursorFocusRatio * 0.7f, 2); + StrongBloom indicator = new(mouseClampedPosition, Vector2.Zero, Color.Lerp(Color.Magenta, Color.Red, cursorFocusRatio), cursorFocusRatio * 0.7f, 2); GeneralParticleHandler.SpawnParticle(indicator); if (target.Calamity().cursorFocus >= CalamityGlobalNPC.cursorFocusMax) @@ -1440,6 +1448,70 @@ namespace CalamityMod.CalPlayer } } + if (rOfResilienceEffect > 0) + rOfResilienceEffect--; + if (Player.HeldItem.type == ModContent.ItemType()) // All players close to a player holding RoR get the benefits + { + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && !Player.dead) + { + Projectile relic = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Player.whoAmI); + } + for (int index = 0; index < Main.player.Length; index++) + { + Player fella = Main.player[index]; + if (Utils.Distance(fella.Center, Player.Center) < 650 && fella.team == Player.team) + { + fella.Calamity().rOfResilienceEffect = (fella != Player ? 120 : 2); + } + } + } + if (rOfResilienceEffect > 0) + { + if (Player.Calamity().mouseRight && rOfResilienceCooldown == 0) + { + int cooldownTime = (Player.Calamity().profanedSoulRelicBuff ? 300 : 600); + rOfResilienceCooldown = cooldownTime; + Player.AddCooldown(Cooldowns.RelicOfResilienceCooldown.ID, cooldownTime); + SoundStyle y = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRockShieldActivate"); + SoundEngine.PlaySound(y with { Volume = 0.7f, Pitch = -0.1f }, Player.Center); + } + + // Adds a floor for defense and dr at 150 and 10% respectivley, will not ignore defense damage + if (Player.Calamity().rOfResilienceCooldown > 300 || Player.Calamity().rOfResilienceCooldown == 0) + { + float fadeStats = (Player.Calamity().rOfResilienceCooldown == 0 ? 1 : Utils.GetLerpValue(300, 600, Player.Calamity().rOfResilienceCooldown, true)); + int maxDefFloor = (int)(150 * fadeStats); + float MaxDRFloor = 0.10f * fadeStats; + if (Player.statDefense < maxDefFloor) + Player.statDefense += maxDefFloor - Player.statDefense; + if (Player.endurance < MaxDRFloor) + Player.endurance += MaxDRFloor - Player.endurance; + } + + int numOfShards = 0; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[1] == 0 && projectile.owner == Player.whoAmI) + { + numOfShards++; + } + } + if (Player.miscCounter % (Player.Calamity().profanedSoulRelicBuff ? 4 : 8) == 0 && numOfShards < (Player.Calamity().profanedSoulRelicBuff ? 75 : 30) && Player.Calamity().rOfResilienceCooldown == 0) + { + if (numOfShards == 0) + { + rOfResilienceOrbitOffset = Main.rand.Next(0, 100 + 1); + SoundStyle sound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash"); + SoundEngine.PlaySound(sound with { Volume = 0.5f, Pitch = -0.3f }, Player.Center); + } + int shardDamage = (int)Player.GetBestClassDamage().ApplyTo(420); + Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, new Vector2(1, 0), ModContent.ProjectileType(), shardDamage, 0f, Player.whoAmI, 0, 0, numOfShards + 1); + } + } + if (rOfResilienceCooldown > 0) + rOfResilienceCooldown--; + if (unstableGraniteCore) { zapActivity += 1; @@ -3729,6 +3801,8 @@ namespace CalamityMod.CalPlayer int dmg = (int)Player.GetTotalDamage().ApplyTo(30); Vector2 startPos = Player.RotatedRelativePoint(Player.MountedCenter, true); + + // 14NOV2024: Ozzatron: clamped mouse position is inappropriate to apply here due to excessive use of decompiled vanilla shitcode Vector2 velocity = Main.MouseWorld - startPos; if (Player.gravDir == -1f) { diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index b730cd81ba..b1d574f2ec 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -25,6 +25,7 @@ using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; +using Mono.Cecil; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -137,16 +138,27 @@ namespace CalamityMod.CalPlayer ItemOnHit(item, damageDone, target.Center, hit.Crit, target.IsAnEnemy(false, true), targetIsDummy); NPCDebuffs(target, item.CountsAsClass(), item.CountsAsClass(), item.CountsAsClass(), item.CountsAsClass(), item.CountsAsClass(), item.CountsAsClass()); + // Ursa Sergeant slash cooldown is reset on kill + if (ursaSergeant && target.life <= 0 && target.realLife == -1) + ursaSergeantCooldown = (int)MathHelper.Clamp(ursaSergeantCooldown - 180, 0, 300); + + // Arc Flash Ring lightning strike (Remember to change the one for projectile hits if applicable when you change this one!) + // This one has a lot less limits than the projectile one, but that's because vanilla broadsword code is limiting (wow so surprising) + if (arcFlashRing && (Main.rand.Next(0, 100) < 6)) + { + var source = item.GetSource_FromThis(); + int damage = (int)((hit.Damage * 4f) * (hit.Crit ? 0.5f : 1)); // 400% damage (uneffected by crits) + Vector2 position = target.Center + new Vector2(0, -750); + + Projectile.NewProjectile(source, position, new Vector2(0, 10), ProjectileType(), damage, 0f, Player.whoAmI, target.whoAmI); + } + // Shattered Community tracks all damage dealt with Rage Mode (ignoring dummies). if (targetIsDummy) return; if (rageModeActive && shatteredCommunity) Player.GetModPlayer().AccumulateRageDamage(damageDone); - - // Ursa Sergeant slash cooldown is reset on kill - if (ursaSergeant && target.life <= 0 && target.realLife == -1) - ursaSergeantCooldown = (int)MathHelper.Clamp(ursaSergeantCooldown - UrsaSergeant.CooldownReducedPerKill, 0, UrsaSergeant.MaxCooldown); } #endregion @@ -275,6 +287,26 @@ namespace CalamityMod.CalPlayer if (ursaSergeant && target.life <= 0 && target.realLife == -1) ursaSergeantCooldown = (int)MathHelper.Clamp(ursaSergeantCooldown - UrsaSergeant.CooldownReducedPerKill, 0, UrsaSergeant.MaxCooldown); + CalamityGlobalProjectile globalProj = proj.Calamity(); + // Arc Flash Ring lightning strike (Remember to change the one for item hits if applicable when you change this one!) + // Minions ignore the chance penalty on penetration + bool spawnChance = (Main.rand.Next(0, 100) < MathHelper.Clamp(6 - proj.numHits, (proj.minion ? 6 : 1), 6)); + if (arcFlashRing && spawnChance && proj.type != ProjectileType() && globalProj.spawnArcFlash) + { + proj.active = true; // Okay so if a projectile manually kills itself on hit, it totally breaks the bolts. to prevent this we set them to active + + var source = proj.GetSource_FromThis(); + int damage = (int)((hit.Damage * 4f) * (hit.Crit ? 0.5f : 1)); // 400% damage (uneffected by crits) + Vector2 position = target.Center + new Vector2(0, -750); + + Projectile bolt = Projectile.NewProjectileDirect(source, position, new Vector2(0, 10), ProjectileType(), damage, 0f, Player.whoAmI, target.whoAmI); + bolt.DamageType = hit.DamageType; + + globalProj.spawnArcFlash = false; + // This is really only used for long lasting projectiles and contact damage minions + globalProj.arcFlashCooldown = 90; + } + if (!proj.npcProj && !proj.trap && proj.friendly) { if ((plaguebringerCarapace || uberBees) && FriendlyBeesList.Includes(proj.type)) diff --git a/CalPlayer/Dashes/ElysianAegisDash.cs b/CalPlayer/Dashes/ElysianAegisDash.cs index 7451ed5044..8ff41a5806 100644 --- a/CalPlayer/Dashes/ElysianAegisDash.cs +++ b/CalPlayer/Dashes/ElysianAegisDash.cs @@ -9,7 +9,6 @@ using Terraria; using Terraria.DataStructures; using Terraria.Graphics.Shaders; using Terraria.ModLoader; -using static Humanizer.In; namespace CalamityMod.CalPlayer.Dashes { @@ -48,6 +47,11 @@ namespace CalamityMod.CalPlayer.Dashes 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(4) ? Color.Khaki : Color.Orange, 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. dashSpeed = 14f; diff --git a/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs index b49e6f1f4a..029b50fe1b 100644 --- a/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs +++ b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs @@ -98,6 +98,10 @@ namespace CalamityMod.CalPlayer.DrawLayers glowMask = ModContent.Request("CalamityMod/Items/Weapons/Ranged/VernalBolterGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/VividClarityGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Ranged/TelluricGlareGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Ranged/BlissfulBombardierGlow").Value; if (glowMask == default) return; diff --git a/Cooldowns/RelicOfResilience.cs b/Cooldowns/RelicOfResilienceCooldown.cs similarity index 77% rename from Cooldowns/RelicOfResilience.cs rename to Cooldowns/RelicOfResilienceCooldown.cs index fe76048f4e..18da908039 100644 --- a/Cooldowns/RelicOfResilience.cs +++ b/Cooldowns/RelicOfResilienceCooldown.cs @@ -3,12 +3,12 @@ using Terraria.Localization; namespace CalamityMod.Cooldowns { - public class RelicOfResilience : CooldownHandler + public class RelicOfResilienceCooldown : CooldownHandler { - public static new string ID => "RelicOfResilience"; + public static new string ID => "RelicOfResilienceCooldown"; public override bool ShouldDisplay => true; public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); - public override string Texture => "CalamityMod/Cooldowns/RelicOfResilience"; + public override string Texture => "CalamityMod/Cooldowns/RelicOfResilienceCooldown"; public override Color OutlineColor => new Color(255, 191, 73); public override Color CooldownStartColor => new Color(122, 66, 59); public override Color CooldownEndColor => new Color(165, 103, 87); diff --git a/Cooldowns/RelicOfResilience.png b/Cooldowns/RelicOfResilienceCooldown.png similarity index 100% rename from Cooldowns/RelicOfResilience.png rename to Cooldowns/RelicOfResilienceCooldown.png diff --git a/Cooldowns/RelicOfResilienceOutline.png b/Cooldowns/RelicOfResilienceCooldownOutline.png similarity index 100% rename from Cooldowns/RelicOfResilienceOutline.png rename to Cooldowns/RelicOfResilienceCooldownOutline.png diff --git a/Cooldowns/RelicOfResilienceOverlay.png b/Cooldowns/RelicOfResilienceCooldownOverlay.png similarity index 100% rename from Cooldowns/RelicOfResilienceOverlay.png rename to Cooldowns/RelicOfResilienceCooldownOverlay.png diff --git a/Cooldowns/WarbanneroftheRighteousBuff.cs b/Cooldowns/WarbanneroftheRighteousBuff.cs new file mode 100644 index 0000000000..78ddea9b66 --- /dev/null +++ b/Cooldowns/WarbanneroftheRighteousBuff.cs @@ -0,0 +1,49 @@ +using System; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.Localization; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Cooldowns +{ + public class WarbanneroftheRighteousBuff : CooldownHandler + { + public float CompletionPercentage => Utils.GetLerpValue(80, 0, instance.timeLeft); + private bool IsEmpty => CompletionPercentage == 0; + private float TextXOffset => (instance.timeLeft <= 20 ? -11 : -18f); + private Vector2 TextPosition => new(TextXOffset, 15); + private Color TextColor => Color.White; + private Color TextBorderColor => Color.Black; + + public static new string ID => "WarbanneroftheRighteousBuff"; + public override bool CanTickDown => false; + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + public override bool ShouldDisplay => instance.player.Calamity().WarbanneroftheRighteous; + public override string Texture => "CalamityMod/Cooldowns/" + ID; + + public override Color CooldownStartColor => IsEmpty ? Color.DimGray : Color.Lerp(Color.SlateGray, Color.DarkGoldenrod, CompletionPercentage); + public override Color CooldownEndColor => IsEmpty ? Color.DimGray : Color.Lerp(Color.SlateGray, Color.Gold, CompletionPercentage); + + public override void DrawExpanded(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + base.DrawExpanded(spriteBatch, position, opacity, scale); + + CalamityUtils.DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, (-instance.timeLeft + 20).ToString() + "%", position + TextPosition, TextColor, TextBorderColor); + } + + public override void DrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + base.DrawCompact(spriteBatch, position, opacity, scale); + + CalamityUtils.DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, (-instance.timeLeft + 20).ToString() + "%", position + TextPosition, TextColor, TextBorderColor); + } + } +} diff --git a/Cooldowns/WarbanneroftheRighteousBuff.png b/Cooldowns/WarbanneroftheRighteousBuff.png new file mode 100644 index 0000000000..66ada2beb1 Binary files /dev/null and b/Cooldowns/WarbanneroftheRighteousBuff.png differ diff --git a/Cooldowns/WarbanneroftheRighteousBuffOutline.png b/Cooldowns/WarbanneroftheRighteousBuffOutline.png new file mode 100644 index 0000000000..5549f1b6fb Binary files /dev/null and b/Cooldowns/WarbanneroftheRighteousBuffOutline.png differ diff --git a/Cooldowns/WarbanneroftheRighteousBuffOverlay.png b/Cooldowns/WarbanneroftheRighteousBuffOverlay.png new file mode 100644 index 0000000000..9d47c29f53 Binary files /dev/null and b/Cooldowns/WarbanneroftheRighteousBuffOverlay.png differ diff --git a/DataStructures/Attunement.cs b/DataStructures/Attunement.cs index 10d2bf28a6..28ae08e39d 100644 --- a/DataStructures/Attunement.cs +++ b/DataStructures/Attunement.cs @@ -495,6 +495,8 @@ namespace CalamityMod.DataStructures { SoundEngine.PlaySound(SoundID.Item78); int damage = (int)player.GetTotalDamage().ApplyTo(OmegaBiomeBlade.WhirlwindAttunement_PassiveBaseDamage); + + // 14NOV2024: Ozzatron: clamped mouse world unnecessary here, just used for direction Projectile beamSword = Projectile.NewProjectileDirect(source, player.Center, player.SafeDirectionTo(Main.MouseWorld, Vector2.One) * 15f, ProjectileType(), damage, 10f, player.whoAmI, 1f); beamSword.timeLeft = 50; UseTimer++; @@ -638,7 +640,7 @@ namespace CalamityMod.DataStructures if (UseTimer % 500 == 449) { SoundEngine.PlaySound(SoundID.Item78); - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, 1f); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, 1f); UseTimer++; } } @@ -672,7 +674,7 @@ namespace CalamityMod.DataStructures if (UseTimer % 500 == 449) { SoundEngine.PlaySound(SoundID.Item78); - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, 1f); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, 1f); UseTimer++; } } diff --git a/Projectiles/Rogue/ExplosiveSun.png b/ExtraTextures/ExplosiveSun.png similarity index 100% rename from Projectiles/Rogue/ExplosiveSun.png rename to ExtraTextures/ExplosiveSun.png diff --git a/Projectiles/Rogue/ExplosiveSun2.png b/ExtraTextures/ExplosiveSun2.png similarity index 100% rename from Projectiles/Rogue/ExplosiveSun2.png rename to ExtraTextures/ExplosiveSun2.png diff --git a/Projectiles/Rogue/ExplosiveSun3.png b/ExtraTextures/ExplosiveSun3.png similarity index 100% rename from Projectiles/Rogue/ExplosiveSun3.png rename to ExtraTextures/ExplosiveSun3.png diff --git a/ExtraTextures/ExtraTextureRefs.cs b/ExtraTextures/ExtraTextureRefs.cs index aaf5d76299..dd5c2d46a8 100644 --- a/ExtraTextures/ExtraTextureRefs.cs +++ b/ExtraTextures/ExtraTextureRefs.cs @@ -38,6 +38,12 @@ namespace CalamityMod.ExtraTextures public static Asset LuckIconVanilla; public static Asset LuckIconLesser; + // Particles + public static Asset CircularSmear; + public static Asset CircularSmearFire1; + public static Asset CircularSmearFire2; + public static Asset CircularSmearFire3; + // Boss Heads // I know it's not exactly a Texture2D but it belongs to ExtraTextures. public static int BossHeadIndex_ChadPrime; @@ -70,6 +76,11 @@ namespace CalamityMod.ExtraTextures LuckIconGreater = ModContent.Request("CalamityMod/ExtraTextures/VanillaBuffs/LuckyGreater", AssetRequestMode.AsyncLoad); LuckIconVanilla = TextureAssets.Buff[BuffID.Lucky]; LuckIconLesser = ModContent.Request("CalamityMod/ExtraTextures/VanillaBuffs/LuckyLesser", AssetRequestMode.AsyncLoad); + + CircularSmear = ModContent.Request("CalamityMod/Particles/CircularSmear", AssetRequestMode.AsyncLoad); + CircularSmearFire1 = ModContent.Request("CalamityMod/Particles/CircularSmearFire1", AssetRequestMode.AsyncLoad); + CircularSmearFire2 = ModContent.Request("CalamityMod/Particles/CircularSmearFire2", AssetRequestMode.AsyncLoad); + CircularSmearFire3 = ModContent.Request("CalamityMod/Particles/CircularSmearFire3", AssetRequestMode.AsyncLoad); } public override void Unload() diff --git a/ExtraTextures/Lasers/FancyBeamEnd.png b/ExtraTextures/Lasers/FancyBeamEnd.png new file mode 100644 index 0000000000..22e2bd4835 Binary files /dev/null and b/ExtraTextures/Lasers/FancyBeamEnd.png differ diff --git a/ExtraTextures/Lasers/FancyBeamMiddle.png b/ExtraTextures/Lasers/FancyBeamMiddle.png new file mode 100644 index 0000000000..f04936e41d Binary files /dev/null and b/ExtraTextures/Lasers/FancyBeamMiddle.png differ diff --git a/ExtraTextures/Lasers/FancyBeamStart.png b/ExtraTextures/Lasers/FancyBeamStart.png new file mode 100644 index 0000000000..7e60c6f086 Binary files /dev/null and b/ExtraTextures/Lasers/FancyBeamStart.png differ diff --git a/ExtraTextures/Lasers/ProvidenceHolyRayStart.png b/ExtraTextures/Lasers/ProvidenceHolyRayStart.png new file mode 100644 index 0000000000..efbc766d6c Binary files /dev/null and b/ExtraTextures/Lasers/ProvidenceHolyRayStart.png differ diff --git a/Graphics/Renderers/RendererManager.cs b/Graphics/Renderers/RendererManager.cs index f66fa9d444..3316d1e63e 100644 --- a/Graphics/Renderers/RendererManager.cs +++ b/Graphics/Renderers/RendererManager.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -118,7 +117,7 @@ namespace CalamityMod.Graphics.Renderers var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.NPC); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise); foreach (var renderer in renderers) renderer.DrawTarget(Main.spriteBatch); @@ -132,7 +131,7 @@ namespace CalamityMod.Graphics.Renderers var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.Projectile); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise); foreach (var renderer in renderers) renderer.DrawTarget(Main.spriteBatch); @@ -146,7 +145,7 @@ namespace CalamityMod.Graphics.Renderers var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.Player); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise); foreach (var renderer in renderers) renderer.DrawTarget(Main.spriteBatch); @@ -159,13 +158,13 @@ namespace CalamityMod.Graphics.Renderers var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.BeforeTiles); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise); foreach (var renderer in renderers) renderer.DrawTarget(Main.spriteBatch); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.Transform); orig(self); } @@ -175,12 +174,12 @@ namespace CalamityMod.Graphics.Renderers var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.AfterEverything); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise); foreach (var renderer in renderers) renderer.DrawTarget(Main.spriteBatch); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.Transform); orig(self); } #endregion diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index e40c1c10e1..962e20cadf 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -181,6 +181,7 @@ namespace CalamityMod.ILEditing IL_WorldGen.Chlorophyte += AdjustChlorophyteSpawnLimits; IL_UIWorldCreation.SetDefaultOptions += ChangeDefaultWorldSize; IL_UIWorldCreation.AddWorldSizeOptions += SwapSmallDescriptionKey; + IL_UIWorldCreation.AddWorldDifficultyOptions += SwapMasterModeDescriptionKey; Terraria.IO.On_WorldFile.ClearTempTiles += ClearModdedTempTiles; On_WorldGen.MakeDungeon += LimitDungeonEntranceXPosition; IL_WorldGen.DungeonHalls += LimitDungeonHallsXPosition; diff --git a/ILEditing/WorldgenILChanges.cs b/ILEditing/WorldgenILChanges.cs index 2347363be0..b6ca1da325 100644 --- a/ILEditing/WorldgenILChanges.cs +++ b/ILEditing/WorldgenILChanges.cs @@ -161,7 +161,7 @@ namespace CalamityMod.ILEditing } #endregion - #region Change Small World Description + #region Change World Generation Descriptions /// /// Changes the description of Small worlds to serve as a warning. /// @@ -181,6 +181,28 @@ namespace CalamityMod.ILEditing // Emit our new string "Mods.CalamityMod.UI.SmallWorldWarning". c.Emit(OpCodes.Ldstr, "Mods.CalamityMod.UI.SmallWorldWarning"); + + + } + + /// + /// Changes the description of Master Mode to mention boss changes. + /// + private static void SwapMasterModeDescriptionKey(ILContext il) + { + // Swap vanilla's Master Mode description string (UI.WorldDescriptionMaster) with Calamity's edited version (Mods.CalamityMod.UI.WorldMaster). + var cursor = new ILCursor(il); + + // Move to after the string. + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdstr("UI.WorldDescriptionMaster"))) + { + LogFailure("Change Master Mode Description", "Could not match string \"UI.WorldDescriptionMaster\"."); + return; + } + + // Pop this value off, then replace it with Calamity's new string. + cursor.EmitPop(); + cursor.Emit(OpCodes.Ldstr, "Mods.CalamityMod.UI.WorldMaster"); } #endregion diff --git a/Items/Accessories/AbyssalMirror.cs b/Items/Accessories/AbyssalMirror.cs index 273064f9ef..40e9b7a0eb 100644 --- a/Items/Accessories/AbyssalMirror.cs +++ b/Items/Accessories/AbyssalMirror.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Items.Accessories public class AbyssalMirror : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Accessories"; + public bool HasFlavorTooltip => true; public override void SetDefaults() { Item.width = 30; diff --git a/Items/Accessories/ArcFlashRing.cs b/Items/Accessories/ArcFlashRing.cs new file mode 100644 index 0000000000..836b76e310 --- /dev/null +++ b/Items/Accessories/ArcFlashRing.cs @@ -0,0 +1,31 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Rarities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class ArcFlashRing : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + public override void SetDefaults() + { + Item.width = 32; + Item.height = 34; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = ModContent.RarityType(); + Item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.arcFlashRing = true; + if (!hideVisual) + modPlayer.arcFlashRingVisual = true; + else + modPlayer.arcFlashRingVisual = false; + } + } +} diff --git a/Items/Accessories/ArcFlashRing.png b/Items/Accessories/ArcFlashRing.png new file mode 100644 index 0000000000..f139949dbb Binary files /dev/null and b/Items/Accessories/ArcFlashRing.png differ diff --git a/Items/Accessories/AscendantInsignia.cs b/Items/Accessories/AscendantInsignia.cs index b1511b89a9..e13bb27c68 100644 --- a/Items/Accessories/AscendantInsignia.cs +++ b/Items/Accessories/AscendantInsignia.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(ItemID.EmpressFlightBooster). AddIngredient(5). - AddIngredient(5). + AddIngredient(5). AddIngredient(ItemID.SoulofFlight, 10). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Accessories/FlameLickedShell.cs b/Items/Accessories/FlameLickedShell.cs index b61c986c6b..4637cba6cc 100644 --- a/Items/Accessories/FlameLickedShell.cs +++ b/Items/Accessories/FlameLickedShell.cs @@ -40,6 +40,7 @@ namespace CalamityMod.Items.Accessories var empowered = calPlayer.flameLickedShellEmpoweredParry; NPC target = player.Center.ClosestNPCAt(1300f, true, true); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 targetPosition = target?.Center ?? Main.MouseWorld; float projectileSpeed = 8f; diff --git a/Items/Accessories/ProfanedSoulCrystal.cs b/Items/Accessories/ProfanedSoulCrystal.cs index 2bdc73d997..85149a4964 100644 --- a/Items/Accessories/ProfanedSoulCrystal.cs +++ b/Items/Accessories/ProfanedSoulCrystal.cs @@ -247,7 +247,8 @@ namespace CalamityMod.Items.Accessories modPlayer.profanedCrystalAnim = maxPscAnimTime; Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); } - + if (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs) + player.Calamity().profanedSoulRelicBuff = true; modPlayer.profanedCrystalHide = hideVisual || modPlayer.profanedCrystalAnim > 0; modPlayer.pSoulShieldVisible = !hideVisual; @@ -291,6 +292,8 @@ namespace CalamityMod.Items.Accessories player.Calamity().profanedSoulWeaponType = weaponType; player.Calamity().profanedSoulWeaponUsage = 0; } + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 correctedVelocity = Main.MouseWorld - player.Center; correctedVelocity.Normalize(); bool empowered = player.Calamity().pscState == (int)ProfanedSoulCrystalState.Empowered; diff --git a/Items/Accessories/WarbanneroftheRighteous.cs b/Items/Accessories/WarbanneroftheRighteous.cs new file mode 100644 index 0000000000..cfc15ce1ec --- /dev/null +++ b/Items/Accessories/WarbanneroftheRighteous.cs @@ -0,0 +1,150 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; +using CalamityMod.Cooldowns; +using CalamityMod.NPCs; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Mono.Cecil; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Items.Accessories +{ + [AutoloadEquip(EquipType.Balloon)] + [LegacyName("SamuraiBadge")] + [LegacyName("WarbanneroftheSun")] + public class WarbanneroftheRighteous : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + internal const float MaxBonus = 0.8f; + internal const float MaxDistance = 350f; + + public override void SetStaticDefaults() + { + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 5)); + ItemID.Sets.AnimatesAsSoul[Type] = true; + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 78; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; + Item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.WarbanneroftheRighteous = true; + + modPlayer.warbannerGlow = !hideVisual; + + if (player.ownedProjectileCounts[ProjectileType()] < 1 && !hideVisual && !player.dead) + { + Projectile light = Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.Center, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI); + } + + int maxValue = (int)(MaxBonus * 100); + float bonus = CalculateBonus(player) - 0.6f; + float displayBonus = (int)((bonus + 0.6f) * 100); // Should range from 0 to the maxValue + + if (player.Calamity().cooldowns.TryGetValue(WarbanneroftheRighteousBuff.ID, out var cooldown)) + { + cooldown.timeLeft = maxValue - (int)displayBonus; + } + else + { + player.AddCooldown(WarbanneroftheRighteousBuff.ID, maxValue); + } + + if (bonus > 0) + player.GetDamage() += bonus; + else + player.GetDamage() += bonus; + + int targetCount = 0; + foreach (NPC npc in Main.ActiveNPCs) // More targets gradually reduces the burn damage for ALL targets + { + if (npc.Calamity().warbannerBurnMarked) + targetCount++; + } + for (int index = 0; index < Main.npc.Length; index++) + { + NPC nPC = Main.npc[index]; + float generousHitboxWidth = Math.Max(nPC.Hitbox.Width / 2f, nPC.Hitbox.Height / 2f) + (100 + 80 * Utils.GetLerpValue(0, 200, Math.Max(nPC.Hitbox.Width / 2f, nPC.Hitbox.Height / 2f))); // Adds some room so max bonus isnt when you're ON the hitbox + float intensity = Utils.Remap(Utils.Distance(player.Center, nPC.Center), MaxDistance + generousHitboxWidth, generousHitboxWidth, 1, 3, true); // We have to have this seperate from bonus, otherwise all effected enemies take damage based on the closest enemy + + if (Utils.Distance(nPC.Center, player.Center) < MaxDistance + generousHitboxWidth && (nPC.IsAnEnemy(true, true, false) || nPC.type == ModContent.NPCType()) && nPC.CanBeChasedBy()) + { + float minDamageMult = 0.35f; + int maxTargets = 25; + float damageMult = Utils.Remap(targetCount, maxTargets, 1, minDamageMult, 1); + + // Handles giving the Warbanner Burn effect + CalamityGlobalNPC modNPC = nPC.Calamity(); + if (!modNPC.warbannerBurnMarked) + { + modNPC.warbannerBurnDirection = Utils.DirectionTo(player.Center, nPC.Center); + modNPC.warbannerBurnMarked = true; + modNPC.warbannerBurnTimer = 2; + } + if (modNPC.warbannerBurnMarked) + { + modNPC.warbannerBurnIntensity = intensity; + modNPC.warbannerBurnDirection = Utils.DirectionTo(player.Center, nPC.Center); + int burnDamage = (int)player.GetBestClassDamage().ApplyTo(47 * damageMult); // There is up to a 3x multiplier on this damage depending on distance from the enemy + modNPC.warbannerBurnDamage = burnDamage; + modNPC.warbannerBurnStacks++; + modNPC.warbannerBurnTimer++; + modNPC.warbannerBurnHideEffects = hideVisual; + } + } + } + } + + private static float CalculateBonus(Player player) + { + float bonus = 0f; + + NPC closestTarget = player.Center.ClosestNPCAt(MaxDistance * 7); // extra range is to account for bonus range from massive targets + if (closestTarget != null) + { + float generousHitboxWidth = Math.Max(closestTarget.Hitbox.Width / 2f, closestTarget.Hitbox.Height / 2f) + (100 + 80 * Utils.GetLerpValue(0, 200, Math.Max(closestTarget.Hitbox.Width / 2f, closestTarget.Hitbox.Height / 2f))); // Adds some room so max bonus isnt when you're ON the hitbox + bonus = Utils.Remap(Utils.Distance(player.Center, closestTarget.Center), MaxDistance + generousHitboxWidth, generousHitboxWidth, 0, MaxBonus, true); + } + else + bonus = 0; + + return bonus; + } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.6f, + drawOffset: new(0f, -2f) + ); + return false; + } + } +} diff --git a/Items/Accessories/WarbanneroftheSun.png b/Items/Accessories/WarbanneroftheRighteous.png similarity index 100% rename from Items/Accessories/WarbanneroftheSun.png rename to Items/Accessories/WarbanneroftheRighteous.png diff --git a/Items/Accessories/WarbanneroftheSun_Balloon.png b/Items/Accessories/WarbanneroftheRighteous_Balloon.png similarity index 100% rename from Items/Accessories/WarbanneroftheSun_Balloon.png rename to Items/Accessories/WarbanneroftheRighteous_Balloon.png diff --git a/Items/Accessories/WarbanneroftheSun.cs b/Items/Accessories/WarbanneroftheSun.cs deleted file mode 100644 index ff2003d17f..0000000000 --- a/Items/Accessories/WarbanneroftheSun.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.DataStructures; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Accessories -{ - [AutoloadEquip(EquipType.Balloon)] - [LegacyName("SamuraiBadge")] - public class WarbanneroftheSun : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Accessories"; - internal const float MaxBonus = 0.2f; - internal const float MaxDistance = 480f; - - public override void SetStaticDefaults() - { - Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 5)); - ItemID.Sets.AnimatesAsSoul[Type] = true; - } - - public override void SetDefaults() - { - Item.width = 32; - Item.height = 78; - Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; - Item.rare = ItemRarityID.Purple; - Item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.warbannerOfTheSun = true; - - float bonus = CalculateBonus(player); - player.GetAttackSpeed() += bonus; - player.GetDamage() += bonus; - player.GetDamage() += bonus; - } - - private static float CalculateBonus(Player player) - { - float bonus = 0f; - - int closestNPC = -1; - foreach (NPC nPC in Main.ActiveNPCs) - { - if (nPC.IsAnEnemy() && !nPC.dontTakeDamage) - { - closestNPC = nPC.whoAmI; - break; - } - } - float distance = -1f; - foreach (NPC nPC in Main.ActiveNPCs) - { - if (nPC.IsAnEnemy() && !nPC.dontTakeDamage) - { - float distance2 = Math.Abs(nPC.position.X + (float)(nPC.width / 2) - (player.position.X + (float)(player.width / 2))) + Math.Abs(nPC.position.Y + (float)(nPC.height / 2) - (player.position.Y + (float)(player.height / 2))); - if (distance == -1f || distance2 < distance) - { - distance = distance2; - closestNPC = nPC.whoAmI; - } - } - } - - if (closestNPC != -1) - { - NPC actualClosestNPC = Main.npc[closestNPC]; - - float generousHitboxWidth = Math.Max(actualClosestNPC.Hitbox.Width / 2f, actualClosestNPC.Hitbox.Height / 2f); - float hitboxEdgeDist = actualClosestNPC.Distance(player.Center) - generousHitboxWidth; - - if (hitboxEdgeDist < 0) - hitboxEdgeDist = 0; - - if (hitboxEdgeDist < MaxDistance) - { - bonus = MathHelper.Lerp(0f, MaxBonus, 1f - (hitboxEdgeDist / MaxDistance)); - - if (bonus > MaxBonus) - bonus = MaxBonus; - } - } - - return bonus; - } - - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) - { - CalamityUtils.DrawInventoryCustomScale( - spriteBatch, - texture: TextureAssets.Item[Type].Value, - position, - frame, - drawColor, - itemColor, - origin, - scale, - wantedScale: 0.6f, - drawOffset: new(0f, -2f) - ); - return false; - } - } -} diff --git a/Items/Accessories/Wings/ElysianWings.cs b/Items/Accessories/Wings/ElysianWings.cs index 11f81e5059..a1cace6d28 100644 --- a/Items/Accessories/Wings/ElysianWings.cs +++ b/Items/Accessories/Wings/ElysianWings.cs @@ -1,5 +1,9 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Accessories.Vanity; +using CalamityMod.Particles; using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -25,14 +29,68 @@ namespace CalamityMod.Items.Accessories.Wings Item.rare = ModContent.RarityType(); Item.accessory = true; } - + public override void UpdateVanity(Player player) + { + DrawWingEffects(player); + } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); player.moveSpeed += 0.1f; player.lavaImmune = true; player.noFallDmg = true; - modPlayer.elysianWingsDust = !hideVisual; + modPlayer.elysianWingsDust = false; + + if (!hideVisual) + DrawWingEffects(player); + } + private void DrawWingEffects(Player player) + { + float rate = Main.GlobalTimeWrappedHourly * 2; + List eColors = new List() + { + Color.Gold, + Color.Khaki + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + + Vector2 spawnPos = player.Center + new Vector2(-25 * player.direction, 0); + Lighting.AddLight(spawnPos, usedColor.ToVector3() * 1.2f); + + if (player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f) + { + spawnPos = player.Center + new Vector2(-25 * player.direction, 0) + Main.rand.NextVector2Circular(20, 20); + Vector2 spawnPos2 = player.Center + new Vector2(15 * player.direction, 0) + Main.rand.NextVector2Circular(20, 20); + + float partScale = Main.rand.NextFloat(0.3f, 0.8f); + Vector2 partVel = new Vector2(0, 5).RotatedBy(0.5f * player.direction).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.5f, 0.8f); + + Particle smoke = new CustomSpark(spawnPos, partVel, "CalamityMod/Particles/SmallBloom", false, 13, partScale * 0.25f, usedColor * 0.4f, Vector2.One, true, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(smoke); + + if (Main.rand.NextBool((player.controlJump ? 2 : 4))) + { + Particle spark3 = new CustomSpark(spawnPos, partVel, "CalamityMod/Particles/ProvidenceMarkParticle", false, 19, partScale, Main.rand.NextBool(4) ? Color.Khaki : Color.Goldenrod, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); + GeneralParticleHandler.SpawnParticle(spark3); + } + + if (Main.rand.NextBool()) + { + Particle smoke2 = new CustomSpark(spawnPos2, partVel, "CalamityMod/Particles/SmallBloom", false, 13, partScale * 0.15f, usedColor * 0.4f, Vector2.One, true, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(smoke2); + if (Main.rand.NextBool((player.controlJump ? 2 : 4))) + { + Particle spark3 = new CustomSpark(spawnPos2, partVel, "CalamityMod/Particles/ProvidenceMarkParticle", false, 19, partScale * 0.7f, Main.rand.NextBool(4) ? Color.Khaki : Color.Goldenrod, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); + GeneralParticleHandler.SpawnParticle(spark3); + } + } + + } } public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) diff --git a/Items/Accessories/Wings/ElysianWingsGlow.png b/Items/Accessories/Wings/ElysianWingsGlow.png new file mode 100644 index 0000000000..61f5a48d4c Binary files /dev/null and b/Items/Accessories/Wings/ElysianWingsGlow.png differ diff --git a/Items/Accessories/Wings/ElysianWings_WingsGlow.png b/Items/Accessories/Wings/ElysianWings_WingsGlow.png new file mode 100644 index 0000000000..5333a8518a Binary files /dev/null and b/Items/Accessories/Wings/ElysianWings_WingsGlow.png differ diff --git a/Items/Accessories/WulfrumAcrobaticsPack.cs b/Items/Accessories/WulfrumAcrobaticsPack.cs index 78fc5d2339..9bd60529f1 100644 --- a/Items/Accessories/WulfrumAcrobaticsPack.cs +++ b/Items/Accessories/WulfrumAcrobaticsPack.cs @@ -425,6 +425,7 @@ namespace CalamityMod.Items.Accessories SoundEngine.PlaySound(WulfrumAcrobaticsPack.ShootSound, Player.Center); if (Player.whoAmI == Main.myPlayer) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 velocity = (Main.MouseWorld - Player.Center).SafeNormalize(Vector2.One) * GrappleVelocity; Projectile.NewProjectile(Player.GetSource_ItemUse(PackItem), Player.Center, velocity, ProjectileType(), 0, 0, Player.whoAmI); diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs b/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs index 14b8cc7a60..67b16fb6b9 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs @@ -44,7 +44,6 @@ namespace CalamityMod.Items.Armor.Hydrothermic public override void UpdateEquip(Player player) { - player.Calamity().rogueAmmoCost *= 0.5f; player.GetDamage() += 0.12f; player.GetCritChance() += 10; player.moveSpeed += 0.05f; diff --git a/Items/Armor/Statigel/StatigelHeadRogue.cs b/Items/Armor/Statigel/StatigelHeadRogue.cs index b53f7d2db3..fab0c20533 100644 --- a/Items/Armor/Statigel/StatigelHeadRogue.cs +++ b/Items/Armor/Statigel/StatigelHeadRogue.cs @@ -40,7 +40,6 @@ namespace CalamityMod.Items.Armor.Statigel public override void UpdateEquip(Player player) { - player.Calamity().rogueAmmoCost *= 0.66f; player.GetDamage() += 0.1f; player.GetCritChance() += 7; player.moveSpeed += 0.05f; diff --git a/Items/Armor/Tarragon/TarragonHeadMelee.cs b/Items/Armor/Tarragon/TarragonHeadMelee.cs index 435fc4eb27..94f2ae5883 100644 --- a/Items/Armor/Tarragon/TarragonHeadMelee.cs +++ b/Items/Armor/Tarragon/TarragonHeadMelee.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Armor.Tarragon public override void UpdateEquip(Player player) { player.GetDamage() += 0.12f; - player.GetCritChance() += 10; + player.GetCritChance() += 7; player.endurance += 0.1f; } diff --git a/Items/Armor/TitanHeart/TitanHeartMantle.cs b/Items/Armor/TitanHeart/TitanHeartMantle.cs index 25c7e691f8..f52d439894 100644 --- a/Items/Armor/TitanHeart/TitanHeartMantle.cs +++ b/Items/Armor/TitanHeart/TitanHeartMantle.cs @@ -34,7 +34,6 @@ namespace CalamityMod.Items.Armor.TitanHeart public override void UpdateEquip(Player player) { player.Calamity().titanHeartMantle = true; - player.Calamity().rogueAmmoCost *= 0.55f; // 15% attack speed penalty player.GetAttackSpeed() -= 0.15f; } diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 277af101c4..bc2f5b1e1c 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -263,12 +263,14 @@ namespace CalamityMod.Items { CalamityPlayer modPlayer = player.Calamity(); var playerSource = player.GetSource_FromThis(); + Vector2 mouse = player.ClampedMouseWorld(); + if (Main.myPlayer == player.whoAmI && player.Calamity().cursedSummonsEnchant) { if (NPC.CountNPCS(ModContent.NPCType()) < 2) { - CalamityNetcode.NewNPC_ClientSide(Main.MouseWorld, ModContent.NPCType(), player); - SoundEngine.PlaySound(SoundID.DD2_DarkMageSummonSkeleton, Main.MouseWorld); + CalamityNetcode.NewNPC_ClientSide(mouse, ModContent.NPCType(), player); + SoundEngine.PlaySound(SoundID.DD2_DarkMageSummonSkeleton, mouse); } } @@ -287,7 +289,7 @@ namespace CalamityMod.Items int monsterDamage = (int)player.GetTotalDamage().ApplyTo(remainingMana * damagePerManaConsumed); // Spawn the Mana Monster - Vector2 shootVelocity = player.SafeDirectionTo(Main.MouseWorld, -Vector2.UnitY).RotatedByRandom(0.07f) * Main.rand.NextFloat(4f, 5f); + Vector2 shootVelocity = player.SafeDirectionTo(mouse, -Vector2.UnitY).RotatedByRandom(0.07f) * Main.rand.NextFloat(4f, 5f); Projectile.NewProjectile(source, player.Center + shootVelocity, shootVelocity, ModContent.ProjectileType(), monsterDamage, 0f, player.whoAmI); // Set the player's mana to zero. @@ -694,6 +696,7 @@ namespace CalamityMod.Items if (p.type == ModContent.ProjectileType() && p.owner == player.whoAmI && p.localAI[1] == 0f) { p.rotation = MathHelper.PiOver2 + MathHelper.PiOver4; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction p.velocity = p.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY) * 22f; p.rotation += p.velocity.ToRotation(); p.ai[0] = 180f; @@ -742,7 +745,8 @@ namespace CalamityMod.Items } if (canContinue && count > 0) { - NPC unluckyTarget = CalamityUtils.MinionHoming(Main.MouseWorld, 1000f, player); + Vector2 mouse = player.ClampedMouseWorld(); + NPC unluckyTarget = CalamityUtils.MinionHoming(mouse, 1000f, player); if (unluckyTarget != null) { int pointyThingyAmount = count; @@ -755,7 +759,7 @@ namespace CalamityMod.Items if (Main.projectile.Length == Main.maxProjectiles) break; int GlacialEmbraceDamage = (int)player.GetTotalDamage().ApplyTo(80); - int projj = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), GlacialEmbraceDamage, 1f, player.whoAmI, angle, 2f); + int projj = Projectile.NewProjectile(source, mouse, Vector2.Zero, ModContent.ProjectileType(), GlacialEmbraceDamage, 1f, player.whoAmI, angle, 2f); Main.projectile[projj].originalDamage = 80; angle += angleVariance; diff --git a/Items/CalamityGlobalItemLoot.cs b/Items/CalamityGlobalItemLoot.cs index 2df054f082..ae6727df34 100644 --- a/Items/CalamityGlobalItemLoot.cs +++ b/Items/CalamityGlobalItemLoot.cs @@ -91,12 +91,12 @@ namespace CalamityMod.Items { ItemID.BeeKeeper, ItemID.BeesKnees, - ItemID.BeeGun + ItemID.BeeGun, + ModContent.ItemType(), }; loot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, queenBeeWeapons)); loot.Add(ModContent.ItemType(), 10); // 10% The Bee loot.Add(ItemID.Stinger, 1, 8, 12); // 100% 8-12 Stinger - loot.Add(ModContent.ItemType(), 1, 50, 75); // 100% 50-75 Hardened Honeycomb loot.AddRevBagAccessories(); loot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); break; diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 6a103cb6b9..7363fc83d0 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -16,6 +16,7 @@ using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Prefixes; using CalamityMod.World; +using Humanizer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; @@ -1127,27 +1128,25 @@ namespace CalamityMod.Items // This function produces a "stat sheet" for a pair of wings from the raw stats. // For "vertical speed", 0 = Bad, 1 = Average, 2 = Good, 3 = Great, 4 = Excellent. - string[] vertSpeedStrings = new string[] { "Bad vertical speed", "Average vertical speed", "Good vertical speed", "Great vertical speed", "Excellent vertical speed" }; + string[] vertSpeedStrings = new string[] { "VertSpeedQuality1", "VertSpeedQuality2", "VertSpeedQuality3", "VertSpeedQuality4", "VertSpeedQuality5" }; string WingStatsTooltip(float hSpeed, float accelMult, int vertSpeed, int flightTime, string extraTooltip = null) { StringBuilder sb = new StringBuilder(512); sb.Append('\n'); - sb.Append($"Horizontal speed: {hSpeed:N2}\n"); - sb.Append($"Acceleration multiplier: {accelMult:N1}\n"); - sb.Append(vertSpeedStrings[vertSpeed]); - sb.Append('\n'); - sb.Append($"Flight time: {flightTime}"); + sb.Append(CalamityUtils.GetText($"Misc.HorizSpeed").Format(hSpeed.ToString("N2")) + $"\n"); + sb.Append(CalamityUtils.GetText($"Misc.AccelMult").Format(accelMult.ToString("N1")) + $"\n"); + sb.Append(CalamityUtils.GetText($"Misc.{vertSpeedStrings[vertSpeed]}") + $"\n"); + sb.Append(CalamityUtils.GetText($"Misc.FlightTime").Format(flightTime.ToString())); if (extraTooltip != null) { sb.Append('\n'); - sb.Append(extraTooltip); + sb.Append(CalamityUtils.GetTextValue($"Vanilla.Wings.{extraTooltip}")); } return sb.ToString(); } // This function is shorthand for appending a stat sheet to a pair of wings. void AddWingStats(float h, float a, int v, int f, string s = null) => EditTooltipByNum(0, (line) => line.Text += WingStatsTooltip(h, a, v, f, s)); - void AddWingStats2(float h, float a, int v, int f, string s = null, string lineName = null) => EditTooltipByName(lineName, (line) => line.Text += WingStatsTooltip(h, a, v, f, s)); if (item.type == ItemID.CreativeWings) AddWingStats(3f, 1f, 0, 25); @@ -1162,26 +1161,25 @@ namespace CalamityMod.Items AddWingStats(6.5f, 1f, 1, 150); if (item.type == ItemID.ButterflyWings) - AddWingStats(7.5f, 1f, 1, 160, "Increases mana regeneration rate"); + AddWingStats(7.5f, 1f, 1, 160, "ButterflyWings"); if (item.type == ItemID.FairyWings) AddWingStats(6.75f, 1f, 1, 130); if (item.type == ItemID.BeeWings) - AddWingStats(7.5f, 1f, 1, 160, "Permanently gives the Honey buff"); + AddWingStats(7.5f, 1f, 1, 160, "BeeWings"); if (item.type == ItemID.HarpyWings) - AddWingStats(6.75f, 1f, 1, 130, "10% increased movement speed\n" + - "With Harpy Ring or Angel Treads equipped, most attacks sometimes launch feathers"); + AddWingStats(6.75f, 1f, 1, 130, "HarpyWings"); if (item.type == ItemID.BoneWings) - AddWingStats(7.5f, 1f, 1, 240, "Halves flight time when taking a hit"); + AddWingStats(7.5f, 1f, 1, 240, "BoneWings"); if (item.type == ItemID.FlameWings) - AddWingStats(7.5f, 1f, 1, 160, "Multiplies all heat debuff damage by 1.25x"); + AddWingStats(7.5f, 1f, 1, 160, "FlameWings"); if (item.type == ItemID.FrozenWings) - AddWingStats(6.75f, 1f, 1, 130, "Multiplies all cold debuff damage by 1.25x"); + AddWingStats(6.75f, 1f, 1, 130, "FrozenWings"); if (item.type == ItemID.GhostWings) AddWingStats(7.5f, 1f, 1, 170); @@ -1190,8 +1188,7 @@ namespace CalamityMod.Items AddWingStats(7.5f, 1f, 1, 170); if (item.type == ItemID.FinWings) - AddWingStats(6.75f, 1f, 1, 130, "Gills effect and you can move freely through liquids\n" + - "You fall faster while submerged in liquid"); + AddWingStats(6.75f, 1f, 1, 130, "FinWings"); if (item.type == ItemID.FishronWings) AddWingStats(8f, 2f, 2, 180); @@ -1200,10 +1197,10 @@ namespace CalamityMod.Items AddWingStats(7.5f, 1f, 1, 180); if (item.type == ItemID.LeafWings) - AddWingStats(7.5f, 1f, 1, 160, "+10 defense and permanent Dryad's Blessing"); + AddWingStats(7.5f, 1f, 1, 160, "LeafWings"); if (item.type == ItemID.BatWings) - AddWingStats(7.5f, 1f, 1, 160, "Improves vision"); + AddWingStats(7.5f, 1f, 1, 160, "BatWings"); // All developer wings have identical stats and no special effects if (item.type == ItemID.Yoraiz0rWings || item.type == ItemID.JimsWings || item.type == ItemID.SkiphsWings || @@ -1217,7 +1214,7 @@ namespace CalamityMod.Items } if (item.type == ItemID.TatteredFairyWings) - AddWingStats(7.5f, 1f, 1, 180, "You leave a trail of fairy dust as you fly"); + AddWingStats(7.5f, 1f, 1, 180, "TatteredFairyWings"); if (item.type == ItemID.SpookyWings) AddWingStats(7.5f, 1f, 1, 180); @@ -1226,26 +1223,25 @@ namespace CalamityMod.Items AddWingStats(6.5f, 1f, 1, 170); if (item.type == ItemID.FestiveWings) - AddWingStats(7.5f, 1f, 1, 180, "Homing ornaments rain down as you fly"); + AddWingStats(7.5f, 1f, 1, 180, "FestiveWings"); if (item.type == ItemID.MothronWings) AddWingStats(7.5f, 1f, 1, 200); if (item.type == ItemID.WingsSolar) - AddWingStats(9f, 2.5f, 3, 180, "Increases Solar Flare armor's dash velocity by 25%"); + AddWingStats(9f, 2.5f, 3, 180, "WingsSolar"); if (item.type == ItemID.WingsStardust) - AddWingStats(9f, 2.5f, 3, 180, "Greatly increases Stardust armor's stardust guardian damage and attack range"); + AddWingStats(9f, 2.5f, 3, 180, "WingsStardust"); if (item.type == ItemID.WingsVortex) - AddWingStats(6.5f, 1.5f, 2, 180, "Prevents dashes from disabling Vortex armor's stealth ability"); + AddWingStats(6.5f, 1.5f, 2, 180, "WingsVortex"); if (item.type == ItemID.WingsNebula) - AddWingStats(6.5f, 1.5f, 2, 180, "Increases the pickup range of Nebula armor's nebula boosters"); + AddWingStats(6.5f, 1.5f, 2, 180, "WingsNebula"); - // Betsy's Wings (and dev wings) are the only wings without "Allows flight and free fall" if (item.type == ItemID.BetsyWings) - AddWingStats2(6f, 2.5f, 2, 150, null, "Equipable"); + AddWingStats(6f, 2.5f, 2, 150); if (item.type == ItemID.RainbowWings) AddWingStats(7f, 2.5f, 2, 100); diff --git a/Items/Mounts/BUMBLEDOGE.cs b/Items/Mounts/BUMBLEDOGE.cs index 942e640030..e3cd53a261 100644 --- a/Items/Mounts/BUMBLEDOGE.cs +++ b/Items/Mounts/BUMBLEDOGE.cs @@ -81,7 +81,7 @@ namespace CalamityMod.Items.Mounts Vector2 vel = Vector2.UnitY.RotatedByRandom(MathHelper.ToRadians(24f)) * Main.rand.NextFloat(-8f, -6f); int damage = (int)player.GetBestClassDamage().ApplyTo(180); float kb = 1f; - Projectile birb = Projectile.NewProjectileDirect(new EntitySource_Parent(player), pos, vel, ModContent.ProjectileType(), damage, kb, player.whoAmI); + Projectile birb = Projectile.NewProjectileDirect(new EntitySource_Mount(player, Type), pos, vel, ModContent.ProjectileType(), damage, kb, player.whoAmI); if (birb.whoAmI.WithinBounds(Main.maxProjectiles)) { birb.DamageType = DamageClass.Generic; diff --git a/Items/Mounts/ExoArmamentsKit.cs b/Items/Mounts/ExoArmamentsKit.cs new file mode 100644 index 0000000000..fb5967b861 --- /dev/null +++ b/Items/Mounts/ExoArmamentsKit.cs @@ -0,0 +1,24 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Mounts +{ + public class ExoArmamentsKit : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Mounts"; + public override void SetDefaults() + { + Item.width = 50; + Item.height = 44; + Item.useAnimation = Item.useTime = 20; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item94; + Item.noMelee = true; + Item.mountType = ModContent.MountType(); + + Item.value = Item.sellPrice(gold: 5); + Item.master = true; + } + } +} diff --git a/Items/Mounts/ExoArmamentsKit.png b/Items/Mounts/ExoArmamentsKit.png new file mode 100644 index 0000000000..1e8a75fcb1 Binary files /dev/null and b/Items/Mounts/ExoArmamentsKit.png differ diff --git a/Items/Mounts/ExoTank.cs b/Items/Mounts/ExoTank.cs new file mode 100644 index 0000000000..8219d43355 --- /dev/null +++ b/Items/Mounts/ExoTank.cs @@ -0,0 +1,353 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.Mounts; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Mounts +{ + public class ExoTank : ModMount + { + public static int DashDamage = 6000; + + public static int MaxHoverTime = 600; + + public static int MissileDamage = 1000; + public static int MissileAttackRate = 4; + public static int MissileLauncherFrameCount = 8; + public static int MissileReuseDelay = 28; // Total use time = AttackRate * FrameCount + ReuseDelay (AttackRate being the "use animation" for the clockwork weapon) + public static readonly SoundStyle MissileLaunchSound = new("CalamityMod/Sounds/Custom/ExoMechs/ArtemisApolloDash") { Volume = 0.5f }; + + public static int MinigunDamage = 400; + public static int MinigunAttackRate = 4; + public static int MinigunFrameCount = 4; + + public class ExoTankData + { + internal bool Hovering; + internal int HoverTime; + internal int MinigunFrame; + internal int MinigunFrameCounter; + internal float MinigunRotation; + + public ExoTankData() + { + Hovering = false; + HoverTime = MaxHoverTime; + MinigunFrame = 0; + MinigunFrameCounter = 0; + MinigunRotation = 0f; + } + } + + public override void SetStaticDefaults() + { + MountData.spawnDust = DustID.Platinum; + MountData.spawnDustNoGravity = true; + MountData.buff = ModContent.BuffType(); + + // Horizontal movement + MountData.runSpeed = 10f; + MountData.dashSpeed = 22.5f; + MountData.swimSpeed = 10f; + MountData.acceleration = 0.5f; + + // Vertical movement + MountData.fallDamage = 0f; + MountData.jumpHeight = 10; + MountData.jumpSpeed = 12f; + + // Frames and offsets + MountData.totalFrames = 3; + MountData.heightBoost = 80; + int[] array = new int[MountData.totalFrames]; + for (int l = 0; l < array.Length; l++) + array[l] = 76; + + MountData.playerYOffsets = array; + MountData.playerHeadOffset = 80; + MountData.bodyFrame = 3; + MountData.xOffset = 0; + MountData.yOffset = -16; + MountData.standingFrameCount = 1; + MountData.standingFrameDelay = 12; + MountData.standingFrameStart = 0; + MountData.runningFrameCount = 3; + MountData.runningFrameDelay = 24; + MountData.runningFrameStart = 0; + MountData.flyingFrameCount = 0; + MountData.flyingFrameDelay = 0; + MountData.flyingFrameStart = 0; + MountData.inAirFrameCount = 1; + MountData.inAirFrameDelay = MountData.standingFrameDelay; + MountData.inAirFrameStart = 0; + MountData.idleFrameCount = 1; + MountData.idleFrameDelay = MountData.standingFrameDelay; + MountData.idleFrameStart = 0; + MountData.idleFrameLoop = true; + MountData.swimFrameCount = MountData.inAirFrameCount; + MountData.swimFrameDelay = MountData.inAirFrameDelay; + MountData.swimFrameStart = MountData.inAirFrameStart; + if (Main.netMode != NetmodeID.Server) + { + // back (back layer) -> backExtra (gun) -> front (launcher) -> frontExtra (front layer) + MountData.backTextureExtra = ModContent.Request("CalamityMod/Items/Mounts/ExoTank_BackGun"); + MountData.backTextureExtraGlow = ModContent.Request("CalamityMod/Items/Mounts/ExoTank_BackGunGlow"); + MountData.frontTextureGlow = ModContent.Request("CalamityMod/Items/Mounts/ExoTank_FrontGlow"); + MountData.frontTextureExtra = ModContent.Request("CalamityMod/Items/Mounts/ExoTank_FrontLayer"); + MountData.frontTextureExtraGlow = ModContent.Request("CalamityMod/Items/Mounts/ExoTank_FrontLayerGlow"); + MountData.textureWidth = MountData.backTexture.Width(); + MountData.textureHeight = MountData.backTexture.Height(); + } + } + + public override void SetMount(Player player, ref bool skipDust) => player.mount._mountSpecificData = new ExoTankData(); + + public override void Dismount(Player player, ref bool skipDust) + { + foreach (Projectile proj in Main.ActiveProjectiles) + { + if (proj.owner == player.whoAmI && proj.type == ModContent.ProjectileType()) + { + proj.Kill(); + break; + } + } + } + + public override void UpdateEffects(Player player) + { + if (Main.myPlayer == player.whoAmI) + { + Mount tank = player.mount; + var data = (ExoTankData)player.mount._mountSpecificData; + ref float minigunRotation = ref data.MinigunRotation; + + // Find the closest NPC targetable by the tank + float range = 960f; // 60 tiles + int targetNPC = -1; + bool canFireLasers = true; + Vector2 gunPosition = player.Center + Vector2.UnitX * 52f * player.direction - Vector2.UnitY * 10f; + foreach (NPC target in Main.ActiveNPCs) + { + if (!target.CanBeChasedBy(tank)) + continue; + + Vector2 targetDif = target.Center - gunPosition; + float angle = MathF.Abs(targetDif.ToRotation()); + + // The tank has a base sight line of 120 degrees, equal to Toy Tank + // However, the laser cannon can only pivot up to 36 degrees and any further will not fire out lasers + if (player.direction == 1) + { + if (angle > MathHelper.ToRadians(60f)) + continue; + + canFireLasers = angle <= MathHelper.ToRadians(18f); + } + else + { + if (angle < MathHelper.ToRadians(120f)) + continue; + + canFireLasers = angle >= MathHelper.ToRadians(162f); + } + + float distance = targetDif.Length(); + if (distance < range && Collision.CanHitLine(gunPosition, 0, 0, target.position, target.width, target.height)) + { + range = distance; + targetNPC = target.whoAmI; + } + } + + var source = new EntitySource_Mount(player, Type); + + // Release 3 missiles matching the animation frames + if ((int)tank._frameExtraCounter % MissileAttackRate == 0) + { + if (tank._frameExtra > 0 && tank._frameExtra < 4) + { + if (tank._frameExtra == 1) + SoundEngine.PlaySound(MissileLaunchSound, player.Center); + + for (int i = 0; i < 3; i++) + { + Vector2 rocketPos = player.Center - Vector2.UnitX * (60f - 4f * i - 6f * tank._frameExtra) * player.direction - Vector2.UnitY * (72f - 8f * i); + Vector2 rocketVel = (Vector2.UnitX * player.direction).RotatedBy(-MathHelper.PiOver4 * player.direction) * 10f; + int rocketDamage = (int)player.GetBestClassDamage().ApplyTo(MissileDamage); + float rocketKB = 1f; + Projectile.NewProjectile(source, rocketPos, rocketVel, ModContent.ProjectileType(), rocketDamage, rocketKB, player.whoAmI); + } + } + } + + if (targetNPC != -1) + { + tank._aiming = true; + if (!canFireLasers) + { + minigunRotation = 0f; + return; + } + + float idealRotation = (Main.npc[targetNPC].Center - gunPosition).SafeNormalize(Vector2.UnitX * player.direction).ToRotation(); + /* + // Cap the rotation + // EDIT: This looks jarring if you can't fire lasers and the lasers are pointless if they are shot anyway. Re-add if we wanted it to shoot something again + if (!canFireLasers) + idealRotation = (player.direction == 1 ? MathHelper.ToRadians(18f) : MathHelper.ToRadians(162f)) * MathF.Sign(idealRotation); + */ + + minigunRotation = idealRotation + (player.direction == 1 ? 0f : MathHelper.Pi); + + // Fires a bullet on every frame switch + if (data.MinigunFrameCounter % MinigunAttackRate == 0) + { + SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound with { Volume = 0.32f }, player.Center); + + Vector2 bulletPos = player.Center + Vector2.UnitX * 28f * player.direction - Vector2.UnitY * 10f + (idealRotation * (player.direction == 1 ? 1.33f : 1f)).ToRotationVector2() * 38f; + Vector2 bulletVel = (Main.npc[targetNPC].Center - bulletPos).SafeNormalize(Vector2.UnitX * player.direction) * Main.rand.NextFloat(15f, 16f); + int bulletDamage = (int)player.GetBestClassDamage().ApplyTo(MinigunDamage); + float bulletKB = 1f; + Projectile.NewProjectile(source, bulletPos, bulletVel, ModContent.ProjectileType(), bulletDamage, bulletKB, player.whoAmI); + + Vector2 flashPos = bulletPos + bulletVel.SafeNormalize(Vector2.Zero) * 36f * (player.direction == 1 ? 1f : 1.33f); + for (int i = 0; i < 2; i++) + { + Dust dust = Dust.NewDustPerfect(flashPos, DustID.FireworksRGB); + dust.noGravity = true; + dust.noLight = true; + dust.velocity = bulletVel.RotatedByRandom(MathHelper.ToRadians(5f)) * Main.rand.NextFloat(0.5f, 1f); + dust.color = Color.Lerp(Color.OrangeRed, Color.Red, Main.rand.NextFloat(0f, 0.8f)); + dust.scale = Main.rand.NextFloat(0.5f, 0.8f); + } + // Muzzle flash + // This would be attached to the gun but the frame rate is too fast for only one to exist at a time + Projectile.NewProjectile(source, flashPos, bulletVel, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + } + } + else + { + tank._aiming = false; + minigunRotation = 0f; + } + } + } + + public override bool UpdateFrame(Player mountedPlayer, int state, Vector2 velocity) + { + Mount tank = mountedPlayer.mount; + var data = (ExoTankData)tank._mountSpecificData; + + // Hover effect + // If grounded, your hover time is reset to max + ref int hoverTime = ref data.HoverTime; + ref bool hovering = ref data.Hovering; + if (state <= 1) + { + hoverTime = MaxHoverTime; + hovering = false; + } + else + { + if (mountedPlayer.controlJump && mountedPlayer.TryingToHoverDown && hoverTime > 0) + { + var source = new EntitySource_Mount(mountedPlayer, Type); + if (mountedPlayer.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + Projectile.NewProjectile(source, mountedPlayer.Bottom, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, mountedPlayer.whoAmI); + + hoverTime--; + hovering = true; + mountedPlayer.velocity.Y -= 0.4f * mountedPlayer.gravDir; + mountedPlayer.velocity.Y *= 0.9f; + if (MathF.Abs(mountedPlayer.velocity.Y) < 0.05f) + mountedPlayer.velocity.Y = 0.00001f; + } + else + hovering = false; + } + + // Ground dust as you travel (State 1 indicates running on the ground) + if (state == 1 && Math.Abs(velocity.X) > mountedPlayer.mount.RunSpeed) + { + for (int i = 0; i < 2; i++) + { + Dust ground = Dust.NewDustDirect(mountedPlayer.BottomLeft - Vector2.UnitX * 40f, mountedPlayer.width + 80, 6, DustID.Platinum); + ground.velocity = new Vector2(velocity.X * 0.15f, Main.rand.NextFloat(-2f, 0f)); + ground.noLight = true; + ground.scale = Main.rand.NextFloat(0.2f, 0.8f); + ground.fadeIn = Main.rand.NextFloat(1f, 1.5f); + ground.shader = GameShaders.Armor.GetSecondaryShader(mountedPlayer.cMount, mountedPlayer); + } + if (mountedPlayer.cMount == 0) + { + float direction = Math.Sign(velocity.X); + mountedPlayer.position += new Vector2(direction * 24f, 0f); + mountedPlayer.FloorVisuals(true); + mountedPlayer.position -= new Vector2(direction * 24f, 0f); + } + } + + // Animation frames locked to 2 states: moving and not moving + if (state != 0) + state = 1; + + // Advances weapon frames while attacking OR while not attacking but mid-animation + if (tank._aiming || (tank._frameExtraCounter >= MissileAttackRate)) + tank._frameExtraCounter++; + else if (tank._frameExtraCounter > 0f) + tank._frameExtraCounter = 0f; + + int totalUseTime = MissileReuseDelay + MissileAttackRate * MissileLauncherFrameCount; + if (tank._frameExtraCounter >= totalUseTime) + { + tank._frameExtraCounter = 0f; + tank._frameExtra = 0; + } + tank._frameExtra = (int)Utils.Remap(tank._frameExtraCounter, MissileReuseDelay, totalUseTime, 0f, MissileLauncherFrameCount, true); + + // Minigun has a separate custom frame counter + ref int minigunFrame = ref data.MinigunFrame; + ref int minigunFrameCounter = ref data.MinigunFrameCounter; + if (tank._aiming || minigunFrameCounter > 0) + minigunFrameCounter++; + + if (minigunFrameCounter >= MinigunAttackRate * MinigunFrameCount) + { + minigunFrameCounter = 0; + minigunFrame = 0; + } + minigunFrame = minigunFrameCounter / MinigunAttackRate; + return true; + } + + public override bool Draw(List playerDrawData, int drawType, Player drawPlayer, ref Texture2D texture, ref Texture2D glowTexture, ref Vector2 drawPosition, ref Rectangle frame, ref Color drawColor, ref Color glowColor, ref float rotation, ref SpriteEffects spriteEffects, ref Vector2 drawOrigin, ref float drawScale, float shadow) + { + // Modify everything for backTextureExtra (minigun) and its glow + if (drawType == 1) + { + var data = (ExoTankData)drawPlayer.mount._mountSpecificData; + frame = texture.Frame(1, MinigunFrameCount, 0, data.MinigunFrame); + drawPosition += new Vector2(drawPlayer.direction == 1 ? 15f : -15f, 7f); + spriteEffects = drawPlayer.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + rotation = data.MinigunRotation; + drawOrigin = new Vector2(drawPlayer.direction == 1 ? 0f : 80f, 12f); + } + + // Frames for frontTexture (missile launcher) and its glow + if (drawType == 2) + frame = texture.Frame(1, MissileLauncherFrameCount, 0, drawPlayer.mount._frameExtra); + + return true; + } + } +} diff --git a/Items/Mounts/ExoTank_Back.png b/Items/Mounts/ExoTank_Back.png new file mode 100644 index 0000000000..d1c13b1c19 Binary files /dev/null and b/Items/Mounts/ExoTank_Back.png differ diff --git a/Items/Mounts/ExoTank_BackGun.png b/Items/Mounts/ExoTank_BackGun.png new file mode 100644 index 0000000000..c6cc2b5c8d Binary files /dev/null and b/Items/Mounts/ExoTank_BackGun.png differ diff --git a/Items/Mounts/ExoTank_BackGunGlow.png b/Items/Mounts/ExoTank_BackGunGlow.png new file mode 100644 index 0000000000..c87fa2614b Binary files /dev/null and b/Items/Mounts/ExoTank_BackGunGlow.png differ diff --git a/Items/Mounts/ExoTank_Front.png b/Items/Mounts/ExoTank_Front.png new file mode 100644 index 0000000000..55c28906a8 Binary files /dev/null and b/Items/Mounts/ExoTank_Front.png differ diff --git a/Items/Mounts/ExoTank_FrontGlow.png b/Items/Mounts/ExoTank_FrontGlow.png new file mode 100644 index 0000000000..6dab98a9ca Binary files /dev/null and b/Items/Mounts/ExoTank_FrontGlow.png differ diff --git a/Items/Mounts/ExoTank_FrontLayer.png b/Items/Mounts/ExoTank_FrontLayer.png new file mode 100644 index 0000000000..1af22c803f Binary files /dev/null and b/Items/Mounts/ExoTank_FrontLayer.png differ diff --git a/Items/Mounts/ExoTank_FrontLayerGlow.png b/Items/Mounts/ExoTank_FrontLayerGlow.png new file mode 100644 index 0000000000..b1ddb46c1b Binary files /dev/null and b/Items/Mounts/ExoTank_FrontLayerGlow.png differ diff --git a/Items/Mounts/SquishyBean.cs b/Items/Mounts/SquishyBean.cs index c45791c96e..fd7088ef8d 100644 --- a/Items/Mounts/SquishyBean.cs +++ b/Items/Mounts/SquishyBean.cs @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Mounts MountData.fallDamage = 0f; MountData.jumpHeight = 20; MountData.jumpSpeed = 15f; + MountData.constantJump = true; // Frames and offsets MountData.totalFrames = 4; diff --git a/Items/RelicOfConvergence.cs b/Items/RelicOfConvergence.cs index 8b202e7772..d441f610cc 100644 --- a/Items/RelicOfConvergence.cs +++ b/Items/RelicOfConvergence.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items { public new string LocalizationCategory => "Items.Misc"; - public static int HealValue = 70; + public static int HealValue = 60; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(HealValue); public override void SetStaticDefaults() @@ -24,7 +24,6 @@ namespace CalamityMod.Items Item.height = 46; Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Shoot; - Item.UseSound = SoundID.DD2_DarkMageCastHeal; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; @@ -33,6 +32,11 @@ namespace CalamityMod.Items Item.shoot = ModContent.ProjectileType(); } + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) { itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; diff --git a/Items/RelicOfResilience.cs b/Items/RelicOfResilience.cs new file mode 100644 index 0000000000..cf610774c1 --- /dev/null +++ b/Items/RelicOfResilience.cs @@ -0,0 +1,32 @@ +using System.Linq; +using CalamityMod.Projectiles.Damageable; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class RelicOfResilience : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetDefaults() + { + Item.width = 40; + Item.height = 34; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; + } + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } + } +} diff --git a/Items/Weapons/Typeless/RelicOfResilience.png b/Items/RelicOfResilience.png similarity index 100% rename from Items/Weapons/Typeless/RelicOfResilience.png rename to Items/RelicOfResilience.png diff --git a/Items/TreasureBags/HiveMindBag.cs b/Items/TreasureBags/HiveMindBag.cs index 20653b5de2..eef4aab55a 100644 --- a/Items/TreasureBags/HiveMindBag.cs +++ b/Items/TreasureBags/HiveMindBag.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Items.TreasureBags ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - new WeightedItemStack(ModContent.ItemType(), 1f, 50, 75), + ModContent.ItemType(), })); // Equipment diff --git a/Items/TreasureBags/PerforatorBag.cs b/Items/TreasureBags/PerforatorBag.cs index 51fdf84905..d710ac9293 100644 --- a/Items/TreasureBags/PerforatorBag.cs +++ b/Items/TreasureBags/PerforatorBag.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Items.TreasureBags ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - new WeightedItemStack(ModContent.ItemType(), 1f, 50, 75), + ModContent.ItemType(), })); // Equipment diff --git a/Items/TreasureBags/StormWeaverBag.cs b/Items/TreasureBags/StormWeaverBag.cs index d3407462e7..a2b96d28f4 100644 --- a/Items/TreasureBags/StormWeaverBag.cs +++ b/Items/TreasureBags/StormWeaverBag.cs @@ -1,8 +1,10 @@ -using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.Materials; using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables.Furniture.DevPaintings; using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.NPCs.StormWeaver; using Microsoft.Xna.Framework; @@ -60,14 +62,14 @@ namespace CalamityMod.Items.TreasureBags // Weapons itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] { - ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType() })); // Equipment + itemLoot.Add(ModContent.ItemType()); itemLoot.AddRevBagAccessories(); - // Stay tuned for Definitely Not Charged Perforator Runald's Band As A Single Item // Vanity itemLoot.Add(ModContent.ItemType(), 7); diff --git a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs index b3c7e03f97..d177e4d0b0 100644 --- a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs +++ b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs @@ -61,6 +61,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Projectile blade = Projectile.NewProjectileDirect(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction blade.rotation = blade.AngleTo(Main.MouseWorld); blade.netUpdate = true; return false; diff --git a/Items/Weapons/DraedonsArsenal/PoleWarper.cs b/Items/Weapons/DraedonsArsenal/PoleWarper.cs index f0acad0d57..5c2902b993 100644 --- a/Items/Weapons/DraedonsArsenal/PoleWarper.cs +++ b/Items/Weapons/DraedonsArsenal/PoleWarper.cs @@ -47,8 +47,9 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockBack) { - Projectile north = Projectile.NewProjectileDirect(source, Main.MouseWorld + Vector2.UnitY * 30f, Vector2.Zero, type, damage, knockBack, player.whoAmI); - Projectile south = Projectile.NewProjectileDirect(source, Main.MouseWorld - Vector2.UnitY * 30f, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Vector2 mouse = player.ClampedMouseWorld(); + Projectile north = Projectile.NewProjectileDirect(source, mouse + Vector2.UnitY * 30f, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile south = Projectile.NewProjectileDirect(source, mouse - Vector2.UnitY * 30f, Vector2.Zero, type, damage, knockBack, player.whoAmI); north.originalDamage = Item.damage; south.originalDamage = Item.damage; north.ai[1] = 1f; diff --git a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs index fded511217..1b041e028e 100644 --- a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs +++ b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs index 887a265f2a..15fda0cf58 100644 --- a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs +++ b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs @@ -44,10 +44,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Point mouseTileCoords = Main.MouseWorld.ToTileCoordinates(); + Vector2 mouse = player.ClampedMouseWorld(); + Point mouseTileCoords = mouse.ToTileCoordinates(); if (!CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).HasTile) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, mouse, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Magic/AetherfluxCannon.cs b/Items/Weapons/Magic/AetherfluxCannon.cs index 0702204071..77be95907f 100644 --- a/Items/Weapons/Magic/AetherfluxCannon.cs +++ b/Items/Weapons/Magic/AetherfluxCannon.cs @@ -15,12 +15,14 @@ namespace CalamityMod.Items.Weapons.Magic { public new string LocalizationCategory => "Items.Weapons.Magic"; public const int UseTime = 36; + public static Color mainColor = Color.Goldenrod; + public static Color accentColor = Color.LightGreen; public override void SetDefaults() { Item.width = 94; Item.height = 54; - Item.damage = 285; + Item.damage = 355; Item.DamageType = DamageClass.Magic; Item.mana = 7; Item.useAnimation = Item.useTime = UseTime; @@ -44,6 +46,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 spawnPosition = player.RotatedRelativePoint(player.MountedCenter, true); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.NewProjectile(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } @@ -52,7 +55,6 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(). - AddIngredient(). AddIngredient(5). AddIngredient(12). AddIngredient(8). diff --git a/Items/Weapons/Magic/AstralStaff.cs b/Items/Weapons/Magic/AstralStaff.cs index 91c599ae57..03a48809e3 100644 --- a/Items/Weapons/Magic/AstralStaff.cs +++ b/Items/Weapons/Magic/AstralStaff.cs @@ -42,6 +42,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 spawnPos = new Vector2(player.MountedCenter.X + Main.rand.Next(-200, 201), player.MountedCenter.Y - 600f); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 targetPos = Main.MouseWorld + new Vector2(Main.rand.Next(-30, 31), Main.rand.Next(-30, 31)); Vector2 velocityReal = targetPos - spawnPos; velocityReal.Normalize(); diff --git a/Items/Weapons/Magic/CosmicRainbow.cs b/Items/Weapons/Magic/CosmicRainbow.cs index a3a795ea03..bc9c2906a0 100644 --- a/Items/Weapons/Magic/CosmicRainbow.cs +++ b/Items/Weapons/Magic/CosmicRainbow.cs @@ -36,6 +36,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 rainbowPos = player.Center + (Vector2.Normalize(velocity) * Main.rand.NextFloat(-36f, 36f)).RotatedBy(MathHelper.PiOver2); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 rainbowVel = Vector2.Normalize(Main.MouseWorld - rainbowPos) * Item.shootSpeed; Projectile.NewProjectile(source, rainbowPos, rainbowVel, type, damage, knockback, Main.myPlayer); diff --git a/Items/Weapons/Magic/DivineRetribution.cs b/Items/Weapons/Magic/DivineRetribution.cs index 2ecc083994..91f0211d95 100644 --- a/Items/Weapons/Magic/DivineRetribution.cs +++ b/Items/Weapons/Magic/DivineRetribution.cs @@ -1,5 +1,4 @@ -using System; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -37,54 +36,21 @@ namespace CalamityMod.Items.Weapons.Magic Item.UseSound = SoundID.Item73; Item.autoReuse = true; - Item.shootSpeed = 19f; + Item.shootSpeed = 25f; Item.shoot = ModContent.ProjectileType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float spearSpeed = Item.shootSpeed; - Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - float mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (player.gravDir == -1f) + // 5 projectiles total + Vector2 mouse = player.ClampedMouseWorld(); + for (int i = -2; i < 3; i++) { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - } - else - { - mouseDistance = spearSpeed / mouseDistance; - } - int numProjectiles = 5; - for (int i = 0; i < numProjectiles; i++) - { - realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(51) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - /* - */ player.position.X), player.MountedCenter.Y + 600f); //- - realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-50, 51); //200 - realPlayerPos.Y += (float)(100 * i); //-= - mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; //+ - - mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; //+ - - if (mouseYDist < 0f) - { - mouseYDist *= -1f; - } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - mouseDistance = spearSpeed / mouseDistance; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - float speedX6 = mouseXDist + (float)Main.rand.Next(-60, 61) * 0.02f; - float speedY7 = mouseYDist + (float)Main.rand.Next(-60, 61) * 0.02f; - float ai1 = Main.rand.NextFloat() + 0.5f; - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX6, -speedY7, type, damage, knockback, player.whoAmI, 0.0f, ai1); + Vector2 newPos = new Vector2(mouse.X + Main.rand.NextFloat(8f, 64f) * i, player.MountedCenter.Y + Main.rand.NextFloat(640f, 800f)); + Vector2 newVel = (mouse + Main.rand.NextVector2CircularEdge(4f, 4f) - newPos).SafeNormalize(Vector2.Zero) * velocity.Length() * Main.rand.NextFloat(1f, 1.25f); + float velScale = 1f + Main.rand.NextFloat(0.02f, 0.08f) * i; + Projectile.NewProjectile(source, newPos, newVel, type, damage, knockback, player.whoAmI, velScale); } return false; } diff --git a/Items/Weapons/Magic/FaceMelter.cs b/Items/Weapons/Magic/FaceMelter.cs index 951693e686..1148903310 100644 --- a/Items/Weapons/Magic/FaceMelter.cs +++ b/Items/Weapons/Magic/FaceMelter.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Magic { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } else diff --git a/Items/Weapons/Magic/FlareBolt.cs b/Items/Weapons/Magic/FlareBolt.cs index 481eb7aab1..3168b9b7ef 100644 --- a/Items/Weapons/Magic/FlareBolt.cs +++ b/Items/Weapons/Magic/FlareBolt.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using System; +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,28 +14,53 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 34; Item.height = 38; - Item.damage = 36; + Item.damage = 40; Item.DamageType = DamageClass.Magic; - Item.mana = 12; - Item.useTime = 30; - Item.useAnimation = 30; + Item.mana = 22; + Item.useTime = 80; + Item.useAnimation = 80; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 5.5f; + Item.knockBack = 5f; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; - Item.UseSound = SoundID.Item20; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 7.5f; + Item.shootSpeed = 6.5f; } + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 4f; + Vector2 itemSize = new Vector2(34, 38); + Vector2 itemOrigin = new Vector2(-24, 4); + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + + base.UseStyle(player, heldItemFrame); + } + public override void UseItemFrame(Player player) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + + float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } public override void AddRecipes() { CreateRecipe(). AddIngredient(ItemID.HellstoneBar, 6). AddIngredient(ItemID.Obsidian, 9). AddIngredient(ItemID.Fireblossom, 2). + AddIngredient(ItemID.Ruby). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/FrigidflashBolt.cs b/Items/Weapons/Magic/FrigidflashBolt.cs index cf35832c2f..5320497da6 100644 --- a/Items/Weapons/Magic/FrigidflashBolt.cs +++ b/Items/Weapons/Magic/FrigidflashBolt.cs @@ -1,6 +1,11 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -10,35 +15,88 @@ namespace CalamityMod.Items.Weapons.Magic { public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/FrigidflashUse"); public static readonly SoundStyle ProjDeathSound = new("CalamityMod/Sounds/Item/FrigidflashDeath"); + public static readonly SoundStyle ChargeSound = new("CalamityMod/Sounds/Item/FrigidflashCharge"); public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + } public override void SetDefaults() { Item.width = 38; Item.height = 42; - Item.damage = 80; + Item.damage = 72; Item.DamageType = DamageClass.Magic; Item.mana = 13; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 5.5f; + Item.knockBack = 6f; Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; - Item.UseSound = UseSound; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; } + public override bool AltFunctionUse(Player player) => true; + public override float UseSpeedMultiplier(Player player) + { + if (player.altFunctionUse == 2) + return 0.25f; + + return 1f; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + if (player.altFunctionUse == 2) // Right Click + { + Projectile bigMagic = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI, 0, 5); + bigMagic.extraUpdates = 4; + bigMagic.timeLeft = 370; + bigMagic.penetrate = -1; + } + else // Left Click + { + Projectile smallMagic = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback / 2, player.whoAmI); + } + return false; + } + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 4f; + Vector2 itemSize = new Vector2(38, 42); + Vector2 itemOrigin = new Vector2(-24, 4); + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + + base.UseStyle(player, heldItemFrame); + } + public override void UseItemFrame(Player player) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + + float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } public override void AddRecipes() { CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(2). - AddIngredient(2). + AddIngredient(5). + AddIngredient(5). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/FrostBolt.cs b/Items/Weapons/Magic/FrostBolt.cs index 489a233792..4b90f09c01 100644 --- a/Items/Weapons/Magic/FrostBolt.cs +++ b/Items/Weapons/Magic/FrostBolt.cs @@ -1,4 +1,7 @@ -using CalamityMod.Projectiles.Magic; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,28 +15,53 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 34; Item.height = 38; - Item.damage = 14; + Item.damage = 25; Item.DamageType = DamageClass.Magic; - Item.mana = 6; - Item.useTime = 20; - Item.useAnimation = 20; + Item.mana = 8; + Item.useTime = 30; + Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; - Item.UseSound = SoundID.Item8; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 6f; + Item.shootSpeed = 8f; } + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 4f; + Vector2 itemSize = new Vector2(34, 38); + Vector2 itemOrigin = new Vector2(-24, 4); + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + + base.UseStyle(player, heldItemFrame); + } + public override void UseItemFrame(Player player) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + + float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } public override void AddRecipes() { CreateRecipe(). AddRecipeGroup("AnyIceBlock", 20). AddRecipeGroup("AnySnowBlock", 10). AddIngredient(ItemID.Shiverthorn, 2). + AddIngredient(ItemID.Sapphire). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/Genesis.cs b/Items/Weapons/Magic/Genesis.cs index f1be1b7b33..20af5325b0 100644 --- a/Items/Weapons/Magic/Genesis.cs +++ b/Items/Weapons/Magic/Genesis.cs @@ -46,6 +46,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction holdout.velocity = player.Calamity().mouseWorld - player.RotatedRelativePoint(player.MountedCenter); return false; } diff --git a/Items/Weapons/Magic/HeliumFlash.cs b/Items/Weapons/Magic/HeliumFlash.cs index 27b31f4a79..4344a34749 100644 --- a/Items/Weapons/Magic/HeliumFlash.cs +++ b/Items/Weapons/Magic/HeliumFlash.cs @@ -52,6 +52,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 spawnPosition = player.RotatedRelativePoint(player.MountedCenter, true); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.NewProjectile(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Magic/Hematemesis.cs b/Items/Weapons/Magic/Hematemesis.cs index bd132f898d..5ccbd20082 100644 --- a/Items/Weapons/Magic/Hematemesis.cs +++ b/Items/Weapons/Magic/Hematemesis.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); for (int x = 0; x < 10; x++) { Projectile.NewProjectile(source, position.X + (float)Main.rand.Next(-150, 150), position.Y + 600f, 0f, -10f, type, damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Magic/InfernalRift.cs b/Items/Weapons/Magic/InfernalRift.cs index 98779d3215..a162271cf9 100644 --- a/Items/Weapons/Magic/InfernalRift.cs +++ b/Items/Weapons/Magic/InfernalRift.cs @@ -61,8 +61,7 @@ namespace CalamityMod.Items.Weapons.Magic } f = Main.rand.NextFloat() * MathHelper.TwoPi; } - Vector2 mouseWorld = Main.MouseWorld; - Vector2 projSpawnPos = mouseWorld - projSpawnOffset; + Vector2 projSpawnPos = player.ClampedMouseWorld() - projSpawnOffset; Vector2 projVelocity = new Vector2(mouseXDist, mouseYDist).SafeNormalize(Vector2.UnitY) * projSpeed; projSpawnPos = projSpawnPos.SafeNormalize(projVelocity) * projSpeed; projSpawnPos = Vector2.Lerp(projSpawnPos, projVelocity, 0.25f); diff --git a/Items/Weapons/Magic/NanoPurge.cs b/Items/Weapons/Magic/NanoPurge.cs index f09ce91f00..c5cd65b095 100644 --- a/Items/Weapons/Magic/NanoPurge.cs +++ b/Items/Weapons/Magic/NanoPurge.cs @@ -4,6 +4,8 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; namespace CalamityMod.Items.Weapons.Magic { @@ -18,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 62; Item.height = 34; - Item.damage = 60; + Item.damage = 135; Item.DamageType = DamageClass.Magic; Item.mana = 8; Item.useAnimation = Item.useTime = UseTime; @@ -27,8 +29,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.noUseGraphic = true; Item.channel = true; Item.knockBack = 3f; - Item.rare = ItemRarityID.Red; - Item.value = CalamityGlobalItem.RarityRedBuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = ModContent.RarityType(); Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; @@ -41,6 +43,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 spawnPosition = player.RotatedRelativePoint(player.MountedCenter, true); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.NewProjectile(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } @@ -49,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.LaserMachinegun). - AddIngredient(ItemID.FragmentVortex, 6). + AddIngredient(7). AddIngredient(ItemID.Nanites, 100). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Weapons/Magic/NightsRay.cs b/Items/Weapons/Magic/NightsRay.cs index d7d5cbaf02..27f2e1b514 100644 --- a/Items/Weapons/Magic/NightsRay.cs +++ b/Items/Weapons/Magic/NightsRay.cs @@ -44,6 +44,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(ItemID.AmberStaff). AddIngredient(10). AddTile(TileID.DemonAltar). + AddCondition(Condition.NotRemixWorld). Register(); CreateRecipe(). AddIngredient(ItemID.CrimsonRod). @@ -52,7 +53,29 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(ItemID.AmberStaff). AddIngredient(10). AddTile(TileID.DemonAltar). + AddCondition(Condition.NotRemixWorld). Register(); + + // CIT 16NOV2024: Due to Wand of Sparking (and Frosting) being swapped with Magic Dagger in Remix, Night's Ray uses Magic Dagger in its recipe there. + CreateRecipe(). + AddIngredient(ItemID.Vilethorn). + AddIngredient(ItemID.MagicMissile). + AddIngredient(ItemID.MagicDagger). + AddIngredient(ItemID.AmberStaff). + AddIngredient(10). + AddTile(TileID.DemonAltar). + AddCondition(Condition.RemixWorld). + Register(); + CreateRecipe(). + AddIngredient(ItemID.CrimsonRod). + AddIngredient(ItemID.MagicMissile). + AddIngredient(ItemID.MagicDagger). + AddIngredient(ItemID.AmberStaff). + AddIngredient(10). + AddTile(TileID.DemonAltar). + AddCondition(Condition.RemixWorld). + Register(); + } } } diff --git a/Items/Weapons/Magic/Nucleosynthesis.cs b/Items/Weapons/Magic/Nucleosynthesis.cs index e718608ca1..f00df0ee15 100644 --- a/Items/Weapons/Magic/Nucleosynthesis.cs +++ b/Items/Weapons/Magic/Nucleosynthesis.cs @@ -64,6 +64,7 @@ namespace CalamityMod.Items.Weapons.Magic else return false; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 spawnOffset = player.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY).RotatedBy(offsetAngle) * -Main.rand.NextFloat(40f, 96f); Vector2 shootDirection = (Main.MouseWorld - (position + spawnOffset)).SafeNormalize(Vector2.UnitX * player.direction); int beam = Projectile.NewProjectile(source, position + spawnOffset, shootDirection * shootSpeed, type, damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Magic/Omicron.cs b/Items/Weapons/Magic/Omicron.cs index 8f0b710e5f..5b920b4c1a 100644 --- a/Items/Weapons/Magic/Omicron.cs +++ b/Items/Weapons/Magic/Omicron.cs @@ -53,6 +53,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction for (int i = 0; i < 2; i++) { Projectile holdout2 = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 0, i == 0 ? 1 : -1); diff --git a/Items/Weapons/Magic/PlasmaRifle.cs b/Items/Weapons/Magic/PlasmaRifle.cs index a7bb31498f..4cf11901f2 100644 --- a/Items/Weapons/Magic/PlasmaRifle.cs +++ b/Items/Weapons/Magic/PlasmaRifle.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 72; Item.height = 20; - Item.damage = 360; + Item.damage = 160; Item.DamageType = DamageClass.Magic; Item.mana = 40; Item.useAnimation = Item.useTime = 40; @@ -39,8 +39,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.autoReuse = true; Item.noMelee = true; - Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); @@ -78,7 +78,7 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(ItemID.ToxicFlask). AddIngredient(ItemID.LaserRifle). - AddIngredient(7). + AddIngredient(ItemID.FragmentVortex, 6). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Magic/PurgeGuzzler.cs b/Items/Weapons/Magic/PurgeGuzzler.cs index 00e44ba34b..316121deab 100644 --- a/Items/Weapons/Magic/PurgeGuzzler.cs +++ b/Items/Weapons/Magic/PurgeGuzzler.cs @@ -18,31 +18,33 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 58; Item.height = 44; - Item.damage = 120; + Item.damage = 152; Item.DamageType = DamageClass.Magic; - Item.mana = 22; - Item.useTime = 24; - Item.useAnimation = 24; + Item.mana = 50; + Item.useTime = 38; + Item.useAnimation = 38; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; Item.knockBack = 4.5f; - Item.UseSound = CommonCalamitySounds.LaserCannonSound; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - // Fire extra lasers to the left and right - Projectile.NewProjectile(source, position, velocity.RotatedBy(-Spread), type, damage, knockback, player.whoAmI); - Projectile.NewProjectile(source, position, velocity.RotatedBy(+Spread), type, damage, knockback, player.whoAmI); - - // Still also fire the center laser - return true; + Vector2 spawnPosition = player.RotatedRelativePoint(player.MountedCenter, true); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile.NewProjectileDirect(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, type, damage, knockback, player.whoAmI); + return false; } } } diff --git a/Items/Weapons/Magic/Serpentine.cs b/Items/Weapons/Magic/Serpentine.cs index 293bc8a8fa..2a9e1ff387 100644 --- a/Items/Weapons/Magic/Serpentine.cs +++ b/Items/Weapons/Magic/Serpentine.cs @@ -44,7 +44,10 @@ namespace CalamityMod.Items.Weapons.Magic player.itemTime = Item.useTime; Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); Vector2 projRotation = Vector2.UnitX.RotatedBy((double)player.fullRotation, default); + + // 14NOV2024: Ozzatron: clamped mouse position is inappropriate to apply here due to excessive use of decompiled vanilla shitcode Vector2 projSpawnPos = Main.MouseWorld - realPlayerPos; + float velX = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; float velY = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; if (player.gravDir == -1f) diff --git a/Items/Weapons/Magic/StarShower.cs b/Items/Weapons/Magic/StarShower.cs index f1da7a9249..f699464be8 100644 --- a/Items/Weapons/Magic/StarShower.cs +++ b/Items/Weapons/Magic/StarShower.cs @@ -40,8 +40,9 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Vector2 destination = Main.MouseWorld; - position = destination - Vector2.UnitY * (Main.MouseWorld.Y - Main.screenPosition.Y + 80f); + Vector2 mouse = player.ClampedMouseWorld(); + Vector2 destination = mouse; + position = destination - Vector2.UnitY * (mouse.Y - Main.screenPosition.Y + 80f); Vector2 cachedPosition = position; float maxRandomOffset = 16f; int totalProjectiles = 5; @@ -49,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Magic { position.X += MathHelper.Lerp(-160f, 160f, i / (float)(totalProjectiles - 1)); position += Main.rand.NextVector2Circular(maxRandomOffset, maxRandomOffset); - velocity = (Main.MouseWorld - position).SafeNormalize(Vector2.UnitY) * ShootSpeed * Main.rand.NextFloat(0.9f, 1.1f); + velocity = (mouse - position).SafeNormalize(Vector2.UnitY) * ShootSpeed * Main.rand.NextFloat(0.9f, 1.1f); Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); position = cachedPosition; } diff --git a/Items/Weapons/Magic/Thunderbolt.cs b/Items/Weapons/Magic/Thunderbolt.cs index b3dc51c976..d52165712c 100644 --- a/Items/Weapons/Magic/Thunderbolt.cs +++ b/Items/Weapons/Magic/Thunderbolt.cs @@ -48,6 +48,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 spawnPosition = player.RotatedRelativePoint(player.MountedCenter, true); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.NewProjectile(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Magic/UltraLiquidator.cs b/Items/Weapons/Magic/UltraLiquidator.cs index e1c2bd8c05..1095523651 100644 --- a/Items/Weapons/Magic/UltraLiquidator.cs +++ b/Items/Weapons/Magic/UltraLiquidator.cs @@ -59,6 +59,7 @@ namespace CalamityMod.Items.Weapons.Magic } f = Main.rand.NextFloat() * MathHelper.TwoPi; } + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 velocityReal = Main.MouseWorld - source; Vector2 upperVelocityLimit = new Vector2(xVec, yVec).SafeNormalize(Vector2.UnitY) * speed; velocityReal = velocityReal.SafeNormalize(upperVelocityLimit) * speed; diff --git a/Items/Weapons/Magic/VitriolicViper.cs b/Items/Weapons/Magic/VitriolicViper.cs index d621aee206..681c2e9007 100644 --- a/Items/Weapons/Magic/VitriolicViper.cs +++ b/Items/Weapons/Magic/VitriolicViper.cs @@ -41,6 +41,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 spawnPosition = player.RotatedRelativePoint(player.MountedCenter, true); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.NewProjectile(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Magic/VividClarity.cs b/Items/Weapons/Magic/VividClarity.cs index 19585a3893..5aabf36d9d 100644 --- a/Items/Weapons/Magic/VividClarity.cs +++ b/Items/Weapons/Magic/VividClarity.cs @@ -64,6 +64,7 @@ namespace CalamityMod.Items.Weapons.Magic } f = Main.rand.NextFloat() * MathHelper.TwoPi; } + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 velocityReal = Main.MouseWorld - source; Vector2 velocityVariation = new Vector2(xPos, yPos).SafeNormalize(Vector2.UnitY) * speed; velocityReal = velocityReal.SafeNormalize(velocityVariation) * speed; diff --git a/Items/Weapons/Magic/VoidVortex.cs b/Items/Weapons/Magic/VoidVortex.cs index a671c7c4c1..abd18f69a4 100644 --- a/Items/Weapons/Magic/VoidVortex.cs +++ b/Items/Weapons/Magic/VoidVortex.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int numOrbs = 12; - Vector2 clickPos = Main.MouseWorld; + Vector2 clickPos = player.ClampedMouseWorld(); float orbDistance = 90f; float orbSpeed = 4f; diff --git a/Items/Weapons/Magic/VoltaicClimax.cs b/Items/Weapons/Magic/VoltaicClimax.cs index 56ab2c6926..5cd70a1c53 100644 --- a/Items/Weapons/Magic/VoltaicClimax.cs +++ b/Items/Weapons/Magic/VoltaicClimax.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int numOrbs = 9; - Vector2 clickPos = Main.MouseWorld; + Vector2 clickPos = player.ClampedMouseWorld(); float orbSpeed = 14f; Vector2 vel = Main.rand.NextVector2CircularEdge(orbSpeed, orbSpeed); for (int i = 0; i < numOrbs; i++) diff --git a/Items/Weapons/Magic/Wingman.cs b/Items/Weapons/Magic/Wingman.cs index b4960be3d1..b083e19c88 100644 --- a/Items/Weapons/Magic/Wingman.cs +++ b/Items/Weapons/Magic/Wingman.cs @@ -47,6 +47,7 @@ namespace CalamityMod.Items.Weapons.Magic for (int i = 0; i < 2; i++) { Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 0, i == 0 ? 1 : -1); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); } diff --git a/Items/Weapons/Magic/WrathoftheAncients.cs b/Items/Weapons/Magic/WrathoftheAncients.cs index 08bde482af..1a625db4d8 100644 --- a/Items/Weapons/Magic/WrathoftheAncients.cs +++ b/Items/Weapons/Magic/WrathoftheAncients.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Melee/BurningRevelation.cs b/Items/Weapons/Melee/BurningRevelation.cs index f3adc1195e..03cb1805f5 100644 --- a/Items/Weapons/Melee/BurningRevelation.cs +++ b/Items/Weapons/Melee/BurningRevelation.cs @@ -1,7 +1,12 @@ using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.Rarities; +using Microsoft.Xna.Framework.Graphics; using Terraria.ID; using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Terraria; +using static Terraria.ModLoader.ModContent; + namespace CalamityMod.Items.Weapons.Melee { @@ -21,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 40; Item.height = 38; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 120; + Item.damage = 300; Item.knockBack = 7.5f; Item.useTime = 20; Item.useAnimation = 20; @@ -39,5 +44,9 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Request(Texture + "Glow").Value); + } } } diff --git a/Items/Weapons/Melee/BurningRevelation.png b/Items/Weapons/Melee/BurningRevelation.png index 96bcbf2574..43251fe869 100644 Binary files a/Items/Weapons/Melee/BurningRevelation.png and b/Items/Weapons/Melee/BurningRevelation.png differ diff --git a/Items/Weapons/Melee/BurningRevelationGlow.png b/Items/Weapons/Melee/BurningRevelationGlow.png new file mode 100644 index 0000000000..3b42554476 Binary files /dev/null and b/Items/Weapons/Melee/BurningRevelationGlow.png differ diff --git a/Items/Weapons/Melee/DarklightGreatsword.cs b/Items/Weapons/Melee/DarklightGreatsword.cs index 9fc987e810..f3ae33d686 100644 --- a/Items/Weapons/Melee/DarklightGreatsword.cs +++ b/Items/Weapons/Melee/DarklightGreatsword.cs @@ -50,6 +50,7 @@ namespace CalamityMod.Items.Weapons.Melee else position += offset; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction velocity = (Main.MouseWorld - position).SafeNormalize(Vector2.UnitY) * ShootSpeed; type = Main.rand.NextBool() ? type : ModContent.ProjectileType(); Projectile.NewProjectile(source, position, velocity, type, (int)(damage * ProjectileDamageMultiplier), knockback * ProjectileDamageMultiplier, player.whoAmI); diff --git a/Items/Weapons/Melee/GalactusBlade.cs b/Items/Weapons/Melee/GalactusBlade.cs index 6a56e3f9c5..eeddb62413 100644 --- a/Items/Weapons/Melee/GalactusBlade.cs +++ b/Items/Weapons/Melee/GalactusBlade.cs @@ -97,7 +97,8 @@ namespace CalamityMod.Items.Weapons.Melee { for (int i = 0; i < 7; i++) { - Vector2 spawnSpot = new Vector2(player.Calamity().mouseWorld.X, player.Center.Y) + new Vector2(Main.rand.NextFloat(-850, 850), Main.rand.NextFloat(-750, -1250)); + Vector2 clampedMouse = player.ClampedMouseWorld(); + Vector2 spawnSpot = new Vector2(clampedMouse.X, player.Center.Y) + new Vector2(Main.rand.NextFloat(-850, 850), Main.rand.NextFloat(-750, -1250)); Projectile comet = Projectile.NewProjectileDirect(Item.GetSource_FromThis(), spawnSpot, Utils.DirectionTo(spawnSpot, player.Calamity().mouseWorld + Main.rand.NextVector2Circular(50, 50)) * Item.shootSpeed, Item.shoot, Item.damage / 3, Item.knockBack, player.whoAmI); comet.extraUpdates = Main.rand.Next(2, 3 + 1); } diff --git a/Items/Weapons/Melee/Greentide.cs b/Items/Weapons/Melee/Greentide.cs index 086741e9f8..1e83d71b10 100644 --- a/Items/Weapons/Melee/Greentide.cs +++ b/Items/Weapons/Melee/Greentide.cs @@ -1,9 +1,7 @@ using System; -using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -47,12 +45,10 @@ namespace CalamityMod.Items.Weapons.Melee for (int i = 0; i < 2; ++i) { Projectile tooth = Projectile.NewProjectileDirect(source, position, velocity.RotatedBy(-0.1f * (i + 1)).RotatedByRandom(0.06f) * (1 - i * 0.3f), type, (int)(damage * 0.7f), knockback / 3, player.whoAmI, 1f, 0f); - tooth.penetrate = 2; } for (int i = 0; i < 2; ++i) { Projectile tooth = Projectile.NewProjectileDirect(source, position, velocity.RotatedBy(0.1f * (i + 1)).RotatedByRandom(0.06f) * (1 - i * 0.3f), type, (int)(damage * 0.7), knockback / 3, player.whoAmI, 1f, 0f); - tooth.penetrate = 2; } Projectile strongTooth = Projectile.NewProjectileDirect(source, position, velocity * 1.2f, type, (int)(damage), knockback, player.whoAmI, 2f, 0f); strongTooth.penetrate = -1; @@ -62,6 +58,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for aiming a projectile NPC target2 = player.Calamity().mouseWorld.ClosestNPCAt(300); if (target2 == null) target2 = target; diff --git a/Items/Weapons/Melee/HolyCollider.cs b/Items/Weapons/Melee/HolyCollider.cs index cdedd6b888..6eb24ed294 100644 --- a/Items/Weapons/Melee/HolyCollider.cs +++ b/Items/Weapons/Melee/HolyCollider.cs @@ -1,75 +1,50 @@ -using Microsoft.Xna.Framework; -using System; +using CalamityMod.Items.BaseItems; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Melee { - public class HolyCollider : ModItem, ILocalizedModType + public class HolyCollider : CustomUseProjItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { - Item.width = 94; - Item.height = 80; - Item.damage = 270; + Item.width = 114; + Item.height = 146; + Item.damage = 2070; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 22; + Item.useAnimation = 45; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 22; + Item.useTime = 45; Item.useTurn = true; Item.knockBack = 7.75f; - Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.shootSpeed = 10f; + Item.channel = true; + Item.shoot = ModContent.ProjectileType(); + Item.noUseGraphic = true; + Item.noMelee = true; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } - - public override void UseStyle(Player player, Rectangle heldItemFrame) + public override bool MeleePrefix() => true; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - player.itemLocation += new Vector2(5f * player.direction, 13f * player.gravDir).RotatedBy(player.itemRotation); + Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, 5); + return false; } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - var source = player.GetSource_ItemUse(Item); - SoundEngine.PlaySound(SoundID.Item14, target.Center); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(Item.shootSpeed, Item.shootSpeed) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int holyFireDamage = player.CalcIntDamage(0.3f * Item.damage); - for (i = 0; i < 4; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(source, target.Center.X, target.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), holyFireDamage, hit.Knockback, Main.myPlayer); - Projectile.NewProjectile(source, target.Center.X, target.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), holyFireDamage, hit.Knockback, Main.myPlayer); - } - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - var source = player.GetSource_ItemUse(Item); - SoundEngine.PlaySound(SoundID.Item14, target.Center); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(Item.shootSpeed, Item.shootSpeed) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int holyFireDamage = player.CalcIntDamage(0.3f * Item.damage); - for (i = 0; i < 4; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(source, target.Center.X, target.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), holyFireDamage, Item.knockBack, Main.myPlayer); - Projectile.NewProjectile(source, target.Center.X, target.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), holyFireDamage, Item.knockBack, Main.myPlayer); - } + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Request(Texture + "Glow").Value); } } } diff --git a/Items/Weapons/Melee/HolyColliderGlow.png b/Items/Weapons/Melee/HolyColliderGlow.png new file mode 100644 index 0000000000..67075c1c28 Binary files /dev/null and b/Items/Weapons/Melee/HolyColliderGlow.png differ diff --git a/Items/Weapons/Melee/Orderbringer.cs b/Items/Weapons/Melee/Orderbringer.cs index f3ed84291e..1490126c7e 100644 --- a/Items/Weapons/Melee/Orderbringer.cs +++ b/Items/Weapons/Melee/Orderbringer.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Melee for (int i = 0; i < 4; i++) { Vector2 vel = (velocity * 2.5f).RotatedByRandom(0.6f); - Projectile.NewProjectile(source, Main.MouseWorld - (velocity * 40) + Main.rand.NextVector2Circular(130, 130), vel * Main.rand.NextFloat(0.8f, 1.2f), ModContent.ProjectileType(), (int)(damage * 0.1f), knockback * 0.2f, player.whoAmI, 0, 0, 1); + Projectile.NewProjectile(source, player.ClampedMouseWorld() - (velocity * 40) + Main.rand.NextVector2Circular(130, 130), vel * Main.rand.NextFloat(0.8f, 1.2f), ModContent.ProjectileType(), (int)(damage * 0.1f), knockback * 0.2f, player.whoAmI, 0, 0, 1); } return false; } @@ -102,6 +102,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { int beamDamage = player.CalcIntDamage(Item.damage); + Vector2 mouseClamped = player.ClampedMouseWorld(); for (int i = 0; i < 2; i++) { Vector2 targetPos = Main.MouseWorld; @@ -109,7 +110,7 @@ namespace CalamityMod.Items.Weapons.Melee if (target2 != null) targetPos = target2.Center + target2.velocity * 14; - Vector2 spawnPos = Main.MouseWorld + new Vector2(Main.rand.NextFloat(-300, 300), -900); + Vector2 spawnPos = mouseClamped + new Vector2(Main.rand.NextFloat(-300, 300), -900); Vector2 vel = (targetPos - spawnPos).SafeNormalize(Vector2.UnitY) * 10; Projectile.NewProjectile(player.GetSource_ItemUse(Item), spawnPos, vel, ModContent.ProjectileType(), beamDamage, 0, player.whoAmI); } diff --git a/Items/Weapons/Melee/SeekingScorcher.cs b/Items/Weapons/Melee/SeekingScorcher.cs index 79f0a44291..f7fb0a7c67 100644 --- a/Items/Weapons/Melee/SeekingScorcher.cs +++ b/Items/Weapons/Melee/SeekingScorcher.cs @@ -1,6 +1,8 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -10,22 +12,27 @@ namespace CalamityMod.Items.Weapons.Melee public class SeekingScorcher : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public static readonly SoundStyle ThrowSound = new("CalamityMod/Sounds/Item/SwingMid") { Volume = 0.5f, Pitch = -0.35f, PitchVariance = 0.1f }; + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastImpact") { Volume = 0.5f, Pitch = 0.2f, PitchVariance = 0.2f }; + public static readonly SoundStyle ShatterSound = new("CalamityMod/Sounds/Item/BlazingCoreParry") { Volume = 0.4f, PitchVariance = 0.2f }; + public static readonly SoundStyle LightShatterSound = new("CalamityMod/Sounds/NPCKilled/CrownJewelShatter") { Pitch = 0.4f, PitchVariance = 0.3f }; + public override void SetDefaults() { Item.width = 86; Item.height = 64; - Item.damage = 232; + Item.damage = 718; + Item.DamageType = DamageClass.MeleeNoSpeed; + Item.useAnimation = Item.useTime = 55; + Item.knockBack = 8.5f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; Item.noMelee = true; Item.noUseGraphic = true; - Item.autoReuse = true; - Item.useAnimation = 17; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 17; - Item.knockBack = 8.5f; - Item.UseSound = SoundID.Item1; - Item.DamageType = DamageClass.MeleeNoSpeed; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 14f; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Melee/SkytideDragoon.cs b/Items/Weapons/Melee/SkytideDragoon.cs new file mode 100644 index 0000000000..ec33a45b04 --- /dev/null +++ b/Items/Weapons/Melee/SkytideDragoon.cs @@ -0,0 +1,43 @@ +using CalamityMod.Items.BaseItems; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class SkytideDragoon : CustomUseProjItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Melee"; + + public override void SetDefaults() + { + Item.width = 86; + Item.height = 94; + Item.damage = 345; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 35; + Item.useTime = 35; + Item.useTurn = true; + Item.knockBack = 12f; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = ModContent.RarityType(); + + Item.channel = true; + Item.shoot = ModContent.ProjectileType(); + Item.noUseGraphic = true; + Item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + } + public override bool MeleePrefix() => true; // This spear can deal more damage with melee speed, no reason to limit it to godly + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/SkytideDragoonGlow").Value); + } + } +} diff --git a/Items/Weapons/Melee/SkytideDragoon.png b/Items/Weapons/Melee/SkytideDragoon.png new file mode 100644 index 0000000000..98d66f472b Binary files /dev/null and b/Items/Weapons/Melee/SkytideDragoon.png differ diff --git a/Items/Weapons/Melee/SkytideDragoonGlow.png b/Items/Weapons/Melee/SkytideDragoonGlow.png new file mode 100644 index 0000000000..c23430079f Binary files /dev/null and b/Items/Weapons/Melee/SkytideDragoonGlow.png differ diff --git a/Items/Weapons/Melee/StormSaber.cs b/Items/Weapons/Melee/StormSaber.cs index 406c384d6d..4df89ae204 100644 --- a/Items/Weapons/Melee/StormSaber.cs +++ b/Items/Weapons/Melee/StormSaber.cs @@ -34,6 +34,8 @@ namespace CalamityMod.Items.Weapons.Melee Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 0.8), knockback, player.whoAmI); Vector2 spawnPos = new Vector2(player.MountedCenter.X + Main.rand.Next(-200, 201), player.MountedCenter.Y - 600f); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 targetPos = Main.MouseWorld + new Vector2(Main.rand.Next(-30, 31), Main.rand.Next(-30, 31)); velocity = targetPos - spawnPos; velocity.Normalize(); diff --git a/Items/Weapons/Melee/TheBurningSky.cs b/Items/Weapons/Melee/TheBurningSky.cs index 1e8fa16cdf..a4e26ae751 100644 --- a/Items/Weapons/Melee/TheBurningSky.cs +++ b/Items/Weapons/Melee/TheBurningSky.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Melee for (int i = 0; i < ProjectilesPerBarrage; ++i) { float randomSpeed = speed * Main.rand.NextFloat(0.7f, 1.4f); - CalamityUtils.ProjectileRain(source, Main.MouseWorld, 290f, 130f, 850f, 1100f, randomSpeed, type, damage, knockback, player.whoAmI); + CalamityUtils.ProjectileRain(source, player.ClampedMouseWorld(), 290f, 130f, 850f, 1100f, randomSpeed, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Melee/TrueArkoftheAncients.cs b/Items/Weapons/Melee/TrueArkoftheAncients.cs index 8ace1c199a..2dfe5ff28b 100644 --- a/Items/Weapons/Melee/TrueArkoftheAncients.cs +++ b/Items/Weapons/Melee/TrueArkoftheAncients.cs @@ -81,6 +81,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (Charge > 0 && player.controlUp) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction float angle = player.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY).ToRotation(); Vector2 laserVector = player.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY) * 600; Projectile.NewProjectile(source, player.Center + angle.ToRotationVector2() * 90f, laserVector, ProjectileType(), (int)(damage * Charge * chargeDamageMultiplier * blastDamageMultiplier), 0, player.whoAmI); diff --git a/Items/Weapons/Ranged/AcesHigh.cs b/Items/Weapons/Ranged/AcesHigh.cs index d0e2d11a52..7f7c60844b 100644 --- a/Items/Weapons/Ranged/AcesHigh.cs +++ b/Items/Weapons/Ranged/AcesHigh.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(ItemID.Revolver). AddIngredient(). - AddIngredient(52). + AddIngredient(). AddIngredient(5). AddTile(). Register(); diff --git a/Items/Weapons/Ranged/AngelicShotgun.cs b/Items/Weapons/Ranged/AngelicShotgun.cs index c5c3189ac6..4057a09072 100644 --- a/Items/Weapons/Ranged/AngelicShotgun.cs +++ b/Items/Weapons/Ranged/AngelicShotgun.cs @@ -15,7 +15,6 @@ namespace CalamityMod.Items.Weapons.Ranged public class AngelicShotgun : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - private static float BulletSpeed = 12f; public override void SetDefaults() { @@ -36,8 +35,8 @@ namespace CalamityMod.Items.Weapons.Ranged Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; - Item.shootSpeed = BulletSpeed; - Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); Item.useAmmo = AmmoID.Bullet; Item.Calamity().canFirePointBlankShots = true; } @@ -49,68 +48,33 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int NumBullets = Main.rand.Next(5, 6+1); - Vector2 baseVelocity = velocity.SafeNormalize(Vector2.Zero) * BulletSpeed; - // If Musket Balls are used, damage is set to match Hallow-Point Rounds for both bullets and lasers if (type == ProjectileID.Bullet) + { + type = ModContent.ProjectileType(); damage += HallowPointRound.BaseDamage - 7; + } // Fire a shotgun spread of bullets. + int NumBullets = Main.rand.Next(5, 6 + 1); + Vector2 baseVelocity = velocity.SafeNormalize(Vector2.Zero) * velocity.Length(); for (int i = 0; i < NumBullets; ++i) { - float dx = Main.rand.NextFloat(-1.3f, 1.3f); - float dy = Main.rand.NextFloat(-1.3f, 1.3f); - Vector2 randomVelocity = baseVelocity + new Vector2(dx, dy); - - if (type == ProjectileID.Bullet) - Projectile.NewProjectile(source, position, randomVelocity, Item.shoot, damage, knockback, player.whoAmI); - else - Projectile.NewProjectile(source, position, randomVelocity, type, damage, knockback, player.whoAmI); + Vector2 randomVelocity = baseVelocity.RotatedByRandom(MathHelper.ToRadians(12.5f)) * Main.rand.NextFloat(0.88f, 1.12f); + Projectile.NewProjectile(source, position + velocity.SafeNormalize(Vector2.Zero) * 16f, randomVelocity, type, damage, knockback, player.whoAmI); } // Spawn a beam from the sky ala Deathhail Staff or Lunar Flare + // This is more powerful if Hallow-Point Rounds (either naturally used or converted) are fired + bool empowered = type == ModContent.ProjectileType(); float laserSpeed = 8f; - int laserDamage = (int)(damage * 2.5f); - float laserKB = 5f; + int laserDamage = (int)(damage * (empowered ? 3.5f : 2f)); + float laserKB = knockback * 1.6f; - Vector2 rrp = player.RotatedRelativePoint(player.MountedCenter, true); - float mouseDX = (float)Main.mouseX - Main.screenPosition.X - rrp.X; - float mouseDY = (float)Main.mouseY - Main.screenPosition.Y - rrp.Y; - - // Correct for grav potion - if (player.gravDir == -1f) - mouseDY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - rrp.Y; - - // Unnecessary NaN checks - float mouseDist = (float)Math.Sqrt((double)(mouseDX * mouseDX + mouseDY * mouseDY)); - if ((float.IsNaN(mouseDX) && float.IsNaN(mouseDY)) || (mouseDX == 0f && mouseDY == 0f)) - { - mouseDX = (float)player.direction; - } - else - { - mouseDist = laserSpeed / mouseDist; - } - - rrp = new Vector2(player.Center.X + (Main.rand.NextFloat(200f) * -player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - rrp.X = (rrp.X + player.Center.X) / 2f + Main.rand.NextFloat(-200f, 200f); - rrp.Y -= 100f; - mouseDX = (float)Main.mouseX + Main.screenPosition.X - rrp.X; - mouseDY = (float)Main.mouseY + Main.screenPosition.Y - rrp.Y; - if (mouseDY < 0f) - { - mouseDY *= -1f; - } - if (mouseDY < 20f) - { - mouseDY = 20f; - } - mouseDist = (float)Math.Sqrt((double)(mouseDX * mouseDX + mouseDY * mouseDY)); - mouseDist = laserSpeed / mouseDist; - mouseDX *= mouseDist; - mouseDY *= mouseDist; - Projectile.NewProjectile(source, rrp, new Vector2(mouseDX, mouseDY + Main.rand.NextFloat(-0.8f, 0.8f)), ModContent.ProjectileType(), laserDamage, laserKB, player.whoAmI); + Vector2 newPos = new Vector2(player.ClampedMouseWorld().X + Main.rand.NextFloat(-160f, 160f), player.MountedCenter.Y - 1200f); + Vector2 newVel = (player.ClampedMouseWorld() + Main.rand.NextVector2CircularEdge(8f, 8f) - newPos).SafeNormalize(Vector2.Zero) * laserSpeed; + Projectile laser = Projectile.NewProjectileDirect(source, newPos, newVel, Item.shoot, laserDamage, laserKB, player.whoAmI); + laser.scale = empowered ? 1.75f : 1f; // Play the sound of the laser beam SoundEngine.PlaySound(SoundID.Item72, player.Center); diff --git a/Items/Weapons/Ranged/ArcNovaDiffuser.cs b/Items/Weapons/Ranged/ArcNovaDiffuser.cs index 18b34004c5..737ffe8a93 100644 --- a/Items/Weapons/Ranged/ArcNovaDiffuser.cs +++ b/Items/Weapons/Ranged/ArcNovaDiffuser.cs @@ -56,6 +56,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 1); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction holdout.velocity = player.Calamity().mouseWorld - player.RotatedRelativePoint(player.MountedCenter); return false; } diff --git a/Items/Weapons/Ranged/BladedgeRailbow.cs b/Items/Weapons/Ranged/BladedgeRailbow.cs index c870e43a22..323cf7ae91 100644 --- a/Items/Weapons/Ranged/BladedgeRailbow.cs +++ b/Items/Weapons/Ranged/BladedgeRailbow.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged { public new string LocalizationCategory => "Items.Weapons.Ranged"; + // TODO -- This is a List. It should be handled in the way the new Collections are handled. #region GFB Arrow Array public static int[] arrowArr = { @@ -80,7 +81,7 @@ namespace CalamityMod.Items.Weapons.Ranged ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType(), + ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), diff --git a/Items/Weapons/Ranged/BlissfulBombardier.cs b/Items/Weapons/Ranged/BlissfulBombardier.cs index 150dc202ea..93f7bfbfff 100644 --- a/Items/Weapons/Ranged/BlissfulBombardier.cs +++ b/Items/Weapons/Ranged/BlissfulBombardier.cs @@ -1,10 +1,13 @@ using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Ranged { @@ -13,33 +16,44 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.width = 76; - Item.height = 30; - Item.damage = 93; + Item.width = 88; + Item.height = 48; + Item.damage = 592; Item.DamageType = DamageClass.Ranged; - Item.useTime = 15; - Item.useAnimation = 15; + Item.useTime = 39; + Item.useAnimation = 39; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 7.5f; + Item.noUseGraphic = true; + Item.channel = true; + Item.knockBack = 14f; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); - Item.UseSound = SoundID.Item11; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = 0.4f, Pitch = -0.5f, PitchVariance = 0.1f }; Item.autoReuse = true; Item.shootSpeed = 24f; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.useAmmo = AmmoID.Rocket; } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0; - public override Vector2? HoldoutOffset() => new Vector2(-10, 0); - - // Figure out which rocket is used - public int RocketType; - public override void OnConsumeAmmo(Item ammo, Player player) => RocketType = ammo.type; + // Spawning the holdout won't consume ammo. + public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] != 0; + // Makes the rotation of the mouse around the player sync in multiplayer. + public override void HoldItem(Player player) + { + player.Calamity().mouseRotationListener = true; + player.Calamity().mouseWorldListener = true; + } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) => Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Request(Texture + "Glow").Value); public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, RocketType); + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + // We set the rotation to the direction to the aim direction so the first frame doesn't appear bugged out. + holdout.velocity = (new Vector2(MathHelper.Lerp(player.Calamity().mouseWorld.X, player.Center.X, 0.55f), player.Center.Y) + new Vector2(0, -500) - player.Center).SafeNormalize(Vector2.Zero); return false; } } diff --git a/Items/Weapons/Ranged/BlissfulBombardier.png b/Items/Weapons/Ranged/BlissfulBombardier.png index 4950236e7d..4ee4918b80 100644 Binary files a/Items/Weapons/Ranged/BlissfulBombardier.png and b/Items/Weapons/Ranged/BlissfulBombardier.png differ diff --git a/Items/Weapons/Ranged/BlissfulBombardierGlow.png b/Items/Weapons/Ranged/BlissfulBombardierGlow.png new file mode 100644 index 0000000000..0be8a0440d Binary files /dev/null and b/Items/Weapons/Ranged/BlissfulBombardierGlow.png differ diff --git a/Items/Weapons/Ranged/ChromaticEruption.cs b/Items/Weapons/Ranged/ChromaticEruption.cs index 4577cc58f0..dd1cab2c5d 100644 --- a/Items/Weapons/Ranged/ChromaticEruption.cs +++ b/Items/Weapons/Ranged/ChromaticEruption.cs @@ -51,6 +51,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 1); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction holdout.velocity = player.Calamity().mouseWorld - player.RotatedRelativePoint(player.MountedCenter); return false; } diff --git a/Items/Weapons/Ranged/DragonsBreath.cs b/Items/Weapons/Ranged/DragonsBreath.cs index ca07e02c07..df0e1a9c79 100644 --- a/Items/Weapons/Ranged/DragonsBreath.cs +++ b/Items/Weapons/Ranged/DragonsBreath.cs @@ -52,6 +52,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Projectile holdout = Projectile.NewProjectileDirect(source, position, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); diff --git a/Items/Weapons/Ranged/FetidEmesis.cs b/Items/Weapons/Ranged/FetidEmesis.cs index f6b5a2fd78..510de31ef1 100644 --- a/Items/Weapons/Ranged/FetidEmesis.cs +++ b/Items/Weapons/Ranged/FetidEmesis.cs @@ -38,6 +38,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); return false; diff --git a/Items/Weapons/Ranged/FlakKraken.cs b/Items/Weapons/Ranged/FlakKraken.cs index 91a8ff73a5..868f04b376 100644 --- a/Items/Weapons/Ranged/FlakKraken.cs +++ b/Items/Weapons/Ranged/FlakKraken.cs @@ -70,6 +70,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); diff --git a/Items/Weapons/Ranged/FlakToxicannon.cs b/Items/Weapons/Ranged/FlakToxicannon.cs index fc7d92f5ec..956f36a2e7 100644 --- a/Items/Weapons/Ranged/FlakToxicannon.cs +++ b/Items/Weapons/Ranged/FlakToxicannon.cs @@ -63,6 +63,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); diff --git a/Items/Weapons/Ranged/FlurrystormCannon.cs b/Items/Weapons/Ranged/FlurrystormCannon.cs index 053abb6042..fb1b12d224 100644 --- a/Items/Weapons/Ranged/FlurrystormCannon.cs +++ b/Items/Weapons/Ranged/FlurrystormCannon.cs @@ -52,6 +52,19 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.Bone, 10). AddIngredient(10). AddTile(TileID.Anvils). + AddCondition(Condition.NotRemixWorld). + Register(); + + // CIT 16NOV2024: Due to Snowball Cannon being swapped with Ice Bow in Remix, Flurrystorm Cannon uses Ice Bow in its recipe there. + // Yes, this makes no sense. I don't care; I prefer obtainability over making sense. + CreateRecipe(). + AddIngredient(ItemID.IceBow). + AddIngredient(ItemID.IllegalGunParts). + AddIngredient(10). + AddIngredient(ItemID.Bone, 10). + AddIngredient(10). + AddTile(TileID.Anvils). + AddCondition(Condition.RemixWorld). Register(); } } diff --git a/Items/Weapons/Ranged/Hellborn.cs b/Items/Weapons/Ranged/Hellborn.cs index bada6debe5..0dedc0af37 100644 --- a/Items/Weapons/Ranged/Hellborn.cs +++ b/Items/Weapons/Ranged/Hellborn.cs @@ -68,6 +68,7 @@ namespace CalamityMod.Items.Weapons.Ranged gunType = 5; Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, gunType); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); return false; diff --git a/Items/Weapons/Ranged/Infinity.cs b/Items/Weapons/Ranged/Infinity.cs index 7800bd11e1..6f702331f1 100644 --- a/Items/Weapons/Ranged/Infinity.cs +++ b/Items/Weapons/Ranged/Infinity.cs @@ -55,6 +55,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int shotType = (player.altFunctionUse == 2 ? type : ModContent.ProjectileType()); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction position = position + (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.UnitX) * 65; float sine = (float)Math.Sin(SineCounter * 0.175f / MathHelper.Pi) * 3.5f; SineCounter++; diff --git a/Items/Weapons/Ranged/Kingsbane.cs b/Items/Weapons/Ranged/Kingsbane.cs index 3532b9c371..1fd0f82a85 100644 --- a/Items/Weapons/Ranged/Kingsbane.cs +++ b/Items/Weapons/Ranged/Kingsbane.cs @@ -41,6 +41,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Projectile holdout = Projectile.NewProjectileDirect(source, position, velocity, Item.shoot, damage, knockback, player.whoAmI); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); return false; } diff --git a/Items/Weapons/Ranged/MagnaCannon.cs b/Items/Weapons/Ranged/MagnaCannon.cs index 92811a79ee..d31343d31b 100644 --- a/Items/Weapons/Ranged/MagnaCannon.cs +++ b/Items/Weapons/Ranged/MagnaCannon.cs @@ -52,6 +52,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 spawnPosition = player.RotatedRelativePoint(player.MountedCenter); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.NewProjectile(source, spawnPosition, player.Calamity().mouseWorld - player.RotatedRelativePoint(player.MountedCenter), ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/MineralMortar.cs b/Items/Weapons/Ranged/MineralMortar.cs index eac32ef156..17194984f0 100644 --- a/Items/Weapons/Ranged/MineralMortar.cs +++ b/Items/Weapons/Ranged/MineralMortar.cs @@ -44,6 +44,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 spawnPosition = player.RotatedRelativePoint(player.MountedCenter, true); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.NewProjectile(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, ModContent.ProjectileType(), 0, 0f, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/Norfleet.cs b/Items/Weapons/Ranged/Norfleet.cs index f2be5f037c..d0d0dbce72 100644 --- a/Items/Weapons/Ranged/Norfleet.cs +++ b/Items/Weapons/Ranged/Norfleet.cs @@ -59,7 +59,8 @@ namespace CalamityMod.Items.Weapons.Ranged } Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, (cheater ? 1000 : 0), loadedShots); - + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); diff --git a/Items/Weapons/Ranged/OntologicalDespoiler.cs b/Items/Weapons/Ranged/OntologicalDespoiler.cs index 71360ac356..2ce1cee044 100644 --- a/Items/Weapons/Ranged/OntologicalDespoiler.cs +++ b/Items/Weapons/Ranged/OntologicalDespoiler.cs @@ -69,6 +69,8 @@ namespace CalamityMod.Items.Weapons.Ranged if (Main.projectile.Any(n => n.active && n.type == Item.shoot && n.owner == player.whoAmI)) return false; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + if (player.Calamity().mouseRight && player.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse) { Projectile holdout2 = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, Item.shoot, player.ActiveItem().damage, 0f, player.whoAmI, 0, 0, 10 + (shotType ? 5 : 0)); diff --git a/Items/Weapons/Ranged/OpalStriker.cs b/Items/Weapons/Ranged/OpalStriker.cs index 18eddc2d04..e2abf396ac 100644 --- a/Items/Weapons/Ranged/OpalStriker.cs +++ b/Items/Weapons/Ranged/OpalStriker.cs @@ -51,6 +51,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 spawnPosition = player.RotatedRelativePoint(player.MountedCenter, true); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.NewProjectile(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/PristineFury.cs b/Items/Weapons/Ranged/PristineFury.cs index 2c4c89a136..e1aa81d309 100644 --- a/Items/Weapons/Ranged/PristineFury.cs +++ b/Items/Weapons/Ranged/PristineFury.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.Dusts; +using CalamityMod.Particles; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -10,12 +11,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - public class PristineFury : ModItem, ILocalizedModType + public class PristineFury : LegendaryItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; public int frameCounter = 0; public int frame = 0; public bool Trail = true; + public int shotCount = 0; + + public static int boomTime = 6; + + public override Color? TooltipExtensionColor => new Color(255, 140, 0); public override void SetStaticDefaults() { @@ -55,15 +61,19 @@ namespace CalamityMod.Items.Weapons.Ranged { if (player.altFunctionUse == 2) { - for (int i = 0; i < 2; i++) - { - Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(5f)); - Projectile.NewProjectile(source, position, newVel, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - } + Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(5f)); + Projectile.NewProjectile(source, position, newVel, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + + Dust dust = Dust.NewDustPerfect(position + velocity * 3f + new Vector2(0, -3), ModContent.DustType(), velocity.RotatedBy(0.25f * player.direction).RotatedByRandom(0.35f) * Main.rand.NextFloat(0.5f, 2.5f), 0, default, Main.rand.NextFloat(0.4f, 0.8f)); + dust.noGravity = true; + dust.color = Color.Orchid; + + CritSpark spark = new CritSpark(position + velocity * 3f + new Vector2(0, -3), velocity.RotatedBy(0.25f * player.direction).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.2f, 1.8f), Color.White, Color.Orchid, 0.9f, 18, 2f, 2.2f); + GeneralParticleHandler.SpawnParticle(spark); } else { - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, Trail ? 1 : 0); + Projectile.NewProjectile(source, position, velocity * 0.8f, type, damage, knockback, player.whoAmI, Trail ? 1 : 0, 0, shotCount); Trail = !Trail; for (int i = 0; i <= 2; i++) { @@ -72,6 +82,7 @@ namespace CalamityMod.Items.Weapons.Ranged } CritSpark spark = new CritSpark(position + velocity * 3f + new Vector2(0, -3), velocity.RotatedBy(0.25f * player.direction).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.2f, 1.8f), Main.rand.NextBool() ? Color.DarkOrange : Color.OrangeRed, Color.OrangeRed, 0.9f, 18, 2f, 1.9f); GeneralParticleHandler.SpawnParticle(spark); + shotCount += 1; } return false; } diff --git a/Items/Weapons/Ranged/Scorpio.cs b/Items/Weapons/Ranged/Scorpio.cs index 250db8b8fa..e4ea8b3ded 100644 --- a/Items/Weapons/Ranged/Scorpio.cs +++ b/Items/Weapons/Ranged/Scorpio.cs @@ -70,6 +70,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, -30); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); diff --git a/Items/Weapons/Ranged/StormDragoon.cs b/Items/Weapons/Ranged/StormDragoon.cs deleted file mode 100644 index 3ba81cc223..0000000000 --- a/Items/Weapons/Ranged/StormDragoon.cs +++ /dev/null @@ -1,56 +0,0 @@ -using CalamityMod.Rarities; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Ranged -{ - public class StormDragoon : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Ranged"; - public override void SetDefaults() - { - Item.width = 74; - Item.height = 34; - Item.damage = 96; - Item.DamageType = DamageClass.Ranged; - Item.useTime = 2; - Item.useAnimation = 20; - Item.reuseDelay = 10; - Item.useLimitPerAnimation = 10; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 3.25f; - Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.rare = ModContent.RarityType(); - Item.UseSound = SoundID.Item31; - Item.autoReuse = true; - Item.shoot = ProjectileID.PurificationPowder; - Item.shootSpeed = 18f; - Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-25, 0); - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - float SpeedX = velocity.X + (float)Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); - return false; - } - - public override bool CanConsumeAmmo(Item ammo, Player player) - { - if (Main.rand.Next(0, 100) < 90) - return false; - return true; - } - } -} diff --git a/Items/Weapons/Ranged/StormDragoon.png b/Items/Weapons/Ranged/StormDragoon.png deleted file mode 100644 index da8a466b98..0000000000 Binary files a/Items/Weapons/Ranged/StormDragoon.png and /dev/null differ diff --git a/Items/Weapons/Ranged/SuperradiantSlaughterer.cs b/Items/Weapons/Ranged/SuperradiantSlaughterer.cs index e0d0977f1c..8c44eeb865 100644 --- a/Items/Weapons/Ranged/SuperradiantSlaughterer.cs +++ b/Items/Weapons/Ranged/SuperradiantSlaughterer.cs @@ -100,6 +100,8 @@ namespace CalamityMod.Items.Weapons.Ranged int damage = (int)player.GetTotalDamage().ApplyTo(Item.damage); float kb = player.GetTotalKnockback().ApplyTo(Item.knockBack); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.NewProjectile(Item.GetSource_FromThis(), player.Center, player.SafeDirectionTo(player.Calamity().mouseWorld), Item.shoot, damage * 2, kb, player.whoAmI, ai1: 2f); } } diff --git a/Items/Weapons/Ranged/Svantechnical.cs b/Items/Weapons/Ranged/Svantechnical.cs index 234dd933ce..8694699bc9 100644 --- a/Items/Weapons/Ranged/Svantechnical.cs +++ b/Items/Weapons/Ranged/Svantechnical.cs @@ -54,6 +54,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int shotType = (player.altFunctionUse == 2 ? type : ModContent.ProjectileType()); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction position = position + (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.UnitX) * 65; float sine = (float)Math.Sin(SineCounter * 0.175f / MathHelper.Pi) * 4f; float sine2 = (float)Math.Sin(SineCounter * 0.275f / MathHelper.Pi) * 2f; diff --git a/Items/Weapons/Ranged/TelluricGlare.cs b/Items/Weapons/Ranged/TelluricGlare.cs index 95485b137b..3ed5d4cfe3 100644 --- a/Items/Weapons/Ranged/TelluricGlare.cs +++ b/Items/Weapons/Ranged/TelluricGlare.cs @@ -1,7 +1,10 @@ using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -10,16 +13,23 @@ namespace CalamityMod.Items.Weapons.Ranged public class TelluricGlare : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public int shots = 0; + public int frame = 0; + public int frameCounter = 0; + public override void SetStaticDefaults() + { + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(3, 5)); + ItemID.Sets.AnimatesAsSoul[Type] = true; + } public override void SetDefaults() { - Item.width = 54; - Item.height = 92; - Item.damage = 216; + Item.width = 74; + Item.height = 126; + Item.damage = 79; Item.DamageType = DamageClass.Ranged; - Item.useTime = 5; - Item.useAnimation = 20; - Item.reuseDelay = 23; - Item.useLimitPerAnimation = 4; + Item.useTime = 3; + Item.useAnimation = 25; + Item.useLimitPerAnimation = 8; Item.knockBack = 7.5f; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -27,20 +37,45 @@ namespace CalamityMod.Items.Weapons.Ranged Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); - Item.UseSound = SoundID.Item102; + Item.UseSound = null; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 18f; Item.useAmmo = AmmoID.Arrow; Item.Calamity().canFirePointBlankShots = true; } - public override Vector2? HoldoutOffset() => new Vector2(-14f, 0f); + public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() < 0.25f; + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture; + //0 = 6 frames, 8 = 3 frames] + texture = ModContent.Request(Texture).Value; + spriteBatch.Draw(texture, position, Item.GetCurrentFrame(ref frame, ref frameCounter, 3, 5), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture; + + texture = ModContent.Request(Texture).Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 3, 5), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + + return false; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Ranged/TelluricGlareGlow").Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 3, 5, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { // Always fires Radiant Arrows regardless of ammo used - type = Item.shoot; + //type = Item.shoot; // The arrow appears from a random location "on the bow". // They are also moved backwards so that they have some time to build up past positions. This helps make them not appear out of thin air. @@ -49,5 +84,20 @@ namespace CalamityMod.Items.Weapons.Ranged position += offset * Main.rand.NextFloat(-19f, 19f); position -= 3f * velocity; } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + bool isHolyArrow = CalamityUtils.CheckWoodenAmmo(type, player); + if (isHolyArrow) + type = Item.shoot; + if (shots % 2 == 0) + { + SoundStyle sound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash"); + SoundEngine.PlaySound(sound with { Volume = 0.25f, Pitch = Main.rand.NextFloat(-0.3f, -0.8f), MaxInstances = -1 }, player.Center); + type = Item.shoot; + } + Projectile.NewProjectile(source, position, velocity, type, (isHolyArrow ? (int)(damage * 1.2f) : damage), knockback, player.whoAmI); + shots++; + return false; + } } } diff --git a/Items/Weapons/Ranged/TelluricGlare.png b/Items/Weapons/Ranged/TelluricGlare.png index a4c34f0dbd..6090c78a53 100644 Binary files a/Items/Weapons/Ranged/TelluricGlare.png and b/Items/Weapons/Ranged/TelluricGlare.png differ diff --git a/Items/Weapons/Ranged/TelluricGlareGlow.png b/Items/Weapons/Ranged/TelluricGlareGlow.png new file mode 100644 index 0000000000..06ea41c2fb Binary files /dev/null and b/Items/Weapons/Ranged/TelluricGlareGlow.png differ diff --git a/Items/Weapons/Ranged/TheHive.cs b/Items/Weapons/Ranged/TheHive.cs index 5acf4b8106..a5365bc034 100644 --- a/Items/Weapons/Ranged/TheHive.cs +++ b/Items/Weapons/Ranged/TheHive.cs @@ -56,6 +56,7 @@ namespace CalamityMod.Items.Weapons.Ranged Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); diff --git a/Items/Weapons/Ranged/TheStorm.cs b/Items/Weapons/Ranged/TheStorm.cs index b9fd74ee14..83e6dd9282 100644 --- a/Items/Weapons/Ranged/TheStorm.cs +++ b/Items/Weapons/Ranged/TheStorm.cs @@ -1,8 +1,8 @@ -using System; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Ranged public class TheStorm : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public int shots = 0; public override void SetStaticDefaults() { @@ -22,19 +23,18 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 54; Item.height = 90; - Item.damage = 35; + Item.damage = 23; Item.DamageType = DamageClass.Ranged; - Item.useTime = 7; - Item.useAnimation = 14; + Item.useTime = 2; + Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); - Item.UseSound = SoundID.Item122; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 28f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Arrow; } @@ -42,65 +42,37 @@ namespace CalamityMod.Items.Weapons.Ranged { return new Vector2(-10, 0); } - + public override bool CanConsumeAmmo(Item ammo, Player player) + { + if (Main.rand.Next(0, 100) < 95) + return false; + return true; + } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int i = Main.myPlayer; - float arrowSpeed = Main.rand.Next(25, 30); - player.itemTime = Item.useTime; - Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - float mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (player.gravDir == -1f) - { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - mouseDistance = arrowSpeed; - } - else - { - mouseDistance = arrowSpeed / mouseDistance; - } + if (shots % 2 == 0) + SoundEngine.PlaySound(SoundID.Item122 with { Volume = 0.6f, PitchVariance = 0.2f }, position); - for (int j = 0; j < 3; j++) + for (int i = 0; i < 2; i++) { - realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - realPlayerPos.Y -= (float)(100 * j); - mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (mouseYDist < 0f) - { - mouseYDist *= -1f; - } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - mouseDistance = arrowSpeed / mouseDistance; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - float speedX4 = mouseXDist + (float)Main.rand.Next(-120, 121) * 0.01f; - float speedY5 = mouseYDist + (float)Main.rand.Next(-120, 121) * 0.01f; + float arrowVelAdjust = Main.rand.NextFloat(-40, 40); + Vector2 arrowSpawnPos = new Vector2(MathHelper.Lerp(player.Calamity().mouseWorld.X, player.Center.X, 0.5f), player.Center.Y) + new Vector2(arrowVelAdjust, Main.rand.NextFloat(-560, -660)); + Vector2 velAdjust = (player.Calamity().mouseWorld - arrowSpawnPos).SafeNormalize(velocity); + Vector2 arrowVel = (velAdjust).RotatedBy(arrowVelAdjust * -0.004f) * Item.shootSpeed; + if (CalamityUtils.CheckWoodenAmmo(type, player)) { - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5 * 0.9f, ModContent.ProjectileType(), damage, knockback, i); - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5 * 0.8f, ModContent.ProjectileType(), damage, knockback, i); + Projectile.NewProjectileDirect(source, arrowSpawnPos, arrowVel, ModContent.ProjectileType(), (int)(damage * (i == 0 ? 1.5f : 1f)), knockback, -1, i == 0 ? 5 : 0); } else { - int arrow1 = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5 * 0.9f, type, damage, knockback, i); - Main.projectile[arrow1].noDropItem = true; - int arrow2 = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5 * 0.8f, type, damage, knockback, i); - Main.projectile[arrow2].noDropItem = true; + Projectile arrow1 = Projectile.NewProjectileDirect(source, arrowSpawnPos, arrowVel, i == 0 ? ModContent.ProjectileType() : type, damage, knockback); + arrow1.noDropItem = true; + arrow1.tileCollide = false; } } + + shots++; return false; } } diff --git a/Items/Weapons/Ranged/WildfireBloom.cs b/Items/Weapons/Ranged/WildfireBloom.cs index d821089aeb..ce9ab240c8 100644 --- a/Items/Weapons/Ranged/WildfireBloom.cs +++ b/Items/Weapons/Ranged/WildfireBloom.cs @@ -51,6 +51,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Projectile holdout = Projectile.NewProjectileDirect(source, position, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); diff --git a/Items/Weapons/Ranged/WulfrumBlunderbuss.cs b/Items/Weapons/Ranged/WulfrumBlunderbuss.cs index f4f497569a..5b74101f5d 100644 --- a/Items/Weapons/Ranged/WulfrumBlunderbuss.cs +++ b/Items/Weapons/Ranged/WulfrumBlunderbuss.cs @@ -99,6 +99,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary due to the result being clamped float aimLength = (Main.MouseWorld - player.MountedCenter).Length(); float damageMult = MathHelper.Lerp(1f, MaxDamageFalloff, Math.Clamp(aimLength - MaxSpreadDistance, 0, MinSpreadDistance - MaxSpreadDistance) / (MinSpreadDistance - MaxSpreadDistance)); damage = (int)(damage * damageMult); @@ -109,6 +110,7 @@ namespace CalamityMod.Items.Weapons.Ranged if (player.Calamity().GeneralScreenShakePower < 3f) player.Calamity().GeneralScreenShakePower = 3f; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary due to the result being clamped float aimLength = (Main.MouseWorld - player.MountedCenter).Length(); float spreadDistance = Math.Clamp(aimLength - MaxSpreadDistance, 0, MinSpreadDistance - MaxSpreadDistance) / (MinSpreadDistance - MaxSpreadDistance); float spread = MathHelper.Lerp(MaxSpread, MinSpread, spreadDistance); diff --git a/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs index bd12133a97..4ce3f83911 100644 --- a/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs +++ b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs @@ -8,26 +8,19 @@ namespace CalamityMod.Items.Weapons.Rogue { public class AdamantiteThrowingAxe : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 30; Item.height = 40; Item.damage = 67; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 14; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 3.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = 1600; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; @@ -51,8 +44,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(150). - AddIngredient(ItemID.AdamantiteBar). + CreateRecipe(). + AddIngredient(ItemID.AdamantiteBar, 10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/BouncySpikyBall.cs b/Items/Weapons/Rogue/BouncySpikyBall.cs deleted file mode 100644 index 212f13a817..0000000000 --- a/Items/Weapons/Rogue/BouncySpikyBall.cs +++ /dev/null @@ -1,68 +0,0 @@ -using CalamityMod.Projectiles.Rogue; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class BouncySpikyBall : RogueWeapon - { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - - public override void SetDefaults() - { - Item.width = 14; - Item.height = 14; - Item.damage = 10; - Item.noMelee = true; - Item.noUseGraphic = true; - Item.useAnimation = 18; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 18; - Item.knockBack = 1f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 0, 1, 0); - Item.rare = ItemRarityID.Blue; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 8f; - Item.DamageType = RogueDamageClass.Instance; - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike - { - int spread = 3; - for (int i = 0; i < 4; i++) - { - Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3, 4), velocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, damage, knockback, player.whoAmI); - if (proj.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[proj].Calamity().stealthStrike = true; - } - spread -= Main.rand.Next(1, 4); - } - return false; - } - return true; - } - - public override void AddRecipes() - { - CreateRecipe(100). - AddIngredient(ItemID.SpikyBall, 100). - AddIngredient(ItemID.PinkGel). - AddTile(TileID.WorkBenches). - Register(); - } - } -} diff --git a/Items/Weapons/Rogue/BouncySpikyBall.png b/Items/Weapons/Rogue/BouncySpikyBall.png deleted file mode 100644 index d409a6b571..0000000000 Binary files a/Items/Weapons/Rogue/BouncySpikyBall.png and /dev/null differ diff --git a/Items/Weapons/Rogue/CobaltKunai.cs b/Items/Weapons/Rogue/CobaltKunai.cs index 3b2b74b77e..1fbc6ca7a2 100644 --- a/Items/Weapons/Rogue/CobaltKunai.cs +++ b/Items/Weapons/Rogue/CobaltKunai.cs @@ -8,26 +8,19 @@ namespace CalamityMod.Items.Weapons.Rogue { public class CobaltKunai : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 14; Item.height = 38; - Item.damage = 58; + Item.damage = 56; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = 900; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; @@ -56,8 +49,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(150). - AddIngredient(ItemID.CobaltBar). + CreateRecipe(). + AddIngredient(ItemID.CobaltBar, 10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/CrystalPiercer.cs b/Items/Weapons/Rogue/CrystalPiercer.cs index 62c1ed394d..f7b115b4da 100644 --- a/Items/Weapons/Rogue/CrystalPiercer.cs +++ b/Items/Weapons/Rogue/CrystalPiercer.cs @@ -10,26 +10,19 @@ namespace CalamityMod.Items.Weapons.Rogue { public class CrystalPiercer : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 62; Item.height = 62; Item.damage = 92; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 22; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 6f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = 2500; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; @@ -55,8 +48,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(150). - AddIngredient(). + CreateRecipe(). + AddIngredient(8). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/Crystalline.cs b/Items/Weapons/Rogue/Crystalline.cs index c7de2c3c34..74260456a7 100644 --- a/Items/Weapons/Rogue/Crystalline.cs +++ b/Items/Weapons/Rogue/Crystalline.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(50). + AddIngredient(). AddIngredient(ItemID.Diamond, 3). AddIngredient(ItemID.FallenStar, 3). AddTile(TileID.Anvils). diff --git a/Items/Weapons/Rogue/EnchantedAxe.cs b/Items/Weapons/Rogue/EnchantedAxe.cs index 129873e18f..187a61f645 100644 --- a/Items/Weapons/Rogue/EnchantedAxe.cs +++ b/Items/Weapons/Rogue/EnchantedAxe.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(100). + AddIngredient(). AddIngredient(ItemID.FallenStar, 5). AddIngredient(10). AddIngredient(ItemID.Bone, 30). @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Rogue Register(); CreateRecipe(). - AddIngredient(100). + AddIngredient(). AddIngredient(ItemID.FallenStar, 5). AddIngredient(10). AddIngredient(ItemID.Bone, 30). diff --git a/Items/Weapons/Rogue/FantasyTalisman.cs b/Items/Weapons/Rogue/FantasyTalisman.cs index f81beacc1d..aad9aeb1d9 100644 --- a/Items/Weapons/Rogue/FantasyTalisman.cs +++ b/Items/Weapons/Rogue/FantasyTalisman.cs @@ -10,53 +10,55 @@ namespace CalamityMod.Items.Weapons.Rogue { public class FantasyTalisman : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 30; Item.height = 30; - Item.damage = 82; + Item.damage = 52; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; - Item.useAnimation = 16; - Item.useTime = 16; + Item.useAnimation = 25; + Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 6f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 0, 60, 0); + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 16.5f; + Item.shootSpeed = 18f; Item.DamageType = RogueDamageClass.Instance; } - - public override float StealthDamageMultiplier => 0.8f; - + public override float StealthDamageMultiplier => 0.7f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + if (!player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - if (stealth.WithinBounds(Main.maxProjectiles)) - Main.projectile[stealth].Calamity().stealthStrike = true; - return false; + for (int i = -1; i <= 1; i++) + { + Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i * 6f)); + Projectile.NewProjectile(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); + } + } + else if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + { + for (int i = -1; i <= 1; i++) + { + Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i * 5f)); + int stealth = Projectile.NewProjectile(source, position, perturbedSpeed, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; + } } return true; } public override void AddRecipes() { - CreateRecipe(150). - AddIngredient(3). - AddIngredient(ItemID.Silk). - AddIngredient(ItemID.Ectoplasm). + CreateRecipe(). + AddIngredient(10). + AddIngredient(ItemID.Silk, 10). + AddIngredient(ItemID.Ectoplasm, 5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/FeatherKnife.cs b/Items/Weapons/Rogue/FeatherKnife.cs index 3688488e55..756ef3c40a 100644 --- a/Items/Weapons/Rogue/FeatherKnife.cs +++ b/Items/Weapons/Rogue/FeatherKnife.cs @@ -10,11 +10,6 @@ namespace CalamityMod.Items.Weapons.Rogue { public class FeatherKnife : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 18; @@ -22,21 +17,20 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noMelee = true; Item.noUseGraphic = true; - Item.damage = 18; + Item.damage = 25; Item.useAnimation = Item.useTime = 20; Item.knockBack = 2f; Item.autoReuse = true; - Item.consumable = true; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; - Item.maxStack = 9999; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 25f; Item.DamageType = RogueDamageClass.Instance; - Item.value = Item.sellPrice(copper: 60); + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; } + public override float StealthDamageMultiplier => 0.7f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { @@ -59,8 +53,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). - AddIngredient(). + CreateRecipe(). + AddIngredient(6). + AddIngredient(ItemID.SunplateBlock, 4). AddTile(TileID.SkyMill). Register(); } diff --git a/Items/Weapons/Rogue/GelDart.cs b/Items/Weapons/Rogue/GelDart.cs index 46abfb7598..c01f1fb608 100644 --- a/Items/Weapons/Rogue/GelDart.cs +++ b/Items/Weapons/Rogue/GelDart.cs @@ -11,18 +11,12 @@ namespace CalamityMod.Items.Weapons.Rogue { public class GelDart : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 26; Item.height = 54; - Item.damage = 28; + Item.damage = 21; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = 11; Item.useStyle = ItemUseStyleID.Swing; @@ -30,13 +24,13 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 0, 2, 50); + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; Item.DamageType = RogueDamageClass.Instance; } + public override float StealthDamageMultiplier => 1.5f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { @@ -57,9 +51,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). - AddIngredient(2). - AddIngredient(2). + CreateRecipe(). + AddIngredient(18). + AddIngredient(18). AddTile(). Register(); } diff --git a/Items/Weapons/Rogue/HardenedHoneycomb.cs b/Items/Weapons/Rogue/HardenedHoneycomb.cs index 85cc054a52..2042fcee4d 100644 --- a/Items/Weapons/Rogue/HardenedHoneycomb.cs +++ b/Items/Weapons/Rogue/HardenedHoneycomb.cs @@ -20,15 +20,13 @@ namespace CalamityMod.Items.Weapons.Rogue Item.height = 32; Item.damage = 19; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 18; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 3f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = 300; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; @@ -51,10 +49,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). - AddIngredient(ItemID.Hive). - AddIngredient(ItemID.CrispyHoneyBlock). - AddIngredient(ItemID.BeeWax). + CreateRecipe(). + AddIngredient(ItemID.Hive, 10). + AddIngredient(ItemID.BeeWax, 8). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/HellsSun.cs b/Items/Weapons/Rogue/HellsSun.cs deleted file mode 100644 index 9d23b85f76..0000000000 --- a/Items/Weapons/Rogue/HellsSun.cs +++ /dev/null @@ -1,85 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Rogue; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class HellsSun : RogueWeapon - { - public override void SetDefaults() - { - Item.width = 22; - Item.height = 18; - Item.damage = 200; - Item.DamageType = RogueDamageClass.Instance; - Item.noMelee = true; - Item.noUseGraphic = true; - Item.useTime = 15; - Item.useAnimation = 15; - Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 5; - Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; - Item.rare = ItemRarityID.Purple; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - - Item.shootSpeed = 5f; - Item.shoot = ModContent.ProjectileType(); - } - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - Item.shoot = ProjectileID.None; - return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; - } - else - { - Item.shoot = ModContent.ProjectileType(); - return player.ownedProjectileCounts[ModContent.ProjectileType()] < 10; - } - } - - public override float StealthDamageMultiplier => 0.10f; - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.killSpikyBalls = false; - if (modPlayer.StealthStrikeAvailable()) //setting the stealth strike - { - int stealth = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - if (stealth.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].penetrate = -1; - Main.projectile[stealth].timeLeft = 2400; - } - return false; - } - return true; - } - - public override bool AltFunctionUse(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.killSpikyBalls = true; - return true; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.LunarBar, 10). - AddIngredient(20). - AddTile(TileID.LunarCraftingStation). - Register(); - } - } -} diff --git a/Items/Weapons/Rogue/HellsSun.png b/Items/Weapons/Rogue/HellsSun.png deleted file mode 100644 index 130f9037b4..0000000000 Binary files a/Items/Weapons/Rogue/HellsSun.png and /dev/null differ diff --git a/Items/Weapons/Rogue/IceStar.cs b/Items/Weapons/Rogue/IceStar.cs index 1f54f0333e..d7cf231cb7 100644 --- a/Items/Weapons/Rogue/IceStar.cs +++ b/Items/Weapons/Rogue/IceStar.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.width = Item.height = 66; Item.damage = 45; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Swing; @@ -27,7 +26,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; Item.value = Item.buyPrice(0, 0, 5, 0); Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Rogue/InfernalKris.cs b/Items/Weapons/Rogue/InfernalKris.cs index f5da2f4637..eacb33e1bc 100644 --- a/Items/Weapons/Rogue/InfernalKris.cs +++ b/Items/Weapons/Rogue/InfernalKris.cs @@ -9,27 +9,20 @@ namespace CalamityMod.Items.Weapons.Rogue { public class InfernalKris : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 32; Item.height = 38; - Item.damage = 24; + Item.damage = 23; Item.noMelee = true; Item.noUseGraphic = true; - Item.consumable = true; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 18; Item.knockBack = 1f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 0, 5, 0); + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; @@ -50,9 +43,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). - AddIngredient(ItemID.HellstoneBar). - AddIngredient(ItemID.Obsidian, 2). + CreateRecipe(). + AddIngredient(ItemID.HellstoneBar, 10). + AddIngredient(ItemID.Obsidian, 9). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/IronFrancisca.cs b/Items/Weapons/Rogue/IronFrancisca.cs index 57c08f19f8..bc128f5463 100644 --- a/Items/Weapons/Rogue/IronFrancisca.cs +++ b/Items/Weapons/Rogue/IronFrancisca.cs @@ -9,33 +9,26 @@ namespace CalamityMod.Items.Weapons.Rogue { public class IronFrancisca : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 40; Item.height = 36; - Item.damage = 14; + Item.damage = 9; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; - Item.useAnimation = 15; + Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 15; + Item.useTime = 20; Item.knockBack = 1f; Item.UseSound = SoundID.Item1; Item.autoReuse = false; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 0, 1, 0); + Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; Item.rare = ItemRarityID.White; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; Item.DamageType = RogueDamageClass.Instance; } - + public override float StealthDamageMultiplier => 3f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) @@ -53,9 +46,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). - AddIngredient(ItemID.IronBar). - AddIngredient(ItemID.Wood). + CreateRecipe(). + AddIngredient(ItemID.IronBar, 7). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/LeadTomahawk.cs b/Items/Weapons/Rogue/LeadTomahawk.cs index 0f2d6b59e9..d07c9ea8e1 100644 --- a/Items/Weapons/Rogue/LeadTomahawk.cs +++ b/Items/Weapons/Rogue/LeadTomahawk.cs @@ -9,33 +9,26 @@ namespace CalamityMod.Items.Weapons.Rogue { public class LeadTomahawk : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 40; Item.height = 36; - Item.damage = 14; + Item.damage = 10; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; - Item.useAnimation = 15; + Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 15; + Item.useTime = 20; Item.knockBack = 1f; Item.UseSound = SoundID.Item1; Item.autoReuse = false; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 0, 1, 0); + Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; Item.rare = ItemRarityID.White; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; Item.DamageType = RogueDamageClass.Instance; } - + public override float StealthDamageMultiplier => 3f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) @@ -53,9 +46,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). - AddIngredient(ItemID.LeadBar). - AddIngredient(ItemID.Wood). + CreateRecipe(). + AddIngredient(ItemID.LeadBar, 7). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/LunarKunai.cs b/Items/Weapons/Rogue/LunarKunai.cs index f55470e5ac..3820751c04 100644 --- a/Items/Weapons/Rogue/LunarKunai.cs +++ b/Items/Weapons/Rogue/LunarKunai.cs @@ -10,18 +10,11 @@ namespace CalamityMod.Items.Weapons.Rogue { public class LunarKunai : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 38; Item.height = 38; Item.damage = 112; - Item.maxStack = 9999; - Item.consumable = true; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 10; @@ -30,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 2f; Item.UseSound = SoundID.Item39; Item.autoReuse = true; - Item.value = Item.sellPrice(copper: 24); + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 22f; @@ -84,7 +77,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(333). + CreateRecipe(). AddIngredient(ItemID.LunarBar, 5). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Weapons/Rogue/MoltenAmputator.cs b/Items/Weapons/Rogue/MoltenAmputator.cs index 4f81f42ffc..6b61c1d864 100644 --- a/Items/Weapons/Rogue/MoltenAmputator.cs +++ b/Items/Weapons/Rogue/MoltenAmputator.cs @@ -1,7 +1,10 @@ -using CalamityMod.Projectiles.Rogue; +using System; +using CalamityMod.Dusts; +using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -10,40 +13,82 @@ namespace CalamityMod.Items.Weapons.Rogue { public class MoltenAmputator : RogueWeapon { - public const float Speed = 21f; - + public float speed = 16; public override void SetDefaults() { - Item.width = 60; - Item.height = 60; - Item.damage = 166; + Item.width = 92; + Item.height = 80; + Item.damage = 200; Item.noMelee = true; Item.noUseGraphic = true; Item.autoReuse = true; - Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 18; - Item.knockBack = 9f; - Item.UseSound = SoundID.Item1; + Item.useTime = Item.useAnimation = 25; + Item.knockBack = 2f; // It needs to be low otherwise enemies dont stay in the slash zone Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = Speed; + Item.shootSpeed = speed; Item.DamageType = RogueDamageClass.Instance; } + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + if (player.Calamity().mouseRight) + { + if (player.Calamity().StealthStrikeAvailable()) + { + player.Calamity().amputatorBuff = 30; + player.Calamity().ConsumeStealthByAttacking(); + SoundStyle buff = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRay"); + SoundEngine.PlaySound(buff with { Volume = 1f, Pitch = Main.rand.NextFloat(0.2f, 0.3f) }, player.Center); - public override float StealthDamageMultiplier => 1.07f; - + for (int i = 0; i < 20; i++) + { + Dust c = Dust.NewDustPerfect(player.Center, ModContent.DustType()); + c.velocity = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 15.5f * (i % 2 == 0 ? 0.88f : 1f); + c.scale = Main.rand.NextFloat(1.3f, 1.6f) * 0.8f * (i % 2 == 0 ? 2.2f : 1.8f); + c.noGravity = true; + c.color = Color.Goldenrod; + c.noLightEmittence = true; + } + } + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[2] < 5 && projectile.timeLeft < 840) + { + projectile.ai[2] = 5; + SoundStyle pullback = new("CalamityMod/Sounds/Item/SwingMid"); + SoundEngine.PlaySound(pullback with { Volume = 0.4f, Pitch = Main.rand.NextFloat(0.4f, 0.5f) }, player.Center); + } + } + } + } + public override float UseSpeedMultiplier(Player player) + { + return (player.Calamity().amputatorBuff > 0 ? 3f : 1); + } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.Calamity().StealthStrikeAvailable()) + bool fastToss = player.Calamity().amputatorBuff > 0; + + SoundStyle fire = new("CalamityMod/Sounds/Item/SpearofDestiny"); + SoundEngine.PlaySound(fire with { Volume = 0.5f, Pitch = (player.Calamity().amputatorBuff > 0 ? -0.4f + (player.Calamity().amputatorBuff * 0.02f) : Main.rand.NextFloat(-0.4f, -0.65f)) }, position); + // Since the positioning of the scythe is important, its velocity is based on your mouse position + Vector2 staticSpeed = Utils.DirectionTo(position, position + velocity) * Utils.Distance(position, player.ClampedMouseWorld()) * 0.022f; + // "fast toss" is the stealth, if you need to change stealth values, change those + int fastTossDamage = (int)(damage * 0.65f); + Projectile scythe = Projectile.NewProjectileDirect(source, position, staticSpeed.RotatedByRandom((player.Calamity().amputatorBuff > 0 ? 0.7f : 0)), type, fastToss ? fastTossDamage : damage, knockback, player.whoAmI, 0, 0, 0); + if (fastToss) { - int ss = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (ss.WithinBounds(Main.maxProjectiles)) - Main.projectile[ss].Calamity().stealthStrike = true; - return false; + scythe.extraUpdates = 6; + scythe.Calamity().stealthStrike = true; + player.Calamity().amputatorBuff--; } - return true; + player.Calamity().ConsumeStealthByAttacking(); + + return false; } } } diff --git a/Items/Weapons/Rogue/MoltenAmputator.png b/Items/Weapons/Rogue/MoltenAmputator.png index 4e44d58710..675411c959 100644 Binary files a/Items/Weapons/Rogue/MoltenAmputator.png and b/Items/Weapons/Rogue/MoltenAmputator.png differ diff --git a/Items/Weapons/Rogue/MonkeyDarts.cs b/Items/Weapons/Rogue/MonkeyDarts.cs deleted file mode 100644 index bfadd571b7..0000000000 --- a/Items/Weapons/Rogue/MonkeyDarts.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using CalamityMod.Projectiles.Rogue; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class MonkeyDarts : RogueWeapon - { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - - public override void SetDefaults() - { - Item.width = 27; - Item.height = 27; - Item.damage = 150; - Item.knockBack = 4; - Item.noMelee = true; - Item.noUseGraphic = true; - Item.consumable = true; - Item.maxStack = 9999; - Item.useStyle = ItemUseStyleID.Swing; - Item.UseSound = SoundID.Item1; - Item.useTime = 20; - Item.useAnimation = 20; - Item.value = Item.buyPrice(0, 0, 4, 0); - Item.rare = ItemRarityID.Lime; - Item.shootSpeed = 12f; - Item.shoot = ModContent.ProjectileType(); - Item.autoReuse = true; - Item.DamageType = RogueDamageClass.Instance; - } - - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 18; - - public override float StealthDamageMultiplier => 0.8f; - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - //Checks if stealth is avalaible to shoot a spread of 3 darts - if (player.Calamity().StealthStrikeAvailable()) - { - float spread = 7; - for (int i = 0; i < 3; i++) - { - Vector2 perturbedspeed = new Vector2(velocity.X * 1.25f, velocity.Y * 1.25f).RotatedBy(MathHelper.ToRadians(spread)); - int p = Projectile.NewProjectile(source, position, perturbedspeed, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 1); - if (p.WithinBounds(Main.maxProjectiles)) - Main.projectile[p].Calamity().stealthStrike = true; - spread -= 7; - } - return false; - } - - else - { - return true; - } - } - - } -} diff --git a/Items/Weapons/Rogue/MonkeyDarts.png b/Items/Weapons/Rogue/MonkeyDarts.png deleted file mode 100644 index f5f895427b..0000000000 Binary files a/Items/Weapons/Rogue/MonkeyDarts.png and /dev/null differ diff --git a/Items/Weapons/Rogue/MythrilKnife.cs b/Items/Weapons/Rogue/MythrilKnife.cs index 8d63d39313..b7be65a638 100644 --- a/Items/Weapons/Rogue/MythrilKnife.cs +++ b/Items/Weapons/Rogue/MythrilKnife.cs @@ -8,18 +8,12 @@ namespace CalamityMod.Items.Weapons.Rogue { public class MythrilKnife : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 12; Item.height = 40; Item.damage = 80; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = 10; Item.useStyle = ItemUseStyleID.Swing; @@ -27,8 +21,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 1.75f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = 1100; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; @@ -49,8 +42,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(150). - AddIngredient(ItemID.MythrilBar). + CreateRecipe(). + AddIngredient(ItemID.MythrilBar, 10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/NastyCholla.cs b/Items/Weapons/Rogue/NastyCholla.cs index 3798f96f9f..4149843acd 100644 --- a/Items/Weapons/Rogue/NastyCholla.cs +++ b/Items/Weapons/Rogue/NastyCholla.cs @@ -9,28 +9,19 @@ namespace CalamityMod.Items.Weapons.Rogue { public class NastyCholla : RogueWeapon { - public static int BaseDamage = 15; - - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 20; Item.height = 18; - Item.damage = BaseDamage; + Item.damage = 10; Item.noMelee = true; Item.noUseGraphic = true; - Item.maxStack = 9999; - Item.consumable = true; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 20; Item.knockBack = 3f; Item.UseSound = SoundID.Item1; - Item.value = Item.buyPrice(0, 0, 0, 50); + Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; Item.rare = ItemRarityID.White; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8f; @@ -60,8 +51,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(10). - AddIngredient(ItemID.Cactus). + CreateRecipe(). + AddIngredient(ItemID.Cactus, 8). AddTile(TileID.WorkBenches). Register(); } diff --git a/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs index 2afca45b5a..54fb0625e8 100644 --- a/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs +++ b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs @@ -8,26 +8,19 @@ namespace CalamityMod.Items.Weapons.Rogue { public class OrichalcumSpikedGemstone : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 14; Item.height = 34; Item.damage = 40; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 13; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 2f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = 1200; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; @@ -51,8 +44,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(150). - AddIngredient(ItemID.OrichalcumBar). + CreateRecipe(). + AddIngredient(ItemID.OrichalcumBar, 10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/PalladiumJavelin.cs b/Items/Weapons/Rogue/PalladiumJavelin.cs index 52d8b1209a..d05f728ce9 100644 --- a/Items/Weapons/Rogue/PalladiumJavelin.cs +++ b/Items/Weapons/Rogue/PalladiumJavelin.cs @@ -8,26 +8,19 @@ namespace CalamityMod.Items.Weapons.Rogue { public class PalladiumJavelin : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 54; Item.height = 54; Item.damage = 118; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 5.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = 1200; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; @@ -47,8 +40,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(150). - AddIngredient(ItemID.PalladiumBar). + CreateRecipe(). + AddIngredient(ItemID.PalladiumBar, 10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/Plaguenade.cs b/Items/Weapons/Rogue/Plaguenade.cs index 698346355d..bbab821611 100644 --- a/Items/Weapons/Rogue/Plaguenade.cs +++ b/Items/Weapons/Rogue/Plaguenade.cs @@ -10,11 +10,6 @@ namespace CalamityMod.Items.Weapons.Rogue { public class Plaguenade : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 20; @@ -22,15 +17,13 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 63; Item.noMelee = true; Item.noUseGraphic = true; - Item.consumable = true; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 15; Item.knockBack = 1.5f; - Item.maxStack = 9999; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(gold: 1); + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); @@ -52,9 +45,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(150). - AddIngredient(ItemID.Beenade, 30). - AddIngredient(5). + CreateRecipe(). + AddIngredient(ItemID.Beenade, 100). + AddIngredient(15). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/PoisonPack.cs b/Items/Weapons/Rogue/PoisonPack.cs deleted file mode 100644 index 858e9aff61..0000000000 --- a/Items/Weapons/Rogue/PoisonPack.cs +++ /dev/null @@ -1,82 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Rogue; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class PoisonPack : RogueWeapon - { - private static float baseKnockback = 1.8f; - - public override void SetDefaults() - { - Item.width = 14; - Item.height = 14; - Item.damage = 20; - Item.DamageType = RogueDamageClass.Instance; - Item.noMelee = true; - Item.noUseGraphic = true; - Item.useTime = 19; - Item.useAnimation = 19; - Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = baseKnockback; - Item.value = CalamityGlobalItem.RarityBlueBuyPrice; - Item.rare = ItemRarityID.Blue; - Item.UseSound = SoundID.Item1; - - Item.shootSpeed = 7f; - Item.shoot = ModContent.ProjectileType(); - } - - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 4; - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - Item.shoot = ProjectileID.None; - return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; - } - else - { - Item.shoot = ModContent.ProjectileType(); - return player.ownedProjectileCounts[ModContent.ProjectileType()] < 3; - } - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.killSpikyBalls = false; - if (modPlayer.StealthStrikeAvailable()) //setting the stealth strike - { - int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (stealth.WithinBounds(Main.maxProjectiles)) - Main.projectile[stealth].Calamity().stealthStrike = true; - return false; - } - return true; - } - - public override bool AltFunctionUse(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.killSpikyBalls = true; - return true; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.JungleSpores, 10). - AddIngredient(ItemID.Stinger, 8). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/Rogue/PoisonPack.png b/Items/Weapons/Rogue/PoisonPack.png deleted file mode 100644 index ba811c24d2..0000000000 Binary files a/Items/Weapons/Rogue/PoisonPack.png and /dev/null differ diff --git a/Items/Weapons/Rogue/ProfanedPartisan.cs b/Items/Weapons/Rogue/ProfanedPartisan.cs index 1a0b20520d..c6d2aec7aa 100644 --- a/Items/Weapons/Rogue/ProfanedPartisan.cs +++ b/Items/Weapons/Rogue/ProfanedPartisan.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 56; Item.height = 56; - Item.damage = 322; + Item.damage = 222; Item.knockBack = 8f; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; @@ -51,8 +51,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(500). - AddIngredient(4). + AddIngredient(). AddIngredient(25). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Weapons/Rogue/RotBall.cs b/Items/Weapons/Rogue/RotBall.cs index 9d76091a63..89cf7dcd29 100644 --- a/Items/Weapons/Rogue/RotBall.cs +++ b/Items/Weapons/Rogue/RotBall.cs @@ -10,18 +10,12 @@ namespace CalamityMod.Items.Weapons.Rogue { public class RotBall : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 30; Item.height = 30; - Item.damage = 24; + Item.damage = 20; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = 16; Item.useStyle = ItemUseStyleID.Swing; @@ -29,8 +23,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = 1000; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; @@ -57,10 +50,10 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). - AddIngredient(ItemID.DemoniteBar). - AddIngredient(). - AddIngredient(ItemID.RottenChunk). + CreateRecipe(). + AddIngredient(ItemID.DemoniteBar, 4). + AddIngredient(12). + AddIngredient(ItemID.RottenChunk, 4). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Weapons/Rogue/ShockGrenade.cs b/Items/Weapons/Rogue/ShockGrenade.cs index 0afc12fa2d..5762ddd8c9 100644 --- a/Items/Weapons/Rogue/ShockGrenade.cs +++ b/Items/Weapons/Rogue/ShockGrenade.cs @@ -10,11 +10,6 @@ namespace CalamityMod.Items.Weapons.Rogue { public class ShockGrenade : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 14; @@ -22,13 +17,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 108; Item.noMelee = true; Item.noUseGraphic = true; - Item.consumable = true; Item.useAnimation = Item.useTime = 18; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 1f; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = Item.buyPrice(0, 1, 0, 0); + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12.5f; @@ -51,15 +44,5 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Rogue/ShockGrenadeGlow").Value); } - - public override void AddRecipes() - { - CreateRecipe(150). - AddIngredient(ItemID.Grenade, 30). - AddIngredient(ItemID.MartianConduitPlating, 5). - AddIngredient(ItemID.Nanites, 5). - AddTile(TileID.WorkBenches). - Register(); - } } } diff --git a/Items/Weapons/Rogue/SludgeSplotch.cs b/Items/Weapons/Rogue/SludgeSplotch.cs index f35fe11b61..d3f9b71e46 100644 --- a/Items/Weapons/Rogue/SludgeSplotch.cs +++ b/Items/Weapons/Rogue/SludgeSplotch.cs @@ -11,26 +11,19 @@ namespace CalamityMod.Items.Weapons.Rogue { public class SludgeSplotch : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 32; Item.height = 30; - Item.damage = 48; + Item.damage = 41; Item.noMelee = true; Item.noUseGraphic = true; - Item.consumable = true; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 18; Item.knockBack = 1f; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = Item.sellPrice(0, 0, 0, 40); + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; @@ -56,9 +49,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). - AddIngredient(15). - AddRecipeGroup("Boss2Material"). + CreateRecipe(). + AddIngredient(50). + AddRecipeGroup("Boss2Material", 8). Register(); } } diff --git a/Items/Weapons/Rogue/StickySpikyBall.cs b/Items/Weapons/Rogue/StickySpikyBall.cs deleted file mode 100644 index 40d52883b8..0000000000 --- a/Items/Weapons/Rogue/StickySpikyBall.cs +++ /dev/null @@ -1,69 +0,0 @@ -using CalamityMod.Projectiles.Rogue; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class StickySpikyBall : RogueWeapon - { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - - public override void SetDefaults() - { - Item.width = 14; - Item.height = 14; - Item.damage = 10; - Item.noMelee = true; - Item.noUseGraphic = true; - Item.maxStack = 9999; - Item.consumable = true; - Item.useAnimation = 20; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 20; - Item.knockBack = 3f; - Item.UseSound = SoundID.Item1; - Item.value = Item.buyPrice(0, 0, 1, 0); - Item.rare = ItemRarityID.Blue; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 8f; - Item.DamageType = RogueDamageClass.Instance; - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike - { - int spread = 3; - for (int i = 0; i < 4; i++) - { - Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3, 4), velocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, damage, knockback, player.whoAmI); - if (proj.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[proj].Calamity().stealthStrike = true; - Main.projectile[proj].timeLeft *= 4; - Main.projectile[proj].localNPCHitCooldown += 15; - } - spread -= Main.rand.Next(1, 4); - } - return false; - } - return true; - } - - public override void AddRecipes() - { - CreateRecipe(100). - AddIngredient(ItemID.SpikyBall, 100). - AddIngredient(ItemID.Gel). - AddTile(TileID.WorkBenches). - Register(); - } - } -} diff --git a/Items/Weapons/Rogue/StickySpikyBall.png b/Items/Weapons/Rogue/StickySpikyBall.png deleted file mode 100644 index 6d92f61274..0000000000 Binary files a/Items/Weapons/Rogue/StickySpikyBall.png and /dev/null differ diff --git a/Items/Weapons/Rogue/TarragonThrowingDart.cs b/Items/Weapons/Rogue/TarragonThrowingDart.cs index 36cf6c2268..cc2beb46e3 100644 --- a/Items/Weapons/Rogue/TarragonThrowingDart.cs +++ b/Items/Weapons/Rogue/TarragonThrowingDart.cs @@ -11,18 +11,12 @@ namespace CalamityMod.Items.Weapons.Rogue { public class TarragonThrowingDart : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 34; Item.height = 34; Item.damage = 380; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = 11; Item.useStyle = ItemUseStyleID.Swing; @@ -30,8 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 4.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = Item.sellPrice(copper: 30); + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; Item.DamageType = RogueDamageClass.Instance; @@ -52,8 +45,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(333). - AddIngredient(). + CreateRecipe(). + AddIngredient(12). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Rogue/TitaniumShuriken.cs b/Items/Weapons/Rogue/TitaniumShuriken.cs index 9c6f50b5a9..99a9d10b37 100644 --- a/Items/Weapons/Rogue/TitaniumShuriken.cs +++ b/Items/Weapons/Rogue/TitaniumShuriken.cs @@ -8,18 +8,12 @@ namespace CalamityMod.Items.Weapons.Rogue { public class TitaniumShuriken : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 34; Item.height = 34; Item.damage = 41; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = 9; Item.useStyle = ItemUseStyleID.Swing; @@ -27,8 +21,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 3f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = 2000; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; @@ -60,8 +53,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(150). - AddIngredient(ItemID.TitaniumBar). + CreateRecipe(). + AddIngredient(ItemID.TitaniumBar, 10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/ToothBall.cs b/Items/Weapons/Rogue/ToothBall.cs index 593ca377c3..2799f984b0 100644 --- a/Items/Weapons/Rogue/ToothBall.cs +++ b/Items/Weapons/Rogue/ToothBall.cs @@ -10,18 +10,12 @@ namespace CalamityMod.Items.Weapons.Rogue { public class ToothBall : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 30; Item.height = 30; - Item.damage = 24; + Item.damage = 20; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useAnimation = 16; Item.useStyle = ItemUseStyleID.Swing; @@ -29,8 +23,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = 1000; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; @@ -57,10 +50,10 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). - AddIngredient(ItemID.CrimtaneBar). - AddIngredient(). - AddIngredient(ItemID.Vertebrae). + CreateRecipe(). + AddIngredient(ItemID.CrimtaneBar, 4). + AddIngredient(12). + AddIngredient(ItemID.Vertebrae, 4). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Weapons/Rogue/WaveSkipper.cs b/Items/Weapons/Rogue/WaveSkipper.cs index 84d53b3f01..8b13ced2b3 100644 --- a/Items/Weapons/Rogue/WaveSkipper.cs +++ b/Items/Weapons/Rogue/WaveSkipper.cs @@ -40,6 +40,7 @@ namespace CalamityMod.Items.Weapons.Rogue { for (int i = -SpreadAngle; i < SpreadAngle * 2; i += SpreadAngle) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 spreadVelocity = player.SafeDirectionTo(Main.MouseWorld).RotatedBy(MathHelper.ToRadians(i)) * Item.shootSpeed; int stealth = Projectile.NewProjectile(source, position, spreadVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) diff --git a/Items/Weapons/Rogue/WebBall.cs b/Items/Weapons/Rogue/WebBall.cs index b74226f9f3..146b03b4f7 100644 --- a/Items/Weapons/Rogue/WebBall.cs +++ b/Items/Weapons/Rogue/WebBall.cs @@ -9,26 +9,19 @@ namespace CalamityMod.Items.Weapons.Rogue { public class WebBall : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 20; Item.height = 18; - Item.damage = 12; + Item.damage = 11; Item.noMelee = true; Item.noUseGraphic = true; - Item.maxStack = 9999; - Item.consumable = true; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 20; Item.knockBack = 3f; Item.UseSound = SoundID.Item1; - Item.value = Item.buyPrice(0, 0, 0, 30); + Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; Item.rare = ItemRarityID.White; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6.5f; @@ -49,8 +42,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(50). - AddIngredient(ItemID.Cobweb, 10). + CreateRecipe(). + AddIngredient(ItemID.Cobweb, 30). Register(); } } diff --git a/Items/Weapons/Rogue/Whitewater.cs b/Items/Weapons/Rogue/Whitewater.cs index c5d57042a6..5666a8cdbd 100644 --- a/Items/Weapons/Rogue/Whitewater.cs +++ b/Items/Weapons/Rogue/Whitewater.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 36; Item.height = 40; - Item.damage = 97; + Item.damage = 90; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 42; diff --git a/Items/Weapons/Rogue/WulfrumKnife.cs b/Items/Weapons/Rogue/WulfrumKnife.cs index 056ec51dd4..57a97d0e19 100644 --- a/Items/Weapons/Rogue/WulfrumKnife.cs +++ b/Items/Weapons/Rogue/WulfrumKnife.cs @@ -12,15 +12,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class WulfrumKnife : RogueWeapon { - public static readonly SoundStyle Throw3Sound = new("CalamityMod/Sounds/Item/WulfrumKnifeThrowFull") { PitchVariance = 0.4f }; - public static readonly SoundStyle Throw2Sound = new("CalamityMod/Sounds/Item/WulfrumKnifeThrowTwo") { PitchVariance = 0.4f }; - public static readonly SoundStyle Throw1Sound = new("CalamityMod/Sounds/Item/WulfrumKnifeThrowSingle") { PitchVariance = 0.4f }; - public static readonly SoundStyle TileHitSound = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit", 2) { PitchVariance = 0.4f, MaxInstances = 3 }; - - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } + public static readonly SoundStyle Throw3Sound = new("CalamityMod/Sounds/Item/WulfrumKnifeThrowFull") { Volume = 0.7f, PitchVariance = 0.4f }; + public static readonly SoundStyle Throw2Sound = new("CalamityMod/Sounds/Item/WulfrumKnifeThrowTwo") { Volume = 0.7f, PitchVariance = 0.4f }; + public static readonly SoundStyle Throw1Sound = new("CalamityMod/Sounds/Item/WulfrumKnifeThrowSingle") { Volume = 0.7f, PitchVariance = 0.4f }; + public static readonly SoundStyle TileHitSound = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit", 2) { Volume = 0.7f, PitchVariance = 0.4f, MaxInstances = 3 }; public int shootCount = 0; public bool stealthStrikeStarted = false; @@ -29,9 +24,8 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 22; Item.height = 38; - Item.damage = 9; + Item.damage = 11; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; //Clockwork burst @@ -43,70 +37,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 1f; Item.UseSound = Throw3Sound; Item.autoReuse = true; - Item.maxStack = 9999; Item.value = Item.sellPrice(0, 0, 0, 5); Item.rare = ItemRarityID.Blue; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 4f; Item.DamageType = RogueDamageClass.Instance; } - - //Magnetization - public override void HoldItem(Player player) - { - player.Calamity().rightClickListener = true; - - if (player.Calamity().mouseRight && Main.rand.NextBool(7)) - { - Particle streak = new ManaDrainStreak(player, Main.rand.NextFloat(0.2f, 0.5f), Main.rand.NextVector2CircularEdge(1f, 1f) * Main.rand.NextFloat(170f, 670f), Main.rand.NextFloat(30f, 44f), Color.GreenYellow, Color.DeepSkyBlue, Main.rand.Next(15, 30)); - GeneralParticleHandler.SpawnParticle(streak); - } - } - - public override void GrabRange(Player player, ref int grabRange) - { - float rangeMult = 2f; - if (player.Distance(Item.Center) < 670 && player.HeldItem.type == ModContent.ItemType() && player.Calamity().mouseRight) - rangeMult = 20f; - - grabRange = (int)(grabRange * rangeMult); - - if (rangeMult > 2f && player.Distance(Item.Center) > 50f) - { - Item.velocity = (player.DirectionTo(Item.Center) * -20f); - - if (Main.rand.NextBool(3)) - { - Vector2 dustCenter = Item.Center + Main.rand.NextVector2Circular(4f, 4f); - - Dust chust = Dust.NewDustPerfect(dustCenter, 15, -Item.velocity * Main.rand.NextFloat(0.2f, 0.1f), Scale: Main.rand.NextFloat(1.2f, 1.8f)); - chust.noGravity = true; - } - } - } - - - //While this may look stupid, its necessary because ReuseDelay fucks up the consumption of the item otherwise. - public override bool ConsumeItem(Player player) => shootCount < 0; - public override bool? UseItem(Player player) - { - int placeholderStock = shootCount; - shootCount = -1; - - if (ItemLoader.ConsumeItem(Item, player)) - { - Item.stack--; - - if (Item.stack <= 0) - Item.TurnToAir(); - } - - shootCount = placeholderStock; - - shootCount++; - return base.UseItem(player); - } - //Random spread public override void UseAnimation(Player player) { @@ -121,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = Throw1Sound; } - public override float StealthDamageMultiplier => 0.8f; + public override float StealthDamageMultiplier => 1.5f; public override bool AdditionalStealthCheck() => stealthStrikeStarted; public override void ModifyStatsExtra(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) @@ -154,8 +90,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(50). - AddIngredient(). + CreateRecipe(). + AddIngredient(9). + AddTile(TileID.Anvils). Register(); } } diff --git a/Items/Weapons/Summon/AbandonedSlimeStaff.cs b/Items/Weapons/Summon/AbandonedSlimeStaff.cs index 82b73bb53b..f29d97c52a 100644 --- a/Items/Weapons/Summon/AbandonedSlimeStaff.cs +++ b/Items/Weapons/Summon/AbandonedSlimeStaff.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Summon { CalamityUtils.KillShootProjectiles(true, type, player); float damageMult = ((float)Math.Log(slimeSlots, 8f)) + 1f; - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); velocity.X = 0; velocity.Y = 0; int slime = Projectile.NewProjectile(source, position, velocity, type, (int)(damage * damageMult), knockback, player.whoAmI); diff --git a/Items/Weapons/Summon/AncientIceChunk.cs b/Items/Weapons/Summon/AncientIceChunk.cs index 88dcabbeb0..00bfcf39ee 100644 --- a/Items/Weapons/Summon/AncientIceChunk.cs +++ b/Items/Weapons/Summon/AncientIceChunk.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, Main.MouseWorld, Main.rand.NextVector2Circular(1f, 1f), type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(1f, 1f), type, damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Summon/AquasScepter.cs b/Items/Weapons/Summon/AquasScepter.cs index 748b39fe52..f97b61c3c5 100644 --- a/Items/Weapons/Summon/AquasScepter.cs +++ b/Items/Weapons/Summon/AquasScepter.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); var projectile = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI); projectile.originalDamage = Item.damage; player.UpdateMaxTurrets(); diff --git a/Items/Weapons/Summon/AtlasMunitionsBeacon.cs b/Items/Weapons/Summon/AtlasMunitionsBeacon.cs index deefde23b3..0706ca78d9 100644 --- a/Items/Weapons/Summon/AtlasMunitionsBeacon.cs +++ b/Items/Weapons/Summon/AtlasMunitionsBeacon.cs @@ -82,9 +82,11 @@ namespace CalamityMod.Items.Weapons.Summon ModContent.ProjectileType(), ModContent.ProjectileType() }); - position = Main.MouseWorld - Vector2.UnitY * 1020f; - velocity = (Main.MouseWorld - position).SafeNormalize(Vector2.UnitY) * Main.rand.NextFloat(9f, 10f); - Projectile.NewProjectile(source, position, velocity, type, Item.damage, knockback, player.whoAmI, Main.MouseWorld.Y - 40f); + + Vector2 mouse = player.ClampedMouseWorld(); + position = mouse - Vector2.UnitY * 1020f; + velocity = (mouse - position).SafeNormalize(Vector2.UnitY) * Main.rand.NextFloat(9f, 10f); + Projectile.NewProjectile(source, position, velocity, type, Item.damage, knockback, player.whoAmI, mouse.Y - 40f); player.UpdateMaxTurrets(); } return false; diff --git a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs index 3feeafde1a..44890bd7ff 100644 --- a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs +++ b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Summon } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int belladonna = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int belladonna = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(belladonna)) Main.projectile[belladonna].originalDamage = Item.damage; return false; diff --git a/Items/Weapons/Summon/BlackHawkRemote.cs b/Items/Weapons/Summon/BlackHawkRemote.cs index 0e212d9636..330d2f3e95 100644 --- a/Items/Weapons/Summon/BlackHawkRemote.cs +++ b/Items/Weapons/Summon/BlackHawkRemote.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.whoAmI == Main.myPlayer) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/BorealisBomber.cs b/Items/Weapons/Summon/BorealisBomber.cs index 7acf178e45..d3fdc3a340 100644 --- a/Items/Weapons/Summon/BorealisBomber.cs +++ b/Items/Weapons/Summon/BorealisBomber.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); velocity.X = 0; velocity.Y = 0; int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, Main.myPlayer); diff --git a/Items/Weapons/Summon/BrittleStarStaff.cs b/Items/Weapons/Summon/BrittleStarStaff.cs index 70ba82739b..a69c43a5a0 100644 --- a/Items/Weapons/Summon/BrittleStarStaff.cs +++ b/Items/Weapons/Summon/BrittleStarStaff.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Summon if (player.altFunctionUse != 2) { Item.noUseGraphic = false; - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); velocity = Vector2.Zero; int SummonNumber = player.ownedProjectileCounts[type]; int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0, 0, SummonNumber); @@ -65,10 +65,5 @@ namespace CalamityMod.Items.Weapons.Summon } return false; } - public override void HoldItem(Player player) - { - //player.Calamity().rightClickListener = true; - //player.Calamity().mouseWorldListener = true; - } } } diff --git a/Items/Weapons/Summon/CalamarisLament.cs b/Items/Weapons/Summon/CalamarisLament.cs index 5423a12cbb..8123714305 100644 --- a/Items/Weapons/Summon/CalamarisLament.cs +++ b/Items/Weapons/Summon/CalamarisLament.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, Main.MouseWorld, velocity, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Summon/CausticStaff.cs b/Items/Weapons/Summon/CausticStaff.cs index 467bfc2fe3..88a22bfafb 100644 --- a/Items/Weapons/Summon/CausticStaff.cs +++ b/Items/Weapons/Summon/CausticStaff.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/CindersOfLament.cs b/Items/Weapons/Summon/CindersOfLament.cs index 9e10aeadf9..6d7d05659f 100644 --- a/Items/Weapons/Summon/CindersOfLament.cs +++ b/Items/Weapons/Summon/CindersOfLament.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (Main.rand.NextBool()) type = ModContent.ProjectileType(); - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/Cnidarian.cs b/Items/Weapons/Summon/Cnidarian.cs index 01f80f495b..6799b4cac7 100644 --- a/Items/Weapons/Summon/Cnidarian.cs +++ b/Items/Weapons/Summon/Cnidarian.cs @@ -78,6 +78,7 @@ namespace CalamityMod.Items.Weapons.Summon public void SetPlayerArms(Player player) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction //Calculate the dirction in which the players arms should be pointing at. Vector2 playerToCursor = (player.Calamity().mouseWorld - player.Center).SafeNormalize(Vector2.UnitX); float armPointingDirection = (playerToCursor.ToRotation()); diff --git a/Items/Weapons/Summon/CorroslimeStaff.cs b/Items/Weapons/Summon/CorroslimeStaff.cs index afab2ce826..bdaf95d306 100644 --- a/Items/Weapons/Summon/CorroslimeStaff.cs +++ b/Items/Weapons/Summon/CorroslimeStaff.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); velocity.X = 0; velocity.Y = 0; int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Summon/CorvidHarbringerStaff.cs b/Items/Weapons/Summon/CorvidHarbringerStaff.cs index aedfb0014f..781e063250 100644 --- a/Items/Weapons/Summon/CorvidHarbringerStaff.cs +++ b/Items/Weapons/Summon/CorvidHarbringerStaff.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/CosmicImmaterializer.cs b/Items/Weapons/Summon/CosmicImmaterializer.cs index 953e77d1b9..d555808fda 100644 --- a/Items/Weapons/Summon/CosmicImmaterializer.cs +++ b/Items/Weapons/Summon/CosmicImmaterializer.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; return false; diff --git a/Items/Weapons/Summon/Cosmilamp.cs b/Items/Weapons/Summon/Cosmilamp.cs index 761729f98c..e1a878b754 100644 --- a/Items/Weapons/Summon/Cosmilamp.cs +++ b/Items/Weapons/Summon/Cosmilamp.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Summon } int existingLamps = player.ownedProjectileCounts[type]; - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) { Main.projectile[p].originalDamage = Item.damage; diff --git a/Items/Weapons/Summon/CrimslimeStaff.cs b/Items/Weapons/Summon/CrimslimeStaff.cs index 21a70f0f06..24fa2614c3 100644 --- a/Items/Weapons/Summon/CrimslimeStaff.cs +++ b/Items/Weapons/Summon/CrimslimeStaff.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); velocity.X = 0; velocity.Y = 0; int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Summon/CryogenicStaff.cs b/Items/Weapons/Summon/CryogenicStaff.cs index f1043a176f..8408855e68 100644 --- a/Items/Weapons/Summon/CryogenicStaff.cs +++ b/Items/Weapons/Summon/CryogenicStaff.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); diff --git a/Items/Weapons/Summon/DaedalusGolemStaff.cs b/Items/Weapons/Summon/DaedalusGolemStaff.cs index 8ac62eb209..ec0b92d270 100644 --- a/Items/Weapons/Summon/DaedalusGolemStaff.cs +++ b/Items/Weapons/Summon/DaedalusGolemStaff.cs @@ -36,10 +36,11 @@ namespace CalamityMod.Items.Weapons.Summon } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Point mouseTileCoords = Main.MouseWorld.ToTileCoordinates(); + Vector2 mouse = player.ClampedMouseWorld(); + Point mouseTileCoords = mouse.ToTileCoordinates(); if (!CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).IsTileSolidGround()) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.UnitY * 4f, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, mouse, Vector2.UnitY * 4f, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/DankStaff.cs b/Items/Weapons/Summon/DankStaff.cs index 82d990e57c..9f99226039 100644 --- a/Items/Weapons/Summon/DankStaff.cs +++ b/Items/Weapons/Summon/DankStaff.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); velocity.X = 0; velocity.Y = 0; int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Summon/DazzlingStabberStaff.cs b/Items/Weapons/Summon/DazzlingStabberStaff.cs index 79afed4b59..b86da55254 100644 --- a/Items/Weapons/Summon/DazzlingStabberStaff.cs +++ b/Items/Weapons/Summon/DazzlingStabberStaff.cs @@ -2,6 +2,7 @@ using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -35,19 +36,22 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + for (int i = 0; i < 3; i++) + { + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, i + 1); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; + } } - float angleMax = MathHelper.ToRadians(45f); + float angleMax = MathHelper.ToRadians(360f); if (CalamityUtils.CountProjectiles(type) == 1) angleMax = 0f; float index = 1f; - if (player.ownedProjectileCounts[Item.shoot] > 8) + if (player.ownedProjectileCounts[Item.shoot] > 30) { - angleMax += MathHelper.ToRadians((player.ownedProjectileCounts[Item.shoot] - 8) * 2.5f); + angleMax += MathHelper.ToRadians((player.ownedProjectileCounts[Item.shoot] - 30) * 2.5f); } - angleMax = angleMax > MathHelper.ToRadians(105f) ? MathHelper.ToRadians(105f) : angleMax; // More intuative than using a min function + angleMax = angleMax > MathHelper.ToRadians(360f) ? MathHelper.ToRadians(360f) : angleMax; // More intuative than using a min function foreach (Projectile p in Main.ActiveProjectiles) { if (p.type == type && p.owner == player.whoAmI) diff --git a/Items/Weapons/Summon/DeepseaStaff.cs b/Items/Weapons/Summon/DeepseaStaff.cs index c66c813752..b68a90c690 100644 --- a/Items/Weapons/Summon/DeepseaStaff.cs +++ b/Items/Weapons/Summon/DeepseaStaff.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); velocity = Vector2.Zero; int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) diff --git a/Items/Weapons/Summon/DragonbloodDisgorger.cs b/Items/Weapons/Summon/DragonbloodDisgorger.cs index 1233abad32..2adca37808 100644 --- a/Items/Weapons/Summon/DragonbloodDisgorger.cs +++ b/Items/Weapons/Summon/DragonbloodDisgorger.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; return false; diff --git a/Items/Weapons/Summon/DreadmineStaff.cs b/Items/Weapons/Summon/DreadmineStaff.cs index 0c2cf657dd..e26467a1f2 100644 --- a/Items/Weapons/Summon/DreadmineStaff.cs +++ b/Items/Weapons/Summon/DreadmineStaff.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { //CalamityUtils.OnlyOneSentry(player, type); - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); diff --git a/Items/Weapons/Summon/EnchantedConch.cs b/Items/Weapons/Summon/EnchantedConch.cs index 6671787689..768ffed01d 100644 --- a/Items/Weapons/Summon/EnchantedConch.cs +++ b/Items/Weapons/Summon/EnchantedConch.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, Main.MouseWorld, Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Summon/Endogenesis.cs b/Items/Weapons/Summon/Endogenesis.cs index f112fa3ef7..97942a9175 100644 --- a/Items/Weapons/Summon/Endogenesis.cs +++ b/Items/Weapons/Summon/Endogenesis.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Summon ModContent.ProjectileType() }); - SummonEndoCooper(source, AttackMode, Main.MouseWorld, damage, Item.damage, knockback, player, out _, out _); + SummonEndoCooper(source, AttackMode, player.ClampedMouseWorld(), damage, Item.damage, knockback, player, out _, out _); AttackMode++; if (AttackMode > 3) diff --git a/Items/Weapons/Summon/EntropysVigil.cs b/Items/Weapons/Summon/EntropysVigil.cs index 942276dd18..676648fcab 100644 --- a/Items/Weapons/Summon/EntropysVigil.cs +++ b/Items/Weapons/Summon/EntropysVigil.cs @@ -42,6 +42,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + Vector2 mouse = player.ClampedMouseWorld(); float randomAngleOffset = Main.rand.NextFloat(MathHelper.TwoPi); for (int i = 0; i < 3; i++) { @@ -51,13 +52,13 @@ namespace CalamityMod.Items.Weapons.Summon switch (i) { case 0: - Projectile.NewProjectile(source, Main.MouseWorld, spawnVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, mouse, spawnVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); break; case 1: - Projectile.NewProjectile(source, Main.MouseWorld, spawnVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, mouse, spawnVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); break; case 2: - Projectile.NewProjectile(source, Main.MouseWorld, spawnVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, mouse, spawnVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); break; } } diff --git a/Items/Weapons/Summon/EtherealSubjugator.cs b/Items/Weapons/Summon/EtherealSubjugator.cs index f4eb67404a..e1103cbc49 100644 --- a/Items/Weapons/Summon/EtherealSubjugator.cs +++ b/Items/Weapons/Summon/EtherealSubjugator.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, Main.MouseWorld, Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Summon/EyeOfNight.cs b/Items/Weapons/Summon/EyeOfNight.cs index def86283ee..4dae0ecdb7 100644 --- a/Items/Weapons/Summon/EyeOfNight.cs +++ b/Items/Weapons/Summon/EyeOfNight.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.UnitY * -3f, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.UnitY * -3f, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/FlarebatStaff.cs b/Items/Weapons/Summon/FlarebatStaff.cs index 0fc4cbeea0..f94955710b 100644 --- a/Items/Weapons/Summon/FlarebatStaff.cs +++ b/Items/Weapons/Summon/FlarebatStaff.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Summon/FleshOfInfidelity.cs b/Items/Weapons/Summon/FleshOfInfidelity.cs index fae2871577..a7f73e84fa 100644 --- a/Items/Weapons/Summon/FleshOfInfidelity.cs +++ b/Items/Weapons/Summon/FleshOfInfidelity.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.UnitY * -1f, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.UnitY * -1f, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Summon/FrostbatStaff.cs b/Items/Weapons/Summon/FrostbatStaff.cs index 651972b837..ade55ae2aa 100644 --- a/Items/Weapons/Summon/FrostbatStaff.cs +++ b/Items/Weapons/Summon/FrostbatStaff.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Summon/GlacialEmbrace.cs b/Items/Weapons/Summon/GlacialEmbrace.cs index a8ff856589..00fc0f2f75 100644 --- a/Items/Weapons/Summon/GlacialEmbrace.cs +++ b/Items/Weapons/Summon/GlacialEmbrace.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Summon if (player.altFunctionUse != 2 && totalMinionSlots < player.maxMinions) { player.AddBuff(ModContent.BuffType(), 120, true); - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; diff --git a/Items/Weapons/Summon/GuidelightofOblivion.cs b/Items/Weapons/Summon/GuidelightofOblivion.cs index 554c3b6f8a..4f3797d962 100644 --- a/Items/Weapons/Summon/GuidelightofOblivion.cs +++ b/Items/Weapons/Summon/GuidelightofOblivion.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { //CalamityUtils.OnlyOneSentry(player, type); - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); diff --git a/Items/Weapons/Summon/HauntedScroll.cs b/Items/Weapons/Summon/HauntedScroll.cs index a8a5bb8a06..df45d5f44b 100644 --- a/Items/Weapons/Summon/HauntedScroll.cs +++ b/Items/Weapons/Summon/HauntedScroll.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); velocity.X = 0; velocity.Y = 0; int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 30f); diff --git a/Items/Weapons/Summon/HerringStaff.cs b/Items/Weapons/Summon/HerringStaff.cs index 8b2772c2e2..33f8bd5fbe 100644 --- a/Items/Weapons/Summon/HerringStaff.cs +++ b/Items/Weapons/Summon/HerringStaff.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/IgneousExaltation.cs b/Items/Weapons/Summon/IgneousExaltation.cs index 7db24c614d..1fb197c03a 100644 --- a/Items/Weapons/Summon/IgneousExaltation.cs +++ b/Items/Weapons/Summon/IgneousExaltation.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Summon } if (player.altFunctionUse != 2 && totalMinionSlots < player.maxMinions) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; diff --git a/Items/Weapons/Summon/InfectedRemote.cs b/Items/Weapons/Summon/InfectedRemote.cs index 9449e7ffbc..afde753a8f 100644 --- a/Items/Weapons/Summon/InfectedRemote.cs +++ b/Items/Weapons/Summon/InfectedRemote.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Summon { CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; return false; diff --git a/Items/Weapons/Summon/KingofConstellationsTenryu.cs b/Items/Weapons/Summon/KingofConstellationsTenryu.cs index 292cbfdc3d..c8e3d512af 100644 --- a/Items/Weapons/Summon/KingofConstellationsTenryu.cs +++ b/Items/Weapons/Summon/KingofConstellationsTenryu.cs @@ -56,7 +56,9 @@ namespace CalamityMod.Items.Weapons.Summon public static void SpawnDragon(int head, int body, int tail, Vector2 spawnPos, Player player, EntitySource_ItemUse_WithAmmo source, int damage, float knockback) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.NewProjectile(source, spawnPos, player.DirectionTo(Main.MouseWorld) * 3, head, damage, knockback, player.whoAmI); + // okay but seriously why are you multiplying zero by three Projectile.NewProjectile(source, spawnPos, Vector2.Zero * 3, tail, damage, knockback, player.whoAmI); for (var i = 0; i < 20; i++) { diff --git a/Items/Weapons/Summon/LegionofCelestia.cs b/Items/Weapons/Summon/LegionofCelestia.cs index fa94cdf36a..227aa6aed1 100644 --- a/Items/Weapons/Summon/LegionofCelestia.cs +++ b/Items/Weapons/Summon/LegionofCelestia.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); velocity.X = 0; velocity.Y = 0; int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Summon/LiliesOfFinality.cs b/Items/Weapons/Summon/LiliesOfFinality.cs index 42f475d32d..6f30839132 100644 --- a/Items/Weapons/Summon/LiliesOfFinality.cs +++ b/Items/Weapons/Summon/LiliesOfFinality.cs @@ -61,8 +61,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, player.Calamity().mouseWorld, new Vector2(-1f, -1f) * 3f, type, damage, knockback, player.whoAmI); - Projectile.NewProjectile(source, player.Calamity().mouseWorld, new Vector2(1f, -1f) * 3f, ProjectileType(), damage, knockback, player.whoAmI); + Vector2 mouse = player.ClampedMouseWorld(); + Projectile.NewProjectile(source, mouse, new Vector2(-1f, -1f) * 3f, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, mouse, new Vector2(1f, -1f) * 3f, ProjectileType(), damage, knockback, player.whoAmI); if (Main.dedServ) return false; @@ -73,7 +74,7 @@ namespace CalamityMod.Items.Weapons.Summon float angle = MathHelper.TwoPi / dustAmount * i; Vector2 dustVelocity = angle.ToRotationVector2() * Main.rand.NextFloat(3f, 6f); Dust spawnDust = Dust.NewDustPerfect( - Main.MouseWorld, + mouse, CommonDustID, dustVelocity, Scale: Main.rand.NextFloat(1.2f, 1.5f)); diff --git a/Items/Weapons/Summon/Metastasis.cs b/Items/Weapons/Summon/Metastasis.cs index b1939d2cff..ce288d7a8b 100644 --- a/Items/Weapons/Summon/Metastasis.cs +++ b/Items/Weapons/Summon/Metastasis.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, -Vector2.UnitY * 5f, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), -Vector2.UnitY * 5f, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; return false; diff --git a/Items/Weapons/Summon/MutatedTruffle.cs b/Items/Weapons/Summon/MutatedTruffle.cs index d0d6f9e215..145cc7d099 100644 --- a/Items/Weapons/Summon/MutatedTruffle.cs +++ b/Items/Weapons/Summon/MutatedTruffle.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Summon { // Only one can be summoned. if (player.ownedProjectileCounts[type] < 1 && player.maxMinions >= 3) - Projectile.NewProjectile(source, Main.MouseWorld, Main.rand.NextVector2Circular(2f, 2f), type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(2f, 2f), type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Summon/OrthoceraShell.cs b/Items/Weapons/Summon/OrthoceraShell.cs index be58cba6f0..54321a17b5 100644 --- a/Items/Weapons/Summon/OrthoceraShell.cs +++ b/Items/Weapons/Summon/OrthoceraShell.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.whoAmI == Main.myPlayer) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); diff --git a/Items/Weapons/Summon/Perdition.cs b/Items/Weapons/Summon/Perdition.cs index d4dd12553a..9db7a9910e 100644 --- a/Items/Weapons/Summon/Perdition.cs +++ b/Items/Weapons/Summon/Perdition.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Summon if (player.altFunctionUse != 2) { if (player.ownedProjectileCounts[type] < 1) - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); } else { diff --git a/Items/Weapons/Summon/PlantationStaff.cs b/Items/Weapons/Summon/PlantationStaff.cs index e94140c11a..f7ab0903ef 100644 --- a/Items/Weapons/Summon/PlantationStaff.cs +++ b/Items/Weapons/Summon/PlantationStaff.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, Main.MouseWorld, Main.rand.NextVector2Circular(2f, 2f), type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(2f, 2f), type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Summon/PuffShroom.cs b/Items/Weapons/Summon/PuffShroom.cs index b2163f8e88..b1e933d4d3 100644 --- a/Items/Weapons/Summon/PuffShroom.cs +++ b/Items/Weapons/Summon/PuffShroom.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int puffGuy = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int puffGuy = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(puffGuy)) Main.projectile[puffGuy].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/ResurrectionButterfly.cs b/Items/Weapons/Summon/ResurrectionButterfly.cs index d2dc0e4032..98ff76631a 100644 --- a/Items/Weapons/Summon/ResurrectionButterfly.cs +++ b/Items/Weapons/Summon/ResurrectionButterfly.cs @@ -36,12 +36,13 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Vector2 mouseDirection = Vector2.Normalize(Main.MouseWorld - player.Center) * Item.shootSpeed; + Vector2 clampedMouse = player.ClampedMouseWorld(); + Vector2 mouseDirection = Vector2.Normalize(clampedMouse - player.Center) * Item.shootSpeed; - int p = Projectile.NewProjectile(source, Main.MouseWorld, mouseDirection.RotatedBy(MathHelper.PiOver2), ModContent.ProjectileType(), damage, knockback, Main.myPlayer, 0f, 0f); + int p = Projectile.NewProjectile(source, clampedMouse, mouseDirection.RotatedBy(MathHelper.PiOver2), ModContent.ProjectileType(), damage, knockback, Main.myPlayer, 0f, 0f); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; - p = Projectile.NewProjectile(source, Main.MouseWorld, mouseDirection.RotatedBy(-MathHelper.PiOver2), ModContent.ProjectileType(), damage, knockback, Main.myPlayer, 0f, 0f); + p = Projectile.NewProjectile(source, clampedMouse, mouseDirection.RotatedBy(-MathHelper.PiOver2), ModContent.ProjectileType(), damage, knockback, Main.myPlayer, 0f, 0f); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; return false; diff --git a/Items/Weapons/Summon/RustyBeaconPrototype.cs b/Items/Weapons/Summon/RustyBeaconPrototype.cs index 1002d5134e..2cc3731c36 100644 --- a/Items/Weapons/Summon/RustyBeaconPrototype.cs +++ b/Items/Weapons/Summon/RustyBeaconPrototype.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 16f); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 16f); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); diff --git a/Items/Weapons/Summon/SanctifiedSpark.cs b/Items/Weapons/Summon/SanctifiedSpark.cs index 70f63705a3..443383274b 100644 --- a/Items/Weapons/Summon/SanctifiedSpark.cs +++ b/Items/Weapons/Summon/SanctifiedSpark.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 128; Item.DamageType = DamageClass.Summon; Item.sentry = true; - Item.mana = 10; + Item.mana = 100; Item.useAnimation = Item.useTime = 14; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { //CalamityUtils.OnlyOneSentry(player, type); - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 16f); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 16f); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); diff --git a/Items/Weapons/Summon/SandSharknadoStaff.cs b/Items/Weapons/Summon/SandSharknadoStaff.cs index a7da28d070..5254fbb849 100644 --- a/Items/Weapons/Summon/SandSharknadoStaff.cs +++ b/Items/Weapons/Summon/SandSharknadoStaff.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int sandnado = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int sandnado = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(sandnado)) Main.projectile[sandnado].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/ScabRipper.cs b/Items/Weapons/Summon/ScabRipper.cs index a129849995..74d18a268c 100644 --- a/Items/Weapons/Summon/ScabRipper.cs +++ b/Items/Weapons/Summon/ScabRipper.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); velocity.X = 0; velocity.Y = 0; int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Summon/ShellfishStaff.cs b/Items/Weapons/Summon/ShellfishStaff.cs index af2726a2cb..acfa24fee7 100644 --- a/Items/Weapons/Summon/ShellfishStaff.cs +++ b/Items/Weapons/Summon/ShellfishStaff.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/SlimePuppetStaff.cs b/Items/Weapons/Summon/SlimePuppetStaff.cs index 1e5a20341c..96f57f7c7c 100644 --- a/Items/Weapons/Summon/SlimePuppetStaff.cs +++ b/Items/Weapons/Summon/SlimePuppetStaff.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, Main.myPlayer); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, Main.myPlayer); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/StaffOfNecrosteocytes.cs b/Items/Weapons/Summon/StaffOfNecrosteocytes.cs index 8de6f7b1af..9bd042de78 100644 --- a/Items/Weapons/Summon/StaffOfNecrosteocytes.cs +++ b/Items/Weapons/Summon/StaffOfNecrosteocytes.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon return false; if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/StaffoftheMechworm.cs b/Items/Weapons/Summon/StaffoftheMechworm.cs index aebe5b1a37..d6bee5eefe 100644 --- a/Items/Weapons/Summon/StaffoftheMechworm.cs +++ b/Items/Weapons/Summon/StaffoftheMechworm.cs @@ -55,19 +55,21 @@ namespace CalamityMod.Items.Weapons.Summon if (Main.myPlayer != owner.whoAmI) return; - int curr = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, 0f, 0f); + Vector2 mouse = owner.ClampedMouseWorld(); + + int curr = Projectile.NewProjectile(source, mouse, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, 0f, 0f); if (Main.projectile.IndexInRange(curr)) Main.projectile[curr].originalDamage = baseDamage; - curr = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, Main.projectile[curr].identity, 0f); + curr = Projectile.NewProjectile(source, mouse, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, Main.projectile[curr].identity, 0f); if (Main.projectile.IndexInRange(curr)) Main.projectile[curr].originalDamage = baseDamage; int prev = curr; - curr = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, Main.projectile[curr].identity, 0f); + curr = Projectile.NewProjectile(source, mouse, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, Main.projectile[curr].identity, 0f); if (Main.projectile.IndexInRange(curr)) Main.projectile[curr].originalDamage = baseDamage; Main.projectile[prev].localAI[1] = curr; prev = curr; - curr = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, Main.projectile[curr].identity, 0f); + curr = Projectile.NewProjectile(source, mouse, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, Main.projectile[curr].identity, 0f); if (Main.projectile.IndexInRange(curr)) Main.projectile[curr].originalDamage = baseDamage; Main.projectile[prev].localAI[1] = curr; diff --git a/Items/Weapons/Summon/StarspawnHelixStaff.cs b/Items/Weapons/Summon/StarspawnHelixStaff.cs index 3d8c9f3def..333bdf5ce4 100644 --- a/Items/Weapons/Summon/StarspawnHelixStaff.cs +++ b/Items/Weapons/Summon/StarspawnHelixStaff.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), velocity, type, damage, knockback, player.whoAmI, 0f, 1f); if (Main.projectile.IndexInRange(p)) { Main.projectile[p].originalDamage = Item.damage; diff --git a/Items/Weapons/Summon/StellarTorusStaff.cs b/Items/Weapons/Summon/StellarTorusStaff.cs index 1d0460de74..2540e43a21 100644 --- a/Items/Weapons/Summon/StellarTorusStaff.cs +++ b/Items/Weapons/Summon/StellarTorusStaff.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int minion = Projectile.NewProjectile(source, Main.MouseWorld, Main.rand.NextVector2Circular(2f, 2f), ModContent.ProjectileType(), damage, knockback, player.whoAmI); + int minion = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(2f, 2f), ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(minion)) Main.projectile[minion].originalDamage = Item.OriginalDamage; diff --git a/Items/Weapons/Summon/StormjawStaff.cs b/Items/Weapons/Summon/StormjawStaff.cs index ab76bab5f6..53c47e8b77 100644 --- a/Items/Weapons/Summon/StormjawStaff.cs +++ b/Items/Weapons/Summon/StormjawStaff.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/UniverseSplitter.cs b/Items/Weapons/Summon/UniverseSplitter.cs index 15932b763a..56e9c75a71 100644 --- a/Items/Weapons/Summon/UniverseSplitter.cs +++ b/Items/Weapons/Summon/UniverseSplitter.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Summon if (!player.HasCooldown(Cooldowns.UniverseSplitter.ID)) { player.AddCooldown(Cooldowns.UniverseSplitter.ID, CalamityUtils.SecondsToFrames(30)); - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; for (int i = 0; i < 36; i++) diff --git a/Items/Weapons/Summon/Vigilance.cs b/Items/Weapons/Summon/Vigilance.cs index 916edd6388..a1bb127949 100644 --- a/Items/Weapons/Summon/Vigilance.cs +++ b/Items/Weapons/Summon/Vigilance.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.maxMinions - player.slotsMinions >= 1f) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) { Main.projectile[p].ai[0] = player.ownedProjectileCounts[type]; diff --git a/Items/Weapons/Summon/VileFeeder.cs b/Items/Weapons/Summon/VileFeeder.cs index b114e35850..e584d973f4 100644 --- a/Items/Weapons/Summon/VileFeeder.cs +++ b/Items/Weapons/Summon/VileFeeder.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, Main.MouseWorld, Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Summon/ViralSprout.cs b/Items/Weapons/Summon/ViralSprout.cs index 54ebb7c65e..967ce92bd5 100644 --- a/Items/Weapons/Summon/ViralSprout.cs +++ b/Items/Weapons/Summon/ViralSprout.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; diff --git a/Items/Weapons/Summon/WarloksMoonFist.cs b/Items/Weapons/Summon/WarloksMoonFist.cs index 90bfeb9063..b346171917 100644 --- a/Items/Weapons/Summon/WarloksMoonFist.cs +++ b/Items/Weapons/Summon/WarloksMoonFist.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Summon if (player.altFunctionUse != 2) { int existingFists = player.ownedProjectileCounts[type]; - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) { Main.projectile[p].originalDamage = Item.damage; diff --git a/Items/Weapons/Summon/WulfrumController.cs b/Items/Weapons/Summon/WulfrumController.cs index 5f1337603a..8aae13745f 100644 --- a/Items/Weapons/Summon/WulfrumController.cs +++ b/Items/Weapons/Summon/WulfrumController.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); velocity.X = 0; velocity.Y = 0; int droid = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); diff --git a/Items/Weapons/Summon/YharonsKindleStaff.cs b/Items/Weapons/Summon/YharonsKindleStaff.cs index 95a5fe66d0..dc09c1c246 100644 --- a/Items/Weapons/Summon/YharonsKindleStaff.cs +++ b/Items/Weapons/Summon/YharonsKindleStaff.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; + position = player.ClampedMouseWorld(); int dragon = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(dragon)) Main.projectile[dragon].originalDamage = Item.damage; diff --git a/Items/Weapons/Typeless/RelicOfDeliverance.cs b/Items/Weapons/Typeless/RelicOfDeliverance.cs index b7eaf469db..8c27c8fcc3 100644 --- a/Items/Weapons/Typeless/RelicOfDeliverance.cs +++ b/Items/Weapons/Typeless/RelicOfDeliverance.cs @@ -12,10 +12,11 @@ namespace CalamityMod.Items.Weapons.Typeless { Item.width = 32; Item.height = 46; - Item.damage = 1350; - Item.useAnimation = Item.useTime = 25; + Item.damage = 1818; + Item.useAnimation = Item.useTime = 35; Item.reuseDelay = 15; Item.useStyle = ItemUseStyleID.Shoot; + Item.DamageType = AverageDamageClass.Instance; Item.UseSound = SoundID.Item46; Item.noMelee = true; Item.noUseGraphic = true; @@ -26,13 +27,18 @@ namespace CalamityMod.Items.Weapons.Typeless Item.Calamity().CannotBeEnchanted = true; } + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) { itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; } // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 16; + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 55; public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; } diff --git a/Items/Weapons/Typeless/RelicOfResilience.cs b/Items/Weapons/Typeless/RelicOfResilience.cs deleted file mode 100644 index 3ac122a0b0..0000000000 --- a/Items/Weapons/Typeless/RelicOfResilience.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System.Linq; -using CalamityMod.Projectiles.Damageable; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Typeless -{ - public class RelicOfResilience : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Typeless"; - public const int CooldownSeconds = 5; - public const float WeaknessDR = 0.45f; - public override void SetStaticDefaults() - { - ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; - } - - public override void SetDefaults() - { - Item.width = 40; - Item.height = 34; - Item.useAnimation = Item.useTime = 28; - Item.useStyle = ItemUseStyleID.HoldUp; - Item.UseSound = SoundID.Item45; - Item.autoReuse = true; - Item.noMelee = true; - Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; - Item.rare = ItemRarityID.Purple; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 0f; - } - - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; - } - - public override bool CanUseItem(Player player) => !player.HasCooldown(Cooldowns.RelicOfResilience.ID); - public override bool? UseItem(Player player) => true; - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - player.AddCooldown(Cooldowns.RelicOfResilience.ID, CalamityUtils.SecondsToFrames(CooldownSeconds)); - int[] shardTypes = new int[] - { - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - }; - if (player.ownedProjectileCounts[Item.shoot] > 0) - { - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.type == Item.shoot) - { - p.Center = Main.MouseWorld; - p.netUpdate = true; - } - } - } - else if (shardTypes.All(proj => player.ownedProjectileCounts[proj] == 0)) - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); - return false; - } - } -} diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index d9f688287e..12a7432de8 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -307,6 +307,11 @@ DraedonGamerChairBuff: { Description: Riding a physics defying gamer chair } +ExoTankBuff: { + DisplayName: Rainbow Road Roller + Description: Your foes shall fall within your calculations +} + GazeOfCrysthamyrBuff: { DisplayName: Gaze of Crysthamyr Description: You are riding a shadow dragon @@ -1024,7 +1029,7 @@ PearlAura: { ProfanedWeakness: { DisplayName: Profaned Weakness - Description: You do less damage + Description: You take more damage } TemporalSadness: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson index 1605931fec..a06d76b7bd 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson @@ -159,7 +159,7 @@ TracersCelestial: { Horizontal speed: 9.00 Acceleration multiplier: 2.6 Good vertical speed - Flight time: 140 + Flight time: 160 24% increased running acceleration and greater mobility on ice Provides the ability to walk on water, honey, and lava Grants immunity to fire and lava @@ -175,7 +175,7 @@ TracersElysian: { Horizontal speed: 10.00 Acceleration multiplier: 2.7 Great vertical speed - Flight time: 180 + Flight time: 220 36% increased running acceleration and greater mobility on ice Provides the ability to walk on water, honey, and lava Grants immunity to fire and lava diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 398aee940e..f5db1a82eb 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -53,7 +53,6 @@ AbyssalMirror: { Enemies are less likely to target you, even in the abyss Generate stealth 25% faster when standing still and 12% faster while moving Grants the ability to dodge attacks, releasing a cloud of lumenyl fluid which damages and stuns nearby enemies - 'Light does not reach the depths of the ocean' ''' HoldShiftTooltip: ''' @@ -62,6 +61,7 @@ AbyssalMirror: { This cooldown is shared with all other dodges and reflects Dodging an attack gives stealth ''' + FlavorTooltip: "'Light does not reach the depths of the ocean'" } AeroStone: { @@ -212,6 +212,17 @@ AquaticHeart: { ''' } +ArcFlashRing: { + DisplayName: Arc Flash Ring + Tooltip: + ''' + Attacks have a 6% chance to call down a lightning bolt for 4x damage + The chance is reduced for each enemy an attack hits + The bolt's damage is based on non-crit damage, but can itself crit + Bolts are transparent and silent if visibility is disabled + ''' +} + ArchaicPowder: { DisplayName: Archaic Powder Tooltip: @@ -1313,6 +1324,7 @@ ProfanedSoulCrystal: { FullTooltip: ''' Provides passive buffs depending on the time of day + Greatly boosts the power of the Guardian's relics Grants additional effects if you have {0} minion slots Summons your own personal Guardians to fight alongside you All non-summon attacks are transformed, and are empowered if no minions are active @@ -1968,12 +1980,14 @@ VoltaicJelly: { ''' } -WarbanneroftheSun: { - DisplayName: Warbanner of the Sun +WarbanneroftheRighteous: { + DisplayName: Warbanner of the Righteous Tooltip: ''' - Increases melee damage, true melee damage and melee speed the closer you are to enemies - These stat boosts max out at 20% + Damage is increased by 20% when close to enemies, but decreased by 60% when none are nearby + Emit a blazing aura that burns and repels nearby enemies + Enemies take increasing damage the closer they are to you and the longer they are near you + Effects are transparent and silent if visibility is disabled ''' } @@ -2021,7 +2035,7 @@ YharimsGift: { Flaming meteors rain down after getting hit Volatile dragon dust trails behind you Increases damage and movement speed by 15% - The power to kill a god pulses from within this artifact + [c/FCA92B:'The power to kill a god pulses from within this artifact'] ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson index 9dd0f19240..44d5e1c2e0 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson @@ -275,7 +275,7 @@ HydrothermicHeadRogue: { Tooltip: ''' 12% increased rogue damage and 10% increased rogue critical strike chance - 50% chance to not consume rogue items and 5% increased movement speed + 5% increased movement speed Grants immunity to fire and lava ''' SetBonus: @@ -523,11 +523,7 @@ TitanHeartBoots: { TitanHeartMantle: { DisplayName: Titan Heart Mantle - Tooltip: - ''' - 45% chance to not consume rogue items - 5% boosted rogue knockback but 15% lowered rogue attack speed - ''' + Tooltip: 5% boosted rogue knockback but 15% lowered rogue attack speed } TitanHeartMask: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson index 14797fa288..360e51e89a 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson @@ -519,7 +519,7 @@ TarragonHeadMelee: { DisplayName: Tarragon Helm Tooltip: ''' - 12% increased melee damage and critical strike chance + 12% increased melee damage and 7% increased melee critical strike chance 10% increased damage reduction ''' SetBonus: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson index 68d7a6fca4..3095f99502 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson @@ -168,7 +168,7 @@ StatigelHeadRogue: { DisplayName: Statigel Mask Tooltip: ''' - 10% increased rogue damage and 34% chance to not consume rogue items + 10% increased rogue damage 7% increased rogue critical strike chance and 5% increased movement speed ''' SetBonus: +90 maximum stealth diff --git a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson index fe15e6d1b6..cceb5e9059 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson @@ -390,9 +390,10 @@ RelicOfConvergence: { DisplayName: Relic of Convergence Tooltip: ''' - Creates a profaned crystal that charges power - Holding out the crystal slows the player down - At the end of its life, the crystal heals the player for {0} HP + Creates a profaned crystal at the cursor that channels a healing aura before shattering + All players within the area of effect are healed for {0} HP + Allies gain 50% extra healing + Holding out the crystal heavily reduces the damage of all summons ''' } @@ -427,3 +428,15 @@ SuperDummy: { Right click to kill all super dummies ''' } + +RelicOfResilience: { + DisplayName: Relic Of Resilience + Tooltip: + ''' + Holding this item creates orbiting rock shards around you and nearby allies + While they orbit you, your minimum defense is set to 150 and minimum damage reduction to 10% + Taking a hit or pressing will pull in the shards, then blast them outward, crippling hit enemies + This effect has a 10 second cooldown after taking a hit + Holding out the shield heavily reduces the damage of all summons while rocks are active, only for you + ''' +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Mounts.hjson b/Localization/en-US/Mods.CalamityMod.Items.Mounts.hjson index 0eaacd1020..afffe3a8bb 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Mounts.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Mounts.hjson @@ -1,13 +1,22 @@ Brimrose: { DisplayName: Brimrose - Tooltip: Summons a brimrose mount + Tooltip: Summons a rideable Brimrose mount +} + +ExoArmamentsKit: { + DisplayName: Exo Armaments Kit + Tooltip: + ''' + Summons a rideable war machine + 'A superweapon just right for your stature' + ''' } ExoThrone: { DisplayName: Exo Box Tooltip: ''' - Materializes a quite cozy and extremely nimble flying Exo throne + Materializes a quite cozy and extremely nimble flying Exo Throne mount Hold [KEY] while sitting in the throne to move slower for more precision 'A comfortable gamer is a dangerous gamer' ''' @@ -24,14 +33,14 @@ Fabsol: { FollyFeed: { DisplayName: Folly Feed - Tooltip: Summons a monstrosity + Tooltip: Summons a rideable monstrosity } GazeOfCrysthamyr: { DisplayName: Gaze of Crysthamyr Tooltip: ''' - Summons a shadow dragon + Summons a rideable shadow dragon mount Hold Up to ascend faster ''' } @@ -45,7 +54,8 @@ OnyxExcavatorKey: { DisplayName: Onyx Excavator Key Tooltip: ''' - Summons a drill to drill through the world so you can destroy all the neat world generation + Summons a rideable Onyx Drill mount + to mine blocks in front of you so you can destroy all the neat world generation with complete disregard for all the creatures that inhabit these lands I am sure the EPA and PETA would like to have a word with you afterwards The power of the destruction scales with the highest powered pickaxe in your inventory @@ -59,5 +69,5 @@ SuspiciousLookingJellyBean: { TundraLeash: { DisplayName: Tundra Leash - Tooltip: Summons a Rimehound mount + Tooltip: Summons a rideable Rimehound mount } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index f3c551bc30..5d49b98b69 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -344,7 +344,11 @@ FatesReveal: { FlareBolt: { DisplayName: Flare Bolt - Tooltip: Casts a slow-moving ball of flame + Tooltip: + ''' + Casts a ball of flame + Balls of flame collapse into a swirling backdraft which pulls in enemies + ''' } ForbiddenSun: { @@ -354,12 +358,22 @@ ForbiddenSun: { FrigidflashBolt: { DisplayName: Frigidflash Bolt - Tooltip: Casts a slow-moving ball of flash-freezing magma + Tooltip: + ''' + Casts a fast ball of flash-freezing magma that bounces off tiles + When hitting a tile, a flarefrost burst is produced + Press to cast an empowered ball that creates a collapsing flarefrost vortex which explodes + ''' } FrostBolt: { DisplayName: Frost Bolt - Tooltip: Casts a slow-moving ball of frost + Tooltip: + ''' + Casts a ball of frost that bounces off tiles + When hitting a tile, a small frost burst is produced + Frost projectiles will fall to the ground after enough time has passed + ''' } Genesis: { @@ -678,7 +692,11 @@ PrimordialEarth: { PurgeGuzzler: { DisplayName: Purge Guzzler - Tooltip: Emits three beams of holy energy in a tight spread + Tooltip: + ''' + Fires a barrage of holy rays that converge into two massive sweeping beams + 'Baptism by holy fire' + ''' } RainbowPartyCannon: { @@ -889,7 +907,7 @@ ThePrince: { DisplayName: The Prince Tooltip: ''' - Casts a holy fireball that explodes into 6 flames + Casts a holy fireball that explodes into six homing flames 'So you're telling me that the prince exploded, and then turned into a flower?' -Dain, the sailor druid ''' diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 8e2f59aac7..d4e8dafe25 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -261,8 +261,11 @@ BurningRevelation: { DisplayName: Burning Revelation Tooltip: ''' - Emits large holy explosions on hit - An exceptionally agile yoyo + An ever burning yoyo that constantly charges power + Direct hits greatly increase the charge and release profaned energy that scales with charge level + At maximum charge, the yoyo unleashes a volley of homing stars that gain damage the farther they travel + Stars with maximum damage let off an additional explosion on hit + 'It burns, but you hold it close to your heart. Clarity and purpose fill your soul' ''' } @@ -719,7 +722,14 @@ Hellkite: { HolyCollider: { DisplayName: Holy Collider - Tooltip: Striking enemies will cause them to explode into holy fire + Tooltip: + ''' + Swings a holy greatsword that can be charged for higher damage + Charged swings create four lingering flares that float around the point of impact + Striking a flare with an uncharged strike will push it around and extend its lifetime + Charged swings can empower flares, turning them into massive fireballs on hit and launching them to your cursor + Holding while swinging will repeatedly do uncharged slashes that create a spread of flames on hit + ''' } IllustriousKnives: { @@ -1072,7 +1082,10 @@ SeekingScorcher: { DisplayName: Seeking Scorcher Tooltip: ''' - Throws a holy boomerang that seeks out up to four enemies before returning to the player + Throws a massive crystalline axe which bounces to three additional targets after hitting + Crystallizes in place if all bounces have not been exhausted + Crystallized hatchets can be shattered by another axe + Doing so empowers the hatchet based on the amount shattered but prevents it from crystallizing 'May your enemies burn in hell for the sins they have committed' ''' } @@ -1086,6 +1099,16 @@ Shimmerspark: { ''' } +SkytideDragoon: { + DisplayName: Skytide Dragoon + Tooltip: + ''' + Calls down a thunderbolt to strike and charge the tip of the spear + Press to discharge the electricity as a spread of bolts that narrows as you spend the energy + Hold when the spear catches the thunderbolt to redirect it to the cursor + ''' +} + SmokingComet: { DisplayName: Smoking Comet Tooltip: Rains stars from the sky diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 3e316b7a50..2a017a725e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -34,7 +34,7 @@ AngelicShotgun: { Tooltip: ''' Each shot casts a radiant beam of holy light from the sky - Converts musket balls into hallow-point rounds + Musket balls convert into hallow-point rounds which also empower the beam 'Fighting 'til the war's won' ''' } @@ -187,8 +187,8 @@ BlissfulBombardier: { DisplayName: Blissful Bombardier Tooltip: ''' - Fires flare rockets - Rockets will destroy tiles with tile-destroying ammo + Launches a crystalline missile high into the sky, raining holy fire on the cursor + The missile relentlessly seeks out a target before bursting into a massive explosion ''' } @@ -986,10 +986,20 @@ PristineFury: { DisplayName: Pristine Fury Tooltip: ''' - Fires an intense helix of flames that explode into a column of smoke - Press to disperse intense clouds of profaned heat + Fires an intense helix of flames that burst into a column of smoke + to disperse flammable crystalline powder + Powder can be ignited, causuing it to explode for extra damage + Both helix flames and other nearby explosions can ignite the powder Uses gel for ammo ''' + LegendaryText: + ''' + 'Me and many others lost everything in this world's darkest hour. + I saw a beast descend from the heavens. It had seven eyes in its body, and heralded countless angels of death. + My family was torn from me by them, and my people forsake me. Even our supposed protectors did nothing to aid us. + And thus I swore to those I lost that I would never take such pain laying down again, that my name would dwarf even that of Zeratros; + That one day, this cruel world would know nothing less than My perfect fury.' + ''' } Pumpler: { @@ -1226,15 +1236,6 @@ StellarCannon: { Tooltip: Launches an explosive astral crystal } -StormDragoon: { - DisplayName: Storm Dragoon - Tooltip: - ''' - Fires a spray of bullets - 90% chance to save ammo - ''' -} - StormSurge: { DisplayName: Storm Surge Tooltip: @@ -1312,7 +1313,13 @@ TauCannon: { TelluricGlare: { DisplayName: Telluric Glare - Tooltip: Fires volleys of four colossal radiant arrows which can pass through walls + Tooltip: + ''' + Rapidly fires volleys of arrows + Every other arrow is converted into radiant greatarrows which pierce but quicky dissapear after striking + Wooden arrows are converted into more powerful greatarrows that deal increased damage + 75% chance to save ammo + ''' } TheBallista: { @@ -1372,8 +1379,9 @@ TheStorm: { DisplayName: The Storm Tooltip: ''' - Fires a spread of arrows from the sky - Converts wooden arrows into lightning bolts + Fires a spread of homing lightning bolts and arrows from the sky + Converts wooden arrows into powerful electric beams + 95% chance to save ammo ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 9885348364..065a4ecd1d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -90,16 +90,6 @@ BouncingEyeball: { ''' } -BouncySpikyBall: { - DisplayName: Bouncy Spiky Ball - Tooltip: - ''' - Throws a very bouncy ball that ricochets off walls and enemies - Receives a small boost in damage and velocity after bouncing off an enemy - Stealth strikes throw four at once - ''' -} - Brimblade: { DisplayName: Brimblade Tooltip: @@ -396,8 +386,9 @@ FantasyTalisman: { Tooltip: ''' Fires high velocity talismans that ignore gravity - Talismans attach to enemies, causing them to release lost souls - Stealth strikes release more souls and leave behind souls as they travel + Talismans attach to enemies, releasing vengeful souls that chase them down + Stealth strikes release more souls and erupt into lost souls on death + 'Good thing I didn't bet against you!' ''' } @@ -538,18 +529,6 @@ HeavenfallenStardisk: { ''' } -HellsSun: { - DisplayName: Hell's Sun - Tooltip: - ''' - Hurls up to 10 gravity-defying spiky balls - Once stationary, periodically emit small suns that explode on hit - Stealth strikes emit suns at a faster rate and last for a longer amount of time - Press to delete all existing spiky balls - 'The Subterranean Sun in the palm of your hand' - ''' -} - Hypothermia: { DisplayName: Hypothermia Tooltip: @@ -746,17 +725,11 @@ MoltenAmputator: { DisplayName: Molten Amputator Tooltip: ''' - Throws a scythe that emits molten globs on enemy hits - Stealth strikes spawn molten globs periodically in flight and more on-hit - ''' -} - -MonkeyDarts: { - DisplayName: Monkey Darts - Tooltip: - ''' - Stealth strikes throw 3 bouncing darts at high speed - 'Perfect for popping' + Throw a spinning scythe that lingers at your cursor + to recall all existing scythes + Recalling a scythe while it's on an enemy rends them for massive damage + with a full stealth bar to empower yourself, greatly increasing attack speed for a short time + You cannot recall scythes thrown while empowered ''' } @@ -863,16 +836,6 @@ Plaguenade: { ''' } -PoisonPack: { - DisplayName: Poison Pack - Tooltip: - ''' - Throws up to 3 poisonous spiky balls - Stealth strikes cause the balls to release spore clouds - Press to delete all existing spiky balls - ''' -} - Prismalline: { DisplayName: Prismalline Tooltip: @@ -1182,15 +1145,6 @@ StellarKnife: { ''' } -StickySpikyBall: { - DisplayName: Sticky Spiky Ball - Tooltip: - ''' - Throws a spiky ball that sticks to everything - Stealth strikes throw four at once and last a lot longer - ''' -} - StormfrontRazor: { DisplayName: Stormfront Razor Tooltip: @@ -1421,6 +1375,5 @@ WulfrumKnife: { ''' Fires wulfrum knives in bursts of 3 Stealth strikes make the knife fly further and hit several times at once - Hold to magnetize all nearby fallen knives back to you ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index 3c52839562..36a6cecebb 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -250,7 +250,14 @@ DankStaff: { DazzlingStabberStaff: { DisplayName: Dazzling Stabber Staff - Tooltip: Summons a holy blade to fight for you + Tooltip: + ''' + Summons three holy daggers made of profaned materials to fight for you + Holy flame daggers gallantly turn all that oppose them to ashes + Crystalline daggers gracefully carve foes to ribbons + Profane daggers brutishtly splinter and reform eternally + 'Ever onward, towards Her future' + ''' } DeathstareRod: { @@ -633,7 +640,10 @@ SanctifiedSpark: { Tooltip: ''' {$CommonItemTooltip.Sentry} - Summons a friendly immolator to fire holy sparks at your enemies + Summons a friendly immolator that will float towards you + Immolators rapidly fire homing flares at nearby enemies, before continuing to float near you again + After firing, Immolators will fire one healing bolt at you for every 4 summon slots you have + 'They might be a bit clingy, but at least they're warm' ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson index ee71b5f69a..6e12a04bf8 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson @@ -30,26 +30,13 @@ RelicOfDeliverance: { DisplayName: Relic of Deliverance Tooltip: ''' - Press to begin charging up a lunging spear attack - Press again to release the charge and lunge towards the cursor - Pressing while lunging to redirect the lunge to the cursor - Holding any other item will cancel the charge - ''' -} - -RelicOfResilience: { - DisplayName: Relic of Resilience - Tooltip: - ''' - Summons an artifact at the mouse position - The artifact is damaged by enemies and all projectiles - When destroyed, the artifact explodes into a rotating burst of shards - If an enemy is in the area of the shards, its next attack will be 45% weaker - This effect has a cooldown - After 5 seconds, the shards come together to reform the original artifact - This reformation can happen 3 times before needing to be re-summoned - You gain a 5 second cooldown when summoning a new artifact - If an artifact already exists, using this item again will relocate it to the cursor + Using mounts you on the spear; holding revvs the spear, slowing you down + Release to launch yourself at high speeds, halved while a boss is alive + Losing too much speed while charging will bust the charge, resetting your speed + The dash allows you to ram through enemies and travel through tiles + Being inside tiles for too long will warp you back to where you entered + Press to dismount + Holding out the spear heavily reduces the damage of all summons ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Misc.hjson index d748a0bf3d..be9f613967 100644 --- a/Localization/en-US/Mods.CalamityMod.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Misc.hjson @@ -41,6 +41,15 @@ Tier2KnowledgeTooltip: The Planetoid schematic must be deciphered first Tier3KnowledgeTooltip: The Jungle schematic must be deciphered first Tier4KnowledgeTooltip: The Underworld schematic must be deciphered first Tier5KnowledgeTooltip: The Ice biome schematic must be deciphered first +// Wing Tooltips and related string +VertSpeedQuality1: Bad vertical speed +VertSpeedQuality2: Average vertical speed +VertSpeedQuality3: Good vertical speed +VertSpeedQuality4: Great vertical speed +VertSpeedQuality5: Excellent vertical speed +HorizSpeed: Horizontal speed: {0} +AccelMult: Acceleration multiplier: {0} +FlightTime: Flight time: {0} // Other CombatText uses and Item Messages ShiftToExpand: Hold SHIFT to see an expanded description LearnedSchematic: You learned how to create new things! diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson index d69e030235..1ac5d4b30e 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson @@ -73,7 +73,6 @@ FoveanatorFlamethrower.DisplayName: Nebulous Flames FrostMist.DisplayName: Frost Mist GooglyEye.DisplayName: Googly Eye GreatSandBlast.DisplayName: Great Sand Blast -HealOrbProv.DisplayName: Heal HellfireExplosion.DisplayName: Brimstone Hellfire Explosion HiveBombGoliath.DisplayName: Hive Bomb HolyAura.DisplayName: Holy Aura diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index c6bb9aca0d..6cbb3601eb 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -70,6 +70,7 @@ ExoVortex2.DisplayName: Subsuming Vortex FabBolt.DisplayName: Fab Bolt FabRay.DisplayName: Fab Ray FatesRevealFlame.DisplayName: Fate's Reveal +FireImplosion.DisplayName: Swirling Backdraft FlareBoltProjectile.DisplayName: Flare Bolt ForbiddenAxeBlade.DisplayName: Ruin Blade ForbiddenSunburst.DisplayName: Sunburst diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index c9ff1ef87a..a44825bf12 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -53,6 +53,7 @@ BrimstoneSwordProj.DisplayName: Brimstone Sword BrinySpout.DisplayName: Briny Spout BrinyTyphoonBubble.DisplayName: Bubble BrokenBiomeBladeHoldout.DisplayName: Broken Biome Blade +BurningHolyBlast.DisplayName: Profaned Blast BurningMeteor.DisplayName: Meteor CatastropheClaymoreSparkle.DisplayName: Catastrophe Sparkle CausticEdgeProjectile.DisplayName: Caustic Edge @@ -87,13 +88,14 @@ DemonBlast.DisplayName: Devil Fork DepthCrusherProjectile.DisplayName: Depth Crusher DepthCrusherSplitProjectile.DisplayName: Depth Crusher Jet DevilsSunriseCyclone.DisplayName: Devil's Sunrise -DivineHatchetBoomerang.DisplayName: Scorching Seeker DNA.DisplayName: DNA DracoBeam.DisplayName: Draconic Beam DracoBeam2.DisplayName: Draconic Beam DraconicSpark.DisplayName: Draconic Spark DragonPowFlail.DisplayName: Dragon Pow DragonRageFireball.DisplayName: Dragon Rage Fireball +DragoonBigBolt.DisplayName: Dragoon Lightning +DragoonSmallBolt.DisplayName: Dragoon Bolt EarthBoom.DisplayName: Earth's Judgement EarthMeteor.DisplayName: Gaia Meteor ElementalGlassStar.DisplayName: Glass Star @@ -221,9 +223,11 @@ SandFire.DisplayName: Fire SanguineFury.DisplayName: Sanguine Fury SanguineFuryDash.DisplayName: Shredding Lunge SanguineFuryWheel.DisplayName: Sanguine Bladewheel +ScorcherExplosion.DisplayName: Scorching Crystal Blast ScourgeoftheCosmosMini.DisplayName: Miniature Cosmic Scourge ScourgeoftheCosmosProj.DisplayName: Cosmic Scourge SeashineSwordProj.DisplayName: Seashine Beam +SeekingScorcherProj.DisplayName: Scorching Seeker SolarNeedle.DisplayName: Solar Needle SolsticeBeam.DisplayName: Solstice Beam SoulScythe.DisplayName: Soul Scythe diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 37fcb50197..62f5e4018d 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -21,13 +21,12 @@ BallistaGreatArrow.DisplayName: Ballista Great Arrow BarinadeArrow.DisplayName: Fin Arrow BlahajBlast.DisplayName: Blahaj Blast BlightFlames.DisplayName: Blight Flames -BlissfulBombardierDustProjectile.DisplayName: Holy Flare Dust +BlissfulBombardierSplitProjectile.DisplayName: Profaned Mini-Rocket BloodBoilerFire.DisplayName: Blood Fire BloodClotFriendly.DisplayName: Blood Clot BloodfireArrowProj.DisplayName: Bloodfire Arrow BloodfireBulletProj.DisplayName: Bloodfire Bullet BloodflareSoul.DisplayName: Blood Soul -Bolt.DisplayName: Storm Bolt BoltArrow.DisplayName: Bolt Arrow BouncingShotgunPellet.DisplayName: Shotgun Pellet BrimstoneBolt.DisplayName: Brimstone Bolt @@ -139,7 +138,7 @@ NorfleetComet.DisplayName: Comet NorfleetExplosion.DisplayName: Explosion NovaChargedShot.DisplayName: Charged Nova Blast NovaShot.DisplayName: Nova Bolt -Nuke.DisplayName: Nuke +NukeOfBliss.DisplayName: Profaned Nuke NullFlash.DisplayName: Null Flash NullShot.DisplayName: Null OntologicalDespoilerBeam.DisplayName: Null-Annihilation Beam @@ -230,6 +229,7 @@ TheMaelstromExplosion.DisplayName: Reaper Explosion TheMaelstromShark.DisplayName: Reaper Shark ThePackMinissile.DisplayName: Pack Minissile ThePackMissile.DisplayName: Pack Missile +TheStormLightningShot.DisplayName: Storm Bolt TitaniumRailgunScope.DisplayName: Titanium Scope TitaniumRailgunShot.DisplayName: Titanium Decimator TorrentialArrow.DisplayName: Torrential Arrow diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson index d31641e95d..559a29fcef 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -22,7 +22,6 @@ BlueFlamePillar.DisplayName: Flame Pillar BlunderBoosterLightning.DisplayName: Blunder Bolt BouncingEyeballProjectile.DisplayName: Bouncy Eyeball BouncingEyeballProjectileStealthStrike.DisplayName: Bouncy Eyeball -BouncyBol.DisplayName: Bouncy Ball Brick.DisplayName: Brick BrickFragment.DisplayName: Brick Fragment Brimblade2.DisplayName: Brimblade @@ -99,7 +98,6 @@ ExecutionersBladeStealthProj.DisplayName: Executioner's Blade ExorcismProj.DisplayName: Exorcism ExorcismShockwave.DisplayName: Exorcism Shockwave ExorcismStar.DisplayName: Exorcism Star -ExplosiveSun.DisplayName: Explosive Sun FantasyTalismanProj.DisplayName: Talisman FantasyTalismanStealth.DisplayName: Talisman FeatherKnifeProjectile.DisplayName: Feather Knife @@ -132,7 +130,6 @@ GrimreaverBat.DisplayName: Grim Bat GrimreaverSkull.DisplayName: Grim Skull HeavenfallenEnergy.DisplayName: Heavenfallen Energy HeavenfallenStardiskBoomerang.DisplayName: Heavenfallen Stardisk -HellsSunProj.DisplayName: Hell's Sun Honeycomb.DisplayName: Honeycomb HoneycombFragment.DisplayName: Honeycomb Fragment HypothermiaChunk.DisplayName: Ice Chunk @@ -177,7 +174,6 @@ MeteorFistProj.DisplayName: Meteor Fist Gud For A Lot Of Shtuff MeteorFistStealth.DisplayName: Meteor Fist Gud For A Lot Of Shtuff MoltenAmputatorProj.DisplayName: Molten Amputator MoltenBlobThrown.DisplayName: Molten Blob -MonkeyDart.DisplayName: Monkey Dart MoonSigil.DisplayName: Moon Sigil MycorootProj.DisplayName: Mycoroot MythrilKnifeProjectile.DisplayName: Mythril Knife @@ -204,7 +200,6 @@ PhantasmalSoulBlue.DisplayName: Blue Spirit PlaguedFuelPackCloud.DisplayName: Plagued Cloud PlaguenadeBee.DisplayName: Plague Bee PlaguenadeProj.DisplayName: Plaguenade -PoisonBol.DisplayName: Poison Ball Prismalline2.DisplayName: Prismalline Prismalline3.DisplayName: Prismalline PrismallineProj.DisplayName: Prismalline @@ -276,7 +271,6 @@ StealthNimbus.DisplayName: Nimbus StealthNimbusCloud.DisplayName: Nimbus StealthRain.DisplayName: Rain StellarKnifeProj.DisplayName: Stellar Knife -StickyBol.DisplayName: Sticky Bol StormfrontLightning.DisplayName: Stormfront Lightning StormfrontRazorProjectile.DisplayName: Stormfront Razor Stormfrontspark.DisplayName: Stormfront Spark diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index 886ebbdb7c..107d00e2db 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -2,12 +2,7 @@ AbaddonCrit.DisplayName: Brimstone Blast AeroExplosive.DisplayName: Aeroboom AllianceTriangle.DisplayName: Alliance Triangle ArcZap.DisplayName: Arc Zap -ArtifactOfResilienceShard1.DisplayName: Artifact Shard -ArtifactOfResilienceShard2.DisplayName: Artifact Shard -ArtifactOfResilienceShard3.DisplayName: Artifact Shard -ArtifactOfResilienceShard4.DisplayName: Artifact Shard -ArtifactOfResilienceShard5.DisplayName: Artifact Shard -ArtifactOfResilienceShard6.DisplayName: Artifact Shard +ArtifactOfResilienceShards.DisplayName: Artifact Shard AscendantAura.DisplayName: Ascendant Aura AstralFallingSand.DisplayName: Astral Falling Sand AstralSandBallFalling.DisplayName: Astral Sand @@ -15,6 +10,7 @@ AstralSandBallGun.DisplayName: Astral Sand AstralSpray.DisplayName: Astral Spray AstralStar.DisplayName: Star AuricLandMineExplosion.DisplayName: Auric Land Mine Explosion +BasicBurst.DisplayName: Nondescript Damaging Explosion BasicPlagueBee.DisplayName: Basic Plague Bee BlazingStarHeal.DisplayName: Blazing Star Heal BlazingStarThatDoesNotHeal.DisplayName: Blazing Star That Does Not Heal @@ -53,9 +49,14 @@ EmpyreanMarble.DisplayName: Empyrean Marble EmpyreanStellarDetritus.DisplayName: Empyrean Stellar Detritus EnergyShell.DisplayName: Energy Shell EutrophicSandBallGun.DisplayName: Eutrophic Sand +ExoTankHoverThrust.DisplayName: Exo Thrust +ExoTankLaser.DisplayName: Mini Exo Pulse Laser +ExoTankMissile.DisplayName: Miracle Missile +ExoTankMuzzleFlash.DisplayName: Mini Exo Flash FeralDoubleBobber.DisplayName: Feral Bobber FlameLickedBarrage.DisplayName: Flame Licked Barrage FlameLickedHellblast.DisplayName: Flame Licked Hellblast +FlashBolt.DisplayName: The Reminder FuckYou.DisplayName: Explosion FungalClumpMinion.DisplayName: Fungal Clump GemTechArmorGem.DisplayName: Trireme's Gem @@ -68,6 +69,7 @@ GreenLabSeeker.DisplayName: Seeking Mechanism HeronBobber.DisplayName: Heron Bobber HideOfAstrumDeusExplosion.DisplayName: Explosion HolyExplosionSupreme.DisplayName: Explosion +HolyStarDamage.DisplayName: Holy Star HydrothermalSmoke.DisplayName: Smoke HydrothermicFlare.DisplayName: Hydrothermic Flare HydrothermicFlareRogue.DisplayName: Hydrothermic Flare @@ -127,6 +129,8 @@ TitanHeartBoom.DisplayName: Titan Heart Boom UrsaSlash.DisplayName: Ursa Slash VerstaltiteBobber.DisplayName: Verstaltite Bobber VoidFieldGenerator.DisplayName: Void Field Generator +WarbannerDamage.DisplayName: The Unmatched Power of the Sun +WarbannerLight.DisplayName: Warbanner Light WaterConvertor.DisplayName: Water Convertor WhiteLabSeeker.DisplayName: Seeking Mechanism WulfrumBobber.DisplayName: Wulfrum Bobber @@ -137,3 +141,4 @@ YanmeisKnifeSlash.DisplayName: Yanmei's Knife YellowLabSeeker.DisplayName: Seeking Mechanism VoidofExtinctionCrit.DisplayName: Void of Extinction Crit XykDeathAnim.DisplayName: Xyk Death Animation +RelicGuard.DisplayName: Relic Guard diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index 636c792fc4..0fa1723928 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -1,4 +1,6 @@ +// Vanilla UI edits SmallWorldWarning: "[c/FF0000:SMALL WORLDS NOT SUPPORTED BY CALAMITY]" +WorldMaster: Game over man, game over! (Brutally hard boss changes, for the truly brave) // Main UI Elements Adrenaline: Adrenaline Nanomachines: Nanomachines @@ -111,7 +113,7 @@ Cooldowns: { PrismaticLaser: Prismatic Laser Barrage Cooldown ProfanedSoulShieldDurability: Profaned Soul Shield Durability ProfanedSoulShieldRecharge: Profaned Soul Shield Recharge - RelicOfResilience: Relic of Resilience Cooldown + RelicOfResilienceCooldown: Relic of Resilience Cooldown RogueBooster: Rogue Booster Cooldown SandCloak: Sand Cloak Cooldown SandsmokeBombActive: Sandsmoke Bomb Duration @@ -125,6 +127,7 @@ Cooldowns: { TarragonCloak: Tarragon Cloak Cooldown TarragonImmunity: Tarragon Immunity Cooldown UniverseSplitter: Universe Splitter Cooldown + WarbanneroftheRighteousBuff: Warbanner Strength WulfrumBastionActive: Power Armor Durability WulfrumBastionCooldown: Wulfrum Bastion Cooldown WulfrumRoverDriveDurability: Protective Matrix Durability diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson index 8b13789179..83d10bae9c 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson @@ -1 +1,23 @@ - +BatWings: Improved vision +BeeWings: Permanently gives the Honey buff +BoneWings: Halves flight time when taking a hit +ButterflyWings: Increases mana regeneration rate +FestiveWings: Homing ornaments rain down as you fly +FinWings: + ''' + Gills effect and you can move freely through liquids + You fall faster while submerged in liquid + ''' +FlameWings: Multiplies all heat debuff damage by 1.25x +FrozenWings: Multiplies all cold debuff damage by 1.25x +HarpyWings: + ''' + 10% increased movement speed + With Harpy Ring or Angel Treads equipped, most attacks sometimes launch feathers + ''' +LeafWings: +10 defense and permanent Dryad's Blessing +WingsNebula: Increases the pickup range of Nebula armor's nebula boosters +WingsSolar: Increases Solar Flare armor's dash velocity by 25% +WingsStardust: Greatly increases Stardust armor's stardust guardian damage and attack range +TatteredFairyWings: You leave a trail of fairy dust as you fly +WingsVortex: Prevents dashes from disabling Vortex armor's stealth ability diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 1ad898e04a..2ce7eefbbd 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -10,10 +10,12 @@ using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon.Whips; using CalamityMod.CalPlayer; +using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.ExtraTextures; using CalamityMod.Graphics.Metaballs; using CalamityMod.Graphics.Renderers.CalamityRenderers; +using CalamityMod.Items; using CalamityMod.Items.Accessories; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.Tools; @@ -89,9 +91,6 @@ using Terraria.ModLoader.Utilities; using Terraria.UI.Chat; using Terraria.Utilities; using static Terraria.ModLoader.ModContent; -using CalamityMod.ExtraTextures; -using MonoMod.Utils; -using CalamityMod.Systems.Collections; namespace CalamityMod.NPCs { @@ -287,6 +286,14 @@ namespace CalamityMod.NPCs public int aCrunch = 0; public int crumble = 0; + public int warbannerBurnTime = 0; // Determines the rate that the enemy is damaged + public int warbannerBurnTimer = 0; // The duration of the debuff + public int warbannerBurnStacks = 0; // The stacks increase how fast the debuff hits + public int warbannerBurnDamage = 0; // Damage of the hits based on player's damage + public Vector2 warbannerBurnDirection; + public float warbannerBurnIntensity = 0; + public bool warbannerBurnMarked = false; + public bool warbannerBurnHideEffects = false; public const int veriumDoomTime = 90; public int veriumDoomTimer = 0; public int veriumDoomStacks = 0; @@ -323,7 +330,6 @@ namespace CalamityMod.NPCs public int sulphurPoison = 0; public int ladHearts = 0; public int kamiFlu = 0; - public int relicOfResilienceCooldown = 0; public int relicOfResilienceWeakness = 0; public int GaussFluxTimer = 0; public int sagePoisonTime = 0; @@ -522,6 +528,14 @@ namespace CalamityMod.NPCs myClone.aCrunch = aCrunch; myClone.crumble = crumble; + myClone.warbannerBurnTime = warbannerBurnTime; + myClone.warbannerBurnTimer = warbannerBurnTimer; + myClone.warbannerBurnStacks = warbannerBurnStacks; + myClone.warbannerBurnDamage = warbannerBurnDamage; + myClone.warbannerBurnDirection = warbannerBurnDirection; + myClone.warbannerBurnIntensity = warbannerBurnIntensity; + myClone.warbannerBurnMarked = warbannerBurnMarked; + myClone.warbannerBurnHideEffects = warbannerBurnHideEffects; myClone.veriumDoomTimer = veriumDoomTimer; myClone.veriumDoomStacks = veriumDoomStacks; myClone.veriumDoomMarked = veriumDoomMarked; @@ -552,7 +566,6 @@ namespace CalamityMod.NPCs myClone.sulphurPoison = sulphurPoison; myClone.ladHearts = ladHearts; myClone.kamiFlu = kamiFlu; - myClone.relicOfResilienceCooldown = relicOfResilienceCooldown; myClone.relicOfResilienceWeakness = relicOfResilienceWeakness; myClone.GaussFluxTimer = GaussFluxTimer; myClone.sagePoisonTime = sagePoisonTime; @@ -3626,10 +3639,10 @@ namespace CalamityMod.NPCs // Calculate extra DR based on kill time, similar to the Hush boss from The Binding of Isaac // Cirrus being active makes the extra DR cease to function bool cirrusBossActive = false; - if (CalamityGlobalNPC.SCal != -1) + if (SCal != -1) { - if (Main.npc[CalamityGlobalNPC.SCal].active) - cirrusBossActive = Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus; + if (Main.npc[SCal].active) + cirrusBossActive = Main.npc[SCal].ModNPC().cirrus; } bool nightProvi = npc.type == NPCType() && !Main.IsItDay(); @@ -3676,6 +3689,8 @@ namespace CalamityMod.NPCs calcDR *= ArmorCrunch.MultiplicativeDamageReductionEnemy; if (npc.Calamity().crumble > 0) calcDR *= Crumbling.MultiplicativeDamageReductionEnemy; + if (relicOfResilienceWeakness > 0) + calcDR *= 0.5f; return calcDR; @@ -5575,10 +5590,6 @@ namespace CalamityMod.NPCs sulphurPoison--; if (sagePoisonTime > 0) sagePoisonTime--; - if (relicOfResilienceCooldown > 0) - relicOfResilienceCooldown--; - if (relicOfResilienceWeakness > 0) - relicOfResilienceWeakness--; if (GaussFluxTimer > 0) GaussFluxTimer--; if (ladHearts > 0) @@ -5592,6 +5603,78 @@ namespace CalamityMod.NPCs if (cursorFocus > 0 && cursorFocus < cursorFocusMax) cursorFocus--; + + if (relicOfResilienceWeakness > 0) + relicOfResilienceWeakness--; + + if (warbannerBurnTimer > 0) + warbannerBurnTimer--; + if (warbannerBurnTimer == 0 && warbannerBurnMarked) + { + warbannerBurnTime = 0; + warbannerBurnDamage = 0; + warbannerBurnMarked = false; + warbannerBurnStacks = 0; + } + if (warbannerBurnMarked) + { + int maxStacks = 300; // Time in frames needed to reach max power + int fastestBurnRate = 2; + int slowestBurnRate = 15; + float burnPower = Utils.Remap(warbannerBurnStacks, 0, maxStacks, slowestBurnRate, fastestBurnRate, true); + + float sizeBonus = (1 + Utils.GetLerpValue(0, 170, Math.Max(npc.Hitbox.Width / 2f, npc.Hitbox.Height / 2f))); + + if (!warbannerBurnHideEffects) + { + Lighting.AddLight(npc.Center, Color.Gold.ToVector3() * 0.3f * warbannerBurnIntensity); + } + if (warbannerBurnStacks == maxStacks && !warbannerBurnHideEffects) + { + // Sound and visual for hitting max stacks + for (int i = 0; i < 15; i++) + { + Particle spark = new SparkParticle(npc.Center, new Vector2(13, 13).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 1f), true, 45, 0.85f, Main.rand.NextBool() ? Color.Goldenrod : Color.Orange); + GeneralParticleHandler.SpawnParticle(spark); + } + SoundStyle fullPower = new("CalamityMod/Sounds/Custom/Providence/ProvidenceBurn"); + SoundEngine.PlaySound(fullPower with { Volume = 0.7f, Pitch = 0.7f }, npc.Center); + warbannerBurnStacks++; + } + if (warbannerBurnIntensity > 2.5f && npc.CanBeMoved(true)) + { + npc.velocity *= 1f - 0.25f * Utils.GetLerpValue(2.5f, 3, warbannerBurnIntensity); + if (npc.velocity.Length() > 5 && warbannerBurnIntensity > 2.85f) // Repel leaping enemies + npc.velocity = -npc.velocity * 0.7f; + } + if (warbannerBurnTime == 0) + { + if (!warbannerBurnHideEffects) + { + int particleLevel = (int)(MathHelper.Clamp((slowestBurnRate - burnPower) * 0.15f, 1, 2) * warbannerBurnIntensity); + for (int d = 0; d < particleLevel; d++) + { + Color color = Main.rand.NextBool() ? Color.Goldenrod : Color.Lerp(Color.OrangeRed, Color.Orange, Main.rand.NextFloat(0, 1)); ; + Vector2 sparkPos = npc.Center - warbannerBurnDirection * 220 * Utils.GetLerpValue(0, 200, Math.Max(npc.Hitbox.Width / 2f, npc.Hitbox.Height / 2f)); + float velAdjust = Main.rand.NextFloat(2, 7) * warbannerBurnIntensity * sizeBonus; + Vector2 endVel = warbannerBurnDirection * velAdjust; + Vector2 startVel = (warbannerBurnDirection * velAdjust).RotatedByRandom(0.6f * warbannerBurnIntensity); + Particle sparks = new VelChangingSpark(sparkPos, startVel, endVel, "CalamityMod/Particles/SmallBloom", Main.rand.Next(18, 22 + 1), Main.rand.NextFloat(0.1f, 0.25f) * sizeBonus, color * 0.75f, new Vector2(0.7f, 1), true, false, 0, false, 0.45f, 0.1f); + GeneralParticleHandler.SpawnParticle(sparks); + Dust lust2 = Dust.NewDustPerfect(sparkPos, DustType(), startVel, Scale: Main.rand.NextFloat(0.7f, 1.1f) * sizeBonus); + lust2.noGravity = true; + lust2.color = color; + lust2.noLightEmittence = true; + } + } + var player = Main.LocalPlayer; + Projectile burnHit = Projectile.NewProjectileDirect(player.GetSource_FromThis(), npc.Center, Vector2.Zero, ProjectileType(), (int)(warbannerBurnDamage * warbannerBurnIntensity), 0, Main.myPlayer, npc.whoAmI); + burnHit.ArmorPenetration = 50; + warbannerBurnTime = (int)(burnPower + (3 - warbannerBurnIntensity) * 4); + } + warbannerBurnTime--; + } + if (veriumDoomTimer > 0) veriumDoomTimer--; if (veriumDoomTimer == 0 && veriumDoomMarked) @@ -6239,6 +6322,9 @@ namespace CalamityMod.NPCs if (modPlayer.camper && !player.StandingStill()) modifiers.SourceDamage *= 0.1f; + if ((projectile.minion || ProjectileID.Sets.MinionShot[projectile.type] || projectile.sentry || ProjectileID.Sets.SentryShot[projectile.type]) && (player.ownedProjectileCounts[ProjectileType()] > 0 || player.ownedProjectileCounts[ProjectileType()] > 0 || (player.Calamity().rOfResilienceCooldown == 0 && player.HeldItem.type == ItemType()))) + modifiers.SourceDamage *= 0.1f; + if (projectile.minion || ProjectileID.Sets.MinionShot[projectile.type] || projectile.sentry || ProjectileID.Sets.SentryShot[projectile.type]) EditWhipTagDamage(projectile, npc, ref modifiers); } @@ -6393,7 +6479,7 @@ namespace CalamityMod.NPCs public override void HitEffect(NPC npc, NPC.HitInfo hit) { if (npc.life <= 0 && npc.Organic() && ashesOnDeath > 0) - DeathAshParticle.CreateAshesFromNPC(npc); + DeathAshParticle.CreateAshesFromNPC(npc, Vector2.Zero); // Cultist shield flicker if (npc.type == NPCID.CultistBoss) @@ -7044,6 +7130,9 @@ namespace CalamityMod.NPCs if (pFlames > 0) // Plague debuff Plague.DrawEffects(npc, ref drawColor); + if (relicOfResilienceWeakness > 0) + ProfanedWeakness.DrawEffects(npc, ref drawColor); + if (rTide > 0) RiptideDebuff.DrawEffects(npc, ref drawColor); @@ -7386,7 +7475,7 @@ namespace CalamityMod.NPCs spriteBatch.Draw(tex, npc.Center - screenPos - new Vector2(drawPosX, drawPosY + additionalYOffset), null, Color.White, 0f, default, 0.5f, SpriteEffects.None, 0f); // Shred stack display - if (currentDebuffs[i] == TextureAssets.Buff[ModContent.BuffType()].Value) + if (currentDebuffs[i] == TextureAssets.Buff[BuffType()].Value) ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, FontAssets.MouseText.Value, somaShredStacks.ToString(), npc.Center - screenPos - new Vector2(drawPosX, drawPosY + additionalYOffset) + Vector2.One * 4f, Color.Gold, 0f, Vector2.Zero, Vector2.One * Main.UIScale * 0.8f); } } diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 486a3babb9..95effcf1f3 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -790,20 +790,20 @@ namespace CalamityMod.NPCs #region Martian Madness // Martian Madness On-Foot Soldiers - // 1-4 Shock Grenade @ 25% + // 5% chance to drop Shock Grenade case NPCID.BrainScrambler: case NPCID.GrayGrunt: case NPCID.GigaZapper: case NPCID.MartianEngineer: case NPCID.RayGunner: case NPCID.ScutlixRider: - npcLoot.Add(ModContent.ItemType(), 4, 1, 4); + npcLoot.Add(ModContent.ItemType(), 20); break; // Martian Officer - // 3-8 Shock Grenade @ 33.33% + // 10% chance to drop Shock Grenade case NPCID.MartianOfficer: - npcLoot.Add(ModContent.ItemType(), 3, 3, 8); + npcLoot.Add(ModContent.ItemType(), 10); break; // Martian Walker @@ -1088,14 +1088,13 @@ namespace CalamityMod.NPCs }); // Define a replacement rule which drops the weapons Calamity style. - npcLoot.AddNormalOnly(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, ItemID.BeeKeeper, ItemID.BeesKnees, ItemID.BeeGun)); + npcLoot.AddNormalOnly(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, ItemID.BeeKeeper, ItemID.BeesKnees, ItemID.BeeGun, ModContent.ItemType())); // Expert+ drops are also available on Normal npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.HiveBackpack)); npcLoot.AddNormalOnly(ModContent.ItemType(), 10); // Would be in the bag otherwise - npcLoot.AddNormalOnly(ModContent.ItemType(), 1, 30, 50); npcLoot.AddNormalOnly(ModContent.ItemType(), ThankYouPainting.DropInt); // Queen Bee drops Stingers in Calamity diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index 865d154ccf..dbd6a74ecb 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -1577,6 +1577,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Relic npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).AddIf(CanDropLoot, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).AddIf(CanDropLoot, ModContent.ItemType(), 4); // GFB Broken Water Filter var GFBOnly = npcLoot.DefineConditionalDropSet(DropHelper.GFB); diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index 600a0916c2..2c7e5ebf0e 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -1343,7 +1343,7 @@ namespace CalamityMod.NPCs.HiveMind ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - new WeightedItemStack(ModContent.ItemType(), 1f, 30, 50), + ModContent.ItemType(), })); // Materials diff --git a/NPCs/Other/LecherousOrb.cs b/NPCs/Other/LecherousOrb.cs index 09396c24f6..8b339b269e 100644 --- a/NPCs/Other/LecherousOrb.cs +++ b/NPCs/Other/LecherousOrb.cs @@ -69,7 +69,7 @@ namespace CalamityMod.NPCs.Other // Notify the owner that the orb has indeed spawned. Owner.Calamity().awaitingLecherousOrbSpawn = false; - Vector2 destination = Vector2.Lerp(Owner.Center, Main.MouseWorld, 0.625f); + Vector2 destination = Vector2.Lerp(Owner.Center, Owner.ClampedMouseWorld(), 0.625f); NPC.Center = Vector2.Lerp(NPC.Center, destination, 0.035f).MoveTowards(destination, 8f); if (NPC.WithinRange(destination, 5f)) NPC.Center = destination; diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index cdc9b9f97e..230e7abc05 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -583,7 +583,7 @@ namespace CalamityMod.NPCs.Perforator ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - new WeightedItemStack(ModContent.ItemType(), 1f, 30, 50), + ModContent.ItemType(), })); // Materials diff --git a/NPCs/Polterghast/PolterghastHook.cs b/NPCs/Polterghast/PolterghastHook.cs index f83679ac0b..a31142c7f1 100644 --- a/NPCs/Polterghast/PolterghastHook.cs +++ b/NPCs/Polterghast/PolterghastHook.cs @@ -162,7 +162,7 @@ namespace CalamityMod.NPCs.Polterghast if (NPC.ai[2] > 40f) NPC.ai[3] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[2] == 20f) + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[2] == 20f && Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 192f) { float shotSpeed = 10f * tileEnrageMult; int type = ModContent.ProjectileType(); diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs index 4a1010d253..8f6db58b0b 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs @@ -1225,7 +1225,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians { npcLoot.Add(ModContent.ItemType(), 4); npcLoot.Add(ModContent.ItemType(), 7); - npcLoot.Add(ModContent.ItemType(), 10); + npcLoot.Add(ModContent.ItemType(), 10); npcLoot.Add(ModContent.ItemType(), 10); npcLoot.Add(ModContent.ItemType()); npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 10, 15, 15, 20)); diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs index 8639908070..b8d0f5f027 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs @@ -4,7 +4,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Accessories; -using CalamityMod.Items.Weapons.Typeless; +using CalamityMod.Items; using CalamityMod.NPCs.Providence; using CalamityMod.Projectiles.Boss; using CalamityMod.World; diff --git a/NPCs/Providence/Glowmasks/ProvidenceAltGlow.png b/NPCs/Providence/Glowmasks/ProvidenceAltGlow.png index 5eb0e426b9..99b6e2d0a5 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceAltGlow.png and b/NPCs/Providence/Glowmasks/ProvidenceAltGlow.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceAltGlow2.png b/NPCs/Providence/Glowmasks/ProvidenceAltGlow2.png index 60af8aa914..3259cd5af7 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceAltGlow2.png and b/NPCs/Providence/Glowmasks/ProvidenceAltGlow2.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceAltGlow2Night.png b/NPCs/Providence/Glowmasks/ProvidenceAltGlow2Night.png deleted file mode 100644 index 04cb6c8f39..0000000000 Binary files a/NPCs/Providence/Glowmasks/ProvidenceAltGlow2Night.png and /dev/null differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceAttackAltGlow.png b/NPCs/Providence/Glowmasks/ProvidenceAttackAltGlow.png index 0b219d9c96..b99318ed88 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceAttackAltGlow.png and b/NPCs/Providence/Glowmasks/ProvidenceAttackAltGlow.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceAttackAltGlow2.png b/NPCs/Providence/Glowmasks/ProvidenceAttackAltGlow2.png index 9cc5fd91d0..0715bea009 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceAttackAltGlow2.png and b/NPCs/Providence/Glowmasks/ProvidenceAttackAltGlow2.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceAttackAltGlow2Night.png b/NPCs/Providence/Glowmasks/ProvidenceAttackAltGlow2Night.png deleted file mode 100644 index b019542ded..0000000000 Binary files a/NPCs/Providence/Glowmasks/ProvidenceAttackAltGlow2Night.png and /dev/null differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceAttackGlow.png b/NPCs/Providence/Glowmasks/ProvidenceAttackGlow.png index e500c7d85b..66778d1c6f 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceAttackGlow.png and b/NPCs/Providence/Glowmasks/ProvidenceAttackGlow.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceAttackGlow2.png b/NPCs/Providence/Glowmasks/ProvidenceAttackGlow2.png index 32d83dd410..59773a389b 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceAttackGlow2.png and b/NPCs/Providence/Glowmasks/ProvidenceAttackGlow2.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceAttackGlow2Night.png b/NPCs/Providence/Glowmasks/ProvidenceAttackGlow2Night.png deleted file mode 100644 index 0ce832dc3f..0000000000 Binary files a/NPCs/Providence/Glowmasks/ProvidenceAttackGlow2Night.png and /dev/null differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceAttackGlowNight.png b/NPCs/Providence/Glowmasks/ProvidenceAttackGlowNight.png index 8a8fab82c6..2394c98c2f 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceAttackGlowNight.png and b/NPCs/Providence/Glowmasks/ProvidenceAttackGlowNight.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlow.png b/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlow.png index d95fd5fac7..bfc7b4d123 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlow.png and b/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlow.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlow2.png b/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlow2.png index 8672089e76..a51a57aad6 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlow2.png and b/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlow2.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlow2Night.png b/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlow2Night.png deleted file mode 100644 index 687d9e3336..0000000000 Binary files a/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlow2Night.png and /dev/null differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlowNight.png b/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlowNight.png index 3b9c2e7427..bfdd7e0b67 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlowNight.png and b/NPCs/Providence/Glowmasks/ProvidenceDefenseAltGlowNight.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceDefenseGlow.png b/NPCs/Providence/Glowmasks/ProvidenceDefenseGlow.png index 858b3dbff1..e9b80e61be 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceDefenseGlow.png and b/NPCs/Providence/Glowmasks/ProvidenceDefenseGlow.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceDefenseGlow2.png b/NPCs/Providence/Glowmasks/ProvidenceDefenseGlow2.png index c0ea7d61ed..e5f4272ac7 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceDefenseGlow2.png and b/NPCs/Providence/Glowmasks/ProvidenceDefenseGlow2.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceDefenseGlow2Night.png b/NPCs/Providence/Glowmasks/ProvidenceDefenseGlow2Night.png deleted file mode 100644 index 78d8a5d5df..0000000000 Binary files a/NPCs/Providence/Glowmasks/ProvidenceDefenseGlow2Night.png and /dev/null differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceDefenseGlowNight.png b/NPCs/Providence/Glowmasks/ProvidenceDefenseGlowNight.png index bd27430046..f75ec70fd8 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceDefenseGlowNight.png and b/NPCs/Providence/Glowmasks/ProvidenceDefenseGlowNight.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceGlow.png b/NPCs/Providence/Glowmasks/ProvidenceGlow.png index 0edb725458..3a35e2d9af 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceGlow.png and b/NPCs/Providence/Glowmasks/ProvidenceGlow.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceGlow2.png b/NPCs/Providence/Glowmasks/ProvidenceGlow2.png index f4268ee8df..e1003731dc 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceGlow2.png and b/NPCs/Providence/Glowmasks/ProvidenceGlow2.png differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceGlow2Night.png b/NPCs/Providence/Glowmasks/ProvidenceGlow2Night.png deleted file mode 100644 index d9e79a8288..0000000000 Binary files a/NPCs/Providence/Glowmasks/ProvidenceGlow2Night.png and /dev/null differ diff --git a/NPCs/Providence/Glowmasks/ProvidenceGlowNight.png b/NPCs/Providence/Glowmasks/ProvidenceGlowNight.png index 3d1a8a1623..7452b5d31e 100644 Binary files a/NPCs/Providence/Glowmasks/ProvidenceGlowNight.png and b/NPCs/Providence/Glowmasks/ProvidenceGlowNight.png differ diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 5b1460b0bf..94546146a0 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -189,16 +189,16 @@ namespace CalamityMod.NPCs.Providence // Normal textures TextureAlt = ModContent.Request(ProviPath + "Alt", AssetRequestMode.AsyncLoad); - TextureAltNight = ModContent.Request(ProviPath + "AltNight", AssetRequestMode.AsyncLoad); - TextureAttack = ModContent.Request(ProviPath + "Attack", AssetRequestMode.AsyncLoad); - TextureAttackNight = ModContent.Request(ProviPath + "AttackNight", AssetRequestMode.AsyncLoad); - TextureAttackAlt = ModContent.Request(ProviPath + "AttackAlt", AssetRequestMode.AsyncLoad); - TextureAttackAltNight = ModContent.Request(ProviPath + "AttackAltNight", AssetRequestMode.AsyncLoad); - TextureDefense = ModContent.Request(ProviPath + "Defense", AssetRequestMode.AsyncLoad); - TextureDefenseNight = ModContent.Request(ProviPath + "DefenseNight", AssetRequestMode.AsyncLoad); - TextureDefenseAlt = ModContent.Request(ProviPath + "DefenseAlt", AssetRequestMode.AsyncLoad); - TextureDefenseAltNight = ModContent.Request(ProviPath + "DefenseAltNight", AssetRequestMode.AsyncLoad); - TextureNight = ModContent.Request(ProviPath + "Night", AssetRequestMode.AsyncLoad); + TextureAltNight = ModContent.Request(ProviPath + "AltNight", AssetRequestMode.AsyncLoad); + TextureAttack = ModContent.Request(ProviPath + "Attack", AssetRequestMode.AsyncLoad); + TextureAttackNight = ModContent.Request(ProviPath + "AttackNight", AssetRequestMode.AsyncLoad); + TextureAttackAlt = ModContent.Request(ProviPath + "AttackAlt", AssetRequestMode.AsyncLoad); + TextureAttackAltNight = ModContent.Request(ProviPath + "AttackAltNight", AssetRequestMode.AsyncLoad); + TextureDefense = ModContent.Request(ProviPath + "Defense", AssetRequestMode.AsyncLoad); + TextureDefenseNight = ModContent.Request(ProviPath + "DefenseNight", AssetRequestMode.AsyncLoad); + TextureDefenseAlt = ModContent.Request(ProviPath + "DefenseAlt", AssetRequestMode.AsyncLoad); + TextureDefenseAltNight = ModContent.Request(ProviPath + "DefenseAltNight", AssetRequestMode.AsyncLoad); + TextureNight = ModContent.Request(ProviPath + "Night", AssetRequestMode.AsyncLoad); // Fire glowmasks Texture_Glow = ModContent.Request(GlowPath + "Glow", AssetRequestMode.AsyncLoad); @@ -217,16 +217,10 @@ namespace CalamityMod.NPCs.Providence // Crystal glowmasks Texture_Glow_2 = ModContent.Request(GlowPath + "Glow2", AssetRequestMode.AsyncLoad); TextureAlt_Glow_2 = ModContent.Request(GlowPath + "AltGlow2", AssetRequestMode.AsyncLoad); - TextureAltNight_Glow_2 = ModContent.Request(GlowPath + "AltGlow2Night", AssetRequestMode.AsyncLoad); TextureAttack_Glow_2 = ModContent.Request(GlowPath + "AttackGlow2", AssetRequestMode.AsyncLoad); - TextureAttackNight_Glow_2 = ModContent.Request(GlowPath + "AttackGlow2Night", AssetRequestMode.AsyncLoad); TextureAttackAlt_Glow_2 = ModContent.Request(GlowPath + "AttackAltGlow2", AssetRequestMode.AsyncLoad); - TextureAttackAltNight_Glow_2 = ModContent.Request(GlowPath + "AttackAltGlow2Night", AssetRequestMode.AsyncLoad); TextureDefense_Glow_2 = ModContent.Request(GlowPath + "DefenseGlow2", AssetRequestMode.AsyncLoad); - TextureDefenseNight_Glow_2 = ModContent.Request(GlowPath + "DefenseGlow2Night", AssetRequestMode.AsyncLoad); TextureDefenseAlt_Glow_2 = ModContent.Request(GlowPath + "DefenseAltGlow2", AssetRequestMode.AsyncLoad); - TextureDefenseAltNight_Glow_2 = ModContent.Request(GlowPath + "DefenseAltGlow2Night", AssetRequestMode.AsyncLoad); - TextureNight_Glow_2 = ModContent.Request(GlowPath + "Glow2Night", AssetRequestMode.AsyncLoad); } #endregion } @@ -2139,7 +2133,7 @@ namespace CalamityMod.NPCs.Providence Texture2D texture = offColor ? TextureNight.Value : TextureAssets.Npc[Type].Value; Texture2D textureGlow = offColor ? TextureNight_Glow.Value : Texture_Glow.Value; - Texture2D textureGlow2 = offColor ? TextureNight_Glow_2.Value : Texture_Glow_2.Value; + Texture2D textureGlow2 = Texture_Glow_2.Value; void drawProvidenceInstance(Vector2 drawOffset, Color? colorOverride) { @@ -2175,13 +2169,13 @@ namespace CalamityMod.NPCs.Providence { texture = offColor ? TextureDefenseNight.Value : TextureDefense.Value; textureGlow = offColor ? TextureDefenseNight_Glow.Value : TextureDefense_Glow.Value; - textureGlow2 = offColor ? TextureDefenseNight_Glow_2.Value : TextureDefense_Glow_2.Value; + textureGlow2 = TextureDefense_Glow_2.Value; } else { texture = offColor ? TextureDefenseAltNight.Value : TextureDefenseAlt.Value; textureGlow = offColor ? TextureDefenseAltNight_Glow.Value : TextureDefenseAlt_Glow.Value; - textureGlow2 = offColor ? TextureDefenseAltNight_Glow_2.Value : TextureDefenseAlt_Glow_2.Value; + textureGlow2 = TextureDefenseAlt_Glow_2.Value; } } else @@ -2191,19 +2185,19 @@ namespace CalamityMod.NPCs.Providence case 1: texture = offColor ? TextureAltNight.Value : TextureAlt.Value; textureGlow = offColor ? TextureAltNight_Glow.Value : TextureAlt_Glow.Value; - textureGlow2 = offColor ? TextureAltNight_Glow_2.Value : TextureAlt_Glow_2.Value; + textureGlow2 = TextureAlt_Glow_2.Value; break; case 2: texture = offColor ? TextureAttackNight.Value : TextureAttack.Value; textureGlow = offColor ? TextureAttackNight_Glow.Value : TextureAttack_Glow.Value; - textureGlow2 = offColor ? TextureAttackNight_Glow_2.Value : TextureAttack_Glow_2.Value; + textureGlow2 = TextureAttack_Glow_2.Value; break; case 3: texture = offColor ? TextureAttackAltNight.Value : TextureAttackAlt.Value; textureGlow = offColor ? TextureAttackAltNight_Glow.Value : TextureAttackAlt_Glow.Value; - textureGlow2 = offColor ? TextureAttackAltNight_Glow_2.Value : TextureAttackAlt_Glow_2.Value; + textureGlow2 = TextureAttackAlt_Glow_2.Value; break; default: @@ -2940,7 +2934,12 @@ namespace CalamityMod.NPCs.Providence if (player is null) return; if (proj.Colliding(proj.Hitbox, player.Hitbox)) + { ApplyDebuffs(player, BaseDuration, NegativeHealValue); + + if (proj.type == ModContent.ProjectileType()) + proj.Kill(); + } } // Include debuffs inflicted by Providence's projectiles for all her forms diff --git a/NPCs/Providence/Providence.png b/NPCs/Providence/Providence.png index 7e0d01db1b..2329e3b9fa 100644 Binary files a/NPCs/Providence/Providence.png and b/NPCs/Providence/Providence.png differ diff --git a/NPCs/Providence/ProvidenceAlt.png b/NPCs/Providence/ProvidenceAlt.png index a8e3aff0fe..51bfda1cbe 100644 Binary files a/NPCs/Providence/ProvidenceAlt.png and b/NPCs/Providence/ProvidenceAlt.png differ diff --git a/NPCs/Providence/ProvidenceAttack.png b/NPCs/Providence/ProvidenceAttack.png index f4886b1a47..95fa23bbd2 100644 Binary files a/NPCs/Providence/ProvidenceAttack.png and b/NPCs/Providence/ProvidenceAttack.png differ diff --git a/NPCs/Providence/ProvidenceAttackAlt.png b/NPCs/Providence/ProvidenceAttackAlt.png index 12a45fb050..c8d1b8c86b 100644 Binary files a/NPCs/Providence/ProvidenceAttackAlt.png and b/NPCs/Providence/ProvidenceAttackAlt.png differ diff --git a/NPCs/Providence/ProvidenceAttackNight.png b/NPCs/Providence/ProvidenceAttackNight.png index d49baf5c6f..ba0f4805f1 100644 Binary files a/NPCs/Providence/ProvidenceAttackNight.png and b/NPCs/Providence/ProvidenceAttackNight.png differ diff --git a/NPCs/Providence/ProvidenceDefense.png b/NPCs/Providence/ProvidenceDefense.png index 4f7cacf054..bb87edea39 100644 Binary files a/NPCs/Providence/ProvidenceDefense.png and b/NPCs/Providence/ProvidenceDefense.png differ diff --git a/NPCs/Providence/ProvidenceDefenseAlt.png b/NPCs/Providence/ProvidenceDefenseAlt.png index 8c4186844a..362376f994 100644 Binary files a/NPCs/Providence/ProvidenceDefenseAlt.png and b/NPCs/Providence/ProvidenceDefenseAlt.png differ diff --git a/NPCs/Providence/ProvidenceDefenseAltNight.png b/NPCs/Providence/ProvidenceDefenseAltNight.png index ecbd22e542..ea54026fac 100644 Binary files a/NPCs/Providence/ProvidenceDefenseAltNight.png and b/NPCs/Providence/ProvidenceDefenseAltNight.png differ diff --git a/NPCs/Providence/ProvidenceDefenseNight.png b/NPCs/Providence/ProvidenceDefenseNight.png index df1ff403ac..36e7062a16 100644 Binary files a/NPCs/Providence/ProvidenceDefenseNight.png and b/NPCs/Providence/ProvidenceDefenseNight.png differ diff --git a/NPCs/Providence/ProvidenceNight.png b/NPCs/Providence/ProvidenceNight.png index be68806d96..175ace4f62 100644 Binary files a/NPCs/Providence/ProvidenceNight.png and b/NPCs/Providence/ProvidenceNight.png differ diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 505cc3219a..a3e45d207f 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -13,6 +13,7 @@ using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Potions; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.NPCs.Perforator; using CalamityMod.Projectiles.Boss; @@ -986,12 +987,15 @@ namespace CalamityMod.NPCs.StormWeaver // Weapons int[] weapons = new int[] { - ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), }; normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, weapons)); + // Equipment + normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + // Materials normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 5, 7)); diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index bf96e5dac6..f20fb06bb9 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -576,7 +576,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - DeathAshParticle.CreateAshesFromNPC(NPC); + DeathAshParticle.CreateAshesFromNPC(NPC, Vector2.Zero); } } } diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index 34f058b979..596c9706a8 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -612,7 +612,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - DeathAshParticle.CreateAshesFromNPC(NPC); + DeathAshParticle.CreateAshesFromNPC(NPC, Vector2.Zero); } } } diff --git a/NPCs/TownNPCs/THIEF.cs b/NPCs/TownNPCs/THIEF.cs index 5285782aa9..8d3fbe9b86 100644 --- a/NPCs/TownNPCs/THIEF.cs +++ b/NPCs/TownNPCs/THIEF.cs @@ -315,7 +315,6 @@ namespace CalamityMod.NPCs.TownNPCs .Add(ModContent.ItemType(), Condition.DownedPirates) .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 60), Condition.DownedMechBossAll) .Add(ModContent.ItemType(), downedCalclone) - .Add(ModContent.ItemType(), Condition.DownedPlantera) .Add(ModContent.ItemType(), Condition.DownedPlantera) .Add(ModContent.ItemType(), Condition.DownedPlantera) .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(1), Condition.DownedGolem) diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index b23d3bc8cd..2e8e90e8d9 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -3266,7 +3266,7 @@ namespace CalamityMod.NPCs.Yharon // Turn into dust on death. if (NPC.life <= 0) - DeathAshParticle.CreateAshesFromNPC(NPC); + DeathAshParticle.CreateAshesFromNPC(NPC, Vector2.Zero); } } #endregion diff --git a/Particles/ArchSmear.png b/Particles/ArchSmear.png new file mode 100644 index 0000000000..0fe4f58d96 Binary files /dev/null and b/Particles/ArchSmear.png differ diff --git a/Particles/BloomLineThick.png b/Particles/BloomLineThick.png new file mode 100644 index 0000000000..ed62f32c4e Binary files /dev/null and b/Particles/BloomLineThick.png differ diff --git a/Particles/BoltParticle.cs b/Particles/BoltParticle.cs index a83ee88aea..1301d565e4 100644 --- a/Particles/BoltParticle.cs +++ b/Particles/BoltParticle.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Particles public Vector2 Stretch = new Vector2(0.5f, 1.6f); public float ShrinkSpeed = 0; public bool Fliped = false; + public bool GlowFade = false; public override int FrameVariants => 3; public override string Texture => "CalamityMod/Particles/Bolt2"; @@ -23,7 +24,7 @@ namespace CalamityMod.Particles public override bool SetLifetime => true; public override bool UseCustomDraw => true; - public BoltParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color, Vector2 stretch, bool glowCenter = false, bool fadeIn = false, float shrinkSpeed = 0) + public BoltParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color, Vector2 stretch, bool glowCenter = false, bool glowFade = false, bool fadeIn = false, float shrinkSpeed = 0) { Position = relativePosition; Velocity = velocity; @@ -42,6 +43,8 @@ namespace CalamityMod.Particles if (FadeIn) Scale = 0f; + + GlowFade = glowFade; } public override void Update() @@ -85,7 +88,7 @@ namespace CalamityMod.Particles spriteBatch.Draw(texture, Position - Main.screenPosition, frame, col, Rotation, origin, scale, Fliped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); if (GlowCenter) - spriteBatch.Draw(texture, Position - Main.screenPosition, frame, Color.Lerp(col, Color.White, 0.8f), Rotation, origin, scale * 0.8f, Fliped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, frame, Color.Lerp(col, Color.White, 0.8f) * (GlowFade ? Utils.GetLerpValue(Lifetime, 0, Time, true) : 1), Rotation, origin, scale * 0.8f, Fliped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); } } } diff --git a/Particles/CircularSmearFire1.png b/Particles/CircularSmearFire1.png new file mode 100644 index 0000000000..7ef6e9aa75 Binary files /dev/null and b/Particles/CircularSmearFire1.png differ diff --git a/Particles/CircularSmearFire2.png b/Particles/CircularSmearFire2.png new file mode 100644 index 0000000000..a5a6eba215 Binary files /dev/null and b/Particles/CircularSmearFire2.png differ diff --git a/Particles/CircularSmearFire3.png b/Particles/CircularSmearFire3.png new file mode 100644 index 0000000000..aaacdbedd4 Binary files /dev/null and b/Particles/CircularSmearFire3.png differ diff --git a/Particles/CircularSmearVFX.cs b/Particles/CircularSmearVFX.cs index 35c866c06f..ef20086549 100644 --- a/Particles/CircularSmearVFX.cs +++ b/Particles/CircularSmearVFX.cs @@ -1,4 +1,8 @@ -using Microsoft.Xna.Framework; +using CalamityMod.ExtraTextures; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using ReLogic.Content; namespace CalamityMod.Particles { @@ -8,9 +12,11 @@ namespace CalamityMod.Particles public override bool UseAdditiveBlend => true; public override bool SetLifetime => true; - public float opacity; + public override bool UseCustomDraw => true; - public CircularSmearVFX(Vector2 position, Color color, float rotation, float scale) + public Asset LoadedAsset; + + public CircularSmearVFX(Vector2 position, Color color, float rotation, float scale, Asset? texture = null) { Position = position; Velocity = Vector2.Zero; @@ -18,6 +24,15 @@ namespace CalamityMod.Particles Scale = scale; Rotation = rotation; Lifetime = 2; + + LoadedAsset = texture; + if (LoadedAsset is null) + LoadedAsset = ExtraTextureRefs.CircularSmear; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + spriteBatch.Draw(LoadedAsset.Value, Position - Main.screenPosition, null, Color, Rotation, LoadedAsset.Value.Size() * 0.5f, Scale, SpriteEffects.None, 0); } } } diff --git a/Particles/CustomSpark.cs b/Particles/CustomSpark.cs index 6c219f7485..e6cb8dfbbb 100644 --- a/Particles/CustomSpark.cs +++ b/Particles/CustomSpark.cs @@ -13,6 +13,8 @@ namespace CalamityMod.Particles public bool FadeIn = false; public float FadeInScale = 0f; public bool GlowCenter = false; + public float GlowCenterScale = 1; + public float GlowOpacity = 1; public string NewTexture; public float ExtraRotation; public Vector2 Stretch = new Vector2(0.5f, 1.6f); @@ -23,7 +25,7 @@ namespace CalamityMod.Particles public override bool SetLifetime => true; public override bool UseCustomDraw => true; - public CustomSpark(Vector2 relativePosition, Vector2 velocity, string texture, bool affectedByGravity, int lifetime, float scale, Color color, Vector2 stretch, bool useAddativeBlend = true, bool glowCenter = false, float extraRotation = 0, bool fadeIn = false, bool affectedByLight = false, float shrinkSpeed = 0) + public CustomSpark(Vector2 relativePosition, Vector2 velocity, string texture, bool affectedByGravity, int lifetime, float scale, Color color, Vector2 stretch, bool useAddativeBlend = true, bool glowCenter = false, float extraRotation = 0, bool fadeIn = false, bool affectedByLight = false, float shrinkSpeed = 0, float glowCenterScale = 1, float glowOpacity = 1) { Position = relativePosition; Velocity = velocity; @@ -40,6 +42,8 @@ namespace CalamityMod.Particles AltVisual = useAddativeBlend; GlowCenter = glowCenter; + GlowCenterScale = glowCenterScale; + GlowOpacity = glowOpacity; FadeIn = fadeIn; @@ -91,7 +95,7 @@ namespace CalamityMod.Particles spriteBatch.Draw(texture, Position - Main.screenPosition, null, col, Rotation, texture.Size() * 0.5f, scale, 0, 0f); if (GlowCenter) - spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f), Rotation, texture.Size() * 0.5f, scale * 0.8f, 0, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f) * GlowOpacity, Rotation, texture.Size() * 0.5f, scale * 0.8f * GlowCenterScale, 0, 0f); } } } diff --git a/Particles/DeathAshParticle.cs b/Particles/DeathAshParticle.cs index 9687520e99..eae6742705 100644 --- a/Particles/DeathAshParticle.cs +++ b/Particles/DeathAshParticle.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Particles public Color AshColor; public Vector2 Center; public Vector2 Velocity; + public static Vector2 VelOverride; public Vector2 TopLeft => Center - Vector2.One * Scale * 3.5f; public Vector2 TopRight => Center + new Vector2(1f, -1f) * Scale * 3.5f; public Vector2 BottomRight => Center + Vector2.One * Scale * 3.5f; @@ -84,12 +85,13 @@ namespace CalamityMod.Particles Main.instance.GraphicsDevice.SetRenderTarget(null); } - public static void CreateAshesFromNPC(NPC npc) + public static void CreateAshesFromNPC(NPC npc, Vector2 velocityOverride) { // Don't create ashes serverside. if (Main.netMode == NetmodeID.Server) return; + VelOverride = velocityOverride; PendingNPCsToDraw[npc] = new(true, ManagedRenderTarget.CreateScreenSizedTarget); } @@ -228,11 +230,19 @@ namespace CalamityMod.Particles float brightness = (AshColor.R + AshColor.G + AshColor.B) / 765f; Time++; + Scale = MathHelper.Clamp(Scale - (brightness < 0.1f ? 0.08f : 0.008f), 0f, 1f); + float dissipationFactor = Utils.GetLerpValue(6f, 16f, Velocity.Length(), true); float velocityInterpolant = Utils.GetLerpValue(25f - dissipationFactor * 10f, 80f - dissipationFactor * 45f, Time, true); Vector2 idealVelocity = new Vector2(Main.windSpeedCurrent * MathHelper.Lerp(0.8f, 1.2f, (float)Math.Sin(Center.Y / 50f + ID)) * 20f, (float)Math.Sin(Main.time / 20f + ID * 0.01f) * 3f - 1f); + if (VelOverride != Vector2.Zero) + { + Vector2 useVel = VelOverride.RotateRandom(0.01f * ID); + idealVelocity = new Vector2(useVel.X * MathHelper.Lerp(0.8f, 1.2f, (float)Math.Sin(Main.time / 20f + ID)), useVel.Y * MathHelper.Lerp(0.8f, 1.2f, (float)Math.Sin(Main.time / 20f + ID))); + } + Velocity = Vector2.Lerp(Velocity, idealVelocity, velocityInterpolant * 0.16f); Center += Velocity; } diff --git a/Particles/FireTypeParticle.png b/Particles/FireTypeParticle.png new file mode 100644 index 0000000000..fe146693be Binary files /dev/null and b/Particles/FireTypeParticle.png differ diff --git a/Particles/FullStar.png b/Particles/FullStar.png new file mode 100644 index 0000000000..adb797ae73 Binary files /dev/null and b/Particles/FullStar.png differ diff --git a/Particles/HeartParticle.png b/Particles/HeartParticle.png new file mode 100644 index 0000000000..d2693e27e0 Binary files /dev/null and b/Particles/HeartParticle.png differ diff --git a/Particles/IceTypeParticle.png b/Particles/IceTypeParticle.png new file mode 100644 index 0000000000..5cf40d79e4 Binary files /dev/null and b/Particles/IceTypeParticle.png differ diff --git a/Particles/ProvidenceMarkParticle.png b/Particles/ProvidenceMarkParticle.png new file mode 100644 index 0000000000..13f25406f5 Binary files /dev/null and b/Particles/ProvidenceMarkParticle.png differ diff --git a/Particles/VelChangingSpark .cs b/Particles/VelChangingSpark .cs new file mode 100644 index 0000000000..f917530522 --- /dev/null +++ b/Particles/VelChangingSpark .cs @@ -0,0 +1,104 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class VelChangingSpark : Particle + { + public Color InitialColor; + public bool FadeIn = false; + public float FadeInScale = 0f; + public bool GlowCenter = false; + public string NewTexture; + public float ExtraRotation; + public Vector2 Stretch = new Vector2(0.5f, 1.6f); + public float ShrinkSpeed = 0; + public Vector2 EndVelocity; + public float LerpRate = 0.1f; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public bool AltVisual = true; + public override bool UseAdditiveBlend => AltVisual; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + + public VelChangingSpark(Vector2 relativePosition, Vector2 startVelocity, Vector2 endVelocity, string texture, int lifetime, float scale, Color color, Vector2 stretch, bool useAddativeBlend = true, bool glowCenter = false, float extraRotation = 0, bool fadeIn = false, float shrinkSpeed = 0, float lerpRate = 0.1f) + { + Position = relativePosition; + Velocity = startVelocity; + EndVelocity = endVelocity; + NewTexture = texture; + ExtraRotation = extraRotation; + AffectedByLight = false; + Scale = scale; + Stretch = stretch; + FadeInScale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + ShrinkSpeed = shrinkSpeed; + + AltVisual = useAddativeBlend; + GlowCenter = glowCenter; + + FadeIn = fadeIn; + + if (FadeIn) + Scale = 0f; + LerpRate = lerpRate; + } + + public override void Update() + { + if (!FadeIn) + { + if ((float)Time / (float)Lifetime < 0.5f) + { + Scale *= 0.95f; + } + Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)); + } + else + { + if ((float)Time / (float)Lifetime < 0.5f) + { + Scale = MathHelper.Lerp(Scale, FadeInScale, 0.2f); + } + else + { + Scale = MathHelper.Lerp(Scale, FadeInScale, -0.21f); + } + } + if ((float)Time / (float)Lifetime < 0.8f) + { + Velocity *= 0.95f; + EndVelocity *= 0.95f; + } + + Velocity = new Vector2(MathHelper.Lerp(Velocity.X, EndVelocity.X, LerpRate), MathHelper.Lerp(Velocity.Y, EndVelocity.Y, LerpRate)); + + Rotation = Velocity.ToRotation() + MathHelper.PiOver2 + ExtraRotation; + + Stretch.X *= (1 - 0.2f * ShrinkSpeed); + Stretch.Y *= (1 + 0.2f * ShrinkSpeed); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Vector2 scale = Stretch * Scale; + Texture2D texture = ModContent.Request(NewTexture).Value; + + Color col = Color; + + if (AffectedByLight) + { + col = Lighting.GetColor((Position / 16).ToPoint()).MultiplyRGB(Color); + } + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, col, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + if (GlowCenter) + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f), Rotation, texture.Size() * 0.5f, scale * 0.8f, 0, 0f); + } + } +} diff --git a/Particles/WulfrumBastionPartsParticle.cs b/Particles/WulfrumBastionPartsParticle.cs index ce2526b388..ea6a9d0ac6 100644 --- a/Particles/WulfrumBastionPartsParticle.cs +++ b/Particles/WulfrumBastionPartsParticle.cs @@ -80,6 +80,7 @@ namespace CalamityMod.Particles { Rotation = MathHelper.Lerp(RotationOffset, 0f, (float)Math.Pow(LifetimeCompletionAdjusted, 0.8f)); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction //The gun if (TimeOffset == 0.6f) Rotation = (Owner.Calamity().mouseWorld - Owner.Center).ToRotation() + (Owner.direction < 0 ? MathHelper.Pi : 0f); diff --git a/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs b/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs index 06eb494b75..bd2b8737e8 100644 --- a/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs @@ -1,16 +1,10 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; using ReLogic.Content; using Terraria; using Terraria.DataStructures; -using Terraria.GameInput; using Terraria.ID; using Terraria.ModLoader; @@ -254,6 +248,17 @@ namespace CalamityMod.Projectiles.BaseProjectiles hitbox = new Rectangle((int)cen.X - (int)(HitboxSize.X / 2), (int)cen.Y - (int)(HitboxSize.Y / 2), (int)HitboxSize.X, (int)HitboxSize.Y); + if (false) // Turn this on to show the hitbox, useful for testing if it's working how you want + { + Particle blastRing = new CustomPulse(hitbox.TopLeft(), Vector2.Zero, Color.Red, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 4); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(hitbox.TopRight(), Vector2.Zero, Color.Gold, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 4); + GeneralParticleHandler.SpawnParticle(blastRing2); + Particle blastRing3 = new CustomPulse(hitbox.BottomLeft(), Vector2.Zero, Color.Green, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 4); + GeneralParticleHandler.SpawnParticle(blastRing3); + Particle blastRing4 = new CustomPulse(hitbox.BottomRight(), Vector2.Zero, Color.Cyan, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 4); + GeneralParticleHandler.SpawnParticle(blastRing4); + } base.ModifyDamageHitbox(ref hitbox); } diff --git a/Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs b/Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs index 2c643a030f..58a99a7932 100644 --- a/Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs @@ -192,6 +192,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles // The center of the player, taking into account if they have a mount or not. Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // The vector between the player and the mouse, used for pointing the holdout. Vector2 ownerToMouse = Owner.Calamity().mouseWorld - armPosition; diff --git a/Projectiles/BaseProjectiles/BaseMaceFlailProjectile.cs b/Projectiles/BaseProjectiles/BaseMaceFlailProjectile.cs index 44249a02b3..e30fdd76b2 100644 --- a/Projectiles/BaseProjectiles/BaseMaceFlailProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseMaceFlailProjectile.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -210,6 +210,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles Projectile.ownerHitCheck = true; if (Projectile.owner == Main.myPlayer) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 toMouse = Owner.MountedCenter.DirectionTo(Main.MouseWorld).SafeNormalize(Vector2.UnitX * Owner.direction); Owner.ChangeDir((toMouse.X > 0f).ToDirectionInt()); if (!Owner.channel) diff --git a/Projectiles/Boss/BrimstoneWave.cs b/Projectiles/Boss/BrimstoneWave.cs index b55aad687d..a524d96893 100644 --- a/Projectiles/Boss/BrimstoneWave.cs +++ b/Projectiles/Boss/BrimstoneWave.cs @@ -62,10 +62,10 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 3) Projectile.frame = 0; - if (Projectile.timeLeft < 30) - Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 30f, 0f, 1f); + if (Projectile.timeLeft < 60) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); else - Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 1170) / 30f), 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 1140) / 30f), 0f, 1f); Lighting.AddLight(Projectile.Center, 0.5f * Projectile.Opacity, 0f, 0f); diff --git a/Projectiles/Boss/HealOrbProv.cs b/Projectiles/Boss/HealOrbProv.cs deleted file mode 100644 index 71c67e33d8..0000000000 --- a/Projectiles/Boss/HealOrbProv.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class HealOrbProv : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Boss"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - Projectile.timeLeft = 300; - Projectile.extraUpdates = 3; - } - - public override void AI() - { - int playerTracker = (int)Projectile.ai[0]; - Vector2 projDirection = Projectile.Center; - float playerDistX = Main.player[playerTracker].Center.X - projDirection.X; - float playerDistY = Main.player[playerTracker].Center.Y - projDirection.Y; - float playerDistance = (float)Math.Sqrt((double)(playerDistX * playerDistX + playerDistY * playerDistY)); - if (playerDistance < 50f && Projectile.position.X < Main.player[playerTracker].position.X + (float)Main.player[playerTracker].width && Projectile.position.X + (float)Projectile.width > Main.player[playerTracker].position.X && Projectile.position.Y < Main.player[playerTracker].position.Y + (float)Main.player[playerTracker].height && Projectile.position.Y + (float)Projectile.height > Main.player[playerTracker].position.Y) - { - if (Projectile.owner == Main.myPlayer) - { - int healAmount = (int)Projectile.ai[1]; - Main.player[playerTracker].HealPlayer(healAmount); - NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, playerTracker, (float)healAmount, 0f, 0f, 0, 0, 0); - } - Projectile.Kill(); - } - playerDistance = 2.5f / playerDistance; - playerDistX *= playerDistance; - playerDistY *= playerDistance; - Projectile.velocity.X = (Projectile.velocity.X * 15f + playerDistX) / 16f; - Projectile.velocity.Y = (Projectile.velocity.Y * 15f + playerDistY) / 16f; - for (int i = 0; i < 1; i++) - { - float shortXVel = Projectile.velocity.X * 0.2f * (float)i; - float shortYVel = -(Projectile.velocity.Y * 0.2f) * (float)i; - int holyFire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, 0f, 0f, 100, default, 1f); - Main.dust[holyFire].noGravity = true; - Main.dust[holyFire].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[holyFire]; - expr_154F9_cp_0.position.X -= shortXVel; - Dust expr_15518_cp_0 = Main.dust[holyFire]; - expr_15518_cp_0.position.Y -= shortYVel; - } - return; - } - } -} diff --git a/Projectiles/Boss/HolyBurnOrb.cs b/Projectiles/Boss/HolyBurnOrb.cs index 1a981b694b..64c20b7f63 100644 --- a/Projectiles/Boss/HolyBurnOrb.cs +++ b/Projectiles/Boss/HolyBurnOrb.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; @@ -77,17 +78,14 @@ namespace CalamityMod.Projectiles.Boss Projectile.localAI[1] += (Projectile.velocity.Length() / 20); Color col = ProvUtils.GetProjectileColor(255); - float vel = MathHelper.Clamp(Projectile.velocity.Length() / 5, 0, 1.5f); - GlowOrbParticle p = new GlowOrbParticle(Projectile.Center, Projectile.velocity + new Vector2(Main.rand.NextFloat(vel * 2), 0).RotatedByRandom(MathHelper.TwoPi), false, 4, 1f, col); - GeneralParticleHandler.SpawnParticle(p); } public override bool PreDraw(ref Color lightColor) { - float lerpMult = MathHelper.Lerp(0.5f, 1.5f, Math.Abs((float)Math.Sin(Projectile.localAI[1] / 10f))); + float lerpMult = MathHelper.Lerp(0.5f, 1.5f, Math.Abs(MathF.Sin(Projectile.localAI[1] / 10f))); Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); @@ -124,27 +122,22 @@ namespace CalamityMod.Projectiles.Boss public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - Projectile.ExpandHitboxBy(50); - int dustType = ProvUtils.GetDustID(); - for (int d = 0; d < 5; d++) + Color particleColor = ProvUtils.GetProjectileColor(0); + Color smokeColor = Color.Lerp(particleColor, Color.DarkSlateGray, 0.5f); + Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, smokeColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.06f, 18); + GeneralParticleHandler.SpawnParticle(pulse); + for (int i = 0; i < 7; i++) { - int holy = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[holy].velocity *= 3f; - Main.dust[holy].noGravity = true; - if (Main.rand.NextBool()) - { - Main.dust[holy].scale = 0.5f; - Main.dust[holy].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } + Particle smoke = new HeavySmokeParticle(Projectile.Center, (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(7f), smokeColor, 30, Main.rand.NextFloat(0.6f, 1f), 0.5f, Main.rand.NextFloat(-0.03f, 0.03f), true); + GeneralParticleHandler.SpawnParticle(smoke); } - for (int d = 0; d < 8; d++) + for (int i = 0; i < 8; i++) { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); - Main.dust[fire].noGravity = true; - Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[fire].velocity *= 2f; - Main.dust[fire].noGravity = true; + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(1.8f, 10f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1f, 1.8f); + dust.color = particleColor; + dust.noLightEmittence = true; } } diff --git a/Projectiles/Boss/HolyFire2.cs b/Projectiles/Boss/HolyFire2.cs index 6c7602c239..dc59bc060b 100644 --- a/Projectiles/Boss/HolyFire2.cs +++ b/Projectiles/Boss/HolyFire2.cs @@ -56,7 +56,8 @@ namespace CalamityMod.Projectiles.Boss int playerTracker = Player.FindClosest(Projectile.Center, 1, 1); - if (Projectile.ai[1] == 0f) + // Natural damage is removed from GFB + if (Projectile.ai[1] == 0f && !Main.zenithWorld) Projectile.damage = Projectile.GetProjectileDamage(ModContent.NPCType()); Projectile.ai[1] += 1f; diff --git a/Projectiles/Boss/HolyLight.cs b/Projectiles/Boss/HolyLight.cs index 31319ee9f3..0d986b7f27 100644 --- a/Projectiles/Boss/HolyLight.cs +++ b/Projectiles/Boss/HolyLight.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Dusts; using CalamityMod.Enums; using CalamityMod.NPCs.Providence; using CalamityMod.Particles; @@ -32,12 +33,15 @@ namespace CalamityMod.Projectiles.Boss public override void OnSpawn(IEntitySource source) { - SoundStyle soundStyle = SoundID.DD2_WitherBeastCrystalImpact; - soundStyle.MaxInstances = 10; - SoundEngine.PlaySound(soundStyle, Projectile.Center); + if (Projectile.ai[2] == 0) + { + SoundStyle soundStyle = SoundID.DD2_WitherBeastCrystalImpact; + soundStyle.MaxInstances = 10; + SoundEngine.PlaySound(soundStyle, Projectile.Center); - Color col = new Color(54, 209, 54); - GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, col, "CalamityMod/Particles/BlastCone", new Vector2(Main.rand.NextFloat(4f, 7f), 1.5f), Vector2.Zero.AngleTo(Projectile.velocity), 1f, 0f, 30)); + Color col = new Color(54, 209, 54); + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, col, "CalamityMod/Particles/BlastCone", new Vector2(Main.rand.NextFloat(4f, 7f), 1.5f), Vector2.Zero.AngleTo(Projectile.velocity), 1f, 0f, 30)); + } } public override void AI() @@ -70,10 +74,8 @@ namespace CalamityMod.Projectiles.Boss } Color col = new Color(54, 209, 54); - - GlowOrbParticle p = new GlowOrbParticle(Projectile.Center, Projectile.velocity, false, 25, 1f, col); - - GeneralParticleHandler.SpawnParticle(p); + Particle spark = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.8f, false, 5, 0.06f, col * 0.85f, new Vector2(1, 0.3f), true, false, 1.5f); + GeneralParticleHandler.SpawnParticle(spark); } public override bool PreDraw(ref Color lightColor) @@ -86,7 +88,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 projDirection = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); Vector2 halfTextureSize = drawTexture.Size() / 2f; Color halfBrightGreen = brightGreen * 0.5f; - float timeLeftColorScale = MathHelper.Lerp(0.5f, 1.5f, Math.Abs((float)Math.Sin(Projectile.localAI[1] / 10f))); + float timeLeftColorScale = MathHelper.Lerp(0.5f, 1.5f, Math.Abs(MathF.Sin(Projectile.localAI[1] / 10f))); Projectile.rotation += MathHelper.ToRadians(timeLeftColorScale * 2f); Vector2 timeLeftDrawEffect = new Vector2(0.5f, 1f) * timeLeftColorScale; Vector2 timeLeftDrawEffect2 = new Vector2(0.5f, 1f) * timeLeftColorScale; @@ -99,9 +101,9 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, (float)Math.PI / 2f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver2 - Projectile.rotation, halfTextureSize, timeLeftDrawEffect, spriteEffects, 0); Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, 0f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect2, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, (float)Math.PI / 2f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver2 - Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, 0f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0); Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver4 + Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); @@ -114,32 +116,25 @@ namespace CalamityMod.Projectiles.Boss public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - Projectile.position.X = Projectile.position.X + (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); - Projectile.width = 40; - Projectile.height = 40; - Projectile.position.X = Projectile.position.X - (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - for (int i = 0; i < 5; i++) + SoundEngine.PlaySound(SoundID.Item14 with { Pitch = -0.3f, Volume = 0.7f }, Projectile.Center); + SoundStyle fireHeal = new("CalamityMod/Sounds/Custom/PlantyMushMine", 3); + SoundEngine.PlaySound(fireHeal with { Volume = 0.5f, Pitch = 0.3f }, Projectile.Center); + Color particleColor = new Color(54, 209, 54); + Color smokeColor = Color.Lerp(particleColor, Color.DarkSlateGray, 0.5f); + Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, smokeColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.06f, 18); + GeneralParticleHandler.SpawnParticle(pulse); + for (int i = 0; i < 7; i++) { - int holyYellow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f); - Main.dust[holyYellow].velocity *= 3f; - Main.dust[holyYellow].noGravity = true; - if (Main.rand.NextBool()) - { - Main.dust[holyYellow].scale = 0.5f; - Main.dust[holyYellow].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } + Particle smoke = new HeavySmokeParticle(Projectile.Center, (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(7f), smokeColor, 30, Main.rand.NextFloat(0.6f, 1f), 0.5f, Main.rand.NextFloat(-0.03f, 0.03f), true); + GeneralParticleHandler.SpawnParticle(smoke); } - for (int j = 0; j < 8; j++) + for (int i = 0; i < 8; i++) { - int holyYellow2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PlatinumCoin, 0f, 0f, 100, default, 3f); - Main.dust[holyYellow2].noGravity = true; - Main.dust[holyYellow2].velocity *= 5f; - holyYellow2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f); - Main.dust[holyYellow2].velocity *= 2f; - Main.dust[holyYellow2].noGravity = true; + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(1.8f, 10f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1f, 1.8f); + dust.color = particleColor; + dust.noLightEmittence = true; } } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 11eca7509d..180ef90a2d 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -88,6 +88,10 @@ namespace CalamityMod.Projectiles // If true, this projectile can apply the infinitely-stacking Shred debuff iconic to Soma Prime. public bool appliesSomaShred = false; + // Arc Flash bolt spawning management + public bool spawnArcFlash = true; + public int arcFlashCooldown = 0; + // Adds Brimstone flames to bullets, currently only used by Animosity public bool brimstoneBullets = false; @@ -3425,6 +3429,9 @@ namespace CalamityMod.Projectiles if (modPlayer.camper && !player.StandingStill()) projectile.damage = (int)(projectile.damage * 0.1); + if ((projectile.minion || ProjectileID.Sets.MinionShot[projectile.type] || projectile.sentry || ProjectileID.Sets.SentryShot[projectile.type]) && (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 || player.ownedProjectileCounts[ModContent.ProjectileType()] > 0)) + projectile.damage = (int)(projectile.damage * 0.1); + if (projectile.CountsAsClass() && stealthStrike) { int gloveArmorPenAmt = modPlayer.nanotech ? 15 : 8; @@ -3917,7 +3924,14 @@ namespace CalamityMod.Projectiles confetti.velocity.Y += Main.rand.Next(-50, 51) * 0.05f; } } - + // Support to help things like holdout swords work with Arc Flash Ring + if (!spawnArcFlash && projectile.numHits == 0) + spawnArcFlash = true; + // Cooldown for the arc flash so that long lasting projectiles (like dashing summons) can spawn multiple bolts + if (arcFlashCooldown >= 0) + arcFlashCooldown--; + if (arcFlashCooldown == 0) + spawnArcFlash = true; if (conditionalHomingRange > 0f) { CalamityUtils.HomeInOnNPC(projectile, !projectile.tileCollide, conditionalHomingRange, 12f, 20f); diff --git a/Projectiles/Damageable/ArtifactOfResilienceBulwark.cs b/Projectiles/Damageable/ArtifactOfResilienceBulwark.cs deleted file mode 100644 index 80877b95ca..0000000000 --- a/Projectiles/Damageable/ArtifactOfResilienceBulwark.cs +++ /dev/null @@ -1,57 +0,0 @@ -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Damageable -{ - public class ArtifactOfResilienceBulwark : DamageableProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Misc"; - public int Reformations = 0; - public const int MaxReformations = 3; - public override int LifeMax => 1; - public override int MaxDamageImmunityFrames => 5; - public override DamageSourceType DamageSources => DamageSourceType.FriendlyProjectiles | DamageSourceType.HostileProjectiles | DamageSourceType.HostileNPCs; - public override SoundStyle HitSound => SoundID.NPCHit3; - public override SoundStyle DeathSound => SoundID.NPCDeath14; - public override void SafeSetDefaults() - { - Projectile.width = Projectile.height = 76; - Projectile.friendly = true; - Projectile.penetrate = 20; - } - - public override void SafeAI() - { - Projectile.rotation += MathHelper.ToRadians(8f); - Vector2 spawnPosition = Projectile.Center + Utils.NextVector2Circular(Main.rand, Projectile.width, Projectile.height) / 2f; - for (int i = 0; i < 8; i++) - { - Dust dust = Dust.NewDustPerfect(spawnPosition, (int)CalamityDusts.ProfanedFire); - dust.velocity = Projectile.DirectionFrom(spawnPosition); - dust.scale = Main.rand.NextFloat(1.1f, 1.5f); - dust.noGravity = true; - } - } - public override void DamageKillEffect() - { - Utils.PoofOfSmoke(Projectile.Center); - } - public override void OnKill(int timeLeft) - { - for (int i = 1; i <= 6; i++) - { - if (Main.myPlayer == Projectile.owner) - { - float angle = MathHelper.TwoPi / 6f * (i - 1); - Projectile shard = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, Mod.Find("ArtifactOfResilienceShard" + i.ToString()).Type, Projectile.damage, Projectile.knockBack, Projectile.owner); - shard.ai[0] = angle; - shard.frameCounter = Projectile.frameCounter + 1; // FrameCounter is a stored value for the amount of times the bulwark has reformed. - } - } - } - } -} diff --git a/Projectiles/Damageable/ArtifactOfResilienceBulwark.png b/Projectiles/Damageable/ArtifactOfResilienceBulwark.png deleted file mode 100644 index 97f00c91bd..0000000000 Binary files a/Projectiles/Damageable/ArtifactOfResilienceBulwark.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/GaussRifleBlast.cs b/Projectiles/DraedonsArsenal/GaussRifleBlast.cs index ca19c0f2e9..c45efa1f29 100644 --- a/Projectiles/DraedonsArsenal/GaussRifleBlast.cs +++ b/Projectiles/DraedonsArsenal/GaussRifleBlast.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.width = Projectile.height = 40; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 1; Projectile.timeLeft = 300; } diff --git a/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs index 168199c675..6ef1364726 100644 --- a/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs +++ b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs @@ -79,6 +79,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal modItem.Charge -= HydraulicVoltCrasher.HoldoutChargeUse; float speed = Owner.inventory[Owner.selectedItem].shootSpeed * Projectile.scale; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 toPointTo = Main.MouseWorld; if (Owner.gravDir == -1f) { diff --git a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs index d070d4e388..9c5b9b0f04 100644 --- a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs +++ b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs @@ -132,6 +132,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal bool hasCharge = modItem.Charge > 0f; if (!player.CantUseHoldout() && playerItem.type == ModContent.ItemType() && hasCharge) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, the effect is capped separately // The distance ratio ranges from 0 (your mouse is directly on the player) to 1 (your mouse is at the max range considered, or any further distance). float mouseDistance = Projectile.Distance(Main.MouseWorld); float distRatio = Utils.GetLerpValue(0f, MaximumMouseRange, mouseDistance, true); diff --git a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs index ac77a1ed3e..fc95a46d89 100644 --- a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs +++ b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs @@ -64,6 +64,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // Checks if the minion can still exist given the player's circumstance. CheckMinionExistence(); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // The properties of the minion's pupil, it looks around the target if there's one and to the mouse if there isn't any. EyeAngle = Projectile.SafeDirectionTo((Target is not null) ? Target.Center : Main.MouseWorld).ToRotation(); EyeOutwardness = Utils.Remap(Projectile.Distance((Target is not null) ? Target.Center : Main.MouseWorld), 0f, 300f, 0f, 5f); diff --git a/Projectiles/Healing/ShinobiHealOrb.cs b/Projectiles/Healing/ShinobiHealOrb.cs index b7027a962e..7a507a57a0 100644 --- a/Projectiles/Healing/ShinobiHealOrb.cs +++ b/Projectiles/Healing/ShinobiHealOrb.cs @@ -1,5 +1,10 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -10,26 +15,41 @@ namespace CalamityMod.Projectiles.Healing public new string LocalizationCategory => "Projectiles.Healing"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 30; + ProjectileID.Sets.TrailingMode[Type] = 0; + } + public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; + Projectile.width = Projectile.height = 20; Projectile.friendly = true; Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.MaxUpdates = 5; - Projectile.timeLeft = 600; + Projectile.timeLeft = 120 * Projectile.MaxUpdates; } - public override void AI() - { - Projectile.HealingProjectile((int)Projectile.ai[1], Projectile.owner, 6f, 15f); + public override void AI() => Projectile.HealingProjectile((int)Projectile.ai[1], Projectile.owner, 6f, 15f); - for (int i = 0; i < 3; i++) + internal Color ColorFunction(float completionRatio) => Color.Lerp(Color.Blue, Color.CornflowerBlue, completionRatio); + internal float WidthFunction(float completionRatio) => 10f * (completionRatio < 0.2f ? MathHelper.Clamp(1f - MathF.Pow(5f * completionRatio - 1f, 2f), 0f, 1f) : Utils.GetLerpValue(1f, 0.2f, completionRatio, true)); + public override bool PreDraw(ref Color lightColor) + { + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/BasicTrail")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); + return false; + } + + public override void OnKill(int timeLeft) + { + for (int i = 0; i < 7; i++) { - int magicHeal = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.MagicMirror, 0f, 0f, 100, default, 1.3f); - Main.dust[magicHeal].noGravity = true; - Main.dust[magicHeal].velocity *= 0f; + Vector2 velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(12f, 20f); + float scale = Main.rand.NextFloat(0.4f, 1.2f); + Particle sparkle = new CritSpark(Projectile.Center, velocity, Color.White, Color.DarkBlue, scale, 24, 0.1f, scale * 2f, Main.rand.NextFloat(0f, 0.01f)); + GeneralParticleHandler.SpawnParticle(sparkle); } } } diff --git a/Projectiles/Magic/AetherfluxCannonHoldout.cs b/Projectiles/Magic/AetherfluxCannonHoldout.cs index 4e5aa5931a..ae0e2654ae 100644 --- a/Projectiles/Magic/AetherfluxCannonHoldout.cs +++ b/Projectiles/Magic/AetherfluxCannonHoldout.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -7,6 +8,7 @@ using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; +using static CalamityMod.Systems.LavaRenderingSystem; namespace CalamityMod.Projectiles.Magic { @@ -26,6 +28,8 @@ namespace CalamityMod.Projectiles.Magic private ref float LastShootAttemptTime => ref Projectile.localAI[0]; private ref float LastAnimationTime => ref Projectile.localAI[1]; + public float postShotFade = 0; + public override void SetStaticDefaults() => Main.projFrames[Type] = 8; public override void KillHoldoutLogic() @@ -74,7 +78,12 @@ namespace CalamityMod.Projectiles.Magic if (manaOK) { if (actuallyShoot) - SoundEngine.PlaySound(SoundID.Item91, Projectile.Center); + { + postShotFade = 1; + SoundStyle fire = new("CalamityMod/Sounds/Item/MagnaCannonShot"); + SoundEngine.PlaySound(fire with { Volume = 0.4f, Pitch = Main.rand.NextFloat(0.1f, 0.3f) }, Projectile.Center); + } + int projID = ModContent.ProjectileType(); float shootSpeed = HeldItem.shootSpeed; @@ -99,11 +108,12 @@ namespace CalamityMod.Projectiles.Magic } } } + postShotFade *= 0.86f; } private void SpawnFiringDust(Vector2 GunTipPosition, Vector2 laserVelocity) { - int dustID = 133; + int dustID = ModContent.DustType(); int dustRadius = 12; float dustRandomness = 11f; int dustDiameter = 2 * dustRadius; @@ -115,18 +125,30 @@ namespace CalamityMod.Projectiles.Magic d.velocity *= 0.18f; d.noGravity = true; d.scale = 0.6f; + d.color = Color.Lerp(AetherfluxCannon.accentColor, AetherfluxCannon.mainColor, Main.rand.NextFloat()); } } public override bool PreDraw(ref Color lightColor) { Texture2D texture = TextureAssets.Projectile[Type].Value; - Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 vel = Projectile.velocity * 10; + Vector2 drawPosition = (Projectile.Center - Main.screenPosition + vel) + vel * (1 - postShotFade); Rectangle frame = texture.Frame(verticalFrames: Main.projFrames[Type], frameY: Projectile.frame); float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f) + MathHelper.PiOver2; Vector2 rotationPoint = frame.Size() * 0.5f; SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipVertically : SpriteEffects.None; - + Texture2D glowTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + for (int i = 0; i < 5; i++) + { + float glowScale = 0.3f; + Main.EntitySpriteDraw(glowTexture, drawPosition + vel * 1.7f, null, Color.Lerp(AetherfluxCannon.accentColor, AetherfluxCannon.mainColor, postShotFade) with { A = 0 }, vel.ToRotation(), glowTexture.Size() * 0.5f, new Vector2(1.4f, 0.75f) * (glowScale - i * 0.05f) * postShotFade * 2.5f, SpriteEffects.None, 0); + } + for (int i = 0; i < 15; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 15f).ToRotationVector2() * 6.5f * postShotFade; + Main.EntitySpriteDraw(texture, drawPosition + drawOffset, frame, Color.Lerp(AetherfluxCannon.accentColor, AetherfluxCannon.mainColor, postShotFade) with { A = 0 }, drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + } Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); return false; diff --git a/Projectiles/Magic/AnahitasArpeggioNote.cs b/Projectiles/Magic/AnahitasArpeggioNote.cs index 62e5a3eaec..3a6d4d73e3 100644 --- a/Projectiles/Magic/AnahitasArpeggioNote.cs +++ b/Projectiles/Magic/AnahitasArpeggioNote.cs @@ -109,8 +109,9 @@ namespace CalamityMod.Projectiles.Magic float degreesAmt = Main.zenithWorld ? 51.428f : 60f; Vector2 musicNoteRotationOffset = Vector2.UnitY.RotatedBy(MathHelper.ToRadians(degreesAmt * NoteSequence) + Projectile.ai[2]); - Projectile.Center = Owner.Calamity().mouseWorld + musicNoteRotationOffset * 220f; - playerDirection = Projectile.Center - Owner.Calamity().mouseWorld; + Vector2 mouse = Owner.ClampedMouseWorld(); + Projectile.Center = mouse + musicNoteRotationOffset * 220f; + playerDirection = Projectile.Center - mouse; playerDirection.Normalize(); playerDirection *= -9.2f; Projectile.velocity = playerDirection; diff --git a/Projectiles/Magic/ApotheosisWorm.cs b/Projectiles/Magic/ApotheosisWorm.cs index b9701da8a0..7e088f2488 100644 --- a/Projectiles/Magic/ApotheosisWorm.cs +++ b/Projectiles/Magic/ApotheosisWorm.cs @@ -135,6 +135,7 @@ namespace CalamityMod.Projectiles.Magic internal void InitializeSegments() { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 directionToMouse = (Main.MouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX * Owner.direction); Projectile.rotation = directionToMouse.ToRotation() + MathHelper.PiOver2; for (int i = 0; i < Segments.Length; i++) diff --git a/Projectiles/Magic/ArtAttackHoldout.cs b/Projectiles/Magic/ArtAttackHoldout.cs index 1a2f5de061..17f1882a58 100644 --- a/Projectiles/Magic/ArtAttackHoldout.cs +++ b/Projectiles/Magic/ArtAttackHoldout.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic { SoundEngine.PlaySound(ArtAttack.UseSound, Owner.Center); Vector2 initialStarVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 15f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Main.MouseWorld, initialStarVelocity, attackType, Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.ClampedMouseWorld(), initialStarVelocity, attackType, Projectile.damage, Projectile.knockBack, Projectile.owner); Projectile.ai[0] = -24f; } else diff --git a/Projectiles/Magic/ArtAttackStar.cs b/Projectiles/Magic/ArtAttackStar.cs index c07be77f85..6f4b933518 100644 --- a/Projectiles/Magic/ArtAttackStar.cs +++ b/Projectiles/Magic/ArtAttackStar.cs @@ -109,7 +109,11 @@ namespace CalamityMod.Projectiles.Magic public void DoMouseMovement() { - Projectile.Center = Main.MouseWorld; + // 14NOV2024: Ozzatron: Art Attack is intentionally limited to clamped mouse so larger screens don't give an advantage. + // If this feels too weird on larger screens, this could be reverted. It is a rather unique case. + + // Projectile.Center = Main.MouseWorld; + Projectile.Center = Owner.ClampedMouseWorld(); // Continuously sync since mouse information is local. Projectile.netUpdate = true; diff --git a/Projectiles/Magic/ChronomancersScytheSwing.cs b/Projectiles/Magic/ChronomancersScytheSwing.cs index f6fc717b09..0aed3a8905 100644 --- a/Projectiles/Magic/ChronomancersScytheSwing.cs +++ b/Projectiles/Magic/ChronomancersScytheSwing.cs @@ -81,6 +81,7 @@ namespace CalamityMod.Projectiles.Magic if (Owner.ActiveItem().shoot == Projectile.type) scaleFactor6 = Owner.ActiveItem().shootSpeed * Projectile.scale; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 slashDirection = Main.MouseWorld - Owner.RotatedRelativePoint(Owner.MountedCenter, true); slashDirection.Normalize(); if (slashDirection.HasNaNs()) @@ -102,6 +103,7 @@ namespace CalamityMod.Projectiles.Magic { if (Main.myPlayer == Projectile.owner) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 velocity = Projectile.Center.DirectionTo(Main.MouseWorld) * IcicleSpeed + new Vector2(Main.rand.NextFloat(-IcicleVariance, IcicleVariance), Main.rand.NextFloat(-IcicleVariance, IcicleVariance)); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * IcicleDamageMultiplier), Projectile.knockBack, Projectile.owner); } diff --git a/Projectiles/Magic/CoralSpoutHoldout.cs b/Projectiles/Magic/CoralSpoutHoldout.cs index ffee1f9bad..ac08faddd8 100644 --- a/Projectiles/Magic/CoralSpoutHoldout.cs +++ b/Projectiles/Magic/CoralSpoutHoldout.cs @@ -59,6 +59,7 @@ namespace CalamityMod.Projectiles.Magic Owner.heldProj = Projectile.whoAmI; } + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction float pointingRotation = (Owner.Calamity().mouseWorld - Owner.MountedCenter).ToRotation(); Projectile.Center = Owner.MountedCenter + pointingRotation.ToRotationVector2() * 40f; diff --git a/Projectiles/Magic/CosmicTentacle.cs b/Projectiles/Magic/CosmicTentacle.cs index 439e9bca7c..feb3ae822f 100644 --- a/Projectiles/Magic/CosmicTentacle.cs +++ b/Projectiles/Magic/CosmicTentacle.cs @@ -43,6 +43,7 @@ namespace CalamityMod.Projectiles.Magic { Player Owner = Main.player[Projectile.owner]; float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 vel = ((Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * 7).RotatedBy(0.2f * curveDirection); if (curveDirection == 100) diff --git a/Projectiles/Magic/DivineRetributionSpear.cs b/Projectiles/Magic/DivineRetributionSpear.cs index 6f1a6aad3b..f1b2dc7525 100644 --- a/Projectiles/Magic/DivineRetributionSpear.cs +++ b/Projectiles/Magic/DivineRetributionSpear.cs @@ -1,8 +1,11 @@ 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.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -11,67 +14,110 @@ namespace CalamityMod.Projectiles.Magic public class DivineRetributionSpear : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public Player Owner => Main.player[Projectile.owner]; + public ref float VelocityScale => ref Projectile.ai[0]; + public ref float Time => ref Projectile.ai[1]; + + public static float HomingSpeed => 20f; + public static float HomingTime => 15f; + public static float ReturnTime => 75f; + public override void SetStaticDefaults() { ProjectileID.Sets.CultistIsResistantTo[Type] = true; - ProjectileID.Sets.TrailCacheLength[Type] = 7; - ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { - Projectile.width = 30; - Projectile.height = 30; + Projectile.width = Projectile.height = 30; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; - Projectile.extraUpdates = 1; Projectile.penetrate = 1; - Projectile.timeLeft = 420; + Projectile.timeLeft = 210; } public override void AI() { - float aiVelocityMult = 25f * Projectile.ai[1]; //100 - float scaleFactor = 5f * Projectile.ai[1]; //5 - float homingRange = 1000f; + Projectile.rotation = Projectile.velocity.ToRotation(); - if (Projectile.velocity.X < 0f) + Time++; + Projectile.Opacity = Utils.GetLerpValue(0f, 18f, Projectile.timeLeft, true); + Lighting.AddLight(Projectile.Center, Color.Gold.ToVector3() * 0.7f * Projectile.Opacity); + + if (Time % 2f == 1f) { - Projectile.spriteDirection = -1; - Projectile.rotation = (float)Math.Atan2((double)-(double)Projectile.velocity.Y, (double)-(double)Projectile.velocity.X); - } - else - { - Projectile.spriteDirection = 1; - Projectile.rotation = Projectile.velocity.ToRotation(); + Vector2 dustOffset = (Vector2.UnitY * MathF.Sin(Projectile.timeLeft * MathHelper.Pi * 0.05f) * 16f).RotatedBy(Projectile.velocity.ToRotation()); + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustOffset, ModContent.DustType()); + dust.noGravity = true; + dust.noLightEmittence = true; + dust.color = Main.rand.NextBool() ? Color.Orange : Color.Goldenrod; + dust.scale = Main.rand.NextFloat(0.4f, 0.6f); } - Lighting.AddLight(Projectile.Center, 0.7f, 0.3f, 0f); - if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) + NPC potentialTarget = Projectile.Center.ClosestNPCAt(Time >= ReturnTime ? 480f : 320f); + if (potentialTarget != null && Time >= HomingTime) { - if (Projectile.Distance(Main.player[Projectile.owner].Center) > homingRange) + Vector2 idealVelocity = Projectile.SafeDirectionTo(potentialTarget.Center) * HomingSpeed * VelocityScale; + Projectile.velocity = (Projectile.velocity * 29f + idealVelocity) / 30f; + Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 3f); + return; + } + else if (Owner.active && !Owner.dead && Time >= ReturnTime) + { + Vector2 idealVelocity = Projectile.SafeDirectionTo(Owner.MountedCenter) * HomingSpeed * VelocityScale * (1.2f - Utils.GetLerpValue(800f, 160f, Vector2.Distance(Projectile.Center, Owner.MountedCenter), true)); + Projectile.velocity = (Projectile.velocity * 29f + idealVelocity) / 30f; + Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 3f); + } + if (!Owner.active || Owner.dead || (Vector2.Distance(Projectile.Center, Owner.MountedCenter) <= 240f && Time >= ReturnTime)) + { + Projectile.timeLeft--; + if (!Owner.active || Owner.dead || Vector2.Distance(Projectile.Center, Owner.MountedCenter) <= 80f) { - Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * (aiVelocityMult - 1f) + moveDirection * scaleFactor) / aiVelocityMult; - return; - } - - CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 9f, 20f); - } - else - { - if (Projectile.timeLeft > 30) - { - Projectile.timeLeft = 30; + if (Projectile.timeLeft > 30) + Projectile.timeLeft = 30; } } } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + Texture2D spear = TextureAssets.Projectile[Type].Value; + Vector2 drawPos = Projectile.Center - Main.screenPosition; + + float cLerp = Utils.GetLerpValue(210, 160, Projectile.timeLeft, true); + Color baseColor = Color.Lerp(Color.Goldenrod, new Color(255, 255, 150), cLerp) * Projectile.Opacity; + Color glowColor = Color.Lerp(Color.OrangeRed, Color.Orange, cLerp) * Projectile.Opacity; + + float squish = MathHelper.Clamp(Projectile.velocity.Length() * 0.04f, 0, 0.2f); + Vector2 scale = new Vector2(1f + squish, 1f - squish); + + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + if (CalamityClientConfig.Instance.Afterimages) + { + for (int i = 0; i < Projectile.oldPos.Length; i++) + { + float completionRatio = i / (float)Projectile.oldPos.Length; + Vector2 trailPos = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition; + + Color trailColor = Color.Lerp(glowColor, Color.Black, completionRatio) * 0.35f; + Vector2 trailScale = scale * MathHelper.Lerp(1f, 0.15f, completionRatio); + + Main.EntitySpriteDraw(spear, trailPos, null, trailColor, Projectile.oldRot[i], spear.Size() * 0.5f, trailScale, SpriteEffects.None); + } + } + + for (int i = 0; i < 8; i++) + { + Vector2 offset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 4f; + Main.EntitySpriteDraw(spear, drawPos + offset, null, Color.Lerp(baseColor, glowColor, 0.8f) * 0.5f, Projectile.rotation, spear.Size() * 0.5f, scale, SpriteEffects.None); + } + Main.spriteBatch.ExitShaderRegion(); + + Main.EntitySpriteDraw(spear, drawPos, null, baseColor, Projectile.rotation, spear.Size() * 0.5f, scale, SpriteEffects.None); return false; } @@ -81,28 +127,20 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 96; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.ExpandHitboxBy(96); Projectile.maxPenetrate = -1; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); - for (int i = 0; i < 6; i++) + for (int i = 0; i < 9; i++) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0, 0); - } - for (int j = 0; j < 10; j++) - { - int divinity = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0, 0); - Main.dust[divinity].noGravity = true; - Main.dust[divinity].velocity *= 3f; - divinity = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0, 0); - Main.dust[divinity].velocity *= 2f; - Main.dust[divinity].noGravity = true; + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Main.rand.NextVector2CircularEdge(5f, 5f)); + dust.noGravity = true; + dust.noLightEmittence = true; + dust.color = Main.rand.NextBool() ? Color.Orange : Color.Goldenrod; + dust.scale = Main.rand.NextFloat(0.8f, 1.4f); } } } diff --git a/Projectiles/Magic/DivineRetributionSpear.png b/Projectiles/Magic/DivineRetributionSpear.png index 2e733503aa..c8b7e089ab 100644 Binary files a/Projectiles/Magic/DivineRetributionSpear.png and b/Projectiles/Magic/DivineRetributionSpear.png differ diff --git a/Projectiles/Magic/EnormousConsumingVortex.cs b/Projectiles/Magic/EnormousConsumingVortex.cs index c722b34332..14bff5823b 100644 --- a/Projectiles/Magic/EnormousConsumingVortex.cs +++ b/Projectiles/Magic/EnormousConsumingVortex.cs @@ -72,6 +72,7 @@ namespace CalamityMod.Projectiles.Magic { if (Main.myPlayer == Projectile.owner) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = Projectile.SafeDirectionTo(Main.MouseWorld) * SubsumingVortex.ReleaseSpeed; Projectile.damage = (int)(Projectile.damage * SubsumingVortex.ReleaseDamageFactor); HasBeenReleased = true; @@ -82,6 +83,7 @@ namespace CalamityMod.Projectiles.Magic { if (Main.myPlayer == Projectile.owner) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = Projectile.SafeDirectionTo(Main.MouseWorld) * SubsumingVortex.ReleaseSpeed; Projectile.damage = (int)(Projectile.damage * (1f + Time * 0.0152f)); HasBeenReleased = true; @@ -163,7 +165,7 @@ namespace CalamityMod.Projectiles.Magic // Smoothly approach a sinusoidal offset as time goes on. float verticalOffset = Utils.Remap(Time, 0f, 90f, -30f, (float)Math.Cos(Projectile.timeLeft / 32f) * 30f); Vector2 hoverDestination = Owner.Top + new Vector2(Owner.direction * Projectile.scale * 30f, verticalOffset); - hoverDestination += (Main.MouseWorld - hoverDestination) * SubsumingVortex.GiantVortexMouseDriftFactor; + hoverDestination += (Owner.ClampedMouseWorld() - hoverDestination) * SubsumingVortex.GiantVortexMouseDriftFactor; Vector2 idealVelocity = Vector2.Zero.MoveTowards(hoverDestination - Projectile.Center, 32f); Projectile.velocity = Vector2.Lerp(Projectile.velocity, idealVelocity, 0.04f); diff --git a/Projectiles/Magic/EternityBook.cs b/Projectiles/Magic/EternityBook.cs index 47b4accb86..07ddff29fc 100644 --- a/Projectiles/Magic/EternityBook.cs +++ b/Projectiles/Magic/EternityBook.cs @@ -49,7 +49,8 @@ namespace CalamityMod.Projectiles.Magic // Summon a bunch of cool things the moment the book is created, assuming an NPC is near the mouse position. if (Main.myPlayer == Projectile.owner && Time == 1f) { - NPC target = Main.MouseWorld.ClosestNPCAt(4400f, true, true); + // 14NOV2024: Ozzatron: Eternity's range is so absurdly high (more than two 1080p screens wide) that it doesn't really matter whether this is capped. + NPC target = player.ClampedMouseWorld().ClosestNPCAt(4400f, true, true); if (target != null) { diff --git a/Projectiles/Magic/EternityHex.cs b/Projectiles/Magic/EternityHex.cs index 857b001868..c52e625edf 100644 --- a/Projectiles/Magic/EternityHex.cs +++ b/Projectiles/Magic/EternityHex.cs @@ -77,7 +77,8 @@ namespace CalamityMod.Projectiles.Magic if (!target.active) { - NPC potentialTarget = Main.MouseWorld.ClosestNPCAt(4400f, true, true); + // 14NOV2024: Ozzatron: Eternity's range is so absurdly high (more than two 1080p screens wide) that it doesn't really matter whether this is capped. + NPC potentialTarget = player.ClampedMouseWorld().ClosestNPCAt(4400f, true, true); if (potentialTarget != null) { // If something happens to the original NPC, such as death, attempt to locate a new target and attack to them. diff --git a/Projectiles/Magic/FireImplosion.cs b/Projectiles/Magic/FireImplosion.cs new file mode 100644 index 0000000000..8f73984e37 --- /dev/null +++ b/Projectiles/Magic/FireImplosion.cs @@ -0,0 +1,192 @@ +using System; +using System.IO; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Build.Construction; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class FireImplosion : ModProjectile, ILocalizedModType // Used by both Flare bolt and Frigidflash Bolt + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Vector2 pushVelocity; + public float customKnockback = 0; + public int time = 0; + public int boomTime = 0; + public bool frigidFlash => Projectile.ai[2] == 5; + public override void SetDefaults() + { + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 55; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; + Projectile.ArmorPenetration = 20; + } + public override void AI() + { + if (customKnockback == 0) // On spawn effects + { + Projectile.scale = 0; + Projectile.alpha = 0; + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/OpalChargedFire") with { Volume = 0.35f, Pitch = 0.7f }, Projectile.Center); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/FireImplosion") with { Volume = 0.45f, Pitch = Main.rand.NextFloat(0.2f, 0.35f) }, Projectile.Center); + customKnockback = Math.Abs(Projectile.knockBack); + Projectile.knockBack = 0; + + for (int i = 0; i < 3; i++) + { + Particle orb1 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 1.1f + i * 0.1f, 18); + GeneralParticleHandler.SpawnParticle(orb1); + } + float rot = Main.rand.NextFloat(-2, 2); + for (int i = 0; i < 8; i++) + { + Vector2 velocity = (MathHelper.TwoPi * i / 8f).ToRotationVector2().RotatedBy(rot) * 13f; + Particle trail = new CustomSpark(Projectile.Center + velocity * 3, velocity * 0.5f, "CalamityMod/Particles/FireTypeParticle", false, 35, 1.5f, Color.OrangeRed, new Vector2(1, 1.3f), true, false, shrinkSpeed: 0.15f); + GeneralParticleHandler.SpawnParticle(trail); + } + } + if (boomTime >= 15) + { + Projectile.scale = 0.95f * Utils.GetLerpValue(42, 0, time, true) * Utils.GetLerpValue(40, 25, time, true); + time++; + } + else // When the vortex is expanding out before it starts shrinking + { + Projectile.scale = 0.95f * Utils.GetLerpValue(0, 15, boomTime, true); + boomTime++; + } + if (Projectile.timeLeft <= 20) // Fizzles out at the end + { + if ((frigidFlash && Projectile.timeLeft % 3 == 0) || !frigidFlash) + { + Particle fx = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 6), "CalamityMod/Particles/FireTypeParticle", false, 22, Main.rand.NextFloat(0.7f, 1.2f), Color.OrangeRed, new Vector2(0.8f, 1f), true, false); + GeneralParticleHandler.SpawnParticle(fx); + } + if (frigidFlash) + { + Particle fx2 = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 6), "CalamityMod/Particles/IceTypeParticle", false, 22, Main.rand.NextFloat(0.7f, 1.2f), Color.DeepSkyBlue, new Vector2(0.8f, 1f), true, false, shrinkSpeed: -0.1f); + GeneralParticleHandler.SpawnParticle(fx2); + } + } + else if (boomTime > 5) + { + for (int i = 0; i < 2; i++) + { + Vector2 vel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(7f, 14) * Projectile.scale; + Dust dust = Dust.NewDustPerfect(Projectile.Center + vel * 3, ModContent.DustType(), vel); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.75f, 1.1f); + dust.color = Color.OrangeRed; + dust.noLightEmittence = true; + } + } + Lighting.AddLight(Projectile.Center, Color.Orange.ToVector3() * 2 * Projectile.scale); + Projectile.rotation += 0.4f; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (frigidFlash) + { + target.AddBuff(BuffID.OnFire3, 30); + target.AddBuff(BuffID.Frostburn2, 30); + } + else + target.AddBuff(BuffID.OnFire, 180); + pushVelocity = Utils.DirectionTo(Projectile.Center, target.Center) * customKnockback; + float minMult = 0.4f; + int hitsToMinMult = 15; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult * (frigidFlash ? 0.5f : 1); // Frigidflash explosion are spawned at full power, so their damage is reduced here + + if (target.CanBeMoved(false)) // The vortex sucks in enemies + { + target.velocity = (-pushVelocity); + } + } + public override void OnKill(int timeLeft) + { + if (frigidFlash) + { + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash") with { Volume = 1, Pitch = -0.2f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.DeerclopsIceAttack with { Volume = 0.85f, Pitch = 0.1f }, Projectile.Center); + + // Create Blast + float blastSize = 160; + float minMultiplier = 0.25f; + int hitsToMinMult = 8; + int debuff1 = BuffID.Frostburn2; + int debuff2 = BuffID.OnFire3; + int debuffTime = 230; + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 4f), customKnockback * 2, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.localAI[0] = debuff1; + blast.localAI[2] = debuff2; + blast.localAI[1] = debuffTime; + blast.DamageType = DamageClass.Magic; + + // BIGGER "Snowflake" visual effect + float rot = Main.rand.NextFloat(-2, 2); + for (int i = 0; i < 8; i++) + { + Vector2 velocity = (MathHelper.TwoPi * i / 8f).ToRotationVector2().RotatedBy(rot) * 14f; + Particle trail = new CustomSpark(Projectile.Center + velocity * 3, velocity * 0.5f, "CalamityMod/Particles/IceTypeParticle", false, 32, 1.3f, Color.Lerp(Color.DeepSkyBlue, Color.White, 0.5f), new Vector2(1.2f, 1.8f), true, false, shrinkSpeed: -0.27f); + GeneralParticleHandler.SpawnParticle(trail); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), velocity.RotatedBy(MathHelper.ToRadians(22.5f)) * 1.2f); + dust.noGravity = true; + dust.scale = 1.75f; + dust.color = Color.OrangeRed; + dust.noLightEmittence = true; + + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), velocity * 1.5f); + dust2.noGravity = true; + dust2.scale = 1.4f; + dust2.color = Color.DeepSkyBlue; + dust2.noLightEmittence = true; + } + for (int i = 0; i < 5; i++) + { + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.3f, 1.1f, 25); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb1 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.DeepSkyBlue, Color.White, i * 0.15f), "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.6f, 0.8f - i * 0.07f, 20); + GeneralParticleHandler.SpawnParticle(orb1); + } + } + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + return CalamityUtils.CircularHitboxCollision(Projectile.Center, (110 * Projectile.scale) + 15, targetHitbox); + } + public override bool PreDraw(ref Color lightColor) + { + if (boomTime < 1) + return false; + float fade = Utils.GetLerpValue(0, 20, Projectile.timeLeft, true); + Texture2D texture = ModContent.Request("CalamityMod/Particles/BloomRing").Value; + Color useColor = frigidFlash ? Color.Lerp(Color.DeepSkyBlue, Color.OrangeRed, fade) : Color.OrangeRed; + + for (int i = 0; i < 15; i++) + { + Color auraColor = useColor with { A = 0 } * 0.4f; + Vector2 drawOffset = (MathHelper.TwoPi * i / 15f).ToRotationVector2().RotatedBy(Main.GlobalTimeWrappedHourly * 28 - fade * 10) * 7 * fade; + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + drawOffset, null, auraColor, Projectile.rotation + i * 2.5f, texture.Size() * 0.5f, new Vector2(1 * fade, 1 + (1 - fade)) * MathHelper.Clamp((Projectile.scale - (i * 0.02f)), 0, 10), SpriteEffects.None); + } + + return false; + } + } +} diff --git a/Projectiles/Magic/FlareBoltProjectile.cs b/Projectiles/Magic/FlareBoltProjectile.cs index d07901184d..e4f2bb2345 100644 --- a/Projectiles/Magic/FlareBoltProjectile.cs +++ b/Projectiles/Magic/FlareBoltProjectile.cs @@ -1,4 +1,9 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Build.Construction; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -8,98 +13,110 @@ namespace CalamityMod.Projectiles.Magic { public class FlareBoltProjectile : ModProjectile, ILocalizedModType { + public ref float time => ref Projectile.ai[0]; + public int wallBounces = 0; + public float fadeIn = 0; + public bool launch = true; + public Color bColor = Color.OrangeRed; public new string LocalizationCategory => "Projectiles.Magic"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 2; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - public override void SetDefaults() { Projectile.width = 16; Projectile.height = 16; Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.penetrate = 4; - Projectile.timeLeft = 480; + Projectile.penetrate = -1; + Projectile.timeLeft = 240; + Projectile.extraUpdates = 2; + Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; + Projectile.localNPCHitCooldown = -1; } - public override void AI() { - if (Projectile.alpha > 0) + Player Owner = Main.player[Projectile.owner]; + Lighting.AddLight(Projectile.Center, bColor.ToVector3()); + Vector2 mouse = Owner.Calamity().mouseWorld; + fadeIn = Utils.GetLerpValue(0, Owner.itemAnimationMax * 0.5f * Projectile.MaxUpdates, time, true); + float velFade = Utils.GetLerpValue(1.5f, 6.5f, Projectile.velocity.Length(), true); + Vector2 velocity = Utils.DirectionTo(Owner.Center, mouse) * Owner.HeldItem.shootSpeed; + Projectile.scale = fadeIn * 1.5f; + if (fadeIn < 1) // Hold the projectile in front of the player while they case the spell { - Projectile.alpha -= 25; - if (Projectile.alpha < 0) - Projectile.alpha = 0; - } - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.45f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.1f / 255f); - for (int i = 0; i < 2; i++) - { - float shortXVel = Projectile.velocity.X / 3f * (float)i; - float shortYVel = Projectile.velocity.Y / 3f * (float)i; - int fourConst = 4; - int fireDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, DustID.InfernoFork, 0f, 0f, 100, default, 1.2f); - Dust dust = Main.dust[fireDust]; - dust.noGravity = true; - dust.velocity *= 0.1f; - dust.velocity += Projectile.velocity * 0.1f; - dust.position.X -= shortXVel; - dust.position.Y -= shortYVel; - } - if (Main.rand.NextBool(10)) - { - int otherFourConst = 4; - int fireDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, DustID.InfernoFork, 0f, 0f, 100, default, 0.6f); - Main.dust[fireDustSmol].velocity *= 0.25f; - Main.dust[fireDustSmol].velocity += Projectile.velocity * 0.5f; - } - Projectile.rotation += 0.3f * (float)Projectile.direction; - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.penetrate--; - if (Projectile.penetrate <= 0) - { - Projectile.Kill(); + Projectile.Center = Owner.Center + velocity.SafeNormalize(Vector2.UnitX) * 48; } else { - if (Projectile.velocity.X != oldVelocity.X) + if (launch) // On launch, spawns some effects and launch the projectile at the mouse { - Projectile.velocity.X = -oldVelocity.X; - } - if (Projectile.velocity.Y != oldVelocity.Y) - { - Projectile.velocity.Y = -oldVelocity.Y; - } - SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - } - return false; - } + Projectile.tileCollide = true; + Vector2 staticSpeed = Utils.DirectionTo(Owner.Center, mouse) * Utils.Distance(Owner.Center, Owner.ClampedMouseWorld()) * 0.0165f; + Projectile.velocity = staticSpeed; + + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/HalleysInfernoShoot") with { Volume = 0.45f, Pitch = 0.3f }, Projectile.Center); + for (int i = 0; i < 20; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(1.5f, 3.5f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.85f, 1.4f); + dust.color = bColor; + dust.noLightEmittence = true; + if (i % 3 == 0) + { + float variance = Main.rand.NextFloat(-0.6f, 0.6f); + float fxScale = Main.rand.NextFloat(1.5f, 1.7f) - Math.Abs(variance); + Vector2 fxVelocity = Projectile.velocity.RotatedBy(variance) * Main.rand.NextFloat(0.6f, 1f) * (1 - Math.Abs(variance)); + + Particle fx = new CustomSpark(Projectile.Center, fxVelocity * 1.3f, "CalamityMod/Particles/FireTypeParticle", false, 22, fxScale, Color.Lerp(bColor, Color.Red, 0.5f), new Vector2(1.8f, 1f), true, false, shrinkSpeed: 0.2f); + GeneralParticleHandler.SpawnParticle(fx); + } + } + launch = false; + } + + if (Main.rand.NextBool(10) && velFade > 0.1f) + { + Particle fx = new CustomSpark(Projectile.Center + Main.rand.NextVector2Circular(8, 8), -Projectile.velocity * 0.9f, "CalamityMod/Particles/FireTypeParticle", false, 32, 1.15f, Color.Lerp(bColor, Color.Red, 0.5f), new Vector2(0.8f, 1f), true, false); + GeneralParticleHandler.SpawnParticle(fx); + } + if (Main.rand.NextBool(6)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(8, 8), ModContent.DustType(), -Projectile.velocity * 0.5f); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.85f, 1.4f); + dust.color = bColor; + dust.noLightEmittence = true; + } + + Particle trail = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.3f, "CalamityMod/Particles/BloomCircle", false, 11, 0.3f, bColor * 0.9f, new Vector2(1, 1f), true, false, shrinkSpeed: 0.7f * velFade); + GeneralParticleHandler.SpawnParticle(trail); + } + + if (Projectile.timeLeft < 120) + { + Projectile.velocity *= 0.98f; + } + + Projectile.rotation += 0.3f * Projectile.direction; + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(BuffID.OnFire, 90); + float minMult = 0.1f; + int hitsToMinMult = 5; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.InfernoFork, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - } + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), Projectile.knockBack, Projectile.owner); } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public override bool PreDraw(ref Color lightColor) { - target.AddBuff(BuffID.OnFire, 180); + Projectile.DrawProjectileWithBackglow(bColor with { A = 0 }, Color.White, 2f * fadeIn); + return false; } } } diff --git a/Projectiles/Magic/FrigidflashBoltProjectile.cs b/Projectiles/Magic/FrigidflashBoltProjectile.cs index 420a0b7dc3..119fbf7c03 100644 --- a/Projectiles/Magic/FrigidflashBoltProjectile.cs +++ b/Projectiles/Magic/FrigidflashBoltProjectile.cs @@ -1,5 +1,11 @@ -using CalamityMod.Items.Weapons.Magic; +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Build.Construction; using Microsoft.Xna.Framework; +using ReLogic.Utilities; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -10,119 +16,255 @@ namespace CalamityMod.Projectiles.Magic public class FrigidflashBoltProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 4; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - + public ref float time => ref Projectile.ai[0]; + public bool bigMagic => Projectile.ai[1] == 5; + public int wallBounces = 0; + public float fadeIn = 0; + public bool launch = true; + public Color fireColor = Color.OrangeRed; + public Color iceColor = Color.DeepSkyBlue; + public SlotId chargeSound; public override void SetDefaults() { Projectile.width = 20; Projectile.height = 20; Projectile.friendly = true; - Projectile.alpha = 255; Projectile.penetrate = 5; Projectile.timeLeft = 480; + Projectile.extraUpdates = 2; Projectile.DamageType = DamageClass.Magic; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; + Projectile.localNPCHitCooldown = -1; + Projectile.tileCollide = false; } - public override void AI() { - if (Projectile.alpha > 0) + Player Owner = Main.player[Projectile.owner]; + Color lightColor = Color.Lerp(fireColor, iceColor, Utils.GetLerpValue(300, 0, Projectile.timeLeft, true)); + Lighting.AddLight(Projectile.Center, lightColor.ToVector3()); + Vector2 mouse = Owner.Calamity().mouseWorld; + fadeIn = launch ? Utils.GetLerpValue(0, Owner.itemAnimationMax * 0.5f * Projectile.MaxUpdates, time, true) : 1; + Vector2 velocity = Utils.DirectionTo(Owner.Center, mouse) * Owner.HeldItem.shootSpeed; + Projectile.scale = fadeIn * (bigMagic ? 1.3f : 1); + if (fadeIn < 1) // Hold the projectile in front of the player while they case the spell { - Projectile.alpha -= 25; - if (Projectile.alpha < 0) - Projectile.alpha = 0; - } - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); - for (int i = 0; i < 2; i++) - { - float shortXVel = Projectile.velocity.X / 3f * (float)i; - float shortYVel = Projectile.velocity.Y / 3f * (float)i; - int fourConst = 4; - int fireDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, DustID.InfernoFork, 0f, 0f, 100, default, 1.2f); - Dust dust = Main.dust[fireDust]; - dust.noGravity = true; - dust.velocity *= 0.1f; - dust.velocity += Projectile.velocity * 0.1f; - dust.position.X -= shortXVel; - dust.position.Y -= shortYVel; - } - if (Main.rand.NextBool(10)) - { - int otherFourConst = 4; - int fireDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, DustID.InfernoFork, 0f, 0f, 100, default, 0.6f); - Main.dust[fireDustSmol].velocity *= 0.25f; - Main.dust[fireDustSmol].velocity += Projectile.velocity * 0.5f; - } - for (int j = 0; j < 2; j++) - { - float shortyX = Projectile.velocity.X / 3f * (float)j; - float shortyY = Projectile.velocity.Y / 3f * (float)j; - int itsAFour = 4; - int frostDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)itsAFour, Projectile.position.Y + (float)itsAFour), Projectile.width - itsAFour * 2, Projectile.height - itsAFour * 2, DustID.Frost, 0f, 0f, 100, default, 1.2f); - Dust dust = Main.dust[frostDust]; - dust.noGravity = true; - dust.velocity *= 0.1f; - dust.velocity += Projectile.velocity * 0.1f; - dust.position.X -= shortyX; - dust.position.Y -= shortyY; - } - if (Main.rand.NextBool(10)) - { - int itsStillAFour = 4; - int frostDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)itsStillAFour, Projectile.position.Y + (float)itsStillAFour), Projectile.width - itsStillAFour * 2, Projectile.height - itsStillAFour * 2, DustID.Frost, 0f, 0f, 100, default, 0.6f); - Main.dust[frostDustSmol].velocity *= 0.25f; - Main.dust[frostDustSmol].velocity += Projectile.velocity * 0.5f; - } - Projectile.rotation += 0.3f * (float)Projectile.direction; - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.penetrate--; - if (Projectile.penetrate <= 0) - { - Projectile.Kill(); + Projectile.Center = Owner.Center + velocity.SafeNormalize(Vector2.UnitX) * 48; + if (bigMagic && time % 7 == 0) + { + if (time == 0) + { + chargeSound = SoundEngine.PlaySound(FrigidflashBolt.ChargeSound with { Volume = 0.6f, Pitch = 0.75f }, Projectile.Center); + } + Vector2 vel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(1f, 3f) * fadeIn; + Dust dust = Dust.NewDustPerfect(Projectile.Center + vel * 3, ModContent.DustType(), vel); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.75f, 1.1f) * fadeIn; + dust.color = Main.rand.NextBool() ? iceColor : fireColor; + dust.noLightEmittence = true; + } + if (SoundEngine.TryGetActiveSound(chargeSound, out var ChargeSound) && ChargeSound.IsPlaying) + ChargeSound.Position = Projectile.Center; } else { - if (Projectile.velocity.X != oldVelocity.X) + if (launch) // On launch, spawns some effects and launch the projectile at the mouse { - Projectile.velocity.X = -oldVelocity.X; + Projectile.tileCollide = true; + Vector2 staticSpeed = Utils.DirectionTo(Owner.Center, mouse) * Utils.Distance(Owner.Center, Owner.ClampedMouseWorld()) * 0.01f; + Projectile.velocity = (bigMagic ? staticSpeed : velocity); + + SoundEngine.PlaySound(FrigidflashBolt.UseSound with { Volume = 1f, Pitch = (bigMagic ? -0.15f : 0.15f) }, Projectile.Center); + if (bigMagic) + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/HalleysInfernoShoot") with { Volume = 0.65f, Pitch = 0.45f }, Projectile.Center); + for (int i = 0; i < (bigMagic ? 14 : 8); i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(1.1f, 1.9f) * (bigMagic ? 2 : 1)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.65f, 1f) * (bigMagic ? 1.5f : 1); + dust.color = Main.rand.NextBool() ? fireColor : iceColor; + dust.noLightEmittence = true; + + if (i % 2 == 0) + { + bool type = Main.rand.NextBool(); + float variance = Main.rand.NextFloat(-0.6f, 0.6f); + float fxScale = (Main.rand.NextFloat(1.5f, 1.7f) - Math.Abs(variance)) * 0.4f; + Vector2 fxVelocity = (Projectile.velocity * 2).RotatedBy(variance) * Main.rand.NextFloat(0.6f, 1f) * (1 - Math.Abs(variance)) * (bigMagic ? 2 : 1); + + Particle fx = new VelChangingSpark(Projectile.Center, fxVelocity * 1.3f, fxVelocity.RotatedBy(variance * 1.3f), "CalamityMod/Particles/FullStar", 22, fxScale, type ? fireColor : iceColor, new Vector2(2f, 1f), true, false, shrinkSpeed: 0.3f, lerpRate: 0.2f); + GeneralParticleHandler.SpawnParticle(fx); + } + } + launch = false; } - if (Projectile.velocity.Y != oldVelocity.Y) + + if (Main.rand.NextBool(8)) { - Projectile.velocity.Y = -oldVelocity.Y; + bool type = Main.rand.NextBool(); + Particle fx = new CustomSpark(Projectile.Center + Main.rand.NextVector2Circular(12, 12), -Projectile.velocity * 0.3f, type ? "CalamityMod/Particles/FireTypeParticle" : "CalamityMod/Particles/IceTypeParticle", false, 32, 0.9f, type ? fireColor : iceColor, new Vector2(0.8f, 1f), true, false, shrinkSpeed: type ? 0.2f : 0); + GeneralParticleHandler.SpawnParticle(fx); } - SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + + float velFade = Utils.GetLerpValue(1.5f, 6.5f, Projectile.velocity.Length(), true); + Particle iceTrail = new CustomSpark(Projectile.Center + (Vector2.One * 3 * Projectile.scale).RotatedBy(Projectile.rotation), -Projectile.velocity * 0.3f, "CalamityMod/Particles/BloomCircle", false, 7, 0.2f, iceColor * 0.9f, new Vector2(1, 1f), true, false, shrinkSpeed: 0.8f * velFade); + GeneralParticleHandler.SpawnParticle(iceTrail); + Particle fireTrail = new CustomSpark(Projectile.Center - (Vector2.One * 3 * Projectile.scale).RotatedBy(Projectile.rotation), -Projectile.velocity * 0.3f, "CalamityMod/Particles/BloomCircle", false, 7, 0.2f, fireColor * 0.9f, new Vector2(1, 1f), true, false, shrinkSpeed: 0.8f * velFade); + GeneralParticleHandler.SpawnParticle(fireTrail); } + if (bigMagic) + { + if (Projectile.timeLeft < 145) + { + Projectile.velocity *= 0.98f; + } + } + else + { + // Gain gravity after a while + // This makes it more useful on the surface where you otherwise have less tiles to work with + if (Projectile.timeLeft < 260) + { + Projectile.velocity.X *= 0.9711f; + if (Projectile.velocity.Y < 15) + Projectile.velocity.Y += 0.19f; + if (Projectile.velocity.Y < 5) + Projectile.velocity.Y *= 0.977f; + wallBounces = 2; // Will always expire on the next tile collide + } + else if (wallBounces > 1) // If you only have one bounce before death, reduce lifetime to start falling faster + Projectile.timeLeft--; + } + + Projectile.rotation += (0.7f * Projectile.direction / Projectile.MaxUpdates) * Projectile.scale; + time++; + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (bigMagic) + { + Projectile.Kill(); + return false; + } + + // Allow bounced bolts to hit enemies already hit before the bounce + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + if (Projectile.velocity.X != oldVelocity.X) + { + Projectile.velocity.X = -oldVelocity.X; + } + if (Projectile.velocity.Y != oldVelocity.Y) + { + Projectile.velocity.Y = -oldVelocity.Y; + } + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + + smallMagicExplosion(); + + if (wallBounces >= 2) + { + Projectile.Kill(); + } + wallBounces++; + return false; } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(BuffID.OnFire3, 60); + target.AddBuff(BuffID.Frostburn2, 60); + float minMult = 0.2f; + int hitsToMinMult = 4; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(FrigidflashBolt.ProjDeathSound, Projectile.Center); - for (int k = 0; k < 3; k++) + if (bigMagic) // Collapsing explosion for the big attack { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.InfernoFork, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Frost, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + // This explosion gets full damage because it spawns another itself, it actually only deals a portion of the projectile damage + Projectile bigBlast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage), Projectile.knockBack, Projectile.owner, 0, 0, 5); + bigBlast.ArmorPenetration = 20; // Hits rapidly enough that it needs some + float rot = Main.rand.NextFloat(-2, 2); + for (int i = 0; i < 6; i++) + { + Vector2 velocity = (MathHelper.TwoPi * i / 6f).ToRotationVector2().RotatedBy(rot - MathHelper.ToRadians(90)) * 8f; + Particle trail = new VelChangingSpark(Projectile.Center + velocity * 20, -velocity * 0.2f, -velocity * 5f, "CalamityMod/Particles/IceTypeParticle", 55, 1.8f, Color.Lerp(iceColor, Color.White, 0.5f), new Vector2(1.1f, 1f), true, false, shrinkSpeed: 0.15f, lerpRate: 0.01f); + GeneralParticleHandler.SpawnParticle(trail); + } + for (int n = 0; n < 15; n++) + { + Vector2 vel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3, 15); + Dust dust = Dust.NewDustPerfect(Projectile.Center + vel * 14, ModContent.DustType(), -vel); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.2f, 1.7f); + dust.color = iceColor; + dust.noLightEmittence = true; + } + } + else + { + if (wallBounces < 2) + { + smallMagicExplosion(); + } + SoundEngine.PlaySound(FrigidflashBolt.ProjDeathSound, Projectile.Center); } } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public void smallMagicExplosion() { - target.AddBuff(BuffID.OnFire3, 180); - target.AddBuff(BuffID.Frostburn2, 180); + // Create Blast + float blastSize = 80; + float minMultiplier = 0.25f; + int hitsToMinMult = 4; + int debuff1 = BuffID.Frostburn2; + int debuff2 = BuffID.OnFire3; + int debuffTime = 90; + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.localAI[0] = debuff1; + blast.localAI[2] = debuff2; + blast.localAI[1] = debuffTime; + blast.timeLeft = 15; + blast.DamageType = DamageClass.Magic; + + SoundEngine.PlaySound(SoundID.Item27 with { Volume = 0.5f, Pitch = 0.3f, MaxInstances = -1 }, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item27 with { Volume = 0.5f, Pitch = -0.3f, MaxInstances = -1 }, Projectile.Center); + + // "Snowflake" visual effect, but now with fire too + float rot = Main.rand.NextFloat(-2, 2); + for (int i = 0; i < 6; i++) + { + Vector2 velocity = (MathHelper.TwoPi * i / 6f).ToRotationVector2().RotatedBy(rot) * 6f; + Particle trail = new CustomSpark(Projectile.Center + velocity * 3, velocity * 0.5f, "CalamityMod/Particles/IceTypeParticle", false, 25, 1.3f, iceColor, new Vector2(1, 1.8f), true, false, shrinkSpeed: -0.45f); + GeneralParticleHandler.SpawnParticle(trail); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), velocity * 1.5f); + dust.noGravity = true; + dust.scale = 1.45f; + dust.color = fireColor; + dust.noLightEmittence = true; + } + for (int i = 0; i < 6; i++) + { + Vector2 velocity = (MathHelper.TwoPi * i / 6f).ToRotationVector2().RotatedBy(rot - MathHelper.ToRadians(90)) * 6f; + Particle trail = new CustomSpark(Projectile.Center + velocity * 6, velocity * 0.5f, "CalamityMod/Particles/FireTypeParticle", false, 25, 1.5f, fireColor, new Vector2(1.8f, 1f), true, false, shrinkSpeed: 0.25f); + GeneralParticleHandler.SpawnParticle(trail); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), velocity * 2f); + dust.noGravity = true; + dust.scale = 1.25f; + dust.color = iceColor; + dust.noLightEmittence = true; + } + + } + public override bool PreDraw(ref Color lightColor) + { + Color drawColor = Color.Lerp(fireColor, iceColor, Utils.GetLerpValue(300, 0, Projectile.timeLeft, true)); + Projectile.DrawProjectileWithBackglow(drawColor with { A = 0 }, Color.White, 3f * fadeIn); + return false; } } } diff --git a/Projectiles/Magic/FrostBoltProjectile.cs b/Projectiles/Magic/FrostBoltProjectile.cs index d906f20215..dae2d9f8c1 100644 --- a/Projectiles/Magic/FrostBoltProjectile.cs +++ b/Projectiles/Magic/FrostBoltProjectile.cs @@ -1,4 +1,9 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -8,99 +13,146 @@ namespace CalamityMod.Projectiles.Magic { public class FrostBoltProjectile : ModProjectile, ILocalizedModType { + public ref float time => ref Projectile.ai[0]; + public int wallBounces = 0; + public float fadeIn = 0; + public bool launch = true; + public Color bColor = Color.DeepSkyBlue; public new string LocalizationCategory => "Projectiles.Magic"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 2; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - public override void SetDefaults() { Projectile.width = 16; Projectile.height = 16; Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.penetrate = 2; + Projectile.penetrate = 3; Projectile.timeLeft = 480; + Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; Projectile.coldDamage = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = -1; } - public override void AI() { - if (Projectile.alpha > 0) + Player Owner = Main.player[Projectile.owner]; + Lighting.AddLight(Projectile.Center, bColor.ToVector3()); + fadeIn = Utils.GetLerpValue(0, Owner.itemAnimationMax * 0.5f * Projectile.MaxUpdates, time, true); + Vector2 velocity = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) * Owner.HeldItem.shootSpeed; + Projectile.scale = fadeIn; + if (fadeIn < 1) // Hold the projectile in front of the player while they case the spell { - Projectile.alpha -= 25; - if (Projectile.alpha < 0) - Projectile.alpha = 0; - } - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.01f / 255f, (255 - Projectile.alpha) * 0.3f / 255f, (255 - Projectile.alpha) * 0.45f / 255f); - for (int i = 0; i < 2; i++) - { - float shortXVel = Projectile.velocity.X / 3f * (float)i; - float shortYVel = Projectile.velocity.Y / 3f * (float)i; - int fourConst = 4; - int frostDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, DustID.Frost, 0f, 0f, 100, default, 1.2f); - Dust dust = Main.dust[frostDust]; - dust.noGravity = true; - dust.velocity *= 0.1f; - dust.velocity += Projectile.velocity * 0.1f; - dust.position.X -= shortXVel; - dust.position.Y -= shortYVel; - } - if (Main.rand.NextBool(10)) - { - int otherFourConst = 4; - int frostDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, DustID.Frost, 0f, 0f, 100, default, 0.6f); - Main.dust[frostDustSmol].velocity *= 0.25f; - Main.dust[frostDustSmol].velocity += Projectile.velocity * 0.5f; - } - Projectile.rotation += 0.3f * (float)Projectile.direction; - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.penetrate--; - if (Projectile.penetrate <= 0) - { - Projectile.Kill(); + Projectile.Center = Owner.Center + velocity.SafeNormalize(Vector2.UnitX) * 48; } else { - if (Projectile.velocity.X != oldVelocity.X) + if (launch) // On launch, spawns some effects and launch the projectile at the mouse { - Projectile.velocity.X = -oldVelocity.X; + Projectile.tileCollide = true; + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/NPCHit/CryogenHit", 3) with { Volume = 0.45f, Pitch = 0.3f }, Projectile.Center); + for (int i = 0; i < 8; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.65f, 1f); + dust.color = bColor; + dust.noLightEmittence = true; + } + Projectile.velocity = velocity; + launch = false; } - if (Projectile.velocity.Y != oldVelocity.Y) + + if (Main.rand.NextBool(15)) { - Projectile.velocity.Y = -oldVelocity.Y; + Particle fx = new CustomSpark(Projectile.Center + Main.rand.NextVector2Circular(8, 8), -Projectile.velocity * 0.3f, "CalamityMod/Particles/IceTypeParticle", false, 32, 0.9f, Color.Lerp(bColor, Color.White, 0.5f), new Vector2(0.8f, 1f), true, false); + GeneralParticleHandler.SpawnParticle(fx); } - SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + + Particle trail = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.3f, "CalamityMod/Particles/BloomCircle", false, 7, 0.2f, bColor * 0.9f, new Vector2(1, 1f), true, false, shrinkSpeed: 0.8f); + GeneralParticleHandler.SpawnParticle(trail); } + // Gain gravity after a while + // This makes it more useful on the surface where you otherwise have less tiles to work with + if (Projectile.timeLeft < 260) + { + Projectile.velocity.X *= 0.9711f; + if (Projectile.velocity.Y < 15) + Projectile.velocity.Y += 0.19f; + if (Projectile.velocity.Y < 5) + Projectile.velocity.Y *= 0.977f; + wallBounces = 2; // Will always expire on the next tile collide + } + else if (wallBounces > 1) // If you only have one bounce before death, reduce lifetime to start falling faster + Projectile.timeLeft--; + Projectile.rotation += 0.3f * Projectile.direction; + time++; + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + // Allow bounced bolts to hit enemies already hit before the bounce + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + if (Projectile.velocity.X != oldVelocity.X) + { + Projectile.velocity.X = -oldVelocity.X; + } + if (Projectile.velocity.Y != oldVelocity.Y) + { + Projectile.velocity.Y = -oldVelocity.Y; + } + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + + // Create Blast + float blastSize = 80; + float minMultiplier = 0.25f; + int hitsToMinMult = 4; + int debuff = BuffID.Frostburn; + int debuffTime = 120; + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.localAI[0] = debuff; + blast.localAI[1] = debuffTime; + blast.timeLeft = 15; + blast.DamageType = DamageClass.Magic; + + SoundEngine.PlaySound(SoundID.Item27 with { Volume = 0.5f, Pitch = 0.3f, MaxInstances = -1 }, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item27 with { Volume = 0.5f, Pitch = -0.3f, MaxInstances = -1 }, Projectile.Center); + + // "Snowflake" visual effect + float rot = Main.rand.NextFloat(-2, 2); + for (int i = 0; i < 6; i++) + { + Vector2 velocity = (MathHelper.TwoPi * i / 6f).ToRotationVector2().RotatedBy(rot) * 6f; + Particle trail = new CustomSpark(Projectile.Center + velocity * 3, velocity * 0.5f, "CalamityMod/Particles/IceTypeParticle", false, 25, 1.3f, Color.Lerp(bColor, Color.White, 0.5f), new Vector2(1, 1.8f), true, false, shrinkSpeed: -0.45f); + GeneralParticleHandler.SpawnParticle(trail); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), velocity * 1.5f); + dust.noGravity = true; + dust.scale = 1.3f; + dust.color = bColor; + dust.noLightEmittence = true; + } + + if (wallBounces >= 2) + { + Projectile.Kill(); + } + wallBounces++; + return false; } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Frost, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - } - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Frostburn, 60); + // Since this reduces the damage of the projectile directly, the damage of its explosions is also decreased + // This is intedned for Frost Bolt, but is not kept for the upgrades + // Feel free to change this to use the same pierce reduction as its upgrades if this doesn't work out + if (Projectile.damage > 1) + Projectile.damage = (int)(Projectile.damage * 0.85f); + } + public override bool PreDraw(ref Color lightColor) + { + Projectile.DrawProjectileWithBackglow(bColor with { A = 0 }, Color.White, 2f * fadeIn); + return false; } } } diff --git a/Projectiles/Magic/HolyLaser.cs b/Projectiles/Magic/HolyLaser.cs index d804f3c477..bb111a2960 100644 --- a/Projectiles/Magic/HolyLaser.cs +++ b/Projectiles/Magic/HolyLaser.cs @@ -1,62 +1,133 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Projectiles.Typeless; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; using Terraria; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Magic { - public class HolyLaser : ModProjectile, ILocalizedModType + public class HolyLaser : BaseLaserbeamProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public override float Lifetime => isBigLaser ? 60 : 30; + + public override float MaxScale => isBigLaser ? 1.5f : 0.8f; + + public override float MaxLaserLength => 1500f; + + private const string LaserTexturePath = "CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRay"; + public override Texture2D LaserBeginTexture => Request(LaserTexturePath + "Start").Value; + public override Texture2D LaserMiddleTexture => Request(LaserTexturePath + "Mid").Value; + public override Texture2D LaserEndTexture => Request(LaserTexturePath + "End").Value; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override Color LaserOverlayColor => Color.White with { A = 0 }; + public override Color LightCastColor => Color.Transparent; + private Projectile Holdout => Main.projectile[(int)Projectile.ai[1]]; + + private bool isBigLaser => Projectile.ai[2] == 1f; + public Color color1 = Color.Goldenrod; + public Color color2 = Color.Orange; + public float extraRot = 0; + public Vector2 displace = Vector2.Zero; + + private Player Owner { get; set; } + + private SlotId BigBeamSoundSlot; + public int time = 0; public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; + Projectile.penetrate = -1; + Projectile.tileCollide = false; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 2; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 180; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 30; + Projectile.localNPCHitCooldown = -1; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), (isBigLaser ? 180 : 90)); + + if (Projectile.numHits > 1) + Projectile.damage = (int)(Projectile.damage * (isBigLaser ? 0.55f : 0.6f)); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float _ = 0f; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * LaserLength, isBigLaser ? 50f : 20f, ref _); } - public override void AI() + public override void UpdateLaserMotion() { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 9f) + float dir = Projectile.ai[0]; + if (time == 0) { - int dustType = Main.rand.Next(2); - if (dustType == 0) + if (!isBigLaser) { - dustType = 244; + extraRot = dir; + Projectile.ai[0] = 0; + } + else + extraRot = 1.2f * dir; + } + Projectile.velocity = Holdout.velocity.RotatedBy(extraRot); + if (!isBigLaser) + { + Projectile.rotation = Holdout.velocity.ToRotation() - MathHelper.PiOver2 + extraRot; + extraRot *= 0.85f; + } + else + { + Projectile.rotation = (Holdout.velocity.ToRotation() - MathHelper.PiOver2) + extraRot; + extraRot -= 0.05f * dir; + } + } + + public override void AttachToSomething() + { + if (Owner == null || !Owner.active || Owner.dead || Owner.CCed || Owner.noItems || Owner.ownedProjectileCounts[ProjectileType()] == 0) return; + Projectile.Center = Holdout.ModProjectile().GunTipPosition; + } + + public override void ExtraBehavior() + { + Owner ??= Main.player[Projectile.owner]; + + Vector2 effectsPosition = Vector2.Lerp(Projectile.Center, Projectile.Center + Projectile.velocity * LaserLength, Main.rand.NextFloat()); + Vector2 randomLineEffectPosition = effectsPosition + Main.rand.NextVector2Circular(7f * (isBigLaser ? 1.2f : 0.8f), 7f * (isBigLaser ? 1.2f : 0.8f)); + + if (Main.rand.NextBool() || isBigLaser) + { + Dust laserDust = Dust.NewDustPerfect(randomLineEffectPosition, 278, Projectile.velocity * Main.rand.NextFloat(5f, 40f), Scale: Main.rand.NextFloat(0.8f, 1.1f)); + laserDust.noGravity = true; + laserDust.color = Main.rand.NextBool(3) ? color2 : color1; + } + + for (int i = 0; i < (isBigLaser ? 4 : 2); i++) + { + effectsPosition = Vector2.Lerp(Projectile.Center, Projectile.Center + Projectile.velocity * LaserLength, Main.rand.NextFloat()); + randomLineEffectPosition = effectsPosition + Main.rand.NextVector2Circular(7f, 7f); + if (i % 2 == 0) + { + Dust laserDust2 = Dust.NewDustPerfect(randomLineEffectPosition, ModContent.DustType(), Projectile.velocity * Main.rand.NextFloat(5f, 40f), Scale: Main.rand.NextFloat(0.8f, 1.1f) * (isBigLaser ? 2 : 1)); + laserDust2.noGravity = true; + laserDust2.color = Main.rand.NextBool(3) ? color2 : color1; + laserDust2.noLightEmittence = true; } else { - dustType = 246; + Particle spark2 = new CustomSpark(randomLineEffectPosition, Projectile.velocity * Main.rand.NextFloat(1f, 10f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 17, Main.rand.NextFloat(1.15f, 1.3f), Color.Lerp(color1, color2, Main.rand.NextFloat()), new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.3f, 0.4f)); + GeneralParticleHandler.SpawnParticle(spark2); } - Vector2 projPos = Projectile.position; - projPos -= Projectile.velocity * 0.25f; - int holyDust = Dust.NewDust(projPos, 1, 1, dustType, 0f, 0f, 0, default, 0.25f); - Main.dust[holyDust].position = projPos; - Main.dust[holyDust].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[holyDust].velocity *= 0.1f; } - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - - if (Projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].DamageType = DamageClass.Magic; - } + time++; } } } diff --git a/Projectiles/Magic/IncineratingFireball.cs b/Projectiles/Magic/IncineratingFireball.cs index 1978c2724d..5e11687a24 100644 --- a/Projectiles/Magic/IncineratingFireball.cs +++ b/Projectiles/Magic/IncineratingFireball.cs @@ -79,8 +79,9 @@ namespace CalamityMod.Projectiles.Magic if (Main.myPlayer == Projectile.owner) { Vector2 projLocation = Owner.Center; - float mouseDist = Vector2.Distance(Main.MouseWorld, projLocation); - Vector2 mouseDiff = Main.MouseWorld - projLocation; + Vector2 mouse = Owner.ClampedMouseWorld(); + float mouseDist = Vector2.Distance(mouse, projLocation); + Vector2 mouseDiff = mouse - projLocation; if (mouseDist > 128f) { mouseDiff.Normalize(); diff --git a/Projectiles/Magic/MeteorStar.cs b/Projectiles/Magic/MeteorStar.cs index 2ae86002c8..e983295e45 100644 --- a/Projectiles/Magic/MeteorStar.cs +++ b/Projectiles/Magic/MeteorStar.cs @@ -81,6 +81,7 @@ namespace CalamityMod.Projectiles.Magic Owner.mount?.Dismount(Owner); Owner.RemoveAllGrapplingHooks(); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld) * 14f; Owner.velocity = Projectile.velocity; Owner.ChangeDir(Math.Sign(Projectile.velocity.X) <= 0 ? -1 : 1); diff --git a/Projectiles/Magic/NanoPurgeHoldout.cs b/Projectiles/Magic/NanoPurgeHoldout.cs index 2437fb60be..6e580453fd 100644 --- a/Projectiles/Magic/NanoPurgeHoldout.cs +++ b/Projectiles/Magic/NanoPurgeHoldout.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -31,6 +32,8 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() => Main.projFrames[Type] = 4; + public float postShotFade = 0; + public override void KillHoldoutLogic() { base.KillHoldoutLogic(); @@ -68,6 +71,7 @@ namespace CalamityMod.Projectiles.Magic bool manaCostPaid = Owner.CheckMana(Owner.ActiveItem(), -1, true, false); if (manaCostPaid) { + postShotFade = 1; SoundEngine.PlaySound(SoundID.Item91, Projectile.Center); int projID = ModContent.ProjectileType(); @@ -89,11 +93,12 @@ namespace CalamityMod.Projectiles.Magic } ExtraBackArmRotation = Utils.Remap(Vector2.Dot(-Vector2.UnitY, Projectile.velocity.SafeNormalize(-Vector2.UnitY)), 0f, 1f, MathHelper.PiOver4, 0f); + postShotFade *= 0.86f; } private void SpawnFiringDust(Vector2 GunTipPosition, Vector2 laserVelocity) { - int dustID = 107; + int dustID = ModContent.DustType(); int dustRadius = 5; int dustDiameter = 2 * dustRadius; Vector2 dustCorner = GunTipPosition - Vector2.One * dustRadius; @@ -103,7 +108,8 @@ namespace CalamityMod.Projectiles.Magic Dust d = Dust.NewDustDirect(dustCorner, dustDiameter, dustDiameter, dustID, dustVel.X, dustVel.Y); d.velocity *= 0.125f; d.noGravity = true; - d.scale = 1.4f; + d.scale = 0.9f; + d.color = Color.Lime; } } @@ -116,7 +122,8 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { Texture2D texture = TextureAssets.Projectile[Type].Value; - Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 vel = Projectile.velocity * 10; + Vector2 drawPosition = (Projectile.Center - Main.screenPosition) - vel * postShotFade; Rectangle frame = texture.Frame(verticalFrames: Main.projFrames[Type], frameY: Projectile.frame); float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f) + MathHelper.PiOver2; Vector2 rotationPoint = frame.Size() * 0.5f; diff --git a/Projectiles/Magic/NanoPurgeLaser.cs b/Projectiles/Magic/NanoPurgeLaser.cs index d72a813d26..9f074f7308 100644 --- a/Projectiles/Magic/NanoPurgeLaser.cs +++ b/Projectiles/Magic/NanoPurgeLaser.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +12,7 @@ namespace CalamityMod.Projectiles.Magic private const float LaserLength = 40f; private const float LaserLengthChangeRate = 1.5f; public bool HasBounced = false; + public int bounceTimer = 0; public override string Texture => "CalamityMod/Projectiles/LaserProj"; @@ -54,10 +57,36 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.localAI[0] <= 0f) Projectile.Kill(); } + + if (Projectile.timeLeft % 2 == 0) + { + Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/GlowSpark", false, 4, 0.02f, Color.Lime, new Vector2(0.6f, 1.4f), true, false, shrinkSpeed: 0.95f); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (bounceTimer > 0) + bounceTimer--; } public override bool OnTileCollide(Vector2 oldVelocity) { + bounceTimer = 10; + for (int i = 0; i < 2; i++) + { + Color color = i == 0 ? Color.White : Color.Lime; + Particle orb2 = new CustomSpark(Projectile.Center, oldVelocity * 0.1f, "CalamityMod/Particles/BloomCircle", false, 15, Main.rand.NextFloat(0.15f, 0.25f) * (i == 0 ? 2 : 3), color, new Vector2(0.7f, 1.1f), true, false); + GeneralParticleHandler.SpawnParticle(orb2); + } + for (int i = 0; i < 5; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 2.5f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.45f, 1.1f); + dust.color = Color.Lime; + dust.noLightEmittence = true; + } + + Player owner = Main.player[Projectile.owner]; + if (!HasBounced) { HasBounced = true; @@ -69,7 +98,7 @@ namespace CalamityMod.Projectiles.Magic if (!n.CanBeChasedBy(Projectile)) continue; - float currentNPCDist = Vector2.Distance(n.Center, Main.MouseWorld); + float currentNPCDist = Vector2.Distance(n.Center, owner.ClampedMouseWorld()); if (currentNPCDist < npcDistCheck) { npcDistCheck = currentNPCDist; @@ -79,7 +108,7 @@ namespace CalamityMod.Projectiles.Magic // If the index is not default, smart bounce in the direction of that enemy. if (index != -1) { - Projectile.velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(Projectile.Center, Main.npc[index], Main.player[Projectile.owner].ActiveItem().shootSpeed, 3); + Projectile.velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(Projectile.Center, Main.npc[index], owner.ActiveItem().shootSpeed, 3); } else // Otherwise, use standard bouncing behavior. { @@ -103,18 +132,24 @@ namespace CalamityMod.Projectiles.Magic public override Color? GetAlpha(Color lightColor) => new Color(96, 255, 96, 0); - public override bool PreDraw(ref Color lightColor) => Projectile.DrawBeam(LaserLength, 2f, lightColor); + public override bool PreDraw(ref Color lightColor) + { + if (bounceTimer == 0) + Projectile.DrawBeam(LaserLength, 2f, lightColor); + return false; + } public override void OnKill(int timeLeft) { - int dustID = 107; - int dustAmt = Main.rand.Next(3, 7); - Vector2 dustPos = Projectile.Center - Projectile.velocity / 2f; - for (int i = 0; i < dustAmt; ++i) + Particle spark2 = new CustomSpark(Projectile.Center, Projectile.velocity * 0.3f, "CalamityMod/Particles/GlowSpark", false, 14, 0.018f, Color.Lime, new Vector2(1f, 1f), true, false, shrinkSpeed: 0.65f); + GeneralParticleHandler.SpawnParticle(spark2); + for (int i = 0; i < 3; i++) { - Dust d = Dust.NewDustDirect(dustPos, 0, 0, dustID, 0f, 0f, Scale: 0.8f); - d.velocity *= 1.15f; - d.noGravity = true; + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.4f, 0.9f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.45f, 1.1f); + dust.color = Color.Lime; + dust.noLightEmittence = true; } } } diff --git a/Projectiles/Magic/OmicronWingman.cs b/Projectiles/Magic/OmicronWingman.cs index 9612ab824f..f1b7b69f51 100644 --- a/Projectiles/Magic/OmicronWingman.cs +++ b/Projectiles/Magic/OmicronWingman.cs @@ -155,6 +155,7 @@ namespace CalamityMod.Projectiles.Magic private void Shoot(bool isGrenade) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 shootDirection = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX); // The position of the tip of the gun. diff --git a/Projectiles/Magic/PhantasmalFuryProj.cs b/Projectiles/Magic/PhantasmalFuryProj.cs index 2250576b86..92135f00a6 100644 --- a/Projectiles/Magic/PhantasmalFuryProj.cs +++ b/Projectiles/Magic/PhantasmalFuryProj.cs @@ -1,9 +1,6 @@ using System; -using System.Threading.Channels; using Microsoft.Xna.Framework; -using Steamworks; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -68,17 +65,11 @@ namespace CalamityMod.Projectiles.Magic } NPC target = Projectile.Center.ClosestNPCAt(700); - if (target != null && target.CanBeChasedBy(Projectile)) - { - Vector2 moveTotarget = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); - if (Projectile.velocity.Length() < 6) - Projectile.velocity += moveTotarget * 0.45f; - else - Projectile.velocity *= 0.9f; - } + CalamityUtils.HomeInOnSelectedNPC(Projectile, target, true, 0.15f, 6, 0.98f, accelerate: true); if (time < 550 && target == null) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction if (Projectile.velocity.Length() < 6) Projectile.velocity += (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * 0.35f; else @@ -108,20 +99,19 @@ namespace CalamityMod.Projectiles.Magic } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - modifiers.SourceDamage *= (launched ? 1f : 0.05f); + modifiers.SourceDamage *= (launched ? 1f : 0.4f); Player Owner = Main.player[Projectile.owner]; if (target.CanBeMoved(true)) { // Custom knockback - Vector2 launchVel = (Owner.Center - target.Center).SafeNormalize(Vector2.UnitY) * -10 * (launched ? 0.5f : 2); + Vector2 launchVel = (Owner.Center - target.Center).SafeNormalize(Vector2.UnitY) * -10 * (launched ? 0.5f : 1); target.velocity = launchVel * (target.knockBackResist == 0 ? 0.5f : 1f); } } public override void OnKill(int timeLeft) { - //SoundEngine.PlaySound(SoundID.Item43, Projectile.Center); for (int i = 0; i <= 3; i++) { Dust dust = Dust.NewDustPerfect(Projectile.Center, 175, (Projectile.velocity * 6).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(1.2f, 1.8f)); diff --git a/Projectiles/Magic/Phantom.cs b/Projectiles/Magic/Phantom.cs index 340dc80388..f3cd1a7704 100644 --- a/Projectiles/Magic/Phantom.cs +++ b/Projectiles/Magic/Phantom.cs @@ -57,34 +57,27 @@ namespace CalamityMod.Projectiles.Magic if (time >= 500) { + Vector2 mouse = Owner.ClampedMouseWorld(); if (time == 500) { Projectile.penetrate = 1; - Projectile.velocity = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * 6; + Projectile.velocity = (mouse - Projectile.Center).SafeNormalize(Vector2.UnitX) * 6; launched = true; } - float badDist = Vector2.Distance(Owner.Calamity().mouseWorld, Projectile.Center); + float badDist = Vector2.Distance(mouse, Projectile.Center); if (badDist < 30) { time = 600; } NPC target = Projectile.Center.ClosestNPCAt(550); - - if (target != null) - { - Vector2 moveToEnemy = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); - if (Projectile.velocity.Length() < 6) - Projectile.velocity += moveToEnemy * 0.3f; - else - Projectile.velocity *= 0.85f; - } + CalamityUtils.HomeInOnSelectedNPC(Projectile, target, true, 0.15f, 6, 0.98f, accelerate: true); if (time < 550 && target == null) { if (Projectile.velocity.Length() < 6) - Projectile.velocity += (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * 0.35f; + Projectile.velocity += (mouse - Projectile.Center).SafeNormalize(Vector2.UnitX) * 0.35f; else Projectile.velocity *= 0.9f; } @@ -108,13 +101,13 @@ namespace CalamityMod.Projectiles.Magic } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - modifiers.SourceDamage *= (launched ? 1f : 0.05f); + modifiers.SourceDamage *= (launched ? 1f : 0.4f); Player Owner = Main.player[Projectile.owner]; if (target.CanBeMoved(true)) { // Custom knockback - Vector2 launchVel = (Owner.Center - target.Center).SafeNormalize(Vector2.UnitY) * -10 * (launched ? 0.5f : 2); + Vector2 launchVel = (Owner.Center - target.Center).SafeNormalize(Vector2.UnitY) * -10 * (launched ? 0.5f : 1); target.velocity = launchVel * (target.knockBackResist == 0 ? 0.5f : 1f); } } diff --git a/Projectiles/Magic/PhasedGodRay.cs b/Projectiles/Magic/PhasedGodRay.cs index 06e3528bdc..a175116a5a 100644 --- a/Projectiles/Magic/PhasedGodRay.cs +++ b/Projectiles/Magic/PhasedGodRay.cs @@ -1,7 +1,11 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -29,13 +33,13 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - Projectile.width = 5; - Projectile.height = 5; + Projectile.width = 20; + Projectile.height = 20; Projectile.friendly = true; Projectile.alpha = 255; - Projectile.penetrate = 2; + Projectile.penetrate = 3; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 12; + Projectile.localNPCHitCooldown = -1; Projectile.MaxUpdates = 3; Projectile.timeLeft = 280; Projectile.DamageType = DamageClass.Magic; @@ -99,28 +103,70 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.localAI[0] <= 0f) Projectile.Kill(); } + + float fadeInLerp = Utils.GetLerpValue(280, 265, Projectile.timeLeft, true); + Color beamColor = Color.Lerp(AetherfluxCannon.accentColor, AetherfluxCannon.mainColor, fadeInLerp); + Color subColor = Color.Lerp(AetherfluxCannon.accentColor, AetherfluxCannon.mainColor, Main.rand.NextFloat()); + + Particle beamBody = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/BloomCircle", false, 7, 0.65f - 0.3f * fadeInLerp, beamColor * 0.8f, new Vector2(1.1f - 0.4f * fadeInLerp, 0.8f + 0.6f * fadeInLerp), true, false, shrinkSpeed: 0.6f); + GeneralParticleHandler.SpawnParticle(beamBody); + + Particle beamCore = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/BloomCircle", false, 5, 0.35f - 0.15f * fadeInLerp, Color.Lerp(beamColor, Color.White, 0.6f), new Vector2(0.7f, 1.4f), true, false, shrinkSpeed: 0.6f); + GeneralParticleHandler.SpawnParticle(beamCore); + + if (Projectile.timeLeft == 280) + { + for (int i = 0; i < 3; i++) + { + subColor = Color.Lerp(AetherfluxCannon.accentColor, AetherfluxCannon.mainColor, Main.rand.NextFloat()); + Particle spark = new CustomSpark(Projectile.Center - Projectile.velocity * 2, (Projectile.velocity).RotatedByRandom(0.8f) * Main.rand.NextFloat(0.5f, 0.7f), "CalamityMod/Particles/SemiCircularSmearVerticalBlank", false, 10, 0.45f, subColor, new Vector2(0.8f, 1.2f), true, false, shrinkSpeed: 0.5f); + GeneralParticleHandler.SpawnParticle(spark); + + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + dust2.scale = Main.rand.NextFloat(0.6f, 1.4f); + dust2.noGravity = true; + dust2.velocity = (Projectile.velocity).RotatedByRandom(0.8f) * Main.rand.NextFloat(0.3f, 0.8f); + dust2.color = subColor; + } + } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + for (int i = 0; i< 2; i++) + { + Color color = AetherfluxCannon.accentColor; + Particle orb2 = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 20, Main.rand.NextFloat(0.15f, 0.25f) * 3, color, new Vector2(1f, 1f), true, false); + GeneralParticleHandler.SpawnParticle(orb2); + } + Projectile.timeLeft = 280; + SoundStyle hitSound = new("CalamityMod/Sounds/Item/MeldShoot"); + SoundEngine.PlaySound(hitSound with { Volume = 0.4f, Pitch = Main.rand.NextFloat(0.5f, 0.65f) }, Projectile.Center); + if (Projectile.damage > 1) + Projectile.damage = (int)(Projectile.damage * 0.865f); + } public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); public override Color? GetAlpha(Color lightColor) => new Color(222, 166, 44, 0); - public override bool PreDraw(ref Color lightColor) => Projectile.DrawBeam(LaserLength, 2f, lightColor, curve: true); + public override bool PreDraw(ref Color lightColor) + { + //Projectile.DrawBeam(LaserLength, 2f, lightColor, curve: true); + return false; + } public override void OnKill(int timeLeft) { - int dustID = 269; - int dustAmt = 4; - Vector2 dustPos = Projectile.Center - Projectile.velocity / 2f; - Vector2 dustVel = Projectile.velocity / 4f; - for (int i = 0; i < dustAmt; ++i) + for (int i = 0; i < 4; i++) { - Dust d = Dust.NewDustDirect(dustPos, 0, 0, dustID, 0f, 0f, Scale: 2.5f); - d.velocity += dustVel; - d.velocity *= Main.rand.NextFloat(0.4f, 1f); - d.noGravity = true; + Color subColor = Color.Lerp(AetherfluxCannon.accentColor, AetherfluxCannon.mainColor, Main.rand.NextFloat()); + float rot = Main.rand.NextFloat(-0.1f, 0.1f); + Vector2 startVel = (Projectile.velocity * 0.1f).RotatedBy(rot); + Vector2 endVel = startVel.RotatedBy(rot * 5) * 20; + Particle orb2 = new VelChangingSpark(Projectile.Center, startVel, endVel, "CalamityMod/Particles/BloomCircle", Main.rand.Next(15, 20 + 1), Main.rand.NextFloat(0.015f, 0.025f) * 15, subColor, new Vector2(1.1f, 1f), true, false, lerpRate: 0.015f, shrinkSpeed: 0.4f); + GeneralParticleHandler.SpawnParticle(orb2); } } } diff --git a/Projectiles/Magic/PrimordialAncientProjectile.cs b/Projectiles/Magic/PrimordialAncientProjectile.cs index a21659f739..55c578264a 100644 --- a/Projectiles/Magic/PrimordialAncientProjectile.cs +++ b/Projectiles/Magic/PrimordialAncientProjectile.cs @@ -159,12 +159,12 @@ namespace CalamityMod.Projectiles.Magic SoundStyle explo = new("CalamityMod/Sounds/Item/MagicRockImpact"); SoundEngine.PlaySound(explo with { Volume = 0.75f, Pitch = 0.35f }, Projectile.Center); - mousePos = Main.MouseWorld; + mousePos = Main.player[Projectile.owner].ClampedMouseWorld(); goToCursor = true; } if (goToCursor) { - mousePos = Main.MouseWorld; + mousePos = Main.player[Projectile.owner].ClampedMouseWorld(); if (time == 355) { CenterX = Projectile.Center.X; diff --git a/Projectiles/Magic/PrinceFlameLarge.cs b/Projectiles/Magic/PrinceFlameLarge.cs index f79be51059..30781ae284 100644 --- a/Projectiles/Magic/PrinceFlameLarge.cs +++ b/Projectiles/Magic/PrinceFlameLarge.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -15,7 +16,9 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public ref float Time => ref Projectile.ai[0]; public const int Lifetime = 60; - public const int FadeoutTime = 25; + public const int FadeoutTime = 24; + public static Color FlameColor => new Color(255, 180, 80); + public override void SetStaticDefaults() { Main.projFrames[Type] = 8; @@ -38,7 +41,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { // Create rose petals. - if (Projectile.localAI[0] == 0f) + if (Time == 0f) { for (int i = 0; i < 10; i++) { @@ -49,7 +52,6 @@ namespace CalamityMod.Projectiles.Magic rose.scale = Main.rand.NextFloat(1.2f, 1.7f); rose.noGravity = Main.rand.NextBool(); } - Projectile.localAI[0] = 1f; } // Explode before dissipating. @@ -58,40 +60,43 @@ namespace CalamityMod.Projectiles.Magic bool dissipating = Projectile.timeLeft < FadeoutTime; - for (int i = 0; i < (dissipating ? 2 : 1); i++) - { - Dust fire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire); - fire.velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(2f, 6f); - fire.scale *= Main.rand.NextFloat(1.15f, 1.7f); - fire.noGravity = Main.rand.NextBool(); - } - // Dissipate at the end of the projectile's lifetime. if (dissipating) { Projectile.frame = (int)Math.Round(MathHelper.Lerp(4f, 7f, Utils.GetLerpValue(FadeoutTime, 0f, Projectile.timeLeft, true))); Projectile.velocity *= 0.95f; + + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(4f, 4f), ModContent.DustType(), (-Projectile.velocity).RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.1f, 0.2f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 1f); + dust.color = FlameColor * 0.8f; + + Particle mist = new MediumMistParticle(Projectile.Center, Projectile.velocity * 0.5f, FlameColor, Color.DarkSlateGray, Main.rand.NextFloat(0.4f, 0.6f), 140, Main.rand.NextFloat(-0.1f, 0.1f)); + GeneralParticleHandler.SpawnParticle(mist); + } + + Particle dyingSmoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, Color.Lerp(FlameColor, Color.DarkSlateGray, 0.3f), 12, Main.rand.NextFloat(0.3f, 0.4f), 0.6f, Main.rand.NextFloat(-0.1f, 0.1f), true); + GeneralParticleHandler.SpawnParticle(dyingSmoke); return; } - // Create bursts of fire dust. - if (Time % 8f == 7f) + // Create bursts of fire dust + if (Time % 2f == 1f && Time > 5f) { - for (int i = 0; i < 12; i++) - { - Vector2 dustSpawnOffset = Vector2.UnitX * -Projectile.width / 2f; - dustSpawnOffset += -Vector2.UnitY.RotatedBy(i * MathHelper.TwoPi / 12f) * new Vector2(8f, 16f); - dustSpawnOffset = dustSpawnOffset.RotatedBy(Projectile.rotation - MathHelper.PiOver2); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(16f, 16f), ModContent.DustType(), (-Projectile.velocity).RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.1f, 0.3f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.5f); + dust.color = FlameColor; - Dust holyFire = Dust.NewDustDirect(Projectile.Center, 0, 0, (int)CalamityDusts.ProfanedFire, 0f, 0f, 160, default, 1f); - holyFire.scale = 1.1f; - holyFire.noGravity = true; - holyFire.position = Projectile.Center + dustSpawnOffset; - holyFire.velocity = Projectile.velocity * 0.1f; - holyFire.velocity = (Projectile.Center - Projectile.velocity * 3f - holyFire.position).SafeNormalize(Vector2.Zero) * 1.25f; - } + Particle mist = new MediumMistParticle(Projectile.Center, Projectile.velocity * 0.5f, FlameColor, Color.DarkSlateGray, Main.rand.NextFloat(1f, 1.5f), 180, Main.rand.NextFloat(-0.1f, 0.1f)); + GeneralParticleHandler.SpawnParticle(mist); } + Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, FlameColor, 24, Main.rand.NextFloat(0.6f, 1f), 0.6f, Main.rand.NextFloat(-0.1f, 0.1f), true); + GeneralParticleHandler.SpawnParticle(smoke); + Time++; Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; Projectile.frameCounter++; @@ -109,6 +114,13 @@ namespace CalamityMod.Projectiles.Magic int damage = (int)(Projectile.damage * 0.66f); float kb = Projectile.knockBack * 0.4f; float offsetAngle = Main.rand.NextFloatDirection() * 0.31f; + for (float i = 0f; i < MathHelper.TwoPi; i += 0.05f) + { + Vector2 velocity = (i + offsetAngle + MathHelper.ToRadians(45f)).ToRotationVector2() * (0.5f + (MathF.Sin(6f * i) + 1f) * 8f); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), velocity); + dust.noGravity = true; + dust.color = Main.hslToRgb(Main.rand.NextFloat(0.05f, 0.15f), 1f, 0.66f); + } for (int i = 0; i < ThePrince.FlameSplitCount; i++) { Vector2 shootVelocity = (MathHelper.TwoPi * i / ThePrince.FlameSplitCount + offsetAngle).ToRotationVector2() * 8f; @@ -129,15 +141,6 @@ namespace CalamityMod.Projectiles.Magic { if (timeLeft > FadeoutTime) ExplodeIntoFireballs(); - - for (int i = 0; i < 30; i++) - { - Dust fire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire); - fire.velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(3f, 8f); - fire.position += fire.velocity.RotatedBy(MathHelper.PiOver2) * 2f; - fire.scale *= Main.rand.NextFloat(1.15f, 1.7f); - fire.noGravity = true; - } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Magic/PrinceFlameSmall.cs b/Projectiles/Magic/PrinceFlameSmall.cs index 35c6dbffe4..f3b2845002 100644 --- a/Projectiles/Magic/PrinceFlameSmall.cs +++ b/Projectiles/Magic/PrinceFlameSmall.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -24,10 +26,9 @@ namespace CalamityMod.Projectiles.Magic Projectile.width = Projectile.height = 16; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.timeLeft = 240; - Projectile.penetrate = 1; Projectile.DamageType = DamageClass.Magic; - Projectile.extraUpdates = 2; + Projectile.MaxUpdates = 3; + Projectile.timeLeft = 80 * Projectile.MaxUpdates; } public override void AI() @@ -38,14 +39,25 @@ namespace CalamityMod.Projectiles.Magic Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; Projectile.Opacity = Utils.GetLerpValue(0f, 15f, Projectile.timeLeft, true); + if (Main.rand.NextBool(3)) + { + Particle mist = new MediumMistParticle(Projectile.Center, Projectile.velocity * 0.5f, PrinceFlameLarge.FlameColor * Projectile.Opacity, Color.DarkSlateGray * Projectile.Opacity, Main.rand.NextFloat(0.4f, 0.6f), 140, Main.rand.NextFloat(-0.1f, 0.1f)); + GeneralParticleHandler.SpawnParticle(mist); + } + if (Time > AttackDelay) + { CalamityUtils.HomeInOnNPC(Projectile, false, 600f, 14f, 32f); + + Particle fire = new GlowOrbParticle(Projectile.Center + Main.rand.NextVector2Circular(6f, 6f), (-Projectile.velocity).RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.1f, 0.4f), false, 9, Main.rand.NextFloat(0.4f, 1f), PrinceFlameLarge.FlameColor); + GeneralParticleHandler.SpawnParticle(fire); + } } public override bool PreDraw(ref Color lightColor) { lightColor = Color.Lerp(lightColor, Color.White, 0.8f); - lightColor.A /= 3; + lightColor.A /= 2; CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } @@ -57,9 +69,18 @@ namespace CalamityMod.Projectiles.Magic return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); + + public override void OnKill(int timeLeft) { - target.AddBuff(ModContent.BuffType(), 60); + for (int i = 0; i < 5; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(2f, 12f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.5f); + dust.color = Main.hslToRgb(Main.rand.NextFloat(0.033f, 0.167f), 1f, 0.66f); + dust.noLightEmittence = true; + } } } } diff --git a/Projectiles/Magic/PurgeGuzzlerHoldout.cs b/Projectiles/Magic/PurgeGuzzlerHoldout.cs new file mode 100644 index 0000000000..b8ee3a15f7 --- /dev/null +++ b/Projectiles/Magic/PurgeGuzzlerHoldout.cs @@ -0,0 +1,147 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + internal class PurgeGuzzlerHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override float MaxOffsetLengthFromArm => 20f; + public override float BaseOffsetY => 0f; + public override float RecoilResolveSpeed => 0.4f; + public override float WeaponTurnSpeed => cooldownTimer > 0 ? 0.02f : 0.06f; + public override string Texture => "CalamityMod/Items/Weapons/Magic/PurgeGuzzler"; + public override Vector2 GunTipPosition => base.GunTipPosition - Vector2.UnitX.RotatedBy(Projectile.rotation) * -10; + public ref float revFrames => ref Projectile.ai[0]; + public ref float cooldownTimer => ref Projectile.ai[1]; + public ref float shootingTimer => ref Projectile.ai[2]; // Dual functions for rapid fire shooting cooldown and recoil + public bool isOnCooldown => cooldownTimer > 0; + public float revSpeed = 1; + public int shotsFired = 0; + + public Color color1 = Color.Goldenrod; + public Color color2 = Color.Orange; + public override void KillHoldoutLogic() + { + if (!isOnCooldown && (Owner.CantUseHoldout(false) || HeldItem.type != Owner.ActiveItem().type)) + Projectile.Kill(); + } + + public override void HoldoutAI() + { + if (!isOnCooldown && (Owner.CantUseHoldout() || HeldItem.type != Owner.ActiveItem().type)) + cooldownTimer = (int)(Utils.Remap(revFrames, 0, 350, 40, 120, true)); + if (isOnCooldown) + { + PostFiringCooldown(); + return; + } + + revSpeed = Utils.Remap(revFrames, 0, 150, 1, 3, true); + if (shootingTimer >= 10 && revFrames < 150) + { + SoundStyle shot = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate"); + SoundEngine.PlaySound(shot with { Pitch = Utils.Remap(revFrames, 0, 150, 0.2f, 0.8f, true), Volume = 0.2f, MaxInstances = -1 }, Projectile.Center); + + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); + float spread = 0.045f * Utils.GetLerpValue(0, 300, revFrames, true); + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(spread), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, revSpeed * (shotsFired % 2 == 0 ? -1f : 1f) * Utils.Remap(revFrames, 120, 150, 0.1f, 0.45f, true), Projectile.whoAmI); + + for (int i = 0; i <= 2; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(2f, 5f) * revSpeed, 0, default, Main.rand.NextFloat(0.3f, 0.7f) * revSpeed); + dust.noGravity = true; + dust.color = Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)); + } + + OffsetLengthFromArm -= 7f; + shootingTimer = 0; + shotsFired++; + } + + shootingTimer += revSpeed; + revFrames++; + + if (revFrames >= 150 && !isOnCooldown) + { + revSpeed = 4; + Owner.Calamity().GeneralScreenShakePower = 3.5f; + OffsetLengthFromArm -= 35f; + cooldownTimer = 60; + SoundStyle bigShot = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRay"); + SoundEngine.PlaySound(bigShot with { Pitch = 0.2f, Volume = 0.7f }, Projectile.Center); + SoundStyle bigShot2 = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyRay"); + SoundEngine.PlaySound(bigShot2 with { Pitch = 0.4f, Volume = 0.8f }, Projectile.Center); + + int bigBeamDamage = (int)(Projectile.damage * 6.5f); + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType(), bigBeamDamage, Projectile.knockBack * 3, Projectile.owner, 1, Projectile.whoAmI, 1); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType(), bigBeamDamage, Projectile.knockBack * 3, Projectile.owner, -1, Projectile.whoAmI, 1); + + for (int i = 0; i <= 25; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, 278, shootVelocity.RotatedByRandom(0.8f) * Main.rand.NextFloat(5f, 30f), 0, default, Main.rand.NextFloat(0.6f, 1.4f)); + dust.noGravity = true; + dust.color = Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)); + } + } + } + private void PostFiringCooldown() + { + Owner.channel = true; + + if (cooldownTimer <= 1) + { + Projectile.Kill(); + } + + cooldownTimer--; + } + + public override bool PreDraw(ref Color lightColor) + { + if (revFrames < 2) + return false; + Texture2D texture = TextureAssets.Projectile[Type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + if (Owner.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && shotsFired > 0) + { + float fade = Utils.GetLerpValue(1, 4, revSpeed); + for (int i = 0; i < 10; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * 5 * fade; + Main.spriteBatch.Draw(texture, drawPosition + drawOffset, null, Color.Orchid with { A = 0 } * fade, drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite, 0f); + } + } + + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + + if (Owner.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && shotsFired > 0) + { + Texture2D rechargeTexture = ModContent.Request("CalamityMod/Particles/LargeBloom").Value; + float rot = Main.GlobalTimeWrappedHourly * 25; + + float sine = MathHelper.Clamp(Math.Abs((float)Math.Sin(rot * 2.275f / MathHelper.Pi)), 0.9f, 1f); + + // Glow Orb + for (int i = 0; i < 6; i++) + Main.EntitySpriteDraw(rechargeTexture, GunTipPosition - Main.screenPosition, null, Color.Lerp(Color.Orchid, Color.Khaki, i * 0.1f) with { A = 0 } * 0.4f, rot * (i * 0.3f), rechargeTexture.Size() * 0.5f, (0.03f + i * 0.007f) * revSpeed * sine, SpriteEffects.None, 0); + } + return false; + } + } +} diff --git a/Projectiles/Magic/RainbowPartyCannonProjectile.cs b/Projectiles/Magic/RainbowPartyCannonProjectile.cs index 4472644d00..a5a9de1063 100644 --- a/Projectiles/Magic/RainbowPartyCannonProjectile.cs +++ b/Projectiles/Magic/RainbowPartyCannonProjectile.cs @@ -85,6 +85,7 @@ namespace CalamityMod.Projectiles.Magic // Place the cannon directly into the player's hand at all times. Projectile.Center = center; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // Set the direction of the cannon if it hasn't been set yet. if (Projectile.velocity == Vector2.Zero || Projectile.velocity.Length() != 1f) Projectile.velocity = (Main.MouseWorld - center).SafeNormalize(Vector2.UnitX * Projectile.direction); diff --git a/Projectiles/Magic/RancorMagicCircle.cs b/Projectiles/Magic/RancorMagicCircle.cs index ec4eefc63e..7a66ecdfcb 100644 --- a/Projectiles/Magic/RancorMagicCircle.cs +++ b/Projectiles/Magic/RancorMagicCircle.cs @@ -101,10 +101,11 @@ namespace CalamityMod.Projectiles.Magic public void UpdateAim() { - // Only execute the aiming code for the owner since Main.MouseWorld is a client-side variable. + // Only execute the aiming code for the owner since mouse position is a client-side variable. if (Main.myPlayer != Projectile.owner) return; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 idealDirection = Owner.SafeDirectionTo(Main.MouseWorld, Vector2.UnitX * Owner.direction); Vector2 newAimDirection = Projectile.velocity.MoveTowards(idealDirection, 0.05f); diff --git a/Projectiles/Magic/SHPB.cs b/Projectiles/Magic/SHPB.cs index 8872be23e2..b5e8b92d14 100644 --- a/Projectiles/Magic/SHPB.cs +++ b/Projectiles/Magic/SHPB.cs @@ -189,6 +189,7 @@ namespace CalamityMod.Projectiles.Magic // Might launches enemies if (GetSoulEffects((int)Projectile.ai[0]) == SoulType.Might && target.CanBeMoved(false)) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 launchVel = (owner.Calamity().mouseWorld - owner.Center).SafeNormalize(Vector2.UnitY) * SHPC.MightKnockbackStrength - new Vector2(0, 3); target.velocity = launchVel; } diff --git a/Projectiles/Magic/SHPExplosion.cs b/Projectiles/Magic/SHPExplosion.cs index 497771e89b..0dd7e51717 100644 --- a/Projectiles/Magic/SHPExplosion.cs +++ b/Projectiles/Magic/SHPExplosion.cs @@ -77,6 +77,7 @@ namespace CalamityMod.Projectiles.Magic // Might launches enemies if (SHPB.GetSoulEffects((int)Projectile.ai[0]) == SHPB.SoulType.Might && target.CanBeMoved(false)) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Player owner = Main.player[Projectile.owner]; Vector2 launchVel = (owner.Calamity().mouseWorld - owner.Center).SafeNormalize(Vector2.UnitY) * SHPC.MightKnockbackStrength - new Vector2(0, 3); target.velocity = launchVel; diff --git a/Projectiles/Magic/Shadowbolt.cs b/Projectiles/Magic/Shadowbolt.cs index 2b1574d21e..adb118628d 100644 --- a/Projectiles/Magic/Shadowbolt.cs +++ b/Projectiles/Magic/Shadowbolt.cs @@ -90,6 +90,7 @@ namespace CalamityMod.Projectiles.Magic { chosenTarget = Projectile.Center.ClosestNPCAt(2000); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction if (chosenTarget == null) targetCenter = Owner.Calamity().mouseWorld; else @@ -102,6 +103,7 @@ namespace CalamityMod.Projectiles.Magic } if (!spawnPlat && reflecting && targetCenter != Vector2.Zero) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction if (chosenTarget == null) targetCenter = Owner.Calamity().mouseWorld; else diff --git a/Projectiles/Magic/SlitheringEelProjectile.cs b/Projectiles/Magic/SlitheringEelProjectile.cs index 1c1582c4af..307379600d 100644 --- a/Projectiles/Magic/SlitheringEelProjectile.cs +++ b/Projectiles/Magic/SlitheringEelProjectile.cs @@ -58,9 +58,10 @@ namespace CalamityMod.Projectiles.Magic else Projectile.Opacity = MathHelper.Clamp(Projectile.Opacity + 0.1f, 0f, 1f); - if (Projectile.timeLeft % 80f < 35f && Projectile.Distance(Main.MouseWorld) > 70f) + Vector2 mouse = Main.player[Projectile.owner].ClampedMouseWorld(); + if (Projectile.timeLeft % 80f < 35f && Projectile.Distance(mouse) > 70f) { - float angleToTarget = Projectile.AngleTo(Main.MouseWorld); + float angleToTarget = Projectile.AngleTo(mouse); float angleDifference = MathHelper.WrapAngle(angleToTarget - Projectile.velocity.ToRotation()); Projectile.velocity = Projectile.velocity.RotatedBy(angleDifference / 9f); } diff --git a/Projectiles/Magic/SparklingLaser.cs b/Projectiles/Magic/SparklingLaser.cs index ced25d2724..a969a6d5f9 100644 --- a/Projectiles/Magic/SparklingLaser.cs +++ b/Projectiles/Magic/SparklingLaser.cs @@ -129,6 +129,7 @@ namespace CalamityMod.Projectiles.Magic // Gently adjusts the aim vector of the laser to point towards the mouse. private void UpdateAim(Vector2 source) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 aimVector = Vector2.Normalize(Main.MouseWorld - source); if (aimVector.HasNaNs()) aimVector = -Vector2.UnitY; diff --git a/Projectiles/Magic/SpiritCongregation.cs b/Projectiles/Magic/SpiritCongregation.cs index 06ed20b5e5..a61fa35f0b 100644 --- a/Projectiles/Magic/SpiritCongregation.cs +++ b/Projectiles/Magic/SpiritCongregation.cs @@ -103,7 +103,8 @@ namespace CalamityMod.Projectiles.Magic Vector2 previousVelocity = Projectile.velocity; // If not sufficiently close to the mouse, move towards it. - if (!Projectile.WithinRange(Main.MouseWorld, 80f)) + Vector2 mouse = Owner.ClampedMouseWorld(); + if (!Projectile.WithinRange(mouse, 80f)) MoveTowardsMouse(); // Otherwise slow down to a point. @@ -195,7 +196,7 @@ namespace CalamityMod.Projectiles.Magic // Make inertia become more significant the more power the congregation has, due to growing size. float inertia = MathHelper.Lerp(18f, 40f, CurrentPower); - Vector2 directionToMouseOffset = Projectile.SafeDirectionTo(Main.MouseWorld + HoverOffset); + Vector2 directionToMouseOffset = Projectile.SafeDirectionTo(Owner.ClampedMouseWorld() + HoverOffset); Vector2 directionToOwner = Projectile.SafeDirectionTo(Owner.Center); Vector2 idealVelocity = Vector2.Lerp(directionToMouseOffset, directionToOwner, 0.25f) * MovementSpeed; diff --git a/Projectiles/Magic/Teslabeam.cs b/Projectiles/Magic/Teslabeam.cs index 15583e7412..c01869a4b3 100644 --- a/Projectiles/Magic/Teslabeam.cs +++ b/Projectiles/Magic/Teslabeam.cs @@ -191,9 +191,11 @@ namespace CalamityMod.Projectiles.Magic Main.spriteBatch.ExitShaderRegion(); return false; } + // Gently adjusts the aim vector of the laser to point towards the mouse. private void UpdateAim(Vector2 source) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 aimVector = Vector2.Normalize(Main.MouseWorld - source); if (aimVector.HasNaNs()) aimVector = -Vector2.UnitY; diff --git a/Projectiles/Magic/ThunderboltOrb.cs b/Projectiles/Magic/ThunderboltOrb.cs index 56d7a48e04..d71b2ec493 100644 --- a/Projectiles/Magic/ThunderboltOrb.cs +++ b/Projectiles/Magic/ThunderboltOrb.cs @@ -123,6 +123,8 @@ namespace CalamityMod.Projectiles.Magic } } } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Electrified, 120); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Electrified, 120); public static Color GetColor(float type) => Color.Lerp(new Color(51, 197, 255), new Color(143, 51, 255), 0.2f + 0.15f * type + 0.2f * MathF.Sin(Main.GlobalTimeWrappedHourly * 10f)); diff --git a/Projectiles/Magic/ThunderboltShot.cs b/Projectiles/Magic/ThunderboltShot.cs index 5aabde34d5..a95f0ff923 100644 --- a/Projectiles/Magic/ThunderboltShot.cs +++ b/Projectiles/Magic/ThunderboltShot.cs @@ -84,6 +84,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + target.AddBuff(BuffID.Electrified, 60); if (Projectile.numHits == 0) Decay(); } diff --git a/Projectiles/Magic/ValkyrieRayStaff.cs b/Projectiles/Magic/ValkyrieRayStaff.cs index 439fb9d839..0fa15fb048 100644 --- a/Projectiles/Magic/ValkyrieRayStaff.cs +++ b/Projectiles/Magic/ValkyrieRayStaff.cs @@ -95,6 +95,7 @@ namespace CalamityMod.Projectiles.Magic // Adjusts the aim vector of the staff to point towards the mouse. This is Last Prism code. private void UpdateAim(Vector2 source, float speed) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 aimVector = Vector2.Normalize(Main.MouseWorld - source); if (aimVector.HasNaNs()) aimVector = -Vector2.UnitY; diff --git a/Projectiles/Magic/VehemenceHoldout.cs b/Projectiles/Magic/VehemenceHoldout.cs index b7547bdd0c..6fc8bd8129 100644 --- a/Projectiles/Magic/VehemenceHoldout.cs +++ b/Projectiles/Magic/VehemenceHoldout.cs @@ -46,6 +46,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter, true); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.rotation = Projectile.AngleTo(Main.MouseWorld); Projectile.velocity = Projectile.rotation.ToRotationVector2(); diff --git a/Projectiles/Magic/WingmanHoldout.cs b/Projectiles/Magic/WingmanHoldout.cs index ecf2db24b1..40ef361242 100644 --- a/Projectiles/Magic/WingmanHoldout.cs +++ b/Projectiles/Magic/WingmanHoldout.cs @@ -126,6 +126,7 @@ namespace CalamityMod.Projectiles.Magic // The center of the player, taking into account if they have a mount or not. Vector2 ownerPosition = Owner.MountedCenter; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // The vector between the player and the mouse. Vector2 ownerToMouse = Owner.Calamity().mouseWorld - ownerPosition; @@ -181,6 +182,7 @@ namespace CalamityMod.Projectiles.Magic private void Shoot(bool isGrenade) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 shootDirection = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX); // The position of the tip of the gun. diff --git a/Projectiles/Magic/WulfrumManaDrain.cs b/Projectiles/Magic/WulfrumManaDrain.cs index 04ede744a2..fcd775b8c4 100644 --- a/Projectiles/Magic/WulfrumManaDrain.cs +++ b/Projectiles/Magic/WulfrumManaDrain.cs @@ -56,9 +56,9 @@ namespace CalamityMod.Projectiles.Magic idleSoundOut.Volume = Math.Clamp((Timer / 30f) + 0.001f, 0f, 1f) * 100f; } - Projectile.timeLeft = 2; Projectile.Center = Owner.MountedCenter; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = (Owner.Calamity().mouseWorld - Owner.MountedCenter).SafeNormalize(Vector2.One); if (Main.rand.NextBool(6)) diff --git a/Projectiles/Magic/YharimsCrystalPrism.cs b/Projectiles/Magic/YharimsCrystalPrism.cs index 5be4576bfe..e6138298dc 100644 --- a/Projectiles/Magic/YharimsCrystalPrism.cs +++ b/Projectiles/Magic/YharimsCrystalPrism.cs @@ -127,6 +127,7 @@ namespace CalamityMod.Projectiles.Magic // Gently adjusts the aim vector of the crystal to point towards the mouse. private void UpdateAim(Vector2 source, float speed) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 aimVector = Vector2.Normalize(Main.MouseWorld - source); if (aimVector.HasNaNs()) aimVector = -Vector2.UnitY; diff --git a/Projectiles/Melee/AbyssBladeProjectile.cs b/Projectiles/Melee/AbyssBladeProjectile.cs index 9f9a13004b..b4249441b1 100644 --- a/Projectiles/Melee/AbyssBladeProjectile.cs +++ b/Projectiles/Melee/AbyssBladeProjectile.cs @@ -115,6 +115,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.netUpdate = true; SoundEngine.PlaySound(SoundID.Item1, Projectile.Center); Projectile.Center = Owner.MountedCenter + Projectile.velocity * 12f; + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction) * 20; startDamage = Projectile.damage; Projectile.spriteDirection = Projectile.direction; @@ -162,7 +164,7 @@ namespace CalamityMod.Projectiles.Melee Time = 0; bool foundTarget = false; - NPC target = Owner.Calamity().mouseWorld.ClosestNPCAt(5000); + NPC target = Owner.ClampedMouseWorld().ClosestNPCAt(1000); if (target != null) { NPCDestination = target.Center + target.velocity * 5f; @@ -173,6 +175,7 @@ namespace CalamityMod.Projectiles.Melee if (!foundTarget) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX * Projectile.direction) * 25; } else diff --git a/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs index af6256b14a..d54d26ff61 100644 --- a/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs @@ -92,6 +92,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = (int)MaxTime; SoundEngine.PlaySound(SoundID.DD2_SkyDragonsFuryShot, Projectile.Center); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); Projectile.velocity.Normalize(); Projectile.rotation = Projectile.velocity.ToRotation(); diff --git a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs index 3e652c4683..02feb57807 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs @@ -109,6 +109,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = (int)MaxTime; SoundEngine.PlaySound(SoundID.Item84 with { Volume = SoundID.Item84.Volume * 0.3f }, Projectile.Center); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); Projectile.velocity.Normalize(); Projectile.rotation = Projectile.velocity.ToRotation(); diff --git a/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs b/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs index 78e0a6833b..48275d38ef 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs @@ -208,8 +208,9 @@ namespace CalamityMod.Projectiles.Melee } //Rotate the blade towards the cursor - Projectile.Center = Vector2.Lerp(Projectile.Center, Owner.Calamity().mouseWorld, 0.025f * ThrowRatio()); - Projectile.Center = Projectile.Center.MoveTowards(Owner.Calamity().mouseWorld, 20f * ThrowRatio()); + Vector2 mouse = Owner.ClampedMouseWorld(); + Projectile.Center = Vector2.Lerp(Projectile.Center, mouse, 0.025f * ThrowRatio()); + Projectile.Center = Projectile.Center.MoveTowards(mouse, 20f * ThrowRatio()); if ((Projectile.Center - Owner.Center).Length() > ArkoftheCosmos.MaxThrowReach) Projectile.Center = Owner.Center + Owner.DirectionTo(Projectile.Center) * ArkoftheCosmos.MaxThrowReach; diff --git a/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs index d2d6ff0273..8a771abafd 100644 --- a/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs @@ -109,6 +109,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = (int)MaxTime; SoundEngine.PlaySound(SoundID.Item84 with { Volume = SoundID.Item84.Volume * 0.3f }, Projectile.Center); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); Projectile.velocity.Normalize(); Projectile.rotation = Projectile.velocity.ToRotation(); diff --git a/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs b/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs index 861b0490a3..8e2d4b093b 100644 --- a/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs @@ -143,6 +143,7 @@ namespace CalamityMod.Projectiles.Melee direction.Normalize(); Projectile.rotation = direction.ToRotation(); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, the result is capped separately if (Thrown) ThrowReach = MathHelper.Clamp((Owner.Center - Owner.Calamity().mouseWorld).Length(), ThrowReachMin, ThrowReachMax); diff --git a/Projectiles/Melee/ArkoftheCosmos_Constellation.cs b/Projectiles/Melee/ArkoftheCosmos_Constellation.cs index 20f812135e..796b9d43b2 100644 --- a/Projectiles/Melee/ArkoftheCosmos_Constellation.cs +++ b/Projectiles/Melee/ArkoftheCosmos_Constellation.cs @@ -20,7 +20,8 @@ namespace CalamityMod.Projectiles.Melee public List Particles; Vector2 AnchorStart => Owner.Center; - Vector2 AnchorEnd => Owner.Calamity().mouseWorld; + // 14NOV2024: Ozzatron: I have no idea what this does so I clamped it + Vector2 AnchorEnd => Owner.ClampedMouseWorld(); public Vector2 SizeVector => Utils.SafeNormalize(AnchorEnd - AnchorStart, Vector2.Zero) * MathHelper.Clamp((AnchorEnd - AnchorStart).Length(), 0, ArkoftheCosmos.MaxThrowReach); public override void SetStaticDefaults() diff --git a/Projectiles/Melee/BasherHoldout.cs b/Projectiles/Melee/BasherHoldout.cs index 6f40f5d2d1..8c01cc7d13 100644 --- a/Projectiles/Melee/BasherHoldout.cs +++ b/Projectiles/Melee/BasherHoldout.cs @@ -48,6 +48,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.scale = 1; Projectile.ai[1] = 1; base.OnSpawn(source); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; useAnim = Owner.itemAnimationMax; @@ -82,6 +83,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCImmunity[i] = 0; Projectile.numHits = 0; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; CanHit = false; @@ -106,10 +108,11 @@ namespace CalamityMod.Projectiles.Melee } - Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f); + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); if (AnimationProgress < (useAnim / 3)) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; CanHit = false; postSwing = false; @@ -186,6 +189,7 @@ namespace CalamityMod.Projectiles.Melee if (target.CanBeMoved(true)) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // Launch Vector2 launchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -12; target.velocity = launchVel * (target.knockBackResist == 0 ? 0.5f : 1f); @@ -200,6 +204,7 @@ namespace CalamityMod.Projectiles.Melee dust2.scale = Main.rand.NextFloat(0.65f, 1.35f); dust2.noGravity = true; } + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 playerLaunchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * 10; Owner.velocity = playerLaunchVel; } diff --git a/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs b/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs index 52e1b475a3..2c39707a19 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs @@ -111,6 +111,7 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, new Vector3(1f, 0.56f, 0.56f) * ShredRatio); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction //Manage position and rotation direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); diff --git a/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs b/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs index 43aed82d98..ca5ee67b92 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs @@ -127,6 +127,7 @@ namespace CalamityMod.Projectiles.Melee break; } + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction //Take the direction the sword is swung. FUCK not controlling the swing direction more than just left/right :| direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); diff --git a/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs b/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs index eeaef1dec2..d0d984b1d2 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs @@ -54,6 +54,7 @@ namespace CalamityMod.Projectiles.Melee { CanBounce = 1f; Projectile.timeLeft = (int)MaxTime; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); Projectile.rotation = direction.ToRotation(); diff --git a/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs b/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs index ce446cb580..700ef6f41d 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs @@ -99,8 +99,9 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization. create control points & shit) { - Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); - Reach = MathHelper.Clamp((Owner.Center - Owner.Calamity().mouseWorld).Length(), MinReach, MaxReach); + Vector2 mouse = Owner.ClampedMouseWorld(); + Projectile.velocity = Owner.SafeDirectionTo(mouse, Vector2.Zero); + Reach = MathHelper.Clamp((Owner.Center - mouse).Length(), MinReach, MaxReach); SoundEngine.PlaySound(SoundID.DD2_OgreSpit, Projectile.Center); controlPoint1 = Projectile.Center; controlPoint2 = Projectile.Center; @@ -131,6 +132,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.Center = Owner.MountedCenter + SwingPosition(ratio); Projectile.direction = Projectile.spriteDirection = -Owner.direction; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Owner.itemRotation = MathHelper.WrapAngle(Owner.AngleTo(Owner.Calamity().mouseWorld) - (Owner.direction < 0 ? MathHelper.Pi : 0)); } public void HookToTile() diff --git a/Projectiles/Melee/BurningHolyBlast.cs b/Projectiles/Melee/BurningHolyBlast.cs new file mode 100644 index 0000000000..bf2e0d5981 --- /dev/null +++ b/Projectiles/Melee/BurningHolyBlast.cs @@ -0,0 +1,40 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class BurningHolyBlast : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + private float ExplosionRadius = 170f; + + public override void SetDefaults() + { + //These shouldn't matter because its circular + Projectile.width = 200; + Projectile.height = 200; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(ModContent.BuffType(), 240); + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.97f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius * Projectile.ai[0], targetHitbox); + } +} diff --git a/Projectiles/Melee/CometQuasherHoldout.cs b/Projectiles/Melee/CometQuasherHoldout.cs index c46ab2f4d9..a73f83d5a2 100644 --- a/Projectiles/Melee/CometQuasherHoldout.cs +++ b/Projectiles/Melee/CometQuasherHoldout.cs @@ -47,6 +47,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.scale = 1; Projectile.ai[1] = -1; base.OnSpawn(source); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Comet Quasher's projectile spawning mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; useAnim = Owner.itemAnimationMax; diff --git a/Projectiles/Melee/CometQuasherMeteor.cs b/Projectiles/Melee/CometQuasherMeteor.cs index 4e177131e0..c9cdaede1b 100644 --- a/Projectiles/Melee/CometQuasherMeteor.cs +++ b/Projectiles/Melee/CometQuasherMeteor.cs @@ -47,24 +47,20 @@ namespace CalamityMod.Projectiles.Melee Projectile.extraUpdates++; if (time == 0) { - chosenTarget = Owner.Calamity().mouseWorld.ClosestNPCAt(2000); + chosenTarget = Owner.ClampedMouseWorld().ClosestNPCAt(700); if (chosenTarget != null) Projectile.velocity = (chosenTarget.Center - Projectile.Center + chosenTarget.velocity * 8).SafeNormalize(Vector2.UnitX) * 3; else + { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * 3; + } } if (Projectile.numHits < 1) { if (chosenTarget == null || chosenTarget.life <= 0) - chosenTarget = Owner.Calamity().mouseWorld.ClosestNPCAt(700); - if (chosenTarget != null) - { - Vector2 moveTotarget = (chosenTarget.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); - if (Projectile.velocity.Length() < 5) - Projectile.velocity += moveTotarget * 0.15f; - else - Projectile.velocity *= 0.8f; - } + chosenTarget = Owner.ClampedMouseWorld().ClosestNPCAt(700); + CalamityUtils.HomeInOnSelectedNPC(Projectile, chosenTarget, true, 0.08f, 5, 0.99f, accelerate: true); } if (targetDist < 1400f) diff --git a/Projectiles/Melee/CosmicOrb.cs b/Projectiles/Melee/CosmicOrb.cs index 857eb8bb36..74cf39e096 100644 --- a/Projectiles/Melee/CosmicOrb.cs +++ b/Projectiles/Melee/CosmicOrb.cs @@ -1,4 +1,8 @@ -using Microsoft.Xna.Framework; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -49,8 +53,41 @@ namespace CalamityMod.Projectiles.Melee } } - if (Main.rand.NextBool(2)) - CalamityUtils.MagnetSphereHitscan(Projectile, 500f, 6f, 8f, 5, ModContent.ProjectileType()); + //if (Main.rand.NextBool(2)) + //CalamityUtils.MagnetSphereHitscan(Projectile, 500f, 6f, 8f, 5, ModContent.ProjectileType()); + int chance = 24 * Projectile.MaxUpdates; + if (Main.rand.NextBool(chance)) + { + int MaxLaserCountPerShot = 5; + int targetCount = 0; + List targets = Main.npc.Where(npc => + { + return npc.active && Projectile.Distance(npc.Center) < 500 && npc.CanBeChasedBy(); + }).ToList(); + foreach (var target in targets) + { + if (targetCount >= MaxLaserCountPerShot) + break; + Projectile laser = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, + Vector2.Zero, + ModContent.ProjectileType(), + (int)(Projectile.damage * 0.8f), + Projectile.knockBack, + Projectile.owner, + target.whoAmI); + laser.ArmorPenetration = 100; + + Vector2 start = Projectile.Center; + Vector2 end = target.Center; + Color color = Main.rand.NextBool() ? Color.Magenta : Color.HotPink; + + Vector2 lerpVel = Vector2.Lerp(start, end, 0.5f); + float scale = 0.015f; + Particle spark = new CustomSpark(lerpVel, Projectile.SafeDirectionTo(target.Center), "CalamityMod/Particles/BloomLineThick", false, 14, scale, color * 0.75f, new Vector2(1, (Utils.Distance(start, end) * 0.034f)), true, false, shrinkSpeed: 0.25f, glowOpacity: 0.65f); + GeneralParticleHandler.SpawnParticle(spark); + targetCount++; + } + } } public override void OnKill(int timeLeft) @@ -77,10 +114,11 @@ namespace CalamityMod.Projectiles.Melee dust.scale = 0.7f; } } - - public override Color? GetAlpha(Color lightColor) + public override bool PreDraw(ref Color lightColor) { - return new Color(200 - Projectile.alpha, 200 - Projectile.alpha, 200 - Projectile.alpha, 200 - Projectile.alpha); + Color drawColor = Color.HotPink; + Projectile.DrawProjectileWithBackglow(drawColor with { A = 0 }, Color.White, 2.5f * Main.rand.NextFloat(0.8f, 1.3f)); + return false; } } } diff --git a/Projectiles/Melee/CrystylCrusherRay.cs b/Projectiles/Melee/CrystylCrusherRay.cs index d66c58b184..fd9454da63 100644 --- a/Projectiles/Melee/CrystylCrusherRay.cs +++ b/Projectiles/Melee/CrystylCrusherRay.cs @@ -60,12 +60,13 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { + Player owner = Main.player[Projectile.owner]; // We start drawing the laser if we have charged up if (IsAtMaxCharge) { - Vector2 maxLength = Main.MouseWorld - Main.player[Projectile.owner].Center; + Vector2 maxLength = owner.ClampedMouseWorld() - owner.Center; - DrawLaser(Terraria.GameContent.TextureAssets.Projectile[Type].Value, Main.player[Projectile.owner].Center, + DrawLaser(Terraria.GameContent.TextureAssets.Projectile[Type].Value, owner.Center, Projectile.velocity, 15f, Projectile.damage, -MathHelper.PiOver2, Projectile.scale, maxLength.Length(), new Color(Main.DiscoR, 0, 255), (int)MOVE_DISTANCE); } return false; @@ -149,7 +150,7 @@ namespace CalamityMod.Projectiles.Melee */ private void SetLaserPosition(Player player) { - Distance = MathHelper.Max(Main.player[Projectile.owner].Distance(Main.MouseWorld) - 20f, MOVE_DISTANCE + 5f); + Distance = MathHelper.Max(player.Distance(player.ClampedMouseWorld()) - 20f, MOVE_DISTANCE + 5f); } private void ChargeLaser(Player player) @@ -204,6 +205,7 @@ namespace CalamityMod.Projectiles.Melee // Multiplayer support here, only run this code if the client running it is the owner of the projectile if (Projectile.owner == Main.myPlayer) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 diff = Main.MouseWorld - player.Center; diff.Normalize(); Projectile.velocity = diff; diff --git a/Projectiles/Melee/DarkMasterClone.cs b/Projectiles/Melee/DarkMasterClone.cs index be519e6b44..f85ba9c18a 100644 --- a/Projectiles/Melee/DarkMasterClone.cs +++ b/Projectiles/Melee/DarkMasterClone.cs @@ -72,6 +72,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.ai[1] > 0) { Projectile.ai[1] = 0; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 direction = Projectile.Center.DirectionTo(Main.MouseWorld); Projectile.direction = Math.Sign(direction.X); if (Projectile.owner == Main.myPlayer) diff --git a/Projectiles/Melee/DeathsAscensionRift.cs b/Projectiles/Melee/DeathsAscensionRift.cs index b844b8ba93..fc66e3383a 100644 --- a/Projectiles/Melee/DeathsAscensionRift.cs +++ b/Projectiles/Melee/DeathsAscensionRift.cs @@ -73,6 +73,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item104 with { Pitch = 0.4f }, Projectile.Center); SoundEngine.PlaySound(SoundID.Item71 with { Pitch = -0.4f }, Projectile.Center); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 direction = Projectile.Center.DirectionTo(Main.MouseWorld) * 12; int spreadfactor = 9; for (int index = 0; index < DeathsAscension.ScytheShotAmount; ++index) diff --git a/Projectiles/Melee/DepthCrusherProjectile.cs b/Projectiles/Melee/DepthCrusherProjectile.cs index 96f9496617..ff4a63b424 100644 --- a/Projectiles/Melee/DepthCrusherProjectile.cs +++ b/Projectiles/Melee/DepthCrusherProjectile.cs @@ -99,6 +99,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.netUpdate = true; SoundEngine.PlaySound(SoundID.Item1, Projectile.Center); Projectile.Center = Owner.MountedCenter + Projectile.velocity * 12f; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction) * 15; startDamage = Projectile.damage; Projectile.spriteDirection = Projectile.direction; diff --git a/Projectiles/Melee/DevilsSunriseProj.cs b/Projectiles/Melee/DevilsSunriseProj.cs index 805f06e933..ab1853e41a 100644 --- a/Projectiles/Melee/DevilsSunriseProj.cs +++ b/Projectiles/Melee/DevilsSunriseProj.cs @@ -65,6 +65,7 @@ namespace CalamityMod.Projectiles.Melee if (Owner.ActiveItem().shoot == Projectile.type) scaleFactor6 = Owner.ActiveItem().shootSpeed * Projectile.scale; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 slashDirection = Main.MouseWorld - Owner.RotatedRelativePoint(Owner.MountedCenter, true); slashDirection.Normalize(); if (slashDirection.HasNaNs()) diff --git a/Projectiles/Melee/DivineHatchetBoomerang.cs b/Projectiles/Melee/DivineHatchetBoomerang.cs deleted file mode 100644 index 9b0c3acdf9..0000000000 --- a/Projectiles/Melee/DivineHatchetBoomerang.cs +++ /dev/null @@ -1,222 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class DivineHatchetBoomerang : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Items/Weapons/Melee/SeekingScorcher"; - - private bool hasHitEnemy = false; - private static int Lifetime = 300; - private static int ReboundTime = 100; - private int targetNPC = -1; - private List previousNPCs = new List() { -1 }; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.CultistIsResistantTo[Type] = true; - ProjectileID.Sets.TrailCacheLength[Type] = 8; - ProjectileID.Sets.TrailingMode[Type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 60; - Projectile.height = 60; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.penetrate = 3; - Projectile.timeLeft = Lifetime; - Projectile.DamageType = DamageClass.MeleeNoSpeed; - Projectile.extraUpdates = 1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - //holy dust - if (Main.rand.NextBool(8)) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - } - - // Boomerang rotation - Projectile.rotation += 0.4f * (float)Projectile.direction; - - // Boomerang sound - if (Projectile.soundDelay == 0) - { - Projectile.soundDelay = 8; - SoundEngine.PlaySound(SoundID.Item7, Projectile.position); - } - - // Returns after some number of frames in the air - if (Projectile.timeLeft < Lifetime - ReboundTime) - Projectile.ai[0] = 1f; - - if (Projectile.ai[0] != 0f) - { - float returnSpeed = 26f; - float acceleration = 1.4f; - - Player owner = Main.player[Projectile.owner]; - - // Delete the projectile if it's excessively far away. - Vector2 playerCenter = owner.Center; - float xDist = playerCenter.X - Projectile.Center.X; - float yDist = playerCenter.Y - Projectile.Center.Y; - float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); - if (dist > 3000f) - Projectile.Kill(); - - dist = returnSpeed / dist; - xDist *= dist; - yDist *= dist; - - // Home back in on the player. - if (Projectile.velocity.X < xDist) - { - Projectile.velocity.X += acceleration; - if (Projectile.velocity.X < 0f && xDist > 0f) - Projectile.velocity.X += acceleration; - } - else if (Projectile.velocity.X > xDist) - { - Projectile.velocity.X -= acceleration; - if (Projectile.velocity.X > 0f && xDist < 0f) - Projectile.velocity.X -= acceleration; - } - if (Projectile.velocity.Y < yDist) - { - Projectile.velocity.Y += acceleration; - if (Projectile.velocity.Y < 0f && yDist > 0f) - Projectile.velocity.Y += acceleration; - } - else if (Projectile.velocity.Y > yDist) - { - Projectile.velocity.Y -= acceleration; - if (Projectile.velocity.Y > 0f && yDist < 0f) - Projectile.velocity.Y -= acceleration; - } - - // Delete the projectile if it touches its owner. - if (Main.myPlayer == Projectile.owner) - if (Projectile.Hitbox.Intersects(owner.Hitbox)) - Projectile.Kill(); - - //home in on nearby NPCs if not returning to player - if (Projectile.penetrate != -1) - { - if (!hasHitEnemy) - { - float range = 999f; - for (int a = 0; a < Main.npc.Length; a++) - { - if (Main.npc[a].CanBeChasedBy(Projectile, false)) - { - if (Vector2.Distance(Main.npc[a].Center, Projectile.Center) < range) - { - Vector2 newVelocity = Main.npc[a].Center - Projectile.Center; - newVelocity.Normalize(); - newVelocity *= 15f; - Projectile.velocity = newVelocity; - } - } - } - } - else - { - if (targetNPC >= 0) - { - Vector2 newVelocity = Main.npc[targetNPC].Center - Projectile.Center; - newVelocity.Normalize(); - newVelocity *= 15f; - Projectile.velocity = newVelocity; - } - } - } - } - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - - //glowmask effect - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - //inflict Holy Flames for 6 seconds - target.AddBuff(ModContent.BuffType(), 180); - - if (Projectile.penetrate != -1) - { - //find a nearby NPC to track - float minDist = 999f; - int index = 0; - foreach (NPC npc in Main.ActiveNPCs) - { - bool hasHitNPC = false; - for (int j = 0; j < previousNPCs.Count; j++) - { - if (previousNPCs[j] == npc.whoAmI) - { - hasHitNPC = true; - } - } - - if (npc == target) - { - previousNPCs.Add(npc.whoAmI); - } - if (npc.CanBeChasedBy(Projectile, false) && npc != target && !hasHitNPC) - { - float dist = (Projectile.Center - npc.Center).Length(); - if (dist < minDist) - { - minDist = dist; - index = npc.whoAmI; - } - } - } - - Vector2 velocityNew; - if (minDist < 999f) - { - hasHitEnemy = true; - targetNPC = index; - velocityNew = Main.npc[index].Center - Projectile.Center; - velocityNew.Normalize(); - velocityNew *= 15f; - Projectile.velocity = velocityNew; - } - else - { - Projectile.penetrate = -1; - Projectile.ai[0] = 1f; - targetNPC = -1; - } - } - - // After its last hit, starts returning instead of vanishing. Can pierce infinitely on the way back. - if (Projectile.penetrate == 1) - { - Projectile.penetrate = -1; - Projectile.ai[0] = 1f; - targetNPC = -1; - } - } - } -} diff --git a/Projectiles/Melee/DragonRageStaff.cs b/Projectiles/Melee/DragonRageStaff.cs index 9c93805d20..01ec734e1f 100644 --- a/Projectiles/Melee/DragonRageStaff.cs +++ b/Projectiles/Melee/DragonRageStaff.cs @@ -59,6 +59,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.ai[0] += 1f; Projectile.rotation += MathHelper.TwoPi * 2f / spinCycleTime * (float)direction; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction int expectedDirection = (player.SafeDirectionTo(Main.MouseWorld).X > 0f).ToDirectionInt(); if (Projectile.ai[0] % spinCycleTime > spinCycleTime * 0.5f && expectedDirection != Projectile.velocity.X) { diff --git a/Projectiles/Melee/DragoonBigBolt.cs b/Projectiles/Melee/DragoonBigBolt.cs new file mode 100644 index 0000000000..57c5bbc58f --- /dev/null +++ b/Projectiles/Melee/DragoonBigBolt.cs @@ -0,0 +1,140 @@ +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DragoonBigBolt : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int time = 0; + public float colorValue = 0; + public float sizeMult = 1; + public override void SetDefaults() + { + Projectile.width = 60; + Projectile.height = 60; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.extraUpdates = 75; + Projectile.timeLeft = 200; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + colorValue = MathHelper.Lerp(colorValue, 50, 0.025f); + Color usedColor = Color.Lerp(Color.Cyan, Color.Orchid, Utils.GetLerpValue(0, 50, colorValue)); + + if (time == 0) + { + colorValue += 30; + sizeMult = Projectile.ai[1]; + } + + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (targetDist < 1400f && Projectile.timeLeft > 5) + { + Vector2 pos = Projectile.Center; + if (Projectile.timeLeft % 4 == 0) + { + if (time < 120) + { + float velMult = (Projectile.ai[1] == 0.5f ? 0.2f : 3 * sizeMult); + Particle spark3 = new CustomSpark(pos, Projectile.velocity * 1.2f * velMult, "CalamityMod/Particles/GlowSpark", false, 11, 0.15f * sizeMult, usedColor, new Vector2(2f, 0.8f), true, true, shrinkSpeed: 1f); + GeneralParticleHandler.SpawnParticle(spark3); + sizeMult *= 0.97f; + } + Particle spark2 = new BoltParticle(pos, -Projectile.velocity * 0.05f, false, 30, 0.6f, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (Main.rand.NextBool(35)) + { + Particle spark2 = new BoltParticle(pos, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 23, Main.rand.NextFloat(0.2f, 0.25f), usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (Main.rand.NextBool(10)) + { + Particle spark2 = new CustomSpark(pos, Projectile.velocity * Main.rand.NextFloat(-0.4f, 0.4f), "CalamityMod/Particles/DrainLineBloom", false, 80, Main.rand.NextFloat(1.2f, 1.3f) * sizeMult, usedColor, new Vector2(1, 4), true, true); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (time % 5 == 0) + { + Dust dust = Dust.NewDustPerfect(pos, 278, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), 0, default, Main.rand.NextFloat(0.45f, 0.6f)); + dust.noGravity = true; + dust.color = usedColor; + } + } + if (Projectile.ai[1] == 0.5f && Projectile.timeLeft == 1) + { + for (int i = 0; i < 3; i++) + { + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Cyan, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f, 1.48f, 15); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f, 0.925f, 15); + GeneralParticleHandler.SpawnParticle(orb2); + } + } + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.15f; + int hitsToMinMult = 3; // Damage falls off very fast, so small bolts are better multitarget + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.Electrified, 300); + if (Projectile.ai[1] != 0.5f) + { + Player Owner = Main.player[Projectile.owner]; + if (Projectile.numHits == 0) + { + Projectile.timeLeft = 5; + Projectile.velocity = Vector2.Zero; + float fxScale = 3; + Vector2 pos = target.Center; + for (int i = 0; i < (int)(7 * fxScale); i++) + { + Particle spark2 = new BoltParticle(pos, (new Vector2(4, 4) * fxScale).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.9f), true, 13, Main.rand.NextFloat(0.1f, 0.15f) * fxScale, Main.rand.NextBool(5) ? Color.Cyan : Color.Orchid, new Vector2(1.8f, 0.8f), true, true, false, 0.7f); + GeneralParticleHandler.SpawnParticle(spark2); + Dust dust = Dust.NewDustPerfect(pos, ModContent.DustType(), (new Vector2(5, 5) * fxScale).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), 0, default, Main.rand.NextFloat(0.4f, 0.55f) * fxScale); + dust.noGravity = !Main.rand.NextBool(3); + dust.color = Main.rand.NextBool(5) ? Color.Cyan : Color.Orchid; + } + Particle pulse2 = new CustomPulse(pos, Vector2.Zero, Color.Cyan, "CalamityMod/Particles/HighResFoggyCircleHardEdge", new Vector2(1, 1), 0, 0f, 0.0815f * fxScale, 10); + GeneralParticleHandler.SpawnParticle(pulse2); + for (int i = 0; i < 2; i++) + { + Particle orb = new CustomPulse(pos, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 1.38f * fxScale, 0.5f * fxScale, 14); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new CustomPulse(pos, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.925f * fxScale, 0.2f * fxScale, 14); + GeneralParticleHandler.SpawnParticle(orb2); + } + } + if (target.CanBeMoved(true)) + { + // Launch + Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center).SafeNormalize(Vector2.UnitY) * -20; + target.velocity = launchVel * (target.knockBackResist == 0 ? 0.5f : 1f); + } + } + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 45 * sizeMult * (Projectile.numHits > 0 ? 6 : 1), targetHitbox); + public override bool? CanCutTiles() => false; + } +} diff --git a/Projectiles/Melee/DragoonSmallBolt.cs b/Projectiles/Melee/DragoonSmallBolt.cs new file mode 100644 index 0000000000..50f9cd897e --- /dev/null +++ b/Projectiles/Melee/DragoonSmallBolt.cs @@ -0,0 +1,83 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DragoonSmallBolt : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int time = 0; + public float colorValue = 0; // The color fade from the first to second color + public override void SetDefaults() + { + Projectile.width = 15; + Projectile.height = 15; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 3; + Projectile.extraUpdates = 10; + Projectile.timeLeft = 200; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + colorValue = MathHelper.Lerp(colorValue, 50, 0.025f); + Color usedColor = Color.Lerp(Color.Cyan, Color.Orchid, Utils.GetLerpValue(0, 50, colorValue)) * 0.7f; + + Projectile.velocity = Projectile.velocity.RotatedBy(Projectile.ai[1] * 0.022f); // Add some outward arc to the movement + + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (targetDist < 1400f) + { + Vector2 pos = Projectile.Center; + if (Projectile.timeLeft % 3 == 0) + { + Particle spark2 = new BoltParticle(pos, -Projectile.velocity * 0.05f, false, 15, 0.4f, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.5f); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (Main.rand.NextBool(35)) + { + Particle spark2 = new BoltParticle(pos, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 23, Main.rand.NextFloat(0.2f, 0.25f), usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (time % 5 == 0) + { + Dust dust = Dust.NewDustPerfect(pos, 278, new Vector2(2, 2).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), 0, default, Main.rand.NextFloat(0.45f, 0.6f)); + dust.noGravity = true; + dust.color = usedColor; + } + } + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.5f; + int hitsToMinMult = 2; // Can only hit thrice + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.Electrified, 180); + for (int i = 0; i < 4; i++) + { + Particle spark2 = new BoltParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 13, Main.rand.NextFloat(0.3f, 0.35f), Main.rand.NextBool() ? Color.Orchid : Color.Cyan, new Vector2(1.8f, 0.8f), true, true, false, 0.9f); + GeneralParticleHandler.SpawnParticle(spark2); + } + + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 25, targetHitbox); + public override bool? CanCutTiles() => false; + } +} diff --git a/Projectiles/Melee/EarthHoldout.cs b/Projectiles/Melee/EarthHoldout.cs index 6b773f3cfe..e2d37191ad 100644 --- a/Projectiles/Melee/EarthHoldout.cs +++ b/Projectiles/Melee/EarthHoldout.cs @@ -50,6 +50,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.scale = 1; Projectile.ai[1] = 1; base.OnSpawn(source); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Earth's projectile spawning mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; useAnim = Owner.itemAnimationMax; @@ -130,7 +132,7 @@ namespace CalamityMod.Projectiles.Melee } - Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f); + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); if (AnimationProgress < (useAnim / 3)) { diff --git a/Projectiles/Melee/EarthMeteor.cs b/Projectiles/Melee/EarthMeteor.cs index 23b50a4d24..3c69d6b0a9 100644 --- a/Projectiles/Melee/EarthMeteor.cs +++ b/Projectiles/Melee/EarthMeteor.cs @@ -91,11 +91,15 @@ namespace CalamityMod.Projectiles.Melee { Projectile.extraUpdates = 15; - NPC target = Owner.Calamity().mouseWorld.ClosestNPCAt(2000); + Vector2 mouse = Owner.ClampedMouseWorld(); + NPC target = mouse.ClosestNPCAt(1000); if (target != null) Projectile.velocity = (target.Center - Projectile.Center + target.velocity * 8).SafeNormalize(Vector2.UnitX) * 8; else + { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * 8; + } } if (time >= fallTime) { diff --git a/Projectiles/Melee/EntropicFlechette.cs b/Projectiles/Melee/EntropicFlechette.cs index 4c7c836849..ae7d312ede 100644 --- a/Projectiles/Melee/EntropicFlechette.cs +++ b/Projectiles/Melee/EntropicFlechette.cs @@ -1,8 +1,5 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.Potions; -using CalamityMod.Dusts; +using CalamityMod.Dusts; using CalamityMod.Particles; -using Microsoft.Build.Construction; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -81,7 +78,7 @@ namespace CalamityMod.Projectiles.Melee if (target == null) { - Vector2 moveToMouse = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX); + Vector2 moveToMouse = (Owner.ClampedMouseWorld() - Projectile.Center).SafeNormalize(Vector2.UnitX); if (Projectile.velocity.Length() < 14) Projectile.velocity += moveToMouse * 0.15f; else @@ -94,11 +91,7 @@ namespace CalamityMod.Projectiles.Melee } else { - Vector2 moveToEnemy = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); - if (Projectile.velocity.Length() < 14 - 9 * Utils.GetLerpValue(280, 60, Projectile.timeLeft, true)) - Projectile.velocity = Projectile.velocity * 0.95f + moveToEnemy * 0.9f; - else - Projectile.velocity *= 0.95f; + CalamityUtils.HomeInOnSelectedNPC(Projectile, target, true, 0.5f, 13, 0.98f); } } else diff --git a/Projectiles/Melee/ExobladeProj.cs b/Projectiles/Melee/ExobladeProj.cs index d7f94d1966..6b4a8c4d19 100644 --- a/Projectiles/Melee/ExobladeProj.cs +++ b/Projectiles/Melee/ExobladeProj.cs @@ -229,6 +229,7 @@ namespace CalamityMod.Projectiles.Melee public void InitializationEffects(bool startInitialization) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction //recalcualte the direction of the swing Projectile.velocity = Owner.MountedCenter.DirectionTo(Owner.Calamity().mouseWorld); //Give the sword slash a random squouish @@ -361,6 +362,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft == 1 + (int)(SwingTime * (Exoblade.PercentageOfAnimationSpentLunging))) SoundEngine.PlaySound(Exoblade.DashSound, Projectile.Center); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = Owner.MountedCenter.DirectionTo(Owner.Calamity().mouseWorld); Projectile.oldPos = new Vector2[Projectile.oldPos.Length]; @@ -374,6 +376,8 @@ namespace CalamityMod.Projectiles.Melee { float rotationStrenght = MathHelper.PiOver4 * 0.05f * (float)Math.Pow(LungeProgression, 3); float currentRotation = Projectile.velocity.ToRotation(); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction float idealRotation = Owner.MountedCenter.DirectionTo(Owner.Calamity().mouseWorld).ToRotation(); Projectile.velocity = currentRotation.AngleTowards(idealRotation, rotationStrenght).ToRotationVector2(); diff --git a/Projectiles/Melee/FallenPaladinsHammerEcho.cs b/Projectiles/Melee/FallenPaladinsHammerEcho.cs index 6ae479f6fe..f5c3cc6629 100644 --- a/Projectiles/Melee/FallenPaladinsHammerEcho.cs +++ b/Projectiles/Melee/FallenPaladinsHammerEcho.cs @@ -57,11 +57,7 @@ namespace CalamityMod.Projectiles.Melee } if (targeted != null) { - Vector2 moveTotarget = (targeted.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); - if (Projectile.velocity.Length() < MathHelper.Clamp(25 - Projectile.ai[0] * 0.1f, 10, 25)) - Projectile.velocity += moveTotarget * (0.35f + Projectile.ai[0] * 0.03f); - else - Projectile.velocity *= 0.9f; + CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.7f, 25, 0.98f); } else Projectile.Kill(); diff --git a/Projectiles/Melee/Galaxia_AndromedasStride.cs b/Projectiles/Melee/Galaxia_AndromedasStride.cs index 6131af0c1f..79b868ced2 100644 --- a/Projectiles/Melee/Galaxia_AndromedasStride.cs +++ b/Projectiles/Melee/Galaxia_AndromedasStride.cs @@ -101,6 +101,7 @@ namespace CalamityMod.Projectiles.Melee if (State == 0f) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); Projectile.Center = Owner.Center + (direction * 70f * ChargeDisplacement()); diff --git a/Projectiles/Melee/Galaxia_AriesWrath.cs b/Projectiles/Melee/Galaxia_AriesWrath.cs index 01b0079f53..1f9a392338 100644 --- a/Projectiles/Melee/Galaxia_AriesWrath.cs +++ b/Projectiles/Melee/Galaxia_AriesWrath.cs @@ -154,8 +154,9 @@ namespace CalamityMod.Projectiles.Melee Projectile.scale = 1f + ScaleEquation(); Projectile.timeLeft = 2; - Projectile.Center = Vector2.Lerp(Projectile.Center, Owner.Calamity().mouseWorld, 0.05f * ThrowDisplace()); - Projectile.Center = Projectile.Center.MoveTowards(Owner.Calamity().mouseWorld, 40f * ThrowDisplace()); + Vector2 mouse = Owner.ClampedMouseWorld(); + Projectile.Center = Vector2.Lerp(Projectile.Center, mouse, 0.05f * ThrowDisplace()); + Projectile.Center = Projectile.Center.MoveTowards(mouse, 40f * ThrowDisplace()); if ((Projectile.Center - Owner.Center).Length() > FourSeasonsGalaxia.AriesAttunement_Reach) Projectile.Center = Owner.Center + Owner.SafeDirectionTo(Projectile.Center, Vector2.Zero) * FourSeasonsGalaxia.AriesAttunement_Reach; diff --git a/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs b/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs index a4d35ba78d..f28406a3ee 100644 --- a/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs +++ b/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs @@ -23,7 +23,8 @@ namespace CalamityMod.Projectiles.Melee Vector2 PreviousEnd = Vector2.Zero; Vector2 AnchorStart => Owner.Center; - Vector2 AnchorEnd => Owner.Calamity().mouseWorld; + // 14NOV2024: Ozzatron: I have no idea what this does so I clamped it + Vector2 AnchorEnd => Owner.ClampedMouseWorld(); public Vector2 SizeVector => Utils.SafeNormalize(AnchorEnd - AnchorStart, Vector2.Zero) * MathHelper.Clamp((AnchorEnd - AnchorStart).Length(), 0, FourSeasonsGalaxia.AriesAttunement_Reach); public override void SetStaticDefaults() @@ -79,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee { Particles.Clear(); - PreviousEnd = Owner.Calamity().mouseWorld - Owner.Center; + PreviousEnd = Owner.ClampedMouseWorld() - Owner.Center; Projectile.ai[0] = 1; Vector2 previousStar = Projectile.Center; Vector2 offset; @@ -134,7 +135,7 @@ namespace CalamityMod.Projectiles.Melee Timer++; //Reset the constellation if the mouse goes too far - if ((Owner.Calamity().mouseWorld - Owner.Center - PreviousEnd).Length() > 120) + if ((Owner.ClampedMouseWorld() - Owner.Center - PreviousEnd).Length() > 120) Timer = ConstellationSwapTime; } diff --git a/Projectiles/Melee/Galaxia_PhoenixsPride.cs b/Projectiles/Melee/Galaxia_PhoenixsPride.cs index d76dde0d6f..846786a679 100644 --- a/Projectiles/Melee/Galaxia_PhoenixsPride.cs +++ b/Projectiles/Melee/Galaxia_PhoenixsPride.cs @@ -79,6 +79,7 @@ namespace CalamityMod.Projectiles.Melee { SoundEngine.PlaySound(SoundID.Item90, Projectile.Center); Projectile.velocity = Vector2.Zero; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); initialized = true; @@ -102,6 +103,7 @@ namespace CalamityMod.Projectiles.Melee Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3; SoundEngine.PlaySound(SoundID.Item80, Projectile.Center); + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); //PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES YES YES MH YES YES for (int i = 0; i <= 8; i++) @@ -201,6 +203,7 @@ namespace CalamityMod.Projectiles.Melee } float rotationAdjusted = MathHelper.WrapAngle(Projectile.rotation) + MathHelper.Pi; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction float mouseAngleAdjusted = MathHelper.WrapAngle(Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One).ToRotation()) + MathHelper.Pi; float deltaAngleShoot = Math.Abs(MathHelper.WrapAngle(rotationAdjusted - mouseAngleAdjusted)); @@ -208,9 +211,12 @@ namespace CalamityMod.Projectiles.Melee { if (Owner.whoAmI == Main.myPlayer) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One) * 15f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.PhoenixAttunement_BoltDamageReduction), 0f, Owner.whoAmI, 0.1f, MathHelper.Pi * 0.02f); } CanDirectFire = false; + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction AngleReset = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One).ToRotation(); } diff --git a/Projectiles/Melee/Galaxia_PolarisGaze.cs b/Projectiles/Melee/Galaxia_PolarisGaze.cs index c676136f38..ffffb7356f 100644 --- a/Projectiles/Melee/Galaxia_PolarisGaze.cs +++ b/Projectiles/Melee/Galaxia_PolarisGaze.cs @@ -72,6 +72,7 @@ namespace CalamityMod.Projectiles.Melee { if (proj.active && proj.type == ProjectileType() && proj.owner == Owner.whoAmI) { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction if (CalamityUtils.AngleBetween(Owner.Center - Main.MouseWorld, Owner.Center - proj.Center) > MathHelper.PiOver4) { proj.Kill(); @@ -151,6 +152,7 @@ namespace CalamityMod.Projectiles.Melee if (Shred < 0) Shred = 0; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction //Manage position and rotation direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); diff --git a/Projectiles/Melee/Galaxia_PolarisGazeStar.cs b/Projectiles/Melee/Galaxia_PolarisGazeStar.cs index b3b897d19e..584d675012 100644 --- a/Projectiles/Melee/Galaxia_PolarisGazeStar.cs +++ b/Projectiles/Melee/Galaxia_PolarisGazeStar.cs @@ -65,6 +65,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item90, Projectile.Center); initialized = true; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); Projectile.rotation = direction.ToRotation(); diff --git a/Projectiles/Melee/GalaxySmasherEcho.cs b/Projectiles/Melee/GalaxySmasherEcho.cs index 4a61eb830e..243bac9bb9 100644 --- a/Projectiles/Melee/GalaxySmasherEcho.cs +++ b/Projectiles/Melee/GalaxySmasherEcho.cs @@ -76,12 +76,7 @@ namespace CalamityMod.Projectiles.Melee } if (targeted != null) { - float speedMult = 0.9f; - Vector2 moveTotarget = (targeted.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); - if (Projectile.velocity.Length() < MathHelper.Clamp(25 - Projectile.ai[0] * 0.1f, 10, 25) * speedMult) - Projectile.velocity += moveTotarget * (0.35f + Projectile.ai[0] * 0.03f) * speedMult; - else - Projectile.velocity *= 0.9f; + CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.6f, 25, 0.98f); } else Projectile.Kill(); diff --git a/Projectiles/Melee/GalaxySmasherMini.cs b/Projectiles/Melee/GalaxySmasherMini.cs index 81b77b82c9..1a9afe5795 100644 --- a/Projectiles/Melee/GalaxySmasherMini.cs +++ b/Projectiles/Melee/GalaxySmasherMini.cs @@ -66,12 +66,7 @@ namespace CalamityMod.Projectiles.Melee if (targeted != null) { - float speedMult = 0.5f; - Vector2 moveTotarget = (targeted.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); - if (Projectile.velocity.Length() < MathHelper.Clamp(25, 10, 25) * speedMult) - Projectile.velocity += moveTotarget * (0.35f) * speedMult; - else - Projectile.velocity *= 0.9f; + CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.18f, 25, 0.99f, accelerate: true); Projectile.extraUpdates = 3; } } diff --git a/Projectiles/Melee/GrandDadHoldout.cs b/Projectiles/Melee/GrandDadHoldout.cs index 102d014242..4a174c495f 100644 --- a/Projectiles/Melee/GrandDadHoldout.cs +++ b/Projectiles/Melee/GrandDadHoldout.cs @@ -51,6 +51,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.scale = 1; Projectile.ai[1] = 1; base.OnSpawn(source); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Grand Dad has no projectiles mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; useAnim = Owner.itemAnimationMax; @@ -110,7 +112,7 @@ namespace CalamityMod.Projectiles.Melee } - Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f); + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); if (AnimationProgress < (useAnim / 3)) { diff --git a/Projectiles/Melee/GrandGuardianHoldout.cs b/Projectiles/Melee/GrandGuardianHoldout.cs index b23ad46f60..83f09b63bc 100644 --- a/Projectiles/Melee/GrandGuardianHoldout.cs +++ b/Projectiles/Melee/GrandGuardianHoldout.cs @@ -51,6 +51,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.scale = 1; Projectile.ai[1] = 1; base.OnSpawn(source); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Grand Guardian has no projectiles mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; useAnim = Owner.itemAnimationMax; @@ -111,7 +113,7 @@ namespace CalamityMod.Projectiles.Melee } - Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f); + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); if (AnimationProgress < (useAnim / 3)) { @@ -224,14 +226,6 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < MathHelper.Clamp(10 - Projectile.numHits * 2, 2, 10); i++) { - //Particle spark2 = new LineParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 45, Main.rand.NextFloat(0.3f, 1f), Main.rand.NextBool(4) ? Color.DarkOrchid : Color.DodgerBlue); - //GeneralParticleHandler.SpawnParticle(spark2); - if (Main.rand.NextBool(3)) - { - //Particle spark3 = new LineParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 45, Main.rand.NextFloat(0.3f, 1f), Color.Lavender); - //GeneralParticleHandler.SpawnParticle(spark3); - } - Dust dust2 = Dust.NewDustPerfect(target.Center, 278, new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.7f)); dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); dust2.noGravity = true; diff --git a/Projectiles/Melee/GreenWater.cs b/Projectiles/Melee/GreenWater.cs index 8b97207f36..8341347563 100644 --- a/Projectiles/Melee/GreenWater.cs +++ b/Projectiles/Melee/GreenWater.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = TimeLeft; Projectile.DamageType = DamageClass.Melee; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 30; + Projectile.localNPCHitCooldown = -1; } public override void AI() @@ -56,16 +56,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity = storedVel; NPC target = Projectile.Center.ClosestNPCAt(500); - Vector2 moveToMouse; - if (target != null) - moveToMouse = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); - else - moveToMouse = Vector2.Zero; - - if (Projectile.velocity.Length() < 12 && Projectile.timeLeft > 60) - Projectile.velocity += moveToMouse * 0.2f; - else - Projectile.velocity *= 0.9f; + CalamityUtils.HomeInOnSelectedNPC(Projectile, target, false, 0.3f, 10, 0.99f); if (Main.rand.NextBool(5)) { @@ -76,17 +67,8 @@ namespace CalamityMod.Projectiles.Melee } else if (Projectile.ai[0] == 1) { - NPC target = Projectile.Center.ClosestNPCAt(200); - Vector2 moveToMouse; - if (target != null) - moveToMouse = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); - else - moveToMouse = Vector2.Zero; - - if (Projectile.velocity.Length() < 8 && Projectile.timeLeft > 60) - Projectile.velocity += moveToMouse * 0.1f; - else - Projectile.velocity *= 0.98f; + NPC target = Projectile.Center.ClosestNPCAt(155); + CalamityUtils.HomeInOnSelectedNPC(Projectile, target, false, 0.15f, 9, 0.98f, accelerate: true); } else { diff --git a/Projectiles/Melee/HellkiteHoldout.cs b/Projectiles/Melee/HellkiteHoldout.cs index 0ebb2e7e19..6e84e315ba 100644 --- a/Projectiles/Melee/HellkiteHoldout.cs +++ b/Projectiles/Melee/HellkiteHoldout.cs @@ -57,6 +57,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.scale = 1; Projectile.ai[1] = -1; base.OnSpawn(source); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Hellkite has no projectiles mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; useAnim = Owner.itemAnimationMax; @@ -214,7 +216,7 @@ namespace CalamityMod.Projectiles.Melee else Owner.direction = 1; } - Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f); + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); if (AnimationProgress < (useAnim / 3)) { diff --git a/Projectiles/Melee/HolyColliderGhost.png b/Projectiles/Melee/HolyColliderGhost.png new file mode 100644 index 0000000000..80f5b69bae Binary files /dev/null and b/Projectiles/Melee/HolyColliderGhost.png differ diff --git a/Projectiles/Melee/HolyColliderHoldout.cs b/Projectiles/Melee/HolyColliderHoldout.cs new file mode 100644 index 0000000000..c22e9af064 --- /dev/null +++ b/Projectiles/Melee/HolyColliderHoldout.cs @@ -0,0 +1,464 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class HolyColliderHoldout : BaseCustomUseStyleProjectile, ILocalizedModType + { + public override int AssignedItemID => ModContent.ItemType(); + + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Melee/HolyCollider"; + public override float HitboxOutset => 100; + + public override Vector2 HitboxSize => new Vector2(200, 200) * Projectile.scale; + public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + + public override Vector2 SpriteOrigin => new(0, 146); + public Vector2 mousePos; + public Vector2 aimVel; + public bool doSwing = false; + public bool postSwing = false; + public float fadeIn = 0; // Used to make particle effects and outer glow on the sword fade in and out + public int useAnim; // Used as your use time stat since checking the held item use time gets jank if your attack speed changes mid swing + public int storedUseAnim; // Used to check your use time when you began using the item and to reset use time when needed + public int swingCount = -1; // Runs counting code first, so it has to be one below + + public int pierceReduction = 0; // Used to reduce damage when striking many enemies with a single swing + + public bool chargedSwing = false; // True if you have a charged swing fully charged + public int chargeTimer = 0; // Timer for charging the blade + public int chargeTimerMax = 240; // This is set to be base don use time on spawn + + public Color mainColor1 = Color.Goldenrod; + public Color mainColor2 = Color.OrangeRed; + + public SlotId AudSlot; + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = TrueMeleeDamageClass.Instance; + } + public override void OnSpawn(IEntitySource source) + { + Projectile.knockBack = 0; + Projectile.scale = 1; + Projectile.ai[1] = -1; + base.OnSpawn(source); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Holy Collider's projectile spawning + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + useAnim = Owner.itemAnimationMax; + storedUseAnim = useAnim; + + chargeTimerMax = (int)(useAnim * 1.5f); // Max charge time is set here + + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + + FlipAsSword = Owner.direction == -1 ? true : false; + } + public override void UseStyle() + { + AnimationProgress = Animation % (chargedSwing ? (int)(storedUseAnim * 1.2f) : storedUseAnim); + + DrawUnconditionally = false; + bool cantUse = (Owner.Calamity().mouseRight || Owner == null || !Owner.active || Owner.dead || Main.mouseLeftRelease || Owner.CCed || Owner.noItems); + + if (CanHit || postSwing) + mousePos = Owner.Center - aimVel; + else + { + mousePos = Owner.Calamity().mouseWorld; + } + + if (CanHit) + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f); + else + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f); + if (chargeTimer > 0) + fadeIn = Utils.Remap(chargeTimer, 0, chargeTimerMax, 0, 1f); + + // If you are no longer holding the charge, then stop charge counter so you can swing + if (cantUse) + { + chargeTimer = 0; + if (Projectile.ai[2] == 5) + { + Owner.itemAnimation = Owner.itemAnimationMax; + Projectile.timeLeft = Owner.itemAnimation; + } + Projectile.ai[2] = 0; + } + else + Projectile.ai[2] = 5; + + if (!doSwing) + { + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + FlipAsSword = Owner.direction == -1 ? true : false; + + Vector2 bladePos = new Vector2(76, 0); + Vector2 particlePos = Owner.Center + (bladePos).RotatedBy(FinalRotation + MathHelper.ToRadians(-45) - 0.1f * (FlipAsSword ? 1 : -1) * -Projectile.ai[1]); + + if (Projectile.ai[2] == 5) + { + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.05f); + + float rotationValue = 65f + (25 * Utils.GetLerpValue(0, chargeTimerMax, chargeTimer, true)) * (FlipAsSword ? 1 : -1) * -Projectile.ai[1]; + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(rotationValue), 0.3f); + Animation = 0; + Owner.itemAnimation++; + Projectile.timeLeft++; + + if (chargeTimer < chargeTimerMax && !chargedSwing) + chargeTimer++; + + Vector2 particleVel = (Owner.Center - particlePos).SafeNormalize(Vector2.UnitX) * -9; + + Dust dust2 = Dust.NewDustPerfect(particlePos, ModContent.DustType(), particleVel.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.2f, 1)); + dust2.scale = Main.rand.NextFloat(0.95f, 1.45f) * fadeIn; + dust2.noGravity = true; + dust2.color = Main.rand.NextBool(3) ? mainColor2 : mainColor1; + + Particle spark3 = new LineParticle(particlePos, particleVel.RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 0.9f), false, 18, Main.rand.NextFloat(0.5f, 0.8f) * fadeIn, Main.rand.NextBool(3) ? mainColor2 : mainColor1); + GeneralParticleHandler.SpawnParticle(spark3); + + if (SoundEngine.TryGetActiveSound(AudSlot, out var ChargeSound) && ChargeSound.IsPlaying) + { + ChargeSound.Position = Projectile.Center; + ChargeSound.Pitch = Utils.Remap(chargeTimer, 0, chargeTimerMax, -0.4f, 0f); + ChargeSound.Volume = Utils.Remap(chargeTimer, 0, chargeTimerMax, 0f, 0.5f) * 100; + } + else if (!chargedSwing) + { + SoundStyle burn = new("CalamityMod/Sounds/Custom/Providence/ProvidenceBurnLoop"); + AudSlot = SoundEngine.PlaySound(burn with { Volume = 0.01f, Pitch = 0, IsLooped = true }, Projectile.Center); + } + } + if (chargeTimer == chargeTimerMax) + { + particlePos = Owner.Center + (bladePos).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); + + SoundStyle fullCharge = new("CalamityMod/Sounds/Custom/Providence/ProvidenceBurn"); + SoundEngine.PlaySound(fullCharge with { Volume = 0.7f, Pitch = 0.5f }, Projectile.Center); + + chargedSwing = true; + useAnim = storedUseAnim / 2; + chargeTimer++; + + for (int i = 0; i < 20; i++) + { + Particle spark2 = new LineParticle(particlePos, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), false, 30, Main.rand.NextFloat(0.3f, 0.8f), Main.rand.NextBool(3) ? mainColor2 : mainColor1); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + + if (chargeTimer == 0) + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + Projectile.numHits = 0; + pierceReduction = 0; + doSwing = true; + } + } + else if (chargeTimer == 0) + { + if (SoundEngine.TryGetActiveSound(AudSlot, out var ChargeSound)) + ChargeSound?.Stop(); + + if (!CanHit && !postSwing) + { + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + else + { + if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); + + if (AnimationProgress < (useAnim / 3)) + { + if (Projectile.ai[2] == 5 && !chargedSwing) + doSwing = false; + + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + postSwing = false; + if (AnimationProgress == 0) + { + Projectile.scale = 1; + Animation = 0; + doSwing = false; + chargeTimer = 0; + chargedSwing = false; + swingCount++; + useAnim = storedUseAnim; + Projectile.ai[1] = -Projectile.ai[1]; + } + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.2f); + FlipAsSword = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX).X > 0 ? true : false; + } + else + { + float time = (AnimationProgress) - (useAnim / 3); + float timeMax = useAnim - (useAnim / 3); + + if (time == (int)(timeMax * (chargedSwing ? 0.2f : 0.4f))) + { + if (!chargedSwing) + { + SoundStyle swing = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastShoot"); + SoundEngine.PlaySound(swing with { Volume = 0.7f, Pitch = 0.35f }, Projectile.Center); + SoundStyle swing2 = new("CalamityMod/Sounds/Item/SwingMid"); + SoundEngine.PlaySound(swing2 with { Volume = 0.55f, Pitch = -0.15f }, Projectile.Center); + } + else + { + SoundStyle swing = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate"); + SoundEngine.PlaySound(swing with { Volume = 0.8f, Pitch = -0.35f }, Projectile.Center); + SoundStyle swing2 = new("CalamityMod/Sounds/Item/SwingMid"); + SoundEngine.PlaySound(swing2 with { Volume = 0.9f, Pitch = -0.55f }, Projectile.Center); + } + } + if ( time > (int)(timeMax * (chargedSwing ? 0.1f : 0.3f)) && time < (int)(timeMax * (chargedSwing ? 0.95f : 0.85f))) + { + CanHit = true; + + Vector2 particleVel = new Vector2(0, 2 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + if (!chargedSwing) + { + for (int i = 0; i < 3; i++) + { + particleVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction) * Main.rand.NextFloat(0.3f, 1f)).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); + particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + if (i < 2) + { + Dust dust2 = Dust.NewDustPerfect(particlePos, ModContent.DustType(), -particleVel.RotatedByRandom(0.3f)); + dust2.scale = Main.rand.NextFloat(0.95f, 1.45f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool(3) ? mainColor2 : mainColor1; + } + else + { + Particle spark = new CustomSpark(particlePos, (-particleVel * 0.2f).RotatedByRandom(0.3f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 17, Main.rand.NextFloat(0.9f, 1.1f), Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)), new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } + } + else + { + CanHit = false; + } + + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(150f * Projectile.ai[1] * Owner.direction, 120f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time / timeMax, 1))), + 0.2f); + + if (time < (int)(timeMax * 0.9f)) + { + postSwing = true; + } + + if (CanHit) + { + if (chargedSwing) + { + for (int i = 0; i < 6; i++) + { + float randRot = Main.rand.NextFloat(-10, -45); + Vector2 dustVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); + GeneralParticleHandler.SpawnParticle(new CustomSpark(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)).RotatedByRandom(0.4f)), -dustVel * Main.rand.NextFloat(0.4f, 0.7f), "CalamityMod/Particles/LargeBloom", false, Main.rand.Next(7, 9 + 1), Main.rand.NextFloat(0.3f, 0.35f), (Main.rand.NextBool(4) ? Color.DarkGoldenrod : Color.Goldenrod), new Vector2(1f, 1.2f), true, false, 0, false, false, 0.45f)); + if (i % 3 == 0) + { + Particle spark = new CustomSpark(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)).RotatedByRandom(0.4f)), -dustVel * Main.rand.NextFloat(0.4f, 0.7f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 27, Main.rand.NextFloat(1.15f, 1.3f), Main.rand.NextBool(4) ? Color.Khaki : Color.Orange, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); + GeneralParticleHandler.SpawnParticle(spark); + } + } + for (int i = 0; i < 6; i++) + { + float randRot = Main.rand.NextFloat(-30, -60); + Vector2 dustVel = (new Vector2(0, 35 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), dustVel * Main.rand.NextFloat(0.3f, 0.9f)); + dust2.scale = Main.rand.NextFloat(0.95f, 1.45f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool(3) ? mainColor2 : mainColor1; + } + } + else + { + for (int i = 0; i < 8; i++) + { + float randRot = Main.rand.NextFloat(-30, -60); + Vector2 dustVel = -(new Vector2(0, 25 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.15f)), ModContent.DustType(), dustVel * Main.rand.NextFloat(0.1f, 0.5f)); + dust2.scale = Main.rand.NextFloat(0.75f, 0.9f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool(3) ? mainColor2 : mainColor1; + } + } + + if (chargedSwing) + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (Vector2.Distance(Owner.Center + (new Vector2(100, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 100 && projectile.active && projectile.type == ModContent.ProjectileType()) + { + projectile.ai[2] = 5; + projectile.owner = Owner.whoAmI; + } + } + } + else + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (Vector2.Distance(Owner.Center + (new Vector2(100, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 100 && projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[0] != 10) + { + Vector2 launchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -2.5f; + projectile.velocity += launchVel; + projectile.timeLeft = 300; + projectile.owner = Owner.whoAmI; + Particle orb2 = new CustomPulse(projectile.Center, Vector2.Zero, Color.Goldenrod, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.8f, 11); + GeneralParticleHandler.SpawnParticle(orb2); + } + } + } + } + } + } + + ArmRotationOffset = MathHelper.ToRadians(-140f); + ArmRotationOffsetBack = MathHelper.ToRadians(-140f); + } + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(AudSlot, out var ChargeSound)) + ChargeSound?.Stop(); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 90); + + // If you are hitting an armored target or kill a target, don't reduce damage based on enemy hits (which uses Projectile.numHits) + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && pierceReduction > 0) + { + pierceReduction -= 1; + } + + if (!chargedSwing) + { + if (Projectile.numHits == 0) + { + SoundStyle hitSound = new("CalamityMod/Sounds/Item/HolyColliderSmallHit"); + SoundEngine.PlaySound(hitSound with { Volume = 0.85f, PitchVariance = 0.25f }, Projectile.Center); + + for (int i = 0; i < 8; i++) + { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile fadedFire = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -11).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.05), Projectile.knockBack, Projectile.owner, 10, target.whoAmI); + fadedFire.timeLeft = Main.rand.Next(40, 55 + 1); + } + } + } + else + { + if (Projectile.numHits == 0) + { + SoundStyle hitSound = new("CalamityMod/Sounds/Item/HolyColliderBigHit"); + SoundEngine.PlaySound(hitSound with { Volume = 1f, PitchVariance = 0.15f }, Projectile.Center); + + float starAngle = MathHelper.ToRadians(45f); + for (int i = 0; i < 4; i++) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 278); + Vector2 vel = (MathHelper.TwoPi * i / 4f).ToRotationVector2().RotatedBy(starAngle) * 8f; + + Particle pulse = new GlowSparkParticle(target.Center, vel, false, 12, 0.1f, Color.Orange, new Vector2(3.2f, 0.9f), true, true, 0.85f); + GeneralParticleHandler.SpawnParticle(pulse); + } + for (int i = 0; i < 4; i++) + { + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, (new Vector2(0, -13).RotatedBy(MathHelper.ToRadians(45f))).RotatedBy(MathHelper.ToRadians(90f) * i), ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), Projectile.knockBack, Projectile.owner, 0, target.whoAmI); + } + } + } + + if (target.CanBeMoved(true)) + { + // Custom knockback + Vector2 launchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * (chargedSwing ? -35 : -23); + target.velocity = launchVel * (target.knockBackResist == 0 ? 0.3f : 1f); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.25f; + int hitsToMinMult = 10; + float damageMult = Utils.Remap(pierceReduction, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= (chargedSwing ? 1f : 0.5f) * damageMult; + } + public override bool PreDraw(ref Color lightColor) + { + // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. + if ((useAnim > 0 || DrawUnconditionally) && (Owner.ItemAnimationActive)) + { + Asset tex = ModContent.Request(Texture); + Asset glowTex = ModContent.Request("CalamityMod/Items/Weapons/Melee/HolyColliderGlow"); + Asset shineTex = ModContent.Request("CalamityMod/Particles/Sparkle"); + bool flipAsSword = (swingCount % 2 == 0 ? !FlipAsSword : FlipAsSword); + float r = flipAsSword ? MathHelper.ToRadians(90) : 0f; + Vector2 generalDrawPos = Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY); + SpriteEffects sEffects = spriteEffects != SpriteEffects.None ? spriteEffects : (flipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + + for (int i = 0; i < 25; i++) + { + Texture2D centerTexture = ModContent.Request("CalamityMod/Projectiles/Melee/HolyColliderGhost").Value; + Color auraColor = mainColor1 with { A = 0 } * 0.15f * fadeIn; + Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * 6 * fadeIn; + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, flipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (flipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + + Main.EntitySpriteDraw(tex.Value, generalDrawPos, tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, flipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, sEffects); + Main.EntitySpriteDraw(glowTex.Value, generalDrawPos, glowTex.Frame(1, FrameCount, 0, Frame), Color.White, Projectile.rotation + RotationOffset + r, flipAsSword ? new Vector2(glowTex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, sEffects); + } + else + { + chargeTimer = 0; + chargedSwing = false; + } + return false; + } + public override void ResetStyle() + { + } + } +} diff --git a/Projectiles/Melee/HolyColliderHolyFire.cs b/Projectiles/Melee/HolyColliderHolyFire.cs index ed2c6ba922..10d9c66588 100644 --- a/Projectiles/Melee/HolyColliderHolyFire.cs +++ b/Projectiles/Melee/HolyColliderHolyFire.cs @@ -1,4 +1,6 @@ -using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -12,6 +14,11 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/Boss/HolyFire2"; + public bool isLaunched = false; + public bool setStats = true; + public static int statMax = 8; + public int setStatTimer = statMax; + public int time = 0; public override void SetStaticDefaults() { Main.projFrames[Type] = 4; @@ -20,22 +27,109 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 26; - Projectile.height = 26; + Projectile.width = 1; + Projectile.height = 1; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 1; + Projectile.penetrate = -1; Projectile.tileCollide = false; - Projectile.timeLeft = 90; + Projectile.timeLeft = 180; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10 * Projectile.MaxUpdates; } - public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 75 && target.CanBeChasedBy(Projectile); + public override bool? CanDamage() => ((time > 10 && !isLaunched) || (isLaunched && !setStats)) ? null : false; public override void AI() { + Player Owner = Main.player[Projectile.owner]; + if (Projectile.ai[2] == 5 && time > 10 && Projectile.ai[0] != 10) + isLaunched = true; + else + Projectile.ai[2] = 0; + + Projectile.scale = Utils.GetLerpValue(0, 40, Projectile.timeLeft, true); + + if (isLaunched) + { + Projectile.rotation = Projectile.velocity.ToRotation(); + if (setStats) + { + if (setStatTimer == statMax) + { + Projectile.timeLeft = 300; + for (int i = 0; i < 2; i++) + { + SoundStyle sound5 = new("CalamityMod/Sounds/Item/HeliumFlashCoreImpact"); + SoundEngine.PlaySound(sound5 with { Volume = 0.55f, Pitch = 0.6f, MaxInstances = 2 }, Projectile.Center); + } + float starAngle = Main.rand.NextFloat(-0.9f, 0.9f); + for (int i = 0; i < 4; i++) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 278); + Vector2 vel = (MathHelper.TwoPi * i / 4f).ToRotationVector2().RotatedBy(starAngle) * 8f; + + Particle pulse = new GlowSparkParticle(Projectile.Center, vel, false, 10, 0.08f, Color.Orange, new Vector2(3.2f, 0.9f), true, true, 0.9f); + GeneralParticleHandler.SpawnParticle(pulse); + } + } + if (setStatTimer == 0) + { + SoundStyle fire = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastShoot"); + SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = 0.4f }, Projectile.Center); + + Projectile.extraUpdates = 5; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Vector2 vel = (Projectile.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * -12; + Projectile.velocity = vel; + Projectile.penetrate = 1; + // This has reduced damage on spawn so this isn't as high as it seems + Projectile.damage *= 15; + time = 0; + setStats = false; + } + else + setStatTimer -= 2; + } + else + { + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(80, 80), ModContent.DustType(), (Projectile.velocity * 2) * Main.rand.NextFloat(0.1f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.85f, 2.45f); + dust.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Goldenrod; + dust.noLightEmittence = true; + } + if (Main.rand.NextBool()) + { + Particle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(80, 80), -Projectile.velocity * Main.rand.NextFloat(0.1f, 1f), false, 11, 0.9f, Main.rand.NextBool() ? Color.Goldenrod : Color.Orange); + GeneralParticleHandler.SpawnParticle(spark); + } + else + { + Particle spark = new CustomSpark(Projectile.Center + Main.rand.NextVector2Circular(80, 80), -Projectile.velocity * Main.rand.NextFloat(0.1f, 1f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 27, Main.rand.NextFloat(1.15f, 1.3f), Main.rand.NextBool(4) ? Color.Khaki : Color.Orange, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); + GeneralParticleHandler.SpawnParticle(spark); + } + + } + } + else + { + if (Main.rand.NextBool(5)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (new Vector2(0, -7)).RotatedByRandom(0.2) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.85f, 1.45f) * Projectile.scale; + dust.color = Color.Goldenrod; + dust.noLightEmittence = true; + } + Projectile.velocity *= 0.965f; + } + Projectile.frameCounter++; - if (Projectile.frameCounter > 6) + if (Projectile.frameCounter > 4) { Projectile.frame++; Projectile.frameCounter = 0; @@ -43,51 +137,69 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.frame > 3) Projectile.frame = 0; - if (Math.Abs(Projectile.velocity.X) < 7f) - Projectile.velocity.X *= 1.05f; - - if (Projectile.timeLeft < 75) - CalamityUtils.HomeInOnNPC(Projectile, true, 450f, 12f, 20f); + time++; } - - public override Color? GetAlpha(Color lightColor) + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, isLaunched ? 100 : 20, targetHitbox); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - return new Color(250, 150, 0, Projectile.alpha); + target.AddBuff(ModContent.BuffType(), 180); } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[Type]; - int y6 = framing * Projectile.frame; - Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); - return false; - } - public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 150; - Projectile.height = 150; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int i = 0; i < 5; i++) + // boom + Player Owner = Main.player[Projectile.owner]; + if (isLaunched && Projectile.scale > 0.2f) { - int holy = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); - if (Main.rand.NextBool()) + Owner.Calamity().GeneralScreenShakePower = 9f; + + SoundStyle sound = new("CalamityMod/Sounds/Item/HolyColliderProjectileHit"); + SoundEngine.PlaySound(sound with { Volume = 1f }, Projectile.Center); + + for (int g = 0; g < 3; g++) { - Main.dust[holy].scale = 0.5f; - Main.dust[holy].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2.8f * (g + 1), 1.7f, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2.2f * (g + 1), 1.3f, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing2); } + for (int i = 0; i < 5; i++) + { + Particle orb1 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.OrangeRed, Color.Orange, i * 0.2f), i == 4 ? "CalamityMod/Particles/ShatteredExplosion" : "CalamityMod/Particles/FlameExplosion", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.11f + i * 0.05f, 18); + GeneralParticleHandler.SpawnParticle(orb1); + } + for (int i = 0; i < 25; i++) + { + Particle spark = new SparkParticle(Projectile.Center, new Vector2(21, 21).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 1f), true, 55, 0.85f, Main.rand.NextBool() ? Color.Goldenrod : Color.OrangeRed); + GeneralParticleHandler.SpawnParticle(spark); + } + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.47), Projectile.knockBack, Projectile.owner, 1.8f); } - for (int j = 0; j < 10; j++) - { - int holy2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 3f); - Main.dust[holy2].noGravity = true; - holy2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); - } + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + Texture2D smallTexture = ModContent.Request("CalamityMod/Projectiles/Melee/HolyColliderHolyFire").Value; + Texture2D bigTexture = ModContent.Request("CalamityMod/Projectiles/Melee/HolyColliderHolyFire2").Value; + + Vector2 drawPos = Projectile.Center - Main.screenPosition; + + // The back glow + float power = !setStats ? 2.4f : 0.6f; + float randSize = Main.rand.NextFloat(0.8f, 1.1f); + Main.EntitySpriteDraw(bloomTexture, drawPos, null, Color.Goldenrod with { A = 0 }, Projectile.rotation, bloomTexture.Size() * 0.5f, 0.65f * randSize * power * Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bloomTexture, drawPos, null, Color.White with { A = 0 } * 0.65f, Projectile.rotation, bloomTexture.Size() * 0.5f, 0.45f * randSize * power * Projectile.scale, SpriteEffects.None, 0); + + Texture2D usedTex = (!setStats ? bigTexture : smallTexture); + Rectangle frame = usedTex.Frame(1, 4, 0, Projectile.frame); + Vector2 rotationPoint = frame.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation; + + if (setStatTimer == statMax || !setStats) + Main.EntitySpriteDraw(usedTex, drawPosition, frame, Color.White, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + return false; } } } diff --git a/Projectiles/Melee/HolyColliderHolyFire2.png b/Projectiles/Melee/HolyColliderHolyFire2.png new file mode 100644 index 0000000000..d83b5f5d2b Binary files /dev/null and b/Projectiles/Melee/HolyColliderHolyFire2.png differ diff --git a/Projectiles/Melee/InsidiousHarpoon.cs b/Projectiles/Melee/InsidiousHarpoon.cs index cc0681195a..19356cd8b4 100644 --- a/Projectiles/Melee/InsidiousHarpoon.cs +++ b/Projectiles/Melee/InsidiousHarpoon.cs @@ -107,18 +107,8 @@ namespace CalamityMod.Projectiles.Melee GeneralParticleHandler.SpawnParticle(spark); } - targetedNPC = Projectile.Center.ClosestNPCAt(600); - if (targetedNPC != null && !hasHitTarget) - { - Vector2 position = targetedNPC.Center; - Vector2 moveToMouse = (position - Projectile.Center).SafeNormalize(Vector2.UnitX); - if (Projectile.velocity.Length() < 23) - Projectile.velocity += moveToMouse * 0.45f; - else - Projectile.velocity *= 0.9f; - } - else if (Projectile.velocity.Length() < 23) - Projectile.velocity *= 1.1f; + targetedNPC = hasHitTarget ? null : Projectile.Center.ClosestNPCAt(600); + CalamityUtils.HomeInOnSelectedNPC(Projectile, targetedNPC, true, 0.6f, 23, 0.97f, accelerate: true); } else if (Main.rand.NextBool(3)) { diff --git a/Projectiles/Melee/MajesticGuardHoldout.cs b/Projectiles/Melee/MajesticGuardHoldout.cs index 296fb500ef..db12b879d1 100644 --- a/Projectiles/Melee/MajesticGuardHoldout.cs +++ b/Projectiles/Melee/MajesticGuardHoldout.cs @@ -46,6 +46,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.scale = 1; Projectile.ai[1] = 1; base.OnSpawn(source); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Majestic Guard has no projectiles mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; useAnim = Owner.itemAnimationMax; @@ -105,7 +107,7 @@ namespace CalamityMod.Projectiles.Melee } - Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f); + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); if (AnimationProgress < (useAnim / 3)) { diff --git a/Projectiles/Melee/MantisClawHoldout.cs b/Projectiles/Melee/MantisClawHoldout.cs index d36aa9cfc3..3f494984e4 100644 --- a/Projectiles/Melee/MantisClawHoldout.cs +++ b/Projectiles/Melee/MantisClawHoldout.cs @@ -69,6 +69,7 @@ namespace CalamityMod.Projectiles.Melee { Owner.Calamity().mouseWorldListener = true; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center + new Vector2(20, 0).RotatedBy(Projectile.rotation), Owner.DirectionTo(Owner.Calamity().mouseWorld) * 30, ModContent.ProjectileType(), (int)(Projectile.damage * JetDamageMultiplier), 7, Owner.whoAmI); @@ -127,6 +128,7 @@ namespace CalamityMod.Projectiles.Melee Owner.Calamity().mouseWorldListener = true; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile slash = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, Owner.DirectionTo(Owner.Calamity().mouseWorld) * 6f, ModContent.ProjectileType(), Projectile.damage, 4f, Owner.whoAmI); slash.rotation = Owner.AngleTo(Owner.Calamity().mouseWorld) + MathHelper.ToRadians(Main.rand.NextFloat(-25, 25)); } diff --git a/Projectiles/Melee/MarniteDeconstructorProj.cs b/Projectiles/Melee/MarniteDeconstructorProj.cs index 35145b1729..1d006e1ea9 100644 --- a/Projectiles/Melee/MarniteDeconstructorProj.cs +++ b/Projectiles/Melee/MarniteDeconstructorProj.cs @@ -71,6 +71,7 @@ namespace CalamityMod.Projectiles.Melee { if (Main.myPlayer == Projectile.owner) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, result is clamped later Vector2 newVelocity = Owner.Calamity().mouseWorld - Owner.MountedCenter; if (Main.tile[Player.tileTargetX, Player.tileTargetY].WallType != 0) diff --git a/Projectiles/Melee/MarniteObliteratorProj.cs b/Projectiles/Melee/MarniteObliteratorProj.cs index 60b4ae4975..d110a46fa3 100644 --- a/Projectiles/Melee/MarniteObliteratorProj.cs +++ b/Projectiles/Melee/MarniteObliteratorProj.cs @@ -73,6 +73,7 @@ namespace CalamityMod.Projectiles.Melee { if (Main.myPlayer == Projectile.owner) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, result is clamped later Vector2 newVelocity = Owner.Calamity().mouseWorld - Owner.MountedCenter; if (Main.tile[Player.tileTargetX, Player.tileTargetY].HasTile) diff --git a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs b/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs index 54251e3ace..4b8122c972 100644 --- a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs +++ b/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs @@ -102,6 +102,7 @@ namespace CalamityMod.Projectiles.Melee if (State == 0f) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); Projectile.Center = Owner.Center + (direction * 70f * ChargeDisplacement()); diff --git a/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs b/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs index 4ca0604618..a32d83e3b2 100644 --- a/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs +++ b/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs @@ -76,6 +76,7 @@ namespace CalamityMod.Projectiles.Melee { SoundEngine.PlaySound(SoundID.Item90, Projectile.Center); Projectile.velocity = Vector2.Zero; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); oldDirection = direction; @@ -97,7 +98,9 @@ namespace CalamityMod.Projectiles.Melee { CurrentState = 1f; SoundEngine.PlaySound(SoundID.Item80, Projectile.Center); + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); + //PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES YES YES MH YES YES for (int i = 0; i <= 8; i++) { diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs index f5e092058f..59258a8874 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs @@ -116,6 +116,7 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, new Vector3(1f, 0.56f, 0.56f) * ShredRatio); + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction //Manage position and rotation direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs index 30ed91b977..eadb3192c7 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs @@ -55,6 +55,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = (int)(30f + ShredRatio * 30f); initialized = true; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); Projectile.rotation = direction.ToRotation(); diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs b/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs index 39309dc368..707b68e657 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs @@ -124,6 +124,7 @@ namespace CalamityMod.Projectiles.Melee break; } + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); Projectile.rotation = direction.ToRotation(); diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs b/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs index 1ae95e7c7e..64db24ff90 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs @@ -59,6 +59,7 @@ namespace CalamityMod.Projectiles.Melee { CanBounce = 1f; Projectile.timeLeft = (int)MaxTime; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); Projectile.rotation = direction.ToRotation(); diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs b/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs index c689dd82ff..f3835831f2 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs @@ -153,6 +153,7 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization. create control points & shit) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, result is clamped Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); Reach = MathHelper.Clamp((Owner.Center - Owner.Calamity().mouseWorld).Length(), MinReach, MaxReach); SoundEngine.PlaySound(SoundID.DD2_OgreSpit, Projectile.Center); diff --git a/Projectiles/Melee/MurasamaSlash.cs b/Projectiles/Melee/MurasamaSlash.cs index 4ae6bfea79..8cf521594d 100644 --- a/Projectiles/Melee/MurasamaSlash.cs +++ b/Projectiles/Melee/MurasamaSlash.cs @@ -158,6 +158,7 @@ namespace CalamityMod.Projectiles.Melee { speed = player.ActiveItem().shootSpeed * Projectile.scale; } + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 newVelocity = (Main.MouseWorld - playerRotatedPoint).SafeNormalize(Vector2.UnitX * player.direction) * speed; // Sync if a velocity component changes. diff --git a/Projectiles/Melee/NeptunesBountyProjectile.cs b/Projectiles/Melee/NeptunesBountyProjectile.cs index f86a683e98..4e6abc98df 100644 --- a/Projectiles/Melee/NeptunesBountyProjectile.cs +++ b/Projectiles/Melee/NeptunesBountyProjectile.cs @@ -115,6 +115,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.netUpdate = true; SoundEngine.PlaySound(SoundID.Item1, Projectile.Center); Projectile.Center = Owner.MountedCenter + Projectile.velocity * 12f; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction) * 28; startDamage = Projectile.damage; Projectile.spriteDirection = Projectile.direction; @@ -144,7 +145,7 @@ namespace CalamityMod.Projectiles.Melee Time = 0; bool foundTarget = false; - NPC target = Owner.Calamity().mouseWorld.ClosestNPCAt(5000); + NPC target = Owner.ClampedMouseWorld().ClosestNPCAt(1000); if (target != null) { NPCDestination = target.Center + target.velocity * 5f; @@ -155,6 +156,7 @@ namespace CalamityMod.Projectiles.Melee if (!foundTarget) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX * Projectile.direction) * 25; } else diff --git a/Projectiles/Melee/OldLordClaymoreProj.cs b/Projectiles/Melee/OldLordClaymoreProj.cs index f15552b0a2..4a0e371bd9 100644 --- a/Projectiles/Melee/OldLordClaymoreProj.cs +++ b/Projectiles/Melee/OldLordClaymoreProj.cs @@ -145,6 +145,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.myPlayer == Projectile.owner) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Owner.velocity = Vector2.Lerp(Owner.velocity, Owner.SafeDirectionTo(Main.MouseWorld) * 16f, 0.125f); NetMessage.SendData(MessageID.PlayerControls, -1, -1, null, Main.myPlayer); } diff --git a/Projectiles/Melee/PhotonRipperProjectile.cs b/Projectiles/Melee/PhotonRipperProjectile.cs index 0fd61c4476..d587a822c6 100644 --- a/Projectiles/Melee/PhotonRipperProjectile.cs +++ b/Projectiles/Melee/PhotonRipperProjectile.cs @@ -155,6 +155,7 @@ namespace CalamityMod.Projectiles.Melee public void HandleChannelMovement(Vector2 playerRotatedPosition) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 idealAimDirection = (Main.MouseWorld - playerRotatedPosition).SafeNormalize(Vector2.UnitX * Owner.direction); float angularAimVelocity = 0.15f; @@ -216,6 +217,7 @@ namespace CalamityMod.Projectiles.Melee // This means that projectile speed boosts will improve the range of the chainsaw. shootReach *= Owner.ActiveItem().shootSpeed; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, the result is separately capped float distanceFromMouse = Owner.Distance(Main.MouseWorld); // If the distance to the mouse is less than the base reach, reach only to mouse. diff --git a/Projectiles/Melee/PrismaticBeam.cs b/Projectiles/Melee/PrismaticBeam.cs index 34a62917e7..0917e7db63 100644 --- a/Projectiles/Melee/PrismaticBeam.cs +++ b/Projectiles/Melee/PrismaticBeam.cs @@ -138,6 +138,7 @@ namespace CalamityMod.Projectiles.Melee // Gently adjusts the aim vector of the laser to point towards the mouse. private void UpdateAim(Vector2 source) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 aimVector = Vector2.Normalize(Main.MouseWorld - source); if (aimVector.HasNaNs()) aimVector = -Vector2.UnitY; diff --git a/Projectiles/Melee/PrismaticBreakerHoldout.cs b/Projectiles/Melee/PrismaticBreakerHoldout.cs index 6219f5c1bc..7b0dc48d71 100644 --- a/Projectiles/Melee/PrismaticBreakerHoldout.cs +++ b/Projectiles/Melee/PrismaticBreakerHoldout.cs @@ -71,6 +71,7 @@ namespace CalamityMod.Projectiles.Melee if (Owner.ownedProjectileCounts[ModContent.ProjectileType()] > 0) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 aimVector = (Main.MouseWorld - Owner.RotatedRelativePoint(Owner.MountedCenter, true)).SafeNormalize(Vector2.UnitY); aimVector = Vector2.Normalize(Vector2.Lerp(aimVector, Vector2.Normalize(storedVelocity), LaserAimLag)); diff --git a/Projectiles/Melee/PrismaticMagicCircle.cs b/Projectiles/Melee/PrismaticMagicCircle.cs index 97b041984e..760f51b0de 100644 --- a/Projectiles/Melee/PrismaticMagicCircle.cs +++ b/Projectiles/Melee/PrismaticMagicCircle.cs @@ -41,6 +41,7 @@ namespace CalamityMod.Projectiles.Melee if (Owner.active && !Owner.dead) Projectile.Center = Owner.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 60f; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 aimVector = (Main.MouseWorld - Owner.RotatedRelativePoint(Owner.MountedCenter, true)).SafeNormalize(Vector2.UnitY); aimVector = Vector2.Normalize(Vector2.Lerp(aimVector, Vector2.Normalize(Projectile.velocity), PrismaticBreakerHoldout.LaserAimLag)); diff --git a/Projectiles/Melee/PrismaticRay.cs b/Projectiles/Melee/PrismaticRay.cs index a920374e94..c10c472e13 100644 --- a/Projectiles/Melee/PrismaticRay.cs +++ b/Projectiles/Melee/PrismaticRay.cs @@ -63,6 +63,7 @@ namespace CalamityMod.Projectiles.Melee public override void UpdateLaserMotion() { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 aimVector = (Main.MouseWorld - Owner.RotatedRelativePoint(Owner.MountedCenter, true)).SafeNormalize(Vector2.UnitY); aimVector = Vector2.Normalize(Vector2.Lerp(aimVector, Vector2.Normalize(Projectile.velocity), PrismaticBreakerHoldout.LaserAimLag)); diff --git a/Projectiles/Melee/PwnagehammerEcho.cs b/Projectiles/Melee/PwnagehammerEcho.cs index e24dfc9dd5..d6e92edfef 100644 --- a/Projectiles/Melee/PwnagehammerEcho.cs +++ b/Projectiles/Melee/PwnagehammerEcho.cs @@ -65,11 +65,7 @@ namespace CalamityMod.Projectiles.Melee } if (targeted != null) { - Vector2 moveTotarget = (targeted.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); - if (Projectile.velocity.Length() < MathHelper.Clamp(25 - Projectile.ai[0] * 0.1f, 10, 25)) - Projectile.velocity += moveTotarget * (0.35f + Projectile.ai[0] * 0.03f); - else - Projectile.velocity *= 0.9f; + CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.6f, 25, 0.98f); } else Projectile.Kill(); diff --git a/Projectiles/Melee/RespiteblockHoldout.cs b/Projectiles/Melee/RespiteblockHoldout.cs index 5428e86b9a..239d3bbccc 100644 --- a/Projectiles/Melee/RespiteblockHoldout.cs +++ b/Projectiles/Melee/RespiteblockHoldout.cs @@ -162,6 +162,7 @@ namespace CalamityMod.Projectiles.Melee public void HandleChannelMovement(Vector2 playerRotatedPosition) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 idealAimDirection = (Main.MouseWorld - playerRotatedPosition).SafeNormalize(Vector2.UnitX * Owner.direction); float angularAimVelocity = 0.15f; diff --git a/Projectiles/Melee/RoxcaliburProj.cs b/Projectiles/Melee/RoxcaliburProj.cs index 8241beb5f4..3b9034c5f4 100644 --- a/Projectiles/Melee/RoxcaliburProj.cs +++ b/Projectiles/Melee/RoxcaliburProj.cs @@ -99,6 +99,7 @@ namespace CalamityMod.Projectiles.Melee } else if (Animation == Charging) //first frame of release { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary; it is a binary above/below player Animation = Main.MouseWorld.Y > player.Center.Y ? Plunging : Swinging; float chargeModifier = ChargeLevel * 2.5f; //modify this to balance damage bonus from charging diff --git a/Projectiles/Melee/ScorcherExplosion.cs b/Projectiles/Melee/ScorcherExplosion.cs new file mode 100644 index 0000000000..025bd83cdc --- /dev/null +++ b/Projectiles/Melee/ScorcherExplosion.cs @@ -0,0 +1,43 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class ScorcherExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 400; + Projectile.height = 400; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 2; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.75f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.88f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f * Projectile.scale, targetHitbox); + } +} + diff --git a/Projectiles/Melee/SeekingScorcherProj.cs b/Projectiles/Melee/SeekingScorcherProj.cs new file mode 100644 index 0000000000..3ade299e4f --- /dev/null +++ b/Projectiles/Melee/SeekingScorcherProj.cs @@ -0,0 +1,389 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Projectiles.Melee +{ + public class SeekingScorcherProj : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Items/Weapons/Melee/SeekingScorcher"; + + public static int WindupSwingTime = 24; + public static int MaxAirtime = 60; + public static int CrystalTransformationTime = 30; + public static int Fadetime = 30; + public static int Lifetime = 600; + public static float ExplosionDamageMult = 3f; + public static float CrystalBounceDamageMult = 2f; // Exponential scaling for multiple bounces but capped at max bounces + public static float CrystalBounceSpeedMult = 1.25f; + public static int MaxBounces = 3; + public const float MaxNPCHomingRange = 1200f; // 75 tiles + public const float MaxAxeHomingRange = 800f; // 50 tiles + + private List PreviousNPCs = new List() { -1 }; + public Player Owner => Main.player[Projectile.owner]; + + public ref float WindupSwingProgress => ref Projectile.ai[0]; + public ref float PhaseTime => ref Projectile.ai[1]; + public ref float CrystalTimer => ref Projectile.ai[2]; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 1; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 94; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = Lifetime + WindupSwingTime; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override bool ShouldUpdatePosition() => WindupSwingProgress > 1f; + + // Can deal damage if already thrown and not crystal + public override bool? CanDamage() => WindupSwingProgress <= 1f || CrystalTimer >= CrystalTransformationTime ? false : base.CanDamage(); + + // Swing animation keys + public CurveSegment pullback = new CurveSegment(EasingType.PolyOut, 0f, 0f, MathHelper.PiOver4 * -1.2f, 2); + public CurveSegment throwout = new CurveSegment(EasingType.PolyOut, 0.7f, MathHelper.PiOver4 * -1.2f, MathHelper.PiOver4 * 1.2f + MathHelper.PiOver2, 3); + internal float ArmAnticipationMovement() => PiecewiseAnimation(WindupSwingProgress, new CurveSegment[] { pullback, throwout }); + + public override void AI() + { + // Wind-up swing animation + if (WindupSwingProgress <= 1f) + { + // Initialize the actual original projectile damage. This is used for the crystal boost later + if (PhaseTime == 0f) + Projectile.originalDamage = Projectile.damage; + + WindupSwingProgress = Utils.GetLerpValue(0f, WindupSwingTime, PhaseTime, true); + PhaseTime++; + + // Recalibrate and perform the throw when ready + if (WindupSwingProgress == 1f) + { + WindupSwingProgress = 2f; + PhaseTime = 0f; + Projectile.Center = Owner.MountedCenter + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 72f; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile.velocity = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction) * Projectile.velocity.Length(); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X >= 0f).ToDirectionInt(); + Projectile.netUpdate = true; + SoundEngine.PlaySound(SeekingScorcher.ThrowSound, Projectile.Center); + return; + } + + // Hold and swing + float armRotation = ArmAnticipationMovement() * Owner.direction; + Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -72f * Owner.gravDir; + Projectile.rotation = ((Owner.direction == 1 ? 0f : -MathHelper.PiOver2) - MathHelper.PiOver4 + armRotation) * Owner.gravDir; + Projectile.spriteDirection = Projectile.direction = Owner.direction; + + Owner.heldProj = Projectile.whoAmI; + Owner.ChangeDir(MathF.Sign(Main.MouseWorld.X - Owner.Center.X)); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); + return; + } + // Crystal transformation and collision explosion + if (CrystalTimer > 0f) + { + if (CrystalTimer >= CrystalTransformationTime) + { + Projectile.velocity = Vector2.Zero; + + foreach (Projectile proj in Main.ActiveProjectiles) + { + // Only allow other axes to hit the crystal axe + if (proj.type != Type) + continue; + + // Check for if the axe is thrown and not turning crystal + if (proj.ai[0] > 1f && proj.ai[2] <= 0f && Projectile.Hitbox.Intersects(proj.Hitbox)) + { + Explode(); + + // Cause the axe that just hit to be empowered and counts as a bounce + proj.damage = Math.Clamp((int)(proj.damage * CrystalBounceDamageMult), 0, (int)(proj.originalDamage * MathF.Pow(CrystalBounceDamageMult, MaxBounces))); + proj.velocity = proj.velocity.RotatedBy(Main.rand.NextBool() ? MathHelper.ToRadians(Main.rand.NextFloat(108f, 162f)) : MathHelper.ToRadians(Main.rand.NextFloat(-162f, -108f))) * CrystalBounceSpeedMult; + proj.ai[1] -= 30f; + proj.ai[2] = -1f; + proj.netUpdate = true; + } + } + } + else + { + Projectile.velocity *= 0.85f; + Projectile.rotation += Projectile.direction * MathHelper.ToRadians(24f) * Utils.GetLerpValue(CrystalTransformationTime, 0f, CrystalTimer, true); + CrystalTimer++; + } + + Projectile.Opacity = Utils.GetLerpValue(0f, Fadetime, Projectile.timeLeft, true); + + if (Projectile.timeLeft <= Fadetime || Main.rand.NextBool(20)) + { + Vector2 velocity = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(14f, 22f); + float scale = Main.rand.NextFloat(0.6f, 1.2f); + Particle spark = new CritSpark(Projectile.Center, velocity, Color.MistyRose, Color.Pink, scale, 30, 0.1f, 3f, Main.rand.NextFloat(0f, 0.01f)); + GeneralParticleHandler.SpawnParticle(spark); + } + return; + } + + // Mid-throw AI and stuff + // Stored value from hitting crystal axes which performs the bounce + if (CrystalTimer == -1f) + { + SharpBounce(); + Projectile.numHits++; + CrystalTimer--; + } + + PhaseTime++; + Projectile.rotation += Projectile.direction * MathHelper.ToRadians(24f); + + // Begin transformation + if (PhaseTime >= MaxAirtime) + { + // Empowered axes return instead + if (Projectile.numHits >= MaxBounces || CrystalTimer < 0f) + ReturnToOwner(); + else + CrystalTimer++; + } + + // Trails + if (Main.rand.NextBool()) + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + if (CrystalTimer < 0f) + { + Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, Color.MistyRose, 24, Main.rand.NextFloat(1.6f, 2f), 0.25f, Main.rand.NextFloat(-0.1f, 0.1f), true); + GeneralParticleHandler.SpawnParticle(smoke); + } + } + // Glowmask + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + + // Disallow the NPC to be targeted again + PreviousNPCs.Add(target.whoAmI); + SharpBounce(); + Projectile.netUpdate = true; + + SoundEngine.PlaySound(SeekingScorcher.HitSound, Projectile.Center); + + Particle boom = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed * 0.6f, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.1f, 24, true); + GeneralParticleHandler.SpawnParticle(boom); + + for (int i = 0; i < 10; i++) + { + Vector2 sparkVelocity = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(6f, 8f); + float sparkScale = Main.rand.NextFloat(1f, 1.4f); + SparkParticle spark = new SparkParticle(Projectile.Center, sparkVelocity, false, 24, sparkScale, Main.rand.NextBool() ? Color.Gold : Color.OrangeRed); + GeneralParticleHandler.SpawnParticle(spark); + + Vector2 smokeVelocity = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(3f, 6f); + float smokeScale = Main.rand.NextFloat(1.6f, 2f); + Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeVelocity, Color.MistyRose, 24, smokeScale, 0.25f, Main.rand.NextFloat(-0.1f, 0.1f), true); + GeneralParticleHandler.SpawnParticle(smoke); + } + + // Empowered axe hits + if (CrystalTimer < 0f) + { + for (int i = 0; i < 7; i++) + { + Vector2 maxScale = new Vector2(Main.rand.NextFloat(1.5f, 4f), Main.rand.NextFloat(0.6f, 1.5f)); + CustomPulse crystal = new CustomPulse(Projectile.Center, Vector2.One, Color.MistyRose, "CalamityMod/Particles/BlastCone", maxScale, Main.rand.NextFloat(MathHelper.TwoPi), 1f, 0.5f, 18); + GeneralParticleHandler.SpawnParticle(crystal); + } + + for (int i = 0; i < 8; i++) + { + Vector2 velocity = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(16f, 28f); + float scale = Main.rand.NextFloat(0.6f, 1.6f); + Particle spark = new CritSpark(Projectile.Center, velocity, Color.MistyRose, Color.Pink, scale, 30, 0.1f, 3f, Main.rand.NextFloat(0f, 0.01f)); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } + + public override void OnKill(int timeLeft) + { + if (CrystalTimer >= CrystalTransformationTime && PhaseTime > 0f) + { + SoundEngine.PlaySound(SeekingScorcher.LightShatterSound, Projectile.Center); + for (int i = 0; i < 9; i++) + { + Vector2 maxScale = new Vector2(Main.rand.NextFloat(2f, 4.5f), Main.rand.NextFloat(1.4f, 2f)); + CustomPulse crystal = new CustomPulse(Projectile.Center, Vector2.One, Color.MistyRose, "CalamityMod/Particles/BlastCone", maxScale, Main.rand.NextFloat(MathHelper.TwoPi), 1f, 0.5f, 18); + GeneralParticleHandler.SpawnParticle(crystal); + } + + for (int i = 0; i < 15; i++) + { + Vector2 smokeVelocity = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(3f, 8f); + float smokeScale = Main.rand.NextFloat(1.6f, 2f); + Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeVelocity, Color.MistyRose, 24, smokeScale, 0.25f, Main.rand.NextFloat(-0.1f, 0.1f), true); + GeneralParticleHandler.SpawnParticle(smoke); + } + } + } + + public void SharpBounce() + { + // Return if exceeding max number of bounces + if (Projectile.numHits >= MaxBounces) + { + PhaseTime = MaxAirtime; + ReturnToOwner(); + return; + } + + float range = MaxNPCHomingRange; + int targetNPC = -1; + foreach (NPC target in Main.ActiveNPCs) + { + if (!target.CanBeChasedBy(Projectile) || PreviousNPCs.Contains(target.whoAmI)) + continue; + + float distance = Vector2.Distance(target.Center, Projectile.Center); + if (distance < range) + { + range = distance; + targetNPC = target.whoAmI; + } + } + + if (targetNPC != -1) + { + // Will only try to bounce towards nearby axes if there are nearby enemies as to not waste axe hits + // The last usable pierce will never be spent on an axe since it would then just return to the player + float range2 = MaxAxeHomingRange; + int targetAxe = -1; + foreach (Projectile proj in Main.ActiveProjectiles) + { + if (proj.type != Type) + continue; + + // Avoid crystal axes that are fading out + float distance = Vector2.Distance(proj.Center, Projectile.Center); + if (distance < range2 && proj.ai[2] >= CrystalTransformationTime && proj.timeLeft > Fadetime) + { + range2 = distance; + targetAxe = proj.whoAmI; + } + } + + // Partially restore airtime + PhaseTime = -12f; + if (targetAxe != -1 && Projectile.numHits < MaxBounces - 1) + Projectile.velocity = Projectile.SafeDirectionTo(Main.projectile[targetAxe].Center) * Projectile.velocity.Length(); + else + Projectile.velocity = Projectile.SafeDirectionTo(Main.npc[targetNPC].Center) * Projectile.velocity.Length(); + } + // If no enemies left, empowered axes just return immediately + // This also applies to the final bounce since that counts as exhausting all bounces + // Otherwise, they will simply retain their original velocity + else if (CrystalTimer < 0f || Projectile.numHits == MaxBounces - 1) + { + PhaseTime = MaxAirtime; + ReturnToOwner(); + } + } + + public void ReturnToOwner() + { + // Swiftly move back towards the player; also make it avoid naturally despawning + Projectile.velocity = Projectile.SafeDirectionTo(Owner.Center) * Projectile.velocity.Length(); + Projectile.timeLeft = 2; + + // Delete the Projectile if it touches its owner or too far away. + if (Projectile.Hitbox.Intersects(Owner.Hitbox) || Vector2.Distance(Projectile.Center, Owner.Center) >= 3000f) + Projectile.Kill(); + } + + public void Explode() + { + PhaseTime = 0f; + Projectile.Kill(); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * ExplosionDamageMult), Projectile.knockBack, Projectile.owner); + + SoundEngine.PlaySound(SeekingScorcher.HitSound, Projectile.Center); + SoundEngine.PlaySound(SeekingScorcher.ShatterSound, Projectile.Center); + + Particle explosion = new DetailedExplosion(Projectile.Center, Vector2.Zero, Color.LightPink, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, 0.65f + 0.1f, 25); + GeneralParticleHandler.SpawnParticle(explosion); + Particle explosion2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.MediumVioletRed, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.2f, 30); + GeneralParticleHandler.SpawnParticle(explosion2); + Particle explosion3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.2f, 30); + GeneralParticleHandler.SpawnParticle(explosion3); + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 1f, 6f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0, 0.2f, 25, true, 0.9f); + GeneralParticleHandler.SpawnParticle(blastRing2); + + for (int i = 0; i < 24; i++) + { + CritSpark spark2 = new CritSpark(Projectile.Center, new Vector2(40, 40).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f), Color.White, Color.Orchid, 0.9f, 35, 2f, 2.2f); + GeneralParticleHandler.SpawnParticle(spark2); + } + for (int i = 0; i < 2; i++) + { + Particle blast = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.3f, 1.5f, 25, true); + GeneralParticleHandler.SpawnParticle(blast); + } + for (int i = 0; i < 2; i++) + { + Particle blast2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.2f, 1.1f, 25, true); + GeneralParticleHandler.SpawnParticle(blast2); + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor) * Projectile.Opacity; + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + //Gain a glow based on how high the charge timer is + if (CrystalTimer != 0f) + { + float fade = Projectile.Opacity * CrystalTimer > 0f ? Utils.GetLerpValue(0, CrystalTransformationTime, CrystalTimer, true) : 1f; + for (int i = 0; i < 10; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * 5 * fade; + Main.spriteBatch.Draw(texture, drawPosition + drawOffset, null, Color.MistyRose with { A = 0 } * fade, drawRotation, rotationPoint, Projectile.scale, flipSprite, 0f); + } + } + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + return false; + } + } +} diff --git a/Projectiles/Melee/Shortswords/SaharaSlicersBlade.cs b/Projectiles/Melee/Shortswords/SaharaSlicersBlade.cs index c1f78143ce..9c6ded3e47 100644 --- a/Projectiles/Melee/Shortswords/SaharaSlicersBlade.cs +++ b/Projectiles/Melee/Shortswords/SaharaSlicersBlade.cs @@ -56,6 +56,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords dust.velocity = -Projectile.velocity * 0.5f; } + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction float armPointingDirection = ((Owner.Calamity().mouseWorld - Owner.MountedCenter).ToRotation()); Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, armPointingDirection - MathHelper.PiOver2); Owner.heldProj = Projectile.whoAmI; diff --git a/Projectiles/Melee/Shortswords/SaharaSlicersBladeAlt.cs b/Projectiles/Melee/Shortswords/SaharaSlicersBladeAlt.cs index bb6b42d38a..d6fd3f55d1 100644 --- a/Projectiles/Melee/Shortswords/SaharaSlicersBladeAlt.cs +++ b/Projectiles/Melee/Shortswords/SaharaSlicersBladeAlt.cs @@ -58,6 +58,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords dust.velocity = -Projectile.velocity * 0.5f; } + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction float armPointingDirection = (Owner.Calamity().mouseWorld - Owner.MountedCenter).ToRotation(); Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, armPointingDirection - MathHelper.PiOver2); Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, 0); diff --git a/Projectiles/Melee/SkytideDragoonGhost.png b/Projectiles/Melee/SkytideDragoonGhost.png new file mode 100644 index 0000000000..9f133fe4f0 Binary files /dev/null and b/Projectiles/Melee/SkytideDragoonGhost.png differ diff --git a/Projectiles/Melee/SkytideDragoonGlow.png b/Projectiles/Melee/SkytideDragoonGlow.png new file mode 100644 index 0000000000..a80503e9ce Binary files /dev/null and b/Projectiles/Melee/SkytideDragoonGlow.png differ diff --git a/Projectiles/Melee/SkytideDragoonHoldout.cs b/Projectiles/Melee/SkytideDragoonHoldout.cs new file mode 100644 index 0000000000..64172d9a2d --- /dev/null +++ b/Projectiles/Melee/SkytideDragoonHoldout.cs @@ -0,0 +1,366 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class SkytideDragoonHoldout : BaseCustomUseStyleProjectile, ILocalizedModType + { + public override int AssignedItemID => ModContent.ItemType(); + + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Melee/SkytideDragoon"; + public override float HitboxOutset => 245; + + public override Vector2 HitboxSize => new Vector2(40, 40); // long thin hitbox for a spear is done in collision, the X here determines hitbox width + public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + + public override Vector2 SpriteOrigin => new(0, 135); + public Vector2 mousePos; + public Vector2 aimVel; + public bool doSwing = true; + public bool postSwing = false; + public float fadeIn = 0; + public float colorFadeIn = 0; + public int useAnim; + public int swingCount = 0; + public float spearOutset = 0; + public bool fireProj = true; + public bool fancySwing => swingCount % 7 == 0; + public bool redirected = false; + public int attackPower = 0; // How many swings you have left before you have to call another bolt + public float attackMult = 0; // A multiplier based on attack power that changes smoothly + public Vector2 tipOutset; + + public Color color1 = Color.Orchid; + public Color color2 = Color.Cyan; + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = DamageClass.Melee; + } + public override void OnSpawn(IEntitySource source) + { + Projectile.knockBack = 0; + Projectile.scale = 1; + Projectile.ai[1] = 1; + base.OnSpawn(source); + + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + Projectile.rotation = Vector2.UnitY.ToRotation() + MathHelper.ToRadians(-135); + useAnim = fancySwing ? (int)(Owner.itemAnimationMax * 2f) : Owner.itemAnimationMax; + + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + + FlipAsSword = Owner.direction == -1 ? true : false; + } + + public override void UseStyle() + { + tipOutset = Vector2.One.RotatedBy(Projectile.rotation + MathHelper.ToRadians(90)) * spearOutset * 12; + AbsolutePosition = Owner.MountedCenter + tipOutset; + AnimationProgress = Animation % useAnim; + DrawUnconditionally = false; + + if (CanHit || postSwing) + mousePos = Owner.Center - aimVel; + else + { + mousePos = Owner.Calamity().mouseWorld; + } + + if (CanHit) + { + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.15f); + } + else + { + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.12f); + } + colorFadeIn = MathHelper.Lerp(colorFadeIn, 0, 0.07f); + + attackMult = MathHelper.Lerp(attackMult, attackPower, 0.15f); + + + if (!doSwing) + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + Projectile.numHits = 0; + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + FlipAsSword = Owner.direction == -1 ? true : false; + fireProj = true; + + doSwing = true; + + swingCount++; + + if (swingCount == 1 && Owner.Calamity().mouseRight) + redirected = true; + else + redirected = false; + + useAnim = (fancySwing || redirected) ? (int)(Owner.itemAnimationMax * 2f) : Owner.itemAnimationMax; + AnimationProgress = Animation % useAnim; + } + else + { + if (!CanHit && !postSwing) + { + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + else + { + if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + + if (fancySwing) + { + Projectile.rotation = Projectile.rotation.AngleLerp(Vector2.UnitY.ToRotation() + MathHelper.ToRadians(-135), (redirected ? 0.1f : 0.22f)); + } + else if (redirected) + { + float lerp = Utils.GetLerpValue(0, useAnim / 2f, AnimationProgress); + CanHit = true; + if (AnimationProgress < (useAnim / 2f)) + { + Projectile.rotation += 0.81f * Owner.direction * (1 - lerp); + Projectile.rotation = MathHelper.WrapAngle(Projectile.rotation); + for (int i = 0; i < 2; i++) + { + Color color = Color.Lerp(Color.White, Main.rand.NextBool() ? color1 : color2, 0.65f); + Vector2 pos = Owner.Center + (new Vector2(160, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); + Vector2 vel = Projectile.rotation.ToRotationVector2().RotatedByRandom(0.4f) * Main.rand.NextFloat(2f, 8f); + Dust dust = Dust.NewDustPerfect(pos, ModContent.DustType(), vel, 0, default, Main.rand.NextFloat(1.85f, 2.2f)); + dust.noGravity = true; + dust.color = color; + + Particle spark2 = new BoltParticle(pos, -vel.RotatedBy(Owner.direction == 1 ? MathHelper.ToRadians(45) : MathHelper.ToRadians(-135)) * Main.rand.NextFloat(1.5f, 1.8f), false, 13, Main.rand.NextFloat(0.2f, 0.35f), color * 0.8f, new Vector2(1.2f, 1f), true, true, false, 0.25f); + GeneralParticleHandler.SpawnParticle(spark2); + + if (i % 2 == 0) + { + Particle orb = new CustomSpark(pos, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 35, 0.75f, color * 0.75f, new Vector2(1f, 1)); + GeneralParticleHandler.SpawnParticle(orb); + } + } + } + else + { + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.15f); + } + } + else + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.25f); + + if (AnimationProgress < (useAnim / 2)) + { + float time = (AnimationProgress) - (useAnim / 3); + float timeMax = useAnim - (useAnim / 3); + + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + + if (redirected) + CanHit = true; + else + CanHit = false; + + postSwing = false; + if (AnimationProgress == 0) + { + doSwing = false; + } + spearOutset = MathHelper.Lerp(spearOutset, MathHelper.ToRadians(120f), 0.2f); + FlipAsSword = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX).X > 0 ? true : false; + } + else + { + float time = (AnimationProgress) - (useAnim / 3); + float timeMax = useAnim - (useAnim / 3); + + spearOutset = MathHelper.Lerp(spearOutset, MathHelper.ToRadians(120f), 0.2f); + + if (time == (int)(timeMax * 0.4f)) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/SkytideSwing"); + SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) - (fancySwing ? 0.3f : 0) }, Projectile.Center); + } + if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.7f)) + { + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = true; + } + else + { + if (fireProj && time >= (int)(timeMax * 0.7f)) + { + if (fancySwing) // Call down the bolt + { + Owner.Calamity().GeneralScreenShakePower = 3f; + SoundStyle sound = new("CalamityMod/Sounds/Item/SkytiedBolt"); + SoundEngine.PlaySound(sound with { Volume = 0.8f }, Projectile.Center); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + new Vector2(0, -600), new Vector2(0, 10), ModContent.ProjectileType(), (int)(Projectile.damage * 5), Projectile.knockBack, Projectile.owner, 0, 0.5f); + proj.timeLeft = 45; + swingCount = 0; + attackPower = 6; + } + else if (redirected) // Redirect the bolt + { + Owner.Calamity().GeneralScreenShakePower = 4.5f; + SoundStyle fire = new("CalamityMod/Sounds/Item/SkytiedBolt"); + SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = -0.2f }, Projectile.Center); + SoundStyle fire2 = new("CalamityMod/Sounds/Item/AuricBulletHit"); + SoundEngine.PlaySound(fire2 with { Volume = 0.5f, Pitch = 0.2f }, Projectile.Center); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - aimVel * 2, aimVel.SafeNormalize(Vector2.UnitX) * -10, ModContent.ProjectileType(), (int)(Projectile.damage * 9), Projectile.knockBack, Projectile.owner, 0, 1f); + swingCount = -1; + attackPower = 0; + } + else // Five projectile scattershot + { + for (int i = -2; i < 3; i++) + { + float rot = (0.1f * attackPower * i / 6f); + Vector2 vel = rot.ToRotationVector2().RotatedBy(aimVel.ToRotation()) * -7; + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - aimVel * 2, vel, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0, rot); + } + attackPower--; + } + colorFadeIn = 1; + fireProj = false; + } + } + if (time >= (int)(timeMax * 0.85f)) + CanHit = false; + + spearOutset = MathHelper.Lerp(spearOutset, MathHelper.ToRadians(MathHelper.Lerp(450f, 0f, CalamityUtils.ExpInOutEasing(time / timeMax, 1))), 0.2f); + + if (time >= timeMax) + doSwing = false; + if (time < (int)(timeMax * 0.7f)) + postSwing = true; + + if (CanHit) + { + for (int i = 0; i < 2; i++) + { + Color color = Color.Lerp(Color.White, Main.rand.NextBool() ? color1 : color2, 0.65f); + float bonus = (1 - (7 / (attackPower + 1))) * 0.3f; + Vector2 pos = Owner.Center + (new Vector2(160, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.05f)); + Vector2 vel = Projectile.rotation.ToRotationVector2().RotatedBy(MathHelper.ToRadians(-45)).RotatedByRandom(0.5f) * Main.rand.NextFloat(6f, 10f); + Dust dust = Dust.NewDustPerfect(pos, Main.rand.NextBool(3) ? 278 : ModContent.DustType(), vel * (1 + bonus), 0, default, Main.rand.NextFloat(1.05f, 1.4f)); + dust.noGravity = !(dust.type == 278); + dust.color = color; + dust.scale += bonus; + } + } + } + } + + ArmRotationOffset = MathHelper.ToRadians(-140f); + ArmRotationOffsetBack = MathHelper.ToRadians(-140f); + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) // Custom collision since it's a spear + { + // Perform an AABB line collision check to check the whole spear. + float _ = float.NaN; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (Projectile.rotation - MathHelper.ToRadians(45)).ToRotationVector2() * HitboxOutset + tipOutset, HitboxSize.X * Projectile.scale, ref _); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) + Projectile.numHits -= 1; + + SoundStyle fire = new("CalamityMod/Sounds/Item/AuricBulletHit"); + SoundEngine.PlaySound(fire with { Volume = 0.55f, Pitch = 0.8f }, Projectile.Center); + SoundStyle fire2 = new("CalamityMod/Sounds/Custom/DefenseDamage"); + SoundEngine.PlaySound(fire2 with { Volume = 0.65f, Pitch = 0.4f }, Projectile.Center); + + if (target.CanBeMoved(true)) + { + // Launch + Vector2 launchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -23; + target.velocity = launchVel * (target.knockBackResist == 0 ? 0.5f : 1f); + } + + target.AddBuff(BuffID.Electrified, 230); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.3f; + int hitsToMinMult = 5; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override bool PreDraw(ref Color lightColor) + { + // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. + if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive) + { + Asset tex = ModContent.Request("CalamityMod/Projectiles/Melee/SkytideDragoonHoldout"); + Asset glowTex = ModContent.Request("CalamityMod/Projectiles/Melee/SkytideDragoonGlow"); + float fxRot = Projectile.rotation + MathHelper.ToRadians(45); + float fxPosRot = Projectile.rotation - MathHelper.ToRadians(45); + float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; + Vector2 drawPos = (Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY)) + Projectile.velocity.SafeNormalize(Vector2.UnitX); + + Color glowColor = Color.Lerp(color1, color2, colorFadeIn) with { A = 0 }; + Color auraColor = Color.Lerp(color2, color1, colorFadeIn) with { A = 0 } * 0.15f * fadeIn; + for (int i = 0; i < 25; i++) + { + // Outline effect + Texture2D centerTexture = ModContent.Request("CalamityMod/Projectiles/Melee/SkytideDragoonGhost").Value; + Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * 7.2f * fadeIn; + Main.EntitySpriteDraw(centerTexture, drawPos + drawOffset, centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + + Main.EntitySpriteDraw(tex.Value, drawPos, tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(glowTex.Value, drawPos, glowTex.Frame(1, FrameCount, 0, Frame), glowColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(glowTex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + + Asset tex2 = ModContent.Request("CalamityMod/Particles/ArchSmear"); + Asset orb = ModContent.Request("CalamityMod/Particles/BloomCircle"); + float sine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 55.5f / MathHelper.Pi); + for (int i = 0; i < 6; i++) + { + // While not super visible here, this hitbox extention effect looks great and I'll use it on stuff like Terra Lance later + Color tipColor = Color.Lerp(color2, color1, (i + 4) / 6) with { A = 0 } * 0.3f * fadeIn; + Vector2 scale = new Vector2(0.25f - i * 0.04f, (1.5f + i * 0.15f) * colorFadeIn) * (0.75f * colorFadeIn * Main.rand.NextFloat(0.9f, 1.1f) + 0.25f); + Main.EntitySpriteDraw(tex2.Value, Owner.Center - Main.screenPosition + fxPosRot.ToRotationVector2() * 130, null, tipColor, fxRot, tex2.Size() * 0.5f, scale, SpriteEffects.None); + } + for (int i = 0; i < 6; i++) + { + // the electric orb at the tip + Color orbColor = Color.Lerp(Color.Lerp(color2, color1, (i + 2) / 6), Color.White, i / 6) with { A = 0 } * 0.5f; + Vector2 scale = new Vector2(Math.Abs(sine * 0.5f) + 0.1f, 1) * (0.05f + i * 0.01f) * attackMult * Main.rand.NextFloat(0.9f, 1.1f) * 2; + Main.EntitySpriteDraw(orb.Value, Owner.Center - Main.screenPosition + fxPosRot.ToRotationVector2() * 180 + tipOutset, null, orbColor, Main.rand.NextFloat(-5, 5), orb.Size() * 0.5f, scale, SpriteEffects.None); + } + } + return false; + } + public override void ResetStyle() + { + } + } +} diff --git a/Projectiles/Melee/SkytideDragoonHoldout.png b/Projectiles/Melee/SkytideDragoonHoldout.png new file mode 100644 index 0000000000..56b38df685 Binary files /dev/null and b/Projectiles/Melee/SkytideDragoonHoldout.png differ diff --git a/Projectiles/Melee/Spears/RedtideSpearProjectile.cs b/Projectiles/Melee/Spears/RedtideSpearProjectile.cs index 953e2b3c9e..89b1190f23 100644 --- a/Projectiles/Melee/Spears/RedtideSpearProjectile.cs +++ b/Projectiles/Melee/Spears/RedtideSpearProjectile.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee.Spears //Player can only do the run attack while moving fast horizontally in the direction of the thrust, but remaining on the ground public bool CanRunAttack => Owner.velocity.Y >= -0.8f && Owner.velocity.Y <= 7f && Math.Abs(Owner.velocity.X) >= Owner.maxRunSpeed * 0.7f && Math.Sign(Owner.velocity.X) == ChargeDirection && Owner.channel && !RunBroken; //You can only start a run attack if you meet the other conditions, but ALSO you can't do it if you are aiming too much upwards or downwards - public bool CanStartRunAttack => CanRunAttack && Math.Abs(Owner.Calamity().mouseWorld.Y - Owner.MountedCenter.Y) <= 300; + public bool CanStartRunAttack => CanRunAttack && Math.Abs(Owner.ClampedMouseWorld().Y - Owner.MountedCenter.Y) <= 300; public ref float RunTimer => ref Projectile.ai[0]; //The window of time during which the run hasn't fully started, and is indentical to the regular thrust's start. This tells us when we can no longer do this switch. public bool FullyRunning => RunTimer > InitializationTime; diff --git a/Projectiles/Melee/Spears/StreamGougeProj.cs b/Projectiles/Melee/Spears/StreamGougeProj.cs index 659d3f95ee..ddefad369a 100644 --- a/Projectiles/Melee/Spears/StreamGougeProj.cs +++ b/Projectiles/Melee/Spears/StreamGougeProj.cs @@ -81,8 +81,9 @@ namespace CalamityMod.Projectiles.Melee.Spears // Create portals near the mouse once charged. if (Main.myPlayer == Projectile.owner && Time >= StreamGouge.SpinTime + StreamGouge.SpearFireTime && Time % 9f == 8f) { - Vector2 portalSpawnPosition = Main.MouseWorld + Main.rand.NextVector2Unit() * Main.rand.NextFloat(50f, 140f); - Vector2 spearVelocity = (Main.MouseWorld - portalSpawnPosition).SafeNormalize(Vector2.UnitY); + Vector2 mouse = Owner.ClampedMouseWorld(); + Vector2 portalSpawnPosition = mouse + Main.rand.NextVector2Unit() * Main.rand.NextFloat(50f, 140f); + Vector2 spearVelocity = (mouse - portalSpawnPosition).SafeNormalize(Vector2.UnitY); Projectile.NewProjectile(Projectile.GetSource_FromThis(), portalSpawnPosition, spearVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } diff --git a/Projectiles/Melee/StellarContemptEcho.cs b/Projectiles/Melee/StellarContemptEcho.cs index 8d094996f2..5ca3078edf 100644 --- a/Projectiles/Melee/StellarContemptEcho.cs +++ b/Projectiles/Melee/StellarContemptEcho.cs @@ -63,12 +63,7 @@ namespace CalamityMod.Projectiles.Melee } if (targeted != null) { - float speedMult = 0.85f; - Vector2 moveTotarget = (targeted.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); - if (Projectile.velocity.Length() < MathHelper.Clamp(25 - Projectile.ai[0] * 0.1f, 10, 25) * speedMult) - Projectile.velocity += moveTotarget * (0.35f + Projectile.ai[0] * 0.03f) * speedMult; - else - Projectile.velocity *= 0.9f; + CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.65f, 25, 0.98f); } else Projectile.Kill(); diff --git a/Projectiles/Melee/StellarStrikerHoldout.cs b/Projectiles/Melee/StellarStrikerHoldout.cs index e0067a811c..ad92875bed 100644 --- a/Projectiles/Melee/StellarStrikerHoldout.cs +++ b/Projectiles/Melee/StellarStrikerHoldout.cs @@ -48,6 +48,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.scale = 1; Projectile.ai[1] = -1; base.OnSpawn(source); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Stellar Striker's projectile spawning mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; useAnim = Owner.itemAnimationMax; diff --git a/Projectiles/Melee/StellarStrikerMeteor.cs b/Projectiles/Melee/StellarStrikerMeteor.cs index d247b25c68..40378025a3 100644 --- a/Projectiles/Melee/StellarStrikerMeteor.cs +++ b/Projectiles/Melee/StellarStrikerMeteor.cs @@ -3,10 +3,8 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using ReLogic.Utilities; using Terraria; using Terraria.Audio; -using Terraria.Graphics.Renderers; using Terraria.ID; using Terraria.ModLoader; @@ -52,24 +50,20 @@ namespace CalamityMod.Projectiles.Melee Projectile.extraUpdates ++; if (time == 0) { - chosenTarget = Owner.Calamity().mouseWorld.ClosestNPCAt(2000); + chosenTarget = Owner.ClampedMouseWorld().ClosestNPCAt(700); if (chosenTarget != null) Projectile.velocity = (chosenTarget.Center - Projectile.Center + chosenTarget.velocity * 8).SafeNormalize(Vector2.UnitX) * 3; else + { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * 3; + } } if (Projectile.numHits < 1) { if (chosenTarget == null || chosenTarget.life <= 0) - chosenTarget = Owner.Calamity().mouseWorld.ClosestNPCAt(700); - if (chosenTarget != null) - { - Vector2 moveTotarget = (chosenTarget.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); - if (Projectile.velocity.Length() < 5) - Projectile.velocity += moveTotarget * 0.15f; - else - Projectile.velocity *= 0.8f; - } + chosenTarget = Owner.ClampedMouseWorld().ClosestNPCAt(700); + CalamityUtils.HomeInOnSelectedNPC(Projectile, chosenTarget, true, 0.09f, 5, 0.99f, accelerate: true); } if (targetDist < 1400f) diff --git a/Projectiles/Melee/StygianShieldAttack.cs b/Projectiles/Melee/StygianShieldAttack.cs index c82c514d61..ed2b80decf 100644 --- a/Projectiles/Melee/StygianShieldAttack.cs +++ b/Projectiles/Melee/StygianShieldAttack.cs @@ -110,6 +110,7 @@ namespace CalamityMod.Projectiles.Melee // Perform the dash if able to if (Charge >= MinChargeTime && !Owner.noItems && !Owner.CCed) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // Set the destination in which the dash is supposed to be Vector2 intendedDestination = Projectile.Center + Projectile.SafeDirectionTo(Owner.Calamity().mouseWorld) * MaxChargeDistance * Charge / MaxChargeTime; @@ -269,6 +270,7 @@ namespace CalamityMod.Projectiles.Melee // Charge sight line if (Charge >= MinChargeTime) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // Where the dash is supposed to take you, taken from above Vector2 dashLength = Projectile.SafeDirectionTo(Owner.Calamity().mouseWorld) * MaxChargeDistance * Charge / MaxChargeTime; Vector2 intendedDestination = Projectile.Center + dashLength; diff --git a/Projectiles/Melee/TerratomereHoldoutProj.cs b/Projectiles/Melee/TerratomereHoldoutProj.cs index f1366e5835..95fd5570a1 100644 --- a/Projectiles/Melee/TerratomereHoldoutProj.cs +++ b/Projectiles/Melee/TerratomereHoldoutProj.cs @@ -160,6 +160,7 @@ namespace CalamityMod.Projectiles.Melee bool createBeams = Time == (int)(Terratomere.SwingTime * RecoveryCompletionRatio) + 5f; if (Main.myPlayer == Projectile.owner && Time == (int)(Terratomere.SwingTime * (SwingCompletionRatio + 0.34f))) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 bigSlashVelocity = Projectile.SafeDirectionTo(Main.MouseWorld) * Owner.ActiveItem().shootSpeed / 2f; if (bigSlashVelocity.AngleBetween(InitialRotation.ToRotationVector2()) > 1.456f) bigSlashVelocity = InitialRotation.ToRotationVector2() * bigSlashVelocity.Length(); diff --git a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs index 1bd5336742..48bc443c2f 100644 --- a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs @@ -92,6 +92,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = (int)MaxTime; SoundEngine.PlaySound(SoundID.DD2_SkyDragonsFuryShot, Projectile.Center); + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); Projectile.velocity.Normalize(); Projectile.rotation = Projectile.velocity.ToRotation(); diff --git a/Projectiles/Melee/TrueBiomeBlade_ChainedMeatHook.cs b/Projectiles/Melee/TrueBiomeBlade_ChainedMeatHook.cs index c8b196c76c..1de85e1494 100644 --- a/Projectiles/Melee/TrueBiomeBlade_ChainedMeatHook.cs +++ b/Projectiles/Melee/TrueBiomeBlade_ChainedMeatHook.cs @@ -66,6 +66,7 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.timeLeft == MaxTwirlTime) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); SoundEngine.PlaySound(SoundID.Item71, Projectile.Center); for (int i = 0; i < 4; i++) diff --git a/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs b/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs index 38a4346f7e..50e4adaacb 100644 --- a/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs +++ b/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs @@ -163,6 +163,7 @@ namespace CalamityMod.Projectiles.Melee return; } + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); Projectile.velocity.Normalize(); Projectile.rotation = Projectile.velocity.ToRotation(); diff --git a/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs b/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs index a0183dbc9b..aa97da0fc6 100644 --- a/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs +++ b/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs @@ -102,6 +102,7 @@ namespace CalamityMod.Projectiles.Melee if (State == 0f) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); Projectile.Center = Owner.Center + (direction * 70f * ChargeDisplacement()); diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs index e7b182dc10..e481eb379b 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs @@ -106,6 +106,7 @@ namespace CalamityMod.Projectiles.Melee { if (proj.active && proj.type == ProjectileType() && proj.owner == Owner.whoAmI) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction if (CalamityUtils.AngleBetween(Owner.Center - Owner.Calamity().mouseWorld, Owner.Center - proj.Center) > MathHelper.PiOver4) { proj.Kill(); @@ -139,6 +140,7 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, new Vector3(1f, 0.56f, 0.56f) * ShredRatio); + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction //Manage position and rotation direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs index 034fc7c9a3..fc841ca661 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs @@ -65,6 +65,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item90, Projectile.Center); initialized = true; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); Projectile.rotation = direction.ToRotation(); diff --git a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs index 0b2cd2c04d..73a041a62a 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs @@ -81,6 +81,7 @@ namespace CalamityMod.Projectiles.Melee { SoundEngine.PlaySound(SoundID.Item90, Projectile.Center); Projectile.velocity = Vector2.Zero; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); initialized = true; @@ -101,7 +102,10 @@ namespace CalamityMod.Projectiles.Melee { CurrentState = 1f; SoundEngine.PlaySound(SoundID.Item80, Projectile.Center); + + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); + //PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES YES YES MH YES YES for (int i = 0; i <= 8; i++) { @@ -171,6 +175,9 @@ namespace CalamityMod.Projectiles.Melee smear.Color = currentColor; } + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + // this applies to all below uses + if (sightLine == null) { sightLine = new LineVFX(Owner.Center, Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One), 0.2f, Color.HotPink, false); diff --git a/Projectiles/Melee/UrchinMaceProjectile.cs b/Projectiles/Melee/UrchinMaceProjectile.cs index c6a2d9fee3..619af44ec1 100644 --- a/Projectiles/Melee/UrchinMaceProjectile.cs +++ b/Projectiles/Melee/UrchinMaceProjectile.cs @@ -167,6 +167,7 @@ namespace CalamityMod.Projectiles.Melee //Spawn a whirlpool typhoon after sending it out if (WindupProgress >= 1f && Projectile.owner == Main.myPlayer) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Main.MouseWorld - Owner.position).SafeNormalize(Vector2.One) * 25f, ModContent.ProjectileType(), (int)(Projectile.damage * whirlpoolDamageMultiplier), Projectile.knockBack, Projectile.owner, 0, 0f); } diff --git a/Projectiles/Melee/ViolenceSlashProjectile.cs b/Projectiles/Melee/ViolenceSlashProjectile.cs index 88203f77a0..c1c1dfe929 100644 --- a/Projectiles/Melee/ViolenceSlashProjectile.cs +++ b/Projectiles/Melee/ViolenceSlashProjectile.cs @@ -65,9 +65,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter) + (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * Projectile.height * 0.45f; Projectile.rotation = SwingSine * MathHelper.ToRadians(87f); - if (Main.myPlayer == Projectile.owner && !Projectile.WithinRange(Main.MouseWorld, Projectile.height + 15f)) + Vector2 mouse = Owner.ClampedMouseWorld(); + if (Main.myPlayer == Projectile.owner && !Projectile.WithinRange(mouse, Projectile.height + 15f)) { - Projectile.velocity = Projectile.SafeDirectionTo(Main.MouseWorld); + Projectile.velocity = Projectile.SafeDirectionTo(mouse); Projectile.netSpam = 0; Projectile.netUpdate = true; } diff --git a/Projectiles/Melee/ViolenceThrownProjectile.cs b/Projectiles/Melee/ViolenceThrownProjectile.cs index 4879094cc4..9b2db2a9b5 100644 --- a/Projectiles/Melee/ViolenceThrownProjectile.cs +++ b/Projectiles/Melee/ViolenceThrownProjectile.cs @@ -70,10 +70,11 @@ namespace CalamityMod.Projectiles.Melee if (Main.myPlayer != Projectile.owner) return; - if (Projectile.WithinRange(Main.MouseWorld, Projectile.velocity.Length() * 0.7f)) - Projectile.Center = Main.MouseWorld; + Vector2 mouse = Owner.ClampedMouseWorld(); + if (Projectile.WithinRange(mouse, Projectile.velocity.Length() * 0.7f)) + Projectile.Center = mouse; else - Projectile.velocity = (Projectile.velocity * 3f + Projectile.DirectionTo(Main.MouseWorld) * 19f) / 4f; + Projectile.velocity = (Projectile.velocity * 3f + Projectile.DirectionTo(mouse) * 19f) / 4f; Projectile.netSpam = 0; Projectile.netUpdate = true; } diff --git a/Projectiles/Melee/WulfrumScrew.cs b/Projectiles/Melee/WulfrumScrew.cs index f45e68d8d1..1f6bb696fc 100644 --- a/Projectiles/Melee/WulfrumScrew.cs +++ b/Projectiles/Melee/WulfrumScrew.cs @@ -153,6 +153,7 @@ namespace CalamityMod.Projectiles.Melee { Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction float distanceFromAim = Projectile.Center.ShortestDistanceToLine(Owner.MountedCenter, Main.MouseWorld); float distanceFromPlayerAcrossSightLine = (Owner.MountedCenter - Projectile.Center.ClosestPointOnLine(Owner.MountedCenter, Main.MouseWorld)).Length(); diff --git a/Projectiles/Melee/WulfrumScrewdriverProj.cs b/Projectiles/Melee/WulfrumScrewdriverProj.cs index 200b137924..9c05c2c756 100644 --- a/Projectiles/Melee/WulfrumScrewdriverProj.cs +++ b/Projectiles/Melee/WulfrumScrewdriverProj.cs @@ -70,6 +70,7 @@ namespace CalamityMod.Projectiles.Melee if (EndLag == 0) //Initialization { EndLag = (float)Math.Max(Owner.ActiveItem().useTime - MaxTime, 1); + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction TrueDirection = (Owner.Calamity().mouseWorld - Owner.MountedCenter).SafeNormalize(Vector2.Zero).ToRotation(); //Store this for the screw hit Projectile.velocity = (Owner.Calamity().mouseWorld - Owner.MountedCenter).SafeNormalize(Vector2.Zero).RotatedByRandom(MathHelper.PiOver4 * 0.15f); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; diff --git a/Projectiles/Melee/Yoyos/AzathothYoyo.cs b/Projectiles/Melee/Yoyos/AzathothYoyo.cs index 2bd20fd772..f5d785e256 100644 --- a/Projectiles/Melee/Yoyos/AzathothYoyo.cs +++ b/Projectiles/Melee/Yoyos/AzathothYoyo.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -41,6 +42,15 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (Projectile.owner == Main.myPlayer) Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.2f, 0.55f), ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, 0f, 0f); } + if (Main.rand.NextBool((int)(MaxUpdates / 2))) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), -Projectile.velocity * Main.rand.NextFloat(0.3f, 1f), 0, default, Main.rand.NextFloat(1.85f, 2.2f)); + dust.color = Main.rand.NextBool() ? Color.Magenta : Color.HotPink; + bool b = !Main.rand.NextBool(3); + dust.scale -= b ? 0.8f : 0; + dust.velocity *= b ? 0.4f : 1; + dust.noGravity = !b; + } if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks Projectile.Kill(); } diff --git a/Projectiles/Melee/Yoyos/BurningRevelationYoyo.cs b/Projectiles/Melee/Yoyos/BurningRevelationYoyo.cs index 3c498738c9..f34a0877a5 100644 --- a/Projectiles/Melee/Yoyos/BurningRevelationYoyo.cs +++ b/Projectiles/Melee/Yoyos/BurningRevelationYoyo.cs @@ -1,8 +1,13 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -13,11 +18,23 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public const int MaxUpdates = 3; + public int timer = 0; + public bool canDamage = true; + public bool firing = false; + public NPC targeted; + public float fade = 0; + public int hitCooldown = 0; + + public float yoyoPower = 0; + public int yoyoPowerMax = 1000; + + public bool cloneYoyo = false; + public bool setCloneDamage = false; public override void SetStaticDefaults() { ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[Type] = 560f; + ProjectileID.Sets.YoyosMaximumRange[Type] = 680f; ProjectileID.Sets.YoyosTopSpeed[Type] = 54f / MaxUpdates; ProjectileID.Sets.TrailCacheLength[Type] = 8; @@ -27,38 +44,201 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetDefaults() { Projectile.aiStyle = ProjAIStyleID.Yoyo; - Projectile.width = Projectile.height = 16; + Projectile.width = 30; + Projectile.height = 32; Projectile.friendly = true; + Projectile.tileCollide = false; Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.MaxUpdates = MaxUpdates; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6 * MaxUpdates; + Projectile.localNPCHitCooldown = 18 * MaxUpdates; } public override void AI() { - if (Main.rand.NextBool(5)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks + // Determine if the yoyo is a yoyo bag/yoyo glove clone + if (!cloneYoyo) + { + int MainYoyo = -1; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile proj = Main.projectile[x]; + if (proj.active && proj.type == Type && proj.owner == Projectile.owner) + { + MainYoyo = x; + break; + } + } + + if (Projectile.whoAmI != MainYoyo) + cloneYoyo = true; + } + if (!setCloneDamage && cloneYoyo) + { + // Since the effects of the yoyo itself are nerfed if it's a clone, it gets a small damage bonus to compensate a bit + Projectile.damage = (int)(Projectile.damage * 1.1f); + setCloneDamage = true; + } + Player Owner = Main.player[Projectile.owner]; + + Lighting.AddLight(Projectile.Center, Color.Gold.ToVector3() * 0.9f); + + // Fading in and out for various visuals + fade = MathHelper.Lerp(fade, (firing ? 1 : 0), 0.03f); + + if (firing) + { + if (targeted == null || targeted.life <= 0) + targeted = Projectile.Center.ClosestNPCAt(600); + + if (timer % (cloneYoyo ? 20 : 10) == 0) // Fire Holy Stars + { + int stardamage = (int)(Projectile.damage * 0.12f); + + Vector2 vel = new Vector2(0, 10).RotatedBy(timer * 0.025f * (cloneYoyo ? -1 : 1)); + Projectile damageStar = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, vel, ModContent.ProjectileType(), stardamage, Projectile.knockBack, Projectile.owner, 0, 5, (targeted == null ? -1 : targeted.whoAmI)); + damageStar.extraUpdates = 1; + damageStar.scale = 0.6f; + Projectile damageStar2 = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, -vel, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, 0, 5, (targeted == null ? -1 : targeted.whoAmI)); + damageStar2.extraUpdates = 1; + damageStar2.scale = 0.6f; + + SoundStyle fire = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastShoot"); + SoundEngine.PlaySound(fire with { Volume = 0.6f, PitchVariance = 0.2f }, Projectile.Center); + } + + // Technically scrapped because the weapon is complex enough, but we might want to use this in the future + /* + if (timer % 60 == 0) // Fire Heal Stars at player (slightly predictive) + { + Vector2 vel = ((Projectile.Center - Owner.Center) - Owner.velocity * 8).SafeNormalize(Vector2.UnitX) * -10; + Projectile healStar = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, vel, ModContent.ProjectileType(), 0, Projectile.knockBack, Projectile.owner, 0, cloneYoyo ? 3 : 10, 5); + healStar.extraUpdates = 2; + SoundStyle fireHeal = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash"); + SoundEngine.PlaySound(fireHeal with { Volume = 0.9f, Pitch = 0.3f }, Projectile.Center); + } + */ + + if (timer <= 0) + { + firing = false; + canDamage = true; + yoyoPower = 0; + } + else + timer--; + } + else + { + if (yoyoPower >= yoyoPowerMax) + { + SoundStyle fireHeal = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRay"); + SoundEngine.PlaySound(fireHeal with { Volume = 0.9f, Pitch = 0.3f }, Projectile.Center); + canDamage = false; + firing = true; + timer = 240; + } + if (Main.rand.NextBool(7)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), ((new Vector2(4, 4)).RotatedByRandom(100) + Projectile.velocity) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.85f, 1.15f); + dust.color = Main.rand.NextBool(5) ? Color.Khaki : Color.Goldenrod; + dust.noLightEmittence = true; + } + yoyoPower++; + } + + if (hitCooldown > 0) + hitCooldown--; + + if ((Projectile.Center - Main.player[Projectile.owner].Center).Length() > 3200f && !firing) // 200 blocks Projectile.Kill(); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 240); - if (Projectile.owner == Main.myPlayer) + if (hitCooldown == 0) { - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].DamageType = DamageClass.MeleeNoSpeed; - } - } + hitCooldown = Projectile.localNPCHitCooldown; + targeted = target; + yoyoPower += 15; + + // Create Explosion + if (Projectile.owner == Main.myPlayer) + { + float power = Utils.GetLerpValue(-100, yoyoPowerMax, yoyoPower, true); + + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, power); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].DamageType = DamageClass.MeleeNoSpeed; + + for (int i = 0; i < (int)(30 * power); i++) + { + if (Main.rand.NextBool()) + { + Particle spark = new CustomSpark(Projectile.Center, ((new Vector2(19, 19) * power).RotatedByRandom(100)) * Main.rand.NextFloat(0.2f, 1f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 27, Main.rand.NextFloat(1.15f, 1.3f), Main.rand.NextBool(4) ? Color.Khaki : Color.Orange, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); + GeneralParticleHandler.SpawnParticle(spark); + } + else + { + bool isSpark = Main.rand.NextBool(5); + Dust dust = Dust.NewDustPerfect(Projectile.Center, isSpark ? 278 : ModContent.DustType(), ((new Vector2(15, 15) * power).RotatedByRandom(100)) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.85f, 2.15f) * power * (isSpark ? 0.5f : 1); + dust.color = Main.rand.NextBool(5) ? Color.Khaki : Color.Goldenrod; + if (isSpark) + dust.noGravity = false; + else + dust.noLightEmittence = true; + } + } + + Particle orb1 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Goldenrod, "CalamityMod/Particles/SoftRoundExplosion", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.14f * power, 15); + GeneralParticleHandler.SpawnParticle(orb1); + + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Khaki, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 2.1f * power, 15); + GeneralParticleHandler.SpawnParticle(orb2); + + SoundStyle explode = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastImpact"); + SoundEngine.PlaySound(explode with { Volume = 0.5f, Pitch = 0.3f * power }, Projectile.Center); + SoundStyle explode2 = new("CalamityMod/Sounds/Item/HeliumFlashReadyAlt"); + SoundEngine.PlaySound(explode2 with { Volume = 0.7f, Pitch = 0.6f * power }, Projectile.Center); + } + } + + target.AddBuff(ModContent.BuffType(), 480); + } + public override bool? CanDamage() => canDamage ? null : false; public override bool PreDraw(ref Color lightColor) { + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D shineTexture = ModContent.Request("CalamityMod/Particles/HalfStar").Value; + + Vector2 drawPos = Projectile.Center - Main.screenPosition; + + // The back glow + float power = Utils.GetLerpValue(-100, yoyoPowerMax, yoyoPower, true); + float randSize = Main.rand.NextFloat(0.9f, 1.1f); + Main.EntitySpriteDraw(bloomTexture, drawPos, null, Color.Goldenrod with { A = 0 }, Projectile.rotation, bloomTexture.Size() * 0.5f, 0.65f * randSize * (1 - fade) * power, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bloomTexture, drawPos, null, Color.White with { A = 0 } * 0.65f, Projectile.rotation, bloomTexture.Size() * 0.5f, 0.45f * randSize * (1 - fade) * power, SpriteEffects.None, 0); + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + Texture2D texture = TextureAssets.Projectile[Type].Value; + + Projectile.DrawProjectileWithBackglow(Color.Goldenrod with { A = 0 } * fade, lightColor, 4f * fade, texture); + + // The shine effect + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.Goldenrod with { A = 0 }, 0, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 4.25f * randSize * fade, SpriteEffects.None, 0); + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.White with { A = 0 } * 0.65f, 0, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 4.05f * randSize * fade, SpriteEffects.None, 0); + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.Goldenrod with { A = 0 }, MathHelper.PiOver2, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 4.25f * randSize * fade, SpriteEffects.None, 0); + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.White with { A = 0 } * 0.65f, MathHelper.PiOver2, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 4.05f * randSize * fade, SpriteEffects.None, 0); + return false; } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 50, targetHitbox); } } diff --git a/Projectiles/Melee/Yoyos/BurningRevelationYoyo.png b/Projectiles/Melee/Yoyos/BurningRevelationYoyo.png index f36d305459..af005458c1 100644 Binary files a/Projectiles/Melee/Yoyos/BurningRevelationYoyo.png and b/Projectiles/Melee/Yoyos/BurningRevelationYoyo.png differ diff --git a/Projectiles/Melee/Yoyos/OracleYoyo.cs b/Projectiles/Melee/Yoyos/OracleYoyo.cs index b34a655cf9..276e13bcb5 100644 --- a/Projectiles/Melee/Yoyos/OracleYoyo.cs +++ b/Projectiles/Melee/Yoyos/OracleYoyo.cs @@ -189,7 +189,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos cloneOffset = cloneOffset.RotatedBy(counter * 0.06f); if (Owner.controlUseItem) { - Projectile.Center = Main.MouseWorld + cloneOffset; + Projectile.Center = Main.player[Projectile.owner].ClampedMouseWorld() + cloneOffset; Projectile.velocity = Vector2.Zero; } } diff --git a/Projectiles/Ranged/AngelicBeam.cs b/Projectiles/Ranged/AngelicBeam.cs index a63d849af3..6748cc971a 100644 --- a/Projectiles/Ranged/AngelicBeam.cs +++ b/Projectiles/Ranged/AngelicBeam.cs @@ -1,6 +1,15 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Ranged { public class AngelicBeam : ModProjectile, ILocalizedModType @@ -8,57 +17,105 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + // Due to how far/fast this thing moves, it'd require way too many points for a smooth long trail using oldPos + public List TrailPos = new List(); + public static int Lifetime = 300; + public static int Fadetime = 30; + + public override void SetStaticDefaults() => ProjectileID.Sets.DrawScreenCheckFluff[Type] = 2000; + public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; + Projectile.width = Projectile.height = 32; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Ranged; Projectile.tileCollide = false; - Projectile.alpha = 255; - // Hitscan laser with a long range - Projectile.timeLeft = 200; - Projectile.extraUpdates = 200; + // Effectively hitscan + Projectile.timeLeft = Lifetime; + Projectile.MaxUpdates = Lifetime; Projectile.penetrate = -1; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 20; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - // Actual laser dust - for (int i = 0; i < 7; ++i) + // Begin fading once the laser is fully spawned in + if (Projectile.ai[0] > 0f) { - int dustType = 262; // Main.rand.NextBool() ? 244 : 246; - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); - - Main.dust[idx].noGravity = true; - Main.dust[idx].position -= i * 0.1666f * Projectile.velocity; - Main.dust[idx].velocity *= 1f; - float scale = Main.rand.NextFloat(0.8f, 1.4f); - Main.dust[idx].scale = scale; + Projectile.Opacity = Utils.GetLerpValue(0f, Fadetime, Projectile.timeLeft, true); + return; + } + else if (Projectile.timeLeft == 1) + { + Projectile.ai[0] = 1f; + Projectile.MaxUpdates = 1; + Projectile.timeLeft = Fadetime; } - // Sparkles "burning off" of the laser beam + if (Projectile.FinalExtraUpdate() || Projectile.numUpdates % 30 == 29 || TrailPos == null) + { + // Initialize 10 points immediately + if (TrailPos == null) + { + TrailPos = new List(10); + for (int i = 0; i < 10; ++i) + TrailPos.Add(Projectile.Center); + } + + TrailPos.Insert(0, Projectile.Center); + + while (TrailPos.Count > 10) + TrailPos.RemoveAt(TrailPos.Count - 1); + } + + // Trail sparks in the laser's path if (Main.rand.NextBool()) { - int dustType = Main.rand.NextBool() ? 244 : 246; - int idx = Dust.NewDust(Projectile.position, 1, 1, dustType); + Particle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(10f * Projectile.scale, 10f * Projectile.scale), Projectile.velocity, false, 15, Main.rand.NextFloat(1f, 1.2f) * Projectile.scale, Color.White); + GeneralParticleHandler.SpawnParticle(spark); + } - Main.dust[idx].noGravity = true; - float ySpeed = Main.rand.NextFloat(3.0f, 5.6f); - Main.dust[idx].velocity.Y -= ySpeed; - float scale = Main.rand.NextFloat(0.4f, 0.8f); - Main.dust[idx].scale = scale; + if (Main.rand.NextBool(4)) + { + Color fireColor = Main.hslToRgb(Main.rand.NextFloat(0.08f, 0.13f) + 0.05f * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f), 1f, 0.7f); + Particle fire = new GlowOrbParticle(Projectile.Center, (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * (Main.rand.NextFloat(1f, 3f) + 3f * Projectile.scale), false, 9, Main.rand.NextFloat(1f, 1.2f) * Projectile.scale, fireColor); + GeneralParticleHandler.SpawnParticle(fire); } } + // Hitbox size does not normally scale with Projectile.scale for some reason so this is done manually + public override void ModifyDamageHitbox(ref Rectangle hitbox) => hitbox.Inflate((int)(Projectile.width * (Projectile.scale - 1f)), (int)(Projectile.height * (Projectile.scale - 1f))); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 180); + + for (int i = 0; i < 6; i++) + { + Dust dust = Dust.NewDustPerfect(target.Center, ModContent.DustType(), (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(2f, 12f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1f, 2.4f) * Projectile.scale; + dust.color = Main.hslToRgb(Main.rand.NextFloat(0.033f, 0.167f), 1f, 0.7f); + dust.noLightEmittence = true; + } + } + + public Color LaserColor(float completionRatio) => Main.hslToRgb(0.08f + 0.05f * completionRatio + 0.05f * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f), 1f, 0.7f) * 0.8f * Projectile.Opacity; + public float LaserWidth(float completionRatio) => 30f * Projectile.Opacity * Projectile.scale; + + public override bool PreDraw(ref Color lightColor) + { + if (TrailPos == null) + return false; + + GameShaders.Misc["CalamityMod:Flame"].UseImage1("Images/Misc/Perlin"); + GameShaders.Misc["CalamityMod:Flame"].UseSaturation(0.5f); + PrimitiveRenderer.RenderTrail(TrailPos, new(LaserWidth, LaserColor, shader: GameShaders.Misc["CalamityMod:Flame"]), 10); + return false; } } } diff --git a/Projectiles/Ranged/BlissfulBombardierDustProjectile.cs b/Projectiles/Ranged/BlissfulBombardierDustProjectile.cs deleted file mode 100644 index c153a7acbc..0000000000 --- a/Projectiles/Ranged/BlissfulBombardierDustProjectile.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class BlissfulBombardierDustProjectile : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 46; - Projectile.height = 46; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 15; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f); - bool xflag = false; - bool yflag = false; - if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) - { - xflag = true; - } - if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) - { - xflag = true; - } - if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) - { - yflag = true; - } - if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) - { - yflag = true; - } - if (xflag && yflag) - { - Projectile.Kill(); - } - float projTimer = 25f; - if (Projectile.ai[0] > 60f) - { - projTimer -= (Projectile.ai[0] - 60f) / 2f; - } - if (projTimer <= 0f) - { - projTimer = 0f; - Projectile.Kill(); - } - Projectile.ai[0] += (2f + Projectile.ai[1]); // Explosions spawned on hit last shorter - int timerCounter = 0; - while ((float)timerCounter < projTimer) - { - float rand1 = (float)Main.rand.Next(-8, 9); - float rand2 = (float)Main.rand.Next(-8, 9); - float rand3 = (float)Main.rand.Next(2, 7); - float randAdjust = (float)Math.Sqrt((double)(rand1 * rand1 + rand2 * rand2)); - randAdjust = rand3 / randAdjust; - rand1 *= randAdjust; - rand2 *= randAdjust; - int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1.5f); - Dust dust = Main.dust[dusty]; - dust.noGravity = true; - dust.position.X = Projectile.Center.X; - dust.position.Y = Projectile.Center.Y; - dust.position.X += (float)Main.rand.Next(-10, 11); - dust.position.Y += (float)Main.rand.Next(-10, 11); - dust.velocity.X = rand1; - dust.velocity.Y = rand2; - timerCounter++; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); - } -} diff --git a/Projectiles/Ranged/BlissfulBombardierHoldout.cs b/Projectiles/Ranged/BlissfulBombardierHoldout.cs new file mode 100644 index 0000000000..06805d2d51 --- /dev/null +++ b/Projectiles/Ranged/BlissfulBombardierHoldout.cs @@ -0,0 +1,243 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Ranged; +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.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class BlissfulBombardierHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ItemType(); + public override float RecoilResolveSpeed => 0.07f; + public override float MaxOffsetLengthFromArm => 60f; + public override float OffsetXUpwards => -18f; + public override float BaseOffsetY => -5f; + public override float OffsetYUpwards => 23f; + + // The type of dust used in the effects and the color of the particles that it'll use depending on the type of rocket used. + // It'll carry over to the projectiles that it shoots. + public static int dustEffectsID { get; set; } + public static Color effectsColor { get; set; } + public static Color staticEffectsColor { get; set; } = Color.Khaki; + + public ref float shootingTimer => ref Projectile.ai[0]; + public ref float PostFireCooldown => ref Projectile.ai[1]; + public bool hasFired = false; + public override void KillHoldoutLogic() + { + + } + public override void ManageHoldout() + { + // The center of the player, taking into account if they have a mount or not. + Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); + + // The vector between the player a relative point in the sky slightly based on mouse position, used for pointing the holdout. + Vector2 ownerToSky = new Vector2(MathHelper.Lerp(Owner.ClampedMouseWorld().X, Owner.Center.X, 0.55f), Owner.Center.Y) + new Vector2(0, -500) - Owner.Center; + + // The direction this holdout's pointing at. + float holdoutDirection = Projectile.velocity.ToRotation(); + + // A range from -1 to 1 for when the holdout is pointing downards of upwards, respectively. + // Used for the offsets. + float proximityLookingUpwards = Vector2.Dot(ownerToSky.SafeNormalize(Vector2.Zero), -Vector2.UnitY * Owner.gravDir); + + int direction = MathF.Sign(ownerToSky.X); + + Vector2 lengthOffset = Projectile.rotation.ToRotationVector2() * OffsetLengthFromArm; + Vector2 armOffset = new Vector2(Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? OffsetXUpwards : OffsetXDownwards) * direction, BaseOffsetY * Owner.gravDir + Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? OffsetYUpwards : OffsetYDownwards) * Owner.gravDir); + Projectile.Center = armPosition + lengthOffset + armOffset; + + Projectile.velocity = holdoutDirection.AngleTowards(ownerToSky.ToRotation(), 0.2f).ToRotationVector2(); + + Projectile.rotation = holdoutDirection; + + Projectile.spriteDirection = direction; + Owner.ChangeDir(direction); + + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = Owner.itemAnimation = 2; + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); + + // -Pi/2 because the arms rotation starts with arms pointing down. + float armRotation = (Projectile.rotation - MathHelper.PiOver2) * Owner.gravDir + (Owner.gravDir == -1 ? MathHelper.Pi : 0f); + Owner.SetCompositeArmFront(true, FrontArmStretch, armRotation + ExtraFrontArmRotation * direction); + Owner.SetCompositeArmBack(true, BackArmStretch, armRotation + ExtraBackArmRotation * direction); + + if (KeepRefreshingLifetime) + Projectile.timeLeft = 2; + + if (OffsetLengthFromArm != MaxOffsetLengthFromArm) + OffsetLengthFromArm = MathHelper.Lerp(OffsetLengthFromArm, MaxOffsetLengthFromArm, RecoilResolveSpeed); + + Projectile.netUpdate = true; + Projectile.netSpam = 0; + } + public override void HoldoutAI() + { + // If there's no player, or the player is the server, or the owner's stunned, there'll be no holdout. + if (Owner.CantUseHoldout() && PostFireCooldown <= 0 && shootingTimer < (int)(Owner.itemAnimationMax * 0.8f)) + { + Projectile.Kill(); + } + + if (!hasFired) + shootingTimer++; + + if (shootingTimer == (int)(Owner.itemAnimationMax) && HeldItem.type == AssociatedItemID && !hasFired) + { + ShootRocket(); + + for (int i = 0; i <= 25; i++) + { + if (i % 2 == 0) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType(), (Projectile.velocity * 12).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.4f, 1.7f), 0, default, Main.rand.NextFloat(1.8f, 2.3f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool(3) ? Color.Orange : effectsColor; + dust.noLightEmittence = true; + } + else + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, 278, (Projectile.velocity * 12).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.4f, 1.7f), 0, default, Main.rand.NextFloat(1.2f, 1.6f)); + dust.noGravity = false; + dust.color = Main.rand.NextBool(3) ? Color.Orange : staticEffectsColor; + } + } + + hasFired = true; + } + + if (PostFireCooldown > 0) + PostFiringCooldown(); + } + + public void ShootRocket() + { + // We use the velocity of this projectile as its direction vector. + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); + float velocityMultiplier = 0.9f; + + // Every time we shoot we use ammo. + // With this method we also use the item's stats, like the shoot speed, or the type of ammo it was used. + Owner.PickAmmo(HeldItem, out _, out float projSpeed, out int damage, out float knockback, out int rocketType); + + // Decides the color of the effects depending on the type of rocket used. + switch (rocketType) + { + case ItemID.WetRocket: + dustEffectsID = 45; + effectsColor = Color.RoyalBlue; + break; + case ItemID.LavaRocket: + dustEffectsID = DustID.Torch; + effectsColor = Color.Red; + break; + case ItemID.HoneyRocket: + dustEffectsID = DustID.Honey; + effectsColor = Color.Yellow; + break; + default: + dustEffectsID = 87; + effectsColor = Color.Goldenrod; + break; + } + + // Spawns the projectile. + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootDirection * projSpeed * velocityMultiplier, ProjectileType(), damage, knockback, Projectile.owner, rocketType); + PostFireCooldown = Owner.itemAnimationMax; + Owner.Calamity().GeneralScreenShakePower = 5f; + + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + SoundStyle fire = new("CalamityMod/Sounds/Item/LauncherHeavyShot"); + SoundEngine.PlaySound(fire with { Volume = 0.9f, PitchVariance = 0.1f }, Projectile.Center); + + for (int k = 0; k < 6; k++) + { + float pulseScale = Main.rand.NextFloat(0.2f, 0.4f); + DirectionalPulseRing pulse = new DirectionalPulseRing(GunTipPosition, (shootDirection * 20).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.5f, 1.2f), (Main.rand.NextBool(3) ? effectsColor : staticEffectsColor) * 0.8f, new Vector2(1, 1), pulseScale - 0.25f, pulseScale, 0f, 20); + GeneralParticleHandler.SpawnParticle(pulse); + } + + // By decreasing the offset length of the gun from the arms, we give an effect of recoil. + OffsetLengthFromArm -= 25f; + } + + public void PostFiringCooldown() + { + Owner.channel = true; + if (PostFireCooldown > 1) + { + PostFireCooldown--; + Vector2 smokeVel = new Vector2(0, -8) * Main.rand.NextFloat(0.1f, 1.1f); + Particle smoke = new HeavySmokeParticle(GunTipPosition, smokeVel, staticEffectsColor, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.3f, 0.6f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + + Dust dust = Dust.NewDustPerfect(GunTipPosition, 303, smokeVel.RotatedByRandom(0.1f), 80, default, Main.rand.NextFloat(0.4f, 1.3f)); + dust.noGravity = false; + dust.color = staticEffectsColor; + } + else + { + PostFireCooldown--; + hasFired = false; + shootingTimer = 0; + } + } + + public override void OnSpawn(IEntitySource source) + { + base.OnSpawn(source); + FrontArmStretch = Player.CompositeArmStretchAmount.Quarter; + ExtraBackArmRotation = MathHelper.ToRadians(15f); + } + + public override bool PreDraw(ref Color lightColor) + { + if (shootingTimer <= 1) + return false; + + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture2 = ModContent.Request("CalamityMod/Items/Weapons/Ranged/BlissfulBombardierGlow").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + if (hasFired) + { + float rumble = Utils.GetLerpValue(0f, Owner.itemAnimationMax, PostFireCooldown, true) * 8f; + drawPosition += Main.rand.NextVector2Circular(rumble, rumble); + } + + if (!hasFired) + { + float fade = Utils.GetLerpValue(0, Owner.itemAnimationMax, shootingTimer, true); + for (int i = 0; i < 10; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * 5 * fade; + Main.spriteBatch.Draw(texture, drawPosition + drawOffset, null, staticEffectsColor with { A = 0 } * fade, drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite, 0f); + } + } + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + Main.EntitySpriteDraw(texture2, drawPosition, null, Color.White, drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + + return false; + } + } +} diff --git a/Projectiles/Ranged/BlissfulBombardierSplitProjectile.cs b/Projectiles/Ranged/BlissfulBombardierSplitProjectile.cs new file mode 100644 index 0000000000..14adc0efa3 --- /dev/null +++ b/Projectiles/Ranged/BlissfulBombardierSplitProjectile.cs @@ -0,0 +1,114 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.Projectiles.Ranged.BlissfulBombardierHoldout; + +namespace CalamityMod.Projectiles.Ranged +{ + public class BlissfulBombardierSplitProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + private ref float RocketID => ref Projectile.ai[0]; + public override void SetDefaults() + { + Projectile.width = 22; + Projectile.height = 34; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.extraUpdates = 4; + Projectile.timeLeft = 400; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = -1; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (Projectile.Center.Y > Owner.ClampedMouseWorld().Y) + Projectile.tileCollide = true; + + //Animation + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + Projectile.velocity *= 1.005f; + + if (Projectile.timeLeft % 2 == 0 && targetDist < 1400) + { + Particle spark = new GlowSparkParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2, -1), -Projectile.velocity * 0.3f, false, 5, 0.06f, effectsColor * 0.65f, new Vector2(1, 0.3f), true, false, 1.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + else + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (Projectile.velocity * -4).RotatedByRandom(0.2) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.35f, 0.55f); + dust.color = Main.rand.NextBool(3) ? Color.Orange : Color.Goldenrod; + dust.noLightEmittence = true; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); + + public override void OnKill(int timeLeft) + { + // Only do rocket effects for the owner client side + if (Projectile.owner != Main.myPlayer) + return; + + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID) + { + // Since we use our own spawning method for the cluster rockets, we don't need them to shoot anything, + // we'll do it ourselves. + clusterProjectileID = ProjectileID.None, + destructiveClusterProjectileID = ProjectileID.None, + }; + + bool isClusterRocket = (RocketID == ItemID.ClusterRocketI || RocketID == ItemID.ClusterRocketII); + SoundStyle fire = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastImpact"); + SoundEngine.PlaySound(fire with { Volume = 0.6f, PitchVariance = 0.2f }, Projectile.Center); + + int blastRadius = (int)(MathHelper.Clamp(Projectile.RocketBehavior(info), 3, 100) * 0.5f); + Projectile.ExpandHitboxBy((float)blastRadius); + Projectile.damage = (int)(Projectile.damage * 0.5f); + Projectile.penetrate = -1; + Projectile.Damage(); + + Particle orb5 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Orange, "CalamityMod/Particles/SoftRoundExplosion", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.025f * blastRadius, 13); + GeneralParticleHandler.SpawnParticle(orb5); + + Particle orb3 = new CustomPulse(Projectile.Center, Vector2.Zero, staticEffectsColor, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.22f * blastRadius, 10, true); + GeneralParticleHandler.SpawnParticle(orb3); + + for (int i = 0; i < 8; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (new Vector2(5, 5) * blastRadius).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.85f, 2.45f) * blastRadius * 0.08f; + dust.color = Color.Goldenrod; + dust.noLightEmittence = true; + } + for (int i = 0; i < 4; i++) + { + Particle spark = new CustomSpark(Projectile.Center + Main.rand.NextVector2Circular(10, 10), (Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10) * Main.rand.NextFloat(0.2f, 1f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 15, Main.rand.NextFloat(1.35f, 1.6f), Main.rand.NextBool(4) ? Color.Khaki : effectsColor, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.45f, 0.55f)); + GeneralParticleHandler.SpawnParticle(spark); + } + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Ranged/BlissfulBombardierSplitProjectile").Value; + + Projectile.DrawProjectileWithBackglow(staticEffectsColor with { A = 0 }, lightColor, 3f, texture); + return false; + } + } +} diff --git a/Projectiles/Ranged/BlissfulBombardierSplitProjectile.png b/Projectiles/Ranged/BlissfulBombardierSplitProjectile.png new file mode 100644 index 0000000000..e61db33ec9 Binary files /dev/null and b/Projectiles/Ranged/BlissfulBombardierSplitProjectile.png differ diff --git a/Projectiles/Ranged/Bolt.cs b/Projectiles/Ranged/Bolt.cs deleted file mode 100644 index 2e67071502..0000000000 --- a/Projectiles/Ranged/Bolt.cs +++ /dev/null @@ -1,96 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class Bolt : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 10; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 8; - Projectile.height = 8; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.alpha = 255; - Projectile.penetrate = 4; - Projectile.extraUpdates = 1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - Projectile.timeLeft = 600; - } - - public override void AI() - { - Projectile.velocity *= 1.015f; - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.timeLeft % 30 == 0) - { - for (int l = 0; l < 12; l++) - { - Vector2 rotate = Vector2.UnitX * (float)-(float)Projectile.width / 2f; - rotate += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - rotate = rotate.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); - int blueDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.FireworkFountain_Blue, 0f, 0f, 160, default, 1f); - Main.dust[blueDust].scale = 1.1f; - Main.dust[blueDust].noGravity = true; - Main.dust[blueDust].position = Projectile.Center + rotate; - Main.dust[blueDust].velocity = Projectile.velocity * 0.1f; - Main.dust[blueDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[blueDust].position) * 1.25f; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - if (Projectile.timeLeft < 85) - { - byte b2 = (byte)(Projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, 100); - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Electrified, 90); - } - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - - public override void OnKill(int timeLeft) - { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 32; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - int rando = Main.rand.Next(4, 8); - for (int i = 0; i < rando; i++) - { - int dust = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, DustID.IceTorch, 0f, 0f, 100, default, 2f); - Main.dust[dust].velocity *= 2f; - Main.dust[dust].noGravity = true; - } - } - } -} diff --git a/Projectiles/Ranged/Bolt.png b/Projectiles/Ranged/Bolt.png deleted file mode 100644 index c9fe916dbf..0000000000 Binary files a/Projectiles/Ranged/Bolt.png and /dev/null differ diff --git a/Projectiles/Ranged/ChargedBlastSplit.cs b/Projectiles/Ranged/ChargedBlastSplit.cs index ed90969521..9251ff639d 100644 --- a/Projectiles/Ranged/ChargedBlastSplit.cs +++ b/Projectiles/Ranged/ChargedBlastSplit.cs @@ -76,10 +76,11 @@ namespace CalamityMod.Projectiles.Ranged } if (Projectile.timeLeft <= 500 && Svant && goToMouse && Projectile.timeLeft % Projectile.extraUpdates == 0) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 mouseSpot = (player.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * homeSpeed; Projectile.velocity.X = MathHelper.Lerp(Projectile.velocity.X, mouseSpot.X, 0.085f); Projectile.velocity.Y = MathHelper.Lerp(Projectile.velocity.Y, mouseSpot.Y, 0.085f); - if (Vector2.Distance(Projectile.Center, player.Calamity().mouseWorld) < 80) + if (Vector2.Distance(Projectile.Center, player.ClampedMouseWorld()) < 80) { Projectile.timeLeft = 300; Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * homeSpeed / 2; diff --git a/Projectiles/Ranged/ClockworkBowHoldout.cs b/Projectiles/Ranged/ClockworkBowHoldout.cs index 3e4f123dde..172ffb6528 100644 --- a/Projectiles/Ranged/ClockworkBowHoldout.cs +++ b/Projectiles/Ranged/ClockworkBowHoldout.cs @@ -152,8 +152,10 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.myPlayer == Projectile.owner) { - float interpolant = Utils.GetLerpValue(5f, 25f, Owner.Distance(Main.MouseWorld), true); + float interpolant = Utils.GetLerpValue(5f, 25f, Owner.Distance(Owner.ClampedMouseWorld()), true); Vector2 oldVelocity = Projectile.velocity; + + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = Vector2.Lerp(Projectile.velocity, Owner.SafeDirectionTo(Main.MouseWorld), interpolant); if (Projectile.velocity != oldVelocity) { diff --git a/Projectiles/Ranged/CondemnationArrow.cs b/Projectiles/Ranged/CondemnationArrow.cs index a35be9307b..a3f208088d 100644 --- a/Projectiles/Ranged/CondemnationArrow.cs +++ b/Projectiles/Ranged/CondemnationArrow.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Ranged; Projectile.arrow = true; - Projectile.extraUpdates = 1; + Projectile.extraUpdates = 2; Projectile.timeLeft = 300; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } diff --git a/Projectiles/Ranged/CondemnationArrowHoming.cs b/Projectiles/Ranged/CondemnationArrowHoming.cs index c9c5268e33..23d7c8f793 100644 --- a/Projectiles/Ranged/CondemnationArrowHoming.cs +++ b/Projectiles/Ranged/CondemnationArrowHoming.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = true; Projectile.DamageType = DamageClass.Ranged; Projectile.arrow = true; - Projectile.extraUpdates = 1; + Projectile.extraUpdates = 2; Projectile.timeLeft = 300; } diff --git a/Projectiles/Ranged/ExoCrystalArrow.cs b/Projectiles/Ranged/ExoCrystalArrow.cs index add3758658..e51f5150fe 100644 --- a/Projectiles/Ranged/ExoCrystalArrow.cs +++ b/Projectiles/Ranged/ExoCrystalArrow.cs @@ -37,6 +37,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; + Projectile.extraUpdates = 1; Projectile.timeLeft = 300; Projectile.arrow = true; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; diff --git a/Projectiles/Ranged/FlakKrakenHoldout.cs b/Projectiles/Ranged/FlakKrakenHoldout.cs index 5e05ab6402..71f1228313 100644 --- a/Projectiles/Ranged/FlakKrakenHoldout.cs +++ b/Projectiles/Ranged/FlakKrakenHoldout.cs @@ -33,6 +33,14 @@ namespace CalamityMod.Projectiles.Ranged public override void HoldoutAI() { + // 15NOV2024: Ozzatron: applying clamped mouse position here is difficult. + // Rockets need to explode "at the cursor", but they do so by storing range to explode. + // Allowing rockets to explode at an unclamped cursor enables higher-resolution screens to have a precision DPS advantage. + // However, clamping the cursor causes the projectiles to explode at incorrect times and places. + // The solution is to use an unclamped cursor, but separately and manually clamp the explosion distance. + // Technically speaking this allows for applying precision DPS at a further vertical distance than intended, + // but the alternative is way too hard to program and will just piss people off. + // // The vector between the player and the mouse. Vector2 ownerToMouse = Owner.Calamity().mouseWorld - Owner.MountedCenter; @@ -72,6 +80,9 @@ namespace CalamityMod.Projectiles.Ranged break; } + // 15NOV2024: Ozzatron: manually clamp flak explosion distance + float flakDist = MathHelper.Clamp(ownerToMouse.Length(), 0f, 960f); + // Spawns the projectile. Projectile.NewProjectile( Projectile.GetSource_FromThis(), @@ -82,7 +93,7 @@ namespace CalamityMod.Projectiles.Ranged itemKnockback, Projectile.owner, rocketTypeShot, - ownerToMouse.Length()); + flakDist); // Applies the knockback to the player. Owner.velocity += ownerToMouse.SafeNormalize(Vector2.UnitY) * -OwnerKnockbackStrength; diff --git a/Projectiles/Ranged/FlakToxicannonHoldout.cs b/Projectiles/Ranged/FlakToxicannonHoldout.cs index b8e3ba2345..c257dcc7a0 100644 --- a/Projectiles/Ranged/FlakToxicannonHoldout.cs +++ b/Projectiles/Ranged/FlakToxicannonHoldout.cs @@ -34,6 +34,14 @@ namespace CalamityMod.Projectiles.Ranged // The center of the player, taking into account if they have a mount or not. Vector2 mountedCenter = Owner.MountedCenter; + // 15NOV2024: Ozzatron: applying clamped mouse position here is difficult. + // Rockets need to explode "at the cursor", but they do so by storing range to explode. + // Allowing rockets to explode at an unclamped cursor enables higher-resolution screens to have a precision DPS advantage. + // However, clamping the cursor causes the projectiles to explode at incorrect times and places. + // The solution is to use an unclamped cursor, but separately and manually clamp the explosion distance. + // Technically speaking this allows for applying precision DPS at a further vertical distance than intended, + // but the alternative is way too hard to program and will just piss people off. + // // The vector between the player and the mouse. Vector2 ownerToMouse = Owner.Calamity().mouseWorld - mountedCenter; @@ -69,6 +77,9 @@ namespace CalamityMod.Projectiles.Ranged break; } + // 15NOV2024: Ozzatron: manually clamp flak explosion distance + float flakDist = MathHelper.Clamp(ownerToMouse.Length(), 0f, 960f); + // Spawns the projectile. Projectile.NewProjectile( Projectile.GetSource_FromThis(), @@ -79,7 +90,7 @@ namespace CalamityMod.Projectiles.Ranged itemKnockback, Projectile.owner, rocketTypeShot, - ownerToMouse.Length()); + flakDist); // Applies the knockback to the player. Owner.velocity += ownerToMouse.SafeNormalize(Vector2.UnitY) * -OwnerKnockbackStrength; diff --git a/Projectiles/Ranged/GodSlayerSlugProj.cs b/Projectiles/Ranged/GodSlayerSlugProj.cs index cbd98e805f..5e47ed764b 100644 --- a/Projectiles/Ranged/GodSlayerSlugProj.cs +++ b/Projectiles/Ranged/GodSlayerSlugProj.cs @@ -119,6 +119,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.netUpdate = true; Projectile.tileCollide = false; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + // Step 1 of the warp: Place the bullet behind the player, opposite the mouse cursor. Vector2 playerToMouseVec = CalamityUtils.SafeDirectionTo(Main.LocalPlayer, Main.MouseWorld, -Vector2.UnitY); float warpDist = Main.rand.NextFloat(70f, 96f); diff --git a/Projectiles/Ranged/HeavenlyGaleProj.cs b/Projectiles/Ranged/HeavenlyGaleProj.cs index 9902e03773..aadec5896c 100644 --- a/Projectiles/Ranged/HeavenlyGaleProj.cs +++ b/Projectiles/Ranged/HeavenlyGaleProj.cs @@ -160,6 +160,8 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.myPlayer == Projectile.owner) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, this is only used to aim the Heavenly Gale bow + float aimInterpolant = Utils.GetLerpValue(10f, 40f, Projectile.Distance(Main.MouseWorld), true); Vector2 oldVelocity = Projectile.velocity; Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), aimInterpolant); diff --git a/Projectiles/Ranged/HydraHead.cs b/Projectiles/Ranged/HydraHead.cs index 6cccc366b3..f6439a1330 100644 --- a/Projectiles/Ranged/HydraHead.cs +++ b/Projectiles/Ranged/HydraHead.cs @@ -73,6 +73,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localAI[0] = 1f; } + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 aimDestination = Owner.Calamity().mouseWorld; float idealRotation = Projectile.AngleTo(aimDestination); if (Time < 0f) diff --git a/Projectiles/Ranged/KingsbaneHoldout.cs b/Projectiles/Ranged/KingsbaneHoldout.cs index 4f7c6b7c73..633f1e94a7 100644 --- a/Projectiles/Ranged/KingsbaneHoldout.cs +++ b/Projectiles/Ranged/KingsbaneHoldout.cs @@ -149,6 +149,8 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.myPlayer == Projectile.owner) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, this is only used to aim the Kingsbane itself + float interpolant = Utils.GetLerpValue(0f, 55f, Owner.Distance(Main.MouseWorld), true); Vector2 oldVelocity = Projectile.velocity; Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), 0.185f).SafeNormalize(Vector2.UnitY); diff --git a/Projectiles/Ranged/LeviatitanMeteor.cs b/Projectiles/Ranged/LeviatitanMeteor.cs index 3cc53d20e9..76d7062dc8 100644 --- a/Projectiles/Ranged/LeviatitanMeteor.cs +++ b/Projectiles/Ranged/LeviatitanMeteor.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.height = 38; Projectile.friendly = true; Projectile.penetrate = 1; + Projectile.extraUpdates = 1; Projectile.timeLeft = Lifetime; Projectile.DamageType = DamageClass.Ranged; } diff --git a/Projectiles/Ranged/MaelstromHoldout.cs b/Projectiles/Ranged/MaelstromHoldout.cs index b67a1b6cdb..4825992c84 100644 --- a/Projectiles/Ranged/MaelstromHoldout.cs +++ b/Projectiles/Ranged/MaelstromHoldout.cs @@ -105,6 +105,8 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.myPlayer == Projectile.owner) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, this is only used to aim the Maelstrom bow + float aimInterpolant = Utils.GetLerpValue(5f, 25f, Projectile.Distance(Main.MouseWorld), true); Vector2 oldVelocity = Projectile.velocity; Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), aimInterpolant); diff --git a/Projectiles/Ranged/MineralMortarHoldout.cs b/Projectiles/Ranged/MineralMortarHoldout.cs index 494c7d15f4..06c9d2f8cb 100644 --- a/Projectiles/Ranged/MineralMortarHoldout.cs +++ b/Projectiles/Ranged/MineralMortarHoldout.cs @@ -22,6 +22,7 @@ namespace CalamityMod.Projectiles.Ranged public override void HoldoutAI() { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 mouse = Owner.Calamity().mouseWorld; Time++; diff --git a/Projectiles/Ranged/NorfleetCannon.cs b/Projectiles/Ranged/NorfleetCannon.cs index 7d1661b57b..909d6ae4c8 100644 --- a/Projectiles/Ranged/NorfleetCannon.cs +++ b/Projectiles/Ranged/NorfleetCannon.cs @@ -119,6 +119,7 @@ namespace CalamityMod.Projectiles.Ranged // The center of the player, taking into account if they have a mount or not. Vector2 ownerPosition = Owner.MountedCenter; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // The vector between the player and the mouse. Vector2 ownerToMouse = Owner.Calamity().mouseWorld - ownerPosition; diff --git a/Projectiles/Ranged/Nuke.cs b/Projectiles/Ranged/Nuke.cs deleted file mode 100644 index dd6560362e..0000000000 --- a/Projectiles/Ranged/Nuke.cs +++ /dev/null @@ -1,215 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class Nuke : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public int flarePowderTimer = 12; - private ref float RocketType => ref Projectile.ai[0]; - - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 3; - ProjectileID.Sets.TrailCacheLength[Type] = 3; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 22; - Projectile.height = 22; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 125; - Projectile.DamageType = DamageClass.Ranged; - } - - public override void AI() - { - //Animation - Projectile.frameCounter++; - if (Projectile.frameCounter > 7) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 2) - { - Projectile.frame = 0; - } - - //Rotation - Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); - Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * Projectile.direction; - - flarePowderTimer--; - if (flarePowderTimer <= 0) - { - if (Projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 0f); - } - flarePowderTimer = 6; - } - - if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) - { - float halfX = Projectile.velocity.X * 0.5f; - float halfY = Projectile.velocity.Y * 0.5f; - int dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.CopperCoin, 0f, 0f, 100, default, 1f); - Main.dust[dust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[dust].velocity *= 0.2f; - Main.dust[dust].noGravity = true; - dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.CopperCoin, 0f, 0f, 100, default, 0.5f); - Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[dust].velocity *= 0.05f; - } - - if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) - { - Projectile.ignoreWater = false; - if (Projectile.wet) - Projectile.timeLeft = 1; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 300); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.33), Projectile.knockBack, Projectile.owner, 0f, 2f); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(ModContent.BuffType(), 300); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.33), Projectile.knockBack, Projectile.owner, 0f, 2f); - } - - public override void OnKill(int timeLeft) - { - Projectile.ExpandHitboxBy(192); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int i = 0; i < 40; i++) - { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); - Main.dust[idx].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[idx].scale = 0.5f; - Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int i = 0; i < 60; i++) - { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 3f); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); - Main.dust[idx].velocity *= 2f; - } - - if (Main.netMode != NetmodeID.Server) - { - Vector2 goreSource = Projectile.Center; - int goreAmt = 10; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) - { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) - { - velocityMult = 0.66f; - } - if (goreIndex >= (2 * goreAmt / 3)) - { - velocityMult = 1f; - } - Mod mod = ModContent.GetInstance(); - int type = Main.rand.Next(61, 64); - int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } - } - - // Only do rocket effects for the owner client side - if (Projectile.owner != Main.myPlayer) - return; - - int blastRadius = 0; - if (RocketType == ItemID.RocketII) - blastRadius = 6; - else if (RocketType == ItemID.RocketIV) - blastRadius = 12; - else if (RocketType == ItemID.MiniNukeII) - blastRadius = 18; - - Projectile.ExpandHitboxBy(22); - - if (blastRadius > 0) - Projectile.ExplodeTiles(blastRadius); - - Point center = Projectile.Center.ToTileCoordinates(); - DelegateMethods.v2_1 = center.ToVector2(); - DelegateMethods.f_1 = 4f; - if (RocketType == ItemID.DryRocket) - { - DelegateMethods.f_1 = 4.5f; - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); - } - else if (RocketType == ItemID.WetRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); - } - else if (RocketType == ItemID.LavaRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); - } - else if (RocketType == ItemID.HoneyRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); - } - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - } -} diff --git a/Projectiles/Ranged/Nuke.png b/Projectiles/Ranged/Nuke.png deleted file mode 100644 index d855762b23..0000000000 Binary files a/Projectiles/Ranged/Nuke.png and /dev/null differ diff --git a/Projectiles/Ranged/NukeOfBliss.cs b/Projectiles/Ranged/NukeOfBliss.cs new file mode 100644 index 0000000000..a8ff6adc94 --- /dev/null +++ b/Projectiles/Ranged/NukeOfBliss.cs @@ -0,0 +1,224 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.Projectiles.Ranged.BlissfulBombardierHoldout; + +namespace CalamityMod.Projectiles.Ranged +{ + public class NukeOfBliss : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + private ref float RocketID => ref Projectile.ai[0]; + public ref float time => ref Projectile.ai[2]; + public int reachedPeakTime = 120; + public int rainDownTimer = 150; + public NPC targeted; + public float fade = 1; + + public override void SetDefaults() + { + Projectile.width = 36; + Projectile.height = 64; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.extraUpdates = 2; + Projectile.timeLeft = 700; + Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Vector2 mouse = Owner.ClampedMouseWorld(); + if (Projectile.Center.Y > mouse.Y && rainDownTimer <= 0) + Projectile.tileCollide = true; + + //Rotation + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * Projectile.direction; + + if (time > reachedPeakTime) + { + if (rainDownTimer > 1) // Make sure the missiles are raining down from above your cursor + { + Projectile.Center = new Vector2(mouse.X, Owner.Center.Y) + new Vector2(0, -600); + } + + if (targeted == null || rainDownTimer > 0) + targeted = (rainDownTimer == 0 ? Projectile.Center + Projectile.velocity * 4 : mouse).ClosestNPCAt(rainDownTimer == 0 ? 350 : 250); + if (targeted != null && Projectile.Center.Y > targeted.Center.Y) + targeted = null; + + if (rainDownTimer >= 80) + { + bool isClusterRocket = (RocketID == ItemID.ClusterRocketI || RocketID == ItemID.ClusterRocketII); + if (rainDownTimer % 15 == 0) + { + SoundStyle fire = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastShoot"); + SoundEngine.PlaySound(fire with { Volume = 0.45f, Pitch = (0 - 0.3f * Utils.GetLerpValue(0, 300, rainDownTimer, true)) }, Projectile.Center); + for (int i = 0; i < (isClusterRocket ? 4 : 2); i++) + { + // 15NOV2024: Ozzatron: clamped mouse position is not used here intentionally so split rockets can attempt to go to your mouse's real position + Vector2 variance = (i % 2 == 0 ? 0.2f : 1) * (new Vector2(80 * (isClusterRocket ? 3 : 1), 0) * Main.rand.NextFloat(-1f, 1f)); + Vector2 velocity = (((targeted != null ? targeted.Center : Owner.Calamity().mouseWorld) - Projectile.Center).SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(8, 12)) + variance * 0.008f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + variance, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * (isClusterRocket ? 0.15f : 0.3f)), Projectile.knockBack, Projectile.owner, Projectile.ai[0], 0f); + } + } + } + if (rainDownTimer > 0) + rainDownTimer--; + if (rainDownTimer == 65) + { + for (int i = 0; i < 3; i++) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/MissileNearing"); + SoundEngine.PlaySound(sound with { Volume = 0.6f, Pitch = 0.4f, MaxInstances = 2 }, Projectile.Center); + } + } + if (rainDownTimer == 1) + { + targeted = null; + Projectile.extraUpdates = 10; + Projectile.penetrate = 1; + Projectile.velocity = ((targeted != null ? targeted.Center : mouse) - Projectile.Center).SafeNormalize(Vector2.UnitX) * 15; + } + if (rainDownTimer == 0) + { + Particle spark2 = new SparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 19, 1.7f, Color.Goldenrod); + GeneralParticleHandler.SpawnParticle(spark2); + if (targeted != null && targeted.Center.Y > Projectile.Center.Y) + { + // Since this uses either mouse or target position, it will not use the homing Utility + Vector2 moveToTrackingPos = ((targeted != null ? targeted.Center : mouse) - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 15) + Projectile.velocity = Projectile.velocity * 0.98f + moveToTrackingPos * 2.5f; + else + Projectile.velocity *= 0.9f; + } + } + } + else + Projectile.velocity *= 0.995f; + + fade = rainDownTimer > 0 ? Utils.GetLerpValue(reachedPeakTime, reachedPeakTime * 0.7f, time, true) : 1; + if (fade > 0.2f) + { + Particle smoke = new HeavySmokeParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.6f), staticEffectsColor, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.3f, 0.6f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + } + + if (RocketID == ItemID.DryRocket || RocketID == ItemID.WetRocket || RocketID == ItemID.LavaRocket || RocketID == ItemID.HoneyRocket) + { + Projectile.ignoreWater = false; + if (Projectile.wet) + Projectile.timeLeft = 1; + } + + time++; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 300); + } + public override void OnKill(int timeLeft) + { + // Only do rocket effects for the owner client side + if (Projectile.owner != Main.myPlayer) + return; + + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID) + { + // Since we use our own spawning method for the cluster rockets, we don't need them to shoot anything, + // we'll do it ourselves. + clusterProjectileID = ProjectileID.None, + destructiveClusterProjectileID = ProjectileID.None, + }; + + bool isClusterRocket = (RocketID == ItemID.ClusterRocketI || RocketID == ItemID.ClusterRocketII); + SoundStyle fire = new("CalamityMod/Sounds/Item/MineralMortarExplode"); + SoundEngine.PlaySound(fire with { Volume = 0.9f, Pitch = 0.4f }, Projectile.Center); + SoundStyle fire2 = new("CalamityMod/Sounds/Item/BlazingCoreParry"); + SoundEngine.PlaySound(fire2 with { Volume = 0.9f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + + int blastRadius = (int)(MathHelper.Clamp(Projectile.RocketBehavior(info), 3, 100)); + Projectile.ExpandHitboxBy((float)blastRadius); + Projectile.damage = (int)(Projectile.damage * 0.5f); + Projectile.penetrate = -1; + Projectile.Damage(); + + float blastRadiusVisual = blastRadius * 0.5f; + + Particle orb4 = new CustomPulse(Projectile.Center, Vector2.Zero, staticEffectsColor, "CalamityMod/Particles/SoftRoundExplosion", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.07f * blastRadiusVisual, 19); + GeneralParticleHandler.SpawnParticle(orb4); + Particle orb5 = new CustomPulse(Projectile.Center, Vector2.Zero, effectsColor, "CalamityMod/Particles/SoftRoundExplosion", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.05f * blastRadiusVisual, 19); + GeneralParticleHandler.SpawnParticle(orb5); + + for (int i = 0; i < 3; i++) + { + Particle orb3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.45f * blastRadiusVisual, 15, true); + GeneralParticleHandler.SpawnParticle(orb3); + } + + for (int i = 0; i < 40; i++) + { + Dust c = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + c.velocity = (MathHelper.TwoPi * i / 40f).ToRotationVector2() * 8.5f * (i % 2 == 0 ? 0.88f : 1f) * blastRadiusVisual; + c.scale = Main.rand.NextFloat(0.3f, 0.6f) * blastRadius * 0.3f * (i % 2 == 0 ? 2.2f : 1.8f); + c.noGravity = true; + c.color = effectsColor; + c.noLightEmittence = true; + } + for (int i = 0; i < 25; i++) + { + if (i < 14) + { + Particle spark = new CustomSpark(Projectile.Center, new Vector2(4, 4).RotatedByRandom(100) * blastRadiusVisual * Main.rand.NextFloat(0.3f, 1f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 27, Main.rand.NextFloat(2.45f, 2.7f), Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)), new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.35f, 0.4f)); + GeneralParticleHandler.SpawnParticle(spark); + } + else + { + Dust l = Dust.NewDustPerfect(Projectile.Center, 278); + l.velocity = new Vector2(5, 5).RotatedByRandom(100) * blastRadiusVisual * Main.rand.NextFloat(0.4f, 1f); + l.scale = Main.rand.NextFloat(0.6f, 0.8f) * blastRadiusVisual * 0.2f * (i % 2 == 0 ? 2.2f : 1.8f); + l.noGravity = false; + l.color = staticEffectsColor; + } + } + for (int i = 0; i < 15; i++) + { + Vector2 velocity = new Vector2(8, 8).RotatedByRandom(100) * blastRadiusVisual * Main.rand.NextFloat(0.4f, 1f); + Particle spark = new CustomSpark(Projectile.Center, velocity, "CalamityMod/Projectiles/Boss/ProvidenceCrystal", false, 12, 0.15f * blastRadius, Color.White, new Vector2(1.5f, 0.4f), true, false, 0, false, false, 0.7f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.35f; + int hitsToMinMult = 10; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult * (rainDownTimer <= 0 ? 1 : 0.2f); + } + public override bool? CanDamage() => (fade <= 0.2f) ? false : null; + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Ranged/NukeOfBliss").Value; + + float fade2 = rainDownTimer > 0 ? Utils.GetLerpValue(reachedPeakTime, reachedPeakTime * 0.7f, time) : 1; + Projectile.DrawProjectileWithBackglow(staticEffectsColor with { A = 0 } * fade2, lightColor * fade2, 6f * Utils.GetLerpValue(0, reachedPeakTime, time, true), texture); + return false; + } + } +} diff --git a/Projectiles/Ranged/NukeOfBliss.png b/Projectiles/Ranged/NukeOfBliss.png new file mode 100644 index 0000000000..73cc8955e2 Binary files /dev/null and b/Projectiles/Ranged/NukeOfBliss.png differ diff --git a/Projectiles/Ranged/NullFlash.cs b/Projectiles/Ranged/NullFlash.cs index a58bcfe1b7..ec3454dacf 100644 --- a/Projectiles/Ranged/NullFlash.cs +++ b/Projectiles/Ranged/NullFlash.cs @@ -70,6 +70,7 @@ namespace CalamityMod.Projectiles.Ranged } if (target.CanBeMoved(true)) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // Custom knockback Vector2 launchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -20; target.velocity = launchVel * (target.knockBackResist == 0 ? 0.5f : 1f); diff --git a/Projectiles/Ranged/NullShot.cs b/Projectiles/Ranged/NullShot.cs index 73d93eb49b..cfe9b11904 100644 --- a/Projectiles/Ranged/NullShot.cs +++ b/Projectiles/Ranged/NullShot.cs @@ -117,12 +117,7 @@ namespace CalamityMod.Projectiles.Ranged NPC targetedNPC = Projectile.Center.ClosestNPCAt(700); if (targetedNPC != null && time > 30 && Projectile.numHits < 1 && Vector2.Distance(targetedNPC.Center, Projectile.Center) < 700) { - Vector2 position = targetedNPC.Center; - Vector2 moveToMouse = (position - Projectile.Center).SafeNormalize(Vector2.UnitX); - if (Projectile.velocity.Length() < 8 - (Utils.GetLerpValue(150, 0, Projectile.timeLeft, true) * 2)) - Projectile.velocity += moveToMouse * (0.42f + Utils.GetLerpValue(300, 150, Projectile.timeLeft, true)); - else - Projectile.velocity *= 0.9f; + CalamityUtils.HomeInOnSelectedNPC(Projectile, targetedNPC, true, 0.2f, 8, 0.97f, accelerate: true); } } else diff --git a/Projectiles/Ranged/OntologicalDespoilerGrenade.cs b/Projectiles/Ranged/OntologicalDespoilerGrenade.cs index 1a9d76454b..975405f5ca 100644 --- a/Projectiles/Ranged/OntologicalDespoilerGrenade.cs +++ b/Projectiles/Ranged/OntologicalDespoilerGrenade.cs @@ -115,13 +115,8 @@ namespace CalamityMod.Projectiles.Ranged NPC targetedNPC = Projectile.Center.ClosestNPCAt(1200); if (targetedNPC != null && time > 30 && Projectile.numHits < 1 && Vector2.Distance(targetedNPC.Center, Projectile.Center) < 1200) { - Vector2 position = targetedNPC.Center; - Vector2 moveToMouse = (position - Projectile.Center).SafeNormalize(Vector2.UnitX); - Vector2 moveSpeed = moveToMouse * (Utils.GetLerpValue(570, 120, Projectile.timeLeft, true)); - if (Projectile.velocity.Length() < 7 - (Utils.GetLerpValue(350, 0, Projectile.timeLeft, true))) - Projectile.velocity = Projectile.velocity * 0.99f + moveSpeed; - else - Projectile.velocity *= 0.94f; + float moveSpeed = Utils.GetLerpValue(570, 120, Projectile.timeLeft, true); + CalamityUtils.HomeInOnSelectedNPC(Projectile, targetedNPC, true, moveSpeed, 7, 0.98f, accelerate: true); explode = true; } time++; diff --git a/Projectiles/Ranged/OntologicalDespoilerShot.cs b/Projectiles/Ranged/OntologicalDespoilerShot.cs index 62658baf77..501f4290c2 100644 --- a/Projectiles/Ranged/OntologicalDespoilerShot.cs +++ b/Projectiles/Ranged/OntologicalDespoilerShot.cs @@ -141,12 +141,8 @@ namespace CalamityMod.Projectiles.Ranged NPC targetedNPC = Projectile.Center.ClosestNPCAt(700); if (targetedNPC != null && time > 30 && Projectile.numHits < 1 && Vector2.Distance(targetedNPC.Center, Projectile.Center) < 700) { - Vector2 position = targetedNPC.Center; - Vector2 moveToMouse = (position - Projectile.Center).SafeNormalize(Vector2.UnitX); - if (Projectile.velocity.Length() < 8 - (Utils.GetLerpValue(350, 0, Projectile.timeLeft, true) * 2)) - Projectile.velocity = Projectile.velocity * 0.95f + moveToMouse * (0.42f + Utils.GetLerpValue(650, 450, Projectile.timeLeft, true)); - else - Projectile.velocity *= 0.9f; + float moveSpeed = (0.42f + Utils.GetLerpValue(650, 450, Projectile.timeLeft, true)); + CalamityUtils.HomeInOnSelectedNPC(Projectile, targetedNPC, true, moveSpeed, 8, 0.95f, accelerate: true); } } else diff --git a/Projectiles/Ranged/PhotovisceratorHoldout.cs b/Projectiles/Ranged/PhotovisceratorHoldout.cs index 3038418116..080a582e7b 100644 --- a/Projectiles/Ranged/PhotovisceratorHoldout.cs +++ b/Projectiles/Ranged/PhotovisceratorHoldout.cs @@ -249,6 +249,8 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.myPlayer == Projectile.owner) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, this is only used to aim the Photoviscerator itself + float interpolant = Utils.GetLerpValue(5f, 90f, Projectile.Distance(Main.MouseWorld), true); Vector2 oldVelocity = Projectile.velocity; Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), interpolant); diff --git a/Projectiles/Ranged/PrismMine.cs b/Projectiles/Ranged/PrismMine.cs index de7662ace0..d0bcb38d43 100644 --- a/Projectiles/Ranged/PrismMine.cs +++ b/Projectiles/Ranged/PrismMine.cs @@ -24,6 +24,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; + Projectile.extraUpdates = 1; Projectile.localNPCHitCooldown = 7; Projectile.timeLeft = 280; } diff --git a/Projectiles/Ranged/PristineFire.cs b/Projectiles/Ranged/PristineFire.cs index 00bf2f3f8a..38a8616c6e 100644 --- a/Projectiles/Ranged/PristineFire.cs +++ b/Projectiles/Ranged/PristineFire.cs @@ -3,10 +3,12 @@ using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -17,39 +19,66 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Particles/MediumMist"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 20; - ProjectileID.Sets.TrailingMode[Type] = 2; - } - public float smokeOpa = 0.25f; + public ref float time => ref Projectile.ai[2]; + public Vector2 beamPos; + public Vector2 beamPos2; + public bool hasIgnited = false; + + public int boomTime = PristineFury.boomTime; public override void SetDefaults() { - Projectile.width = Projectile.height = 6; + Projectile.width = Projectile.height = 40; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.MaxUpdates = 4; + Projectile.MaxUpdates = 5; Projectile.timeLeft = 120; + Projectile.tileCollide = false; } public override void AI() { - if (Projectile.timeLeft < 118) + float mult = Utils.GetLerpValue(140, 75, Projectile.timeLeft, true); + + Lighting.AddLight(Projectile.Center, Color.Lerp(Color.Red, Color.Goldenrod, mult).ToVector3() * 0.7f); + + if (Projectile.timeLeft < 116) { - if (smokeOpa > 0) - smokeOpa -= 0.02f; + float sine = (float)Math.Sin(time * 0.65f / MathHelper.Pi); - Lighting.AddLight(Projectile.Center, 1f, 1f, 0.25f); - - // Light smoke - Color smokeColor = new Color(255, Main.rand.Next(160, 230 + 1), 100, 100); - Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(smokeOpa * 10) * (Main.rand.NextFloat(0.4f, 0.65f) - smokeOpa), smokeColor, 16, Main.rand.NextFloat(0.6f, 1.2f), 0.2f + smokeOpa, glowing: true); - GeneralParticleHandler.SpawnParticle(smoke); + beamPos = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * (30f * mult * -1) * Utils.GetLerpValue(116, 108, Projectile.timeLeft, true); + beamPos2 = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * (30f * mult) * Utils.GetLerpValue(116, 108, Projectile.timeLeft, true); + for (int i = 0; i < 2; i++) + { + Particle beam = new CustomSpark(i == 0 ? beamPos : beamPos2, Projectile.velocity * 0.1f, "CalamityMod/Particles/SmallBloom", false, 6, (0.065f * mult) + 0.01f, Color.Lerp(Color.Red, Color.Goldenrod, mult), new Vector2(1f, 2.5f), true, false); + GeneralParticleHandler.SpawnParticle(beam); + } } + + if (!hasIgnited) + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (Vector2.Distance(Projectile.Center, projectile.Center) <= 100 && projectile.active && projectile.type == ModContent.ProjectileType() && projectile.Opacity > 0.5f) + { + if (projectile.ai[2] == 0) + { + projectile.ai[2] = boomTime; + hasIgnited = true; + SoundStyle ignite = new("CalamityMod/Sounds/Custom/Providence/ProvidenceBurn"); + SoundEngine.PlaySound(ignite with { Volume = 1f, Pitch = Main.rand.NextFloat(0.5f, 0.6f), SoundLimitBehavior = SoundLimitBehavior.IgnoreNew }, Projectile.Center); + } + else + hasIgnited = true; + } + } + } + Projectile.rotation = Projectile.velocity.ToRotation(); + time--; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); @@ -63,11 +92,15 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localNPCHitCooldown = 10; Projectile.Damage(); - LineParticle spark = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.23f, 0.56f)) * Main.rand.NextFloat(0.4f, 2.5f), false, 8, 1.2f, Main.rand.NextBool() ? Color.Orange : Color.DarkOrange); - GeneralParticleHandler.SpawnParticle(spark); - LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.23f, -0.56f)) * Main.rand.NextFloat(0.4f, 2.5f), false, 8, 1.2f, Main.rand.NextBool() ? Color.Orange : Color.DarkOrange); - GeneralParticleHandler.SpawnParticle(spark2); - + for (int i = 0; i < 4; i++) + { + Vector2 linePos = i < 2 ? beamPos : beamPos2; + Vector2 lineVel = (Utils.DirectionFrom(linePos, Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 40) * 3).RotatedByRandom(0.16f) * Main.rand.NextFloat(0.4f, 2.5f); + + Particle beam = new CustomSpark(linePos, lineVel, "CalamityMod/Particles/SmallBloom", false, 11, 0.09f, Main.rand.NextBool() ? Color.Orange : Color.DarkOrange, new Vector2(2f, 1.5f), true, false, 0, false, false, 1.1f); + GeneralParticleHandler.SpawnParticle(beam); + } + for (int i = 0; i <= 3; i++) { Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 169 : 158, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f), 0, default, Main.rand.NextFloat(1.6f, 2.2f)); @@ -83,29 +116,10 @@ namespace CalamityMod.Projectiles.Ranged Particle smoke = new MediumMistParticle(smokePos, smokeVel, Main.rand.NextBool() ? Color.Orange : Color.DarkOrange, Color.Black, Main.rand.NextFloat(0.7f, 1.9f) - velMulti, 225 - Main.rand.Next(60), 0.1f); GeneralParticleHandler.SpawnParticle(smoke); } + } - - public float HelixTrailWidthFunction(float completionRatio) => Utils.GetLerpValue(1f, 0.4f, completionRatio, true) * 1.5f; - public Color HelixTrailColorFunction(float completionRatio) => Projectile.timeLeft < 105 ? Projectile.ai[0] == 1 ? Color.DarkOrange * (1f - completionRatio) : Color.Orange * (1f - completionRatio) : Color.Transparent; - public override bool PreDraw(ref Color lightColor) { - // Draw a double helix trail - for (int direction = -1; direction <= 1; direction += 2) - { - List trailPositions = new List(); - int trailPoints = ProjectileID.Sets.TrailCacheLength[Type]; - // Add points adjusted for sine - for (int i = 0; i < Projectile.oldPos.Length; i++) - { - if (Projectile.oldPos[i] == Vector2.Zero) - break; - - Vector2 sinOffset = (Vector2.UnitY * direction * MathF.Sin(i * MathHelper.Pi * 0.125f) * 24f).RotatedBy(Projectile.oldRot[i]); - trailPositions.Add(Projectile.oldPos[i] + sinOffset); - } - PrimitiveRenderer.RenderTrail(trailPositions, new(HelixTrailWidthFunction, HelixTrailColorFunction, (_) => Projectile.Size * 0.5f), 60); - } return false; } } diff --git a/Projectiles/Ranged/PristineSecondary.cs b/Projectiles/Ranged/PristineSecondary.cs index be33fda1e1..b796cff7d9 100644 --- a/Projectiles/Ranged/PristineSecondary.cs +++ b/Projectiles/Ranged/PristineSecondary.cs @@ -1,8 +1,13 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -14,9 +19,13 @@ namespace CalamityMod.Projectiles.Ranged public override string Texture => "CalamityMod/Projectiles/Magic/RancorFog"; public ref float ScaleFactor => ref Projectile.ai[0]; - public ref float LightPower => ref Projectile.ai[1]; + public float LightPower = 0; - public Color FogColor = new Color(255, 220, 100); + public Color FogColor = Color.Orchid; + public float FogRotation = 0; + public int boomTime = PristineFury.boomTime; + + public bool Ignited = false; public override void SetDefaults() { @@ -26,27 +35,51 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = -1; - Projectile.timeLeft = 150; + Projectile.timeLeft = 230; Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 2; } public override void AI() { - // Add some degree of variation to the fog with scale/rotation/color - if (Projectile.ai[2] == 0f) - { - Projectile.scale = Main.rand.NextFloat(0.15f, 0.75f); - Projectile.ai[2] = Main.rand.NextFloat(MathHelper.TwoPi); - FogColor.G = (byte)Main.rand.Next(160, 230 + 1); - } - ScaleFactor += 0.01f; - ScaleFactor = MathHelper.Clamp(ScaleFactor, 0f, Projectile.scale); - Lighting.AddLight(Projectile.Center, new Vector3(1f, 1f, 0.25f) * ScaleFactor); - Projectile.rotation = Projectile.velocity.ToRotation() + Projectile.ai[2]; + // Deadshot Brooch moment + if (Projectile.MaxUpdates > 1) + Projectile.MaxUpdates = 1; - Projectile.velocity *= 0.98f; - Projectile.Opacity = Utils.GetLerpValue(150f, 135f, Projectile.timeLeft, true) * Utils.GetLerpValue(0f, 90f, Projectile.timeLeft, true); + if (Projectile.ai[2] == boomTime) + Ignited = true; + if (Ignited) + { + if (Projectile.ai[2] == boomTime) + { + Projectile.damage *= 7; // This is probably too much lol + FogColor = Color.Lerp(Color.OrangeRed, Color.Goldenrod, Main.rand.NextFloat()); + + SoundStyle ignite = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastImpact"); + SoundEngine.PlaySound(ignite with { Volume = 0.4f, Pitch = Main.rand.NextFloat(0.5f, 0.6f) }, Projectile.Center); + } + FogColor = Color.Lerp(Color.OrangeRed, Color.Goldenrod, Main.rand.NextFloat(0.5f, 1)); + if (Projectile.timeLeft > boomTime + 1) + Projectile.timeLeft = (int)(Projectile.timeLeft * 0.95f); + Projectile.scale *= 1.12f; + ScaleFactor *= 1.06f; + if (Projectile.ai[2] > 1) + Projectile.ai[2]--; + } + // Add some degree of variation to the fog with scale/rotation/color + if (FogRotation == 0f) + { + Projectile.scale = Main.rand.NextFloat(0.62f, 1.15f); + FogRotation = Main.rand.NextFloat(MathHelper.TwoPi); + FogColor.G += (byte)Main.rand.Next(10, 80 + 1); + } + ScaleFactor += 0.014f; + ScaleFactor = MathHelper.Clamp(ScaleFactor, 0f, Projectile.scale); + Lighting.AddLight(Projectile.Center,FogColor.ToVector3() * ScaleFactor); + Projectile.rotation = Projectile.velocity.ToRotation() + FogRotation; + + Projectile.velocity *= Main.rand.NextFloat(0.95f, 0.99f); + Projectile.Opacity = Utils.GetLerpValue(280f, 135f, Projectile.timeLeft, true) * Utils.GetLerpValue(0f, 90f, Projectile.timeLeft, true); // 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information. if (Main.netMode == NetmodeID.Server) @@ -56,11 +89,47 @@ namespace CalamityMod.Projectiles.Ranged // Without this, it may render over the fullblack that the game renders for obscured tiles. float lightPowerBelow = Lighting.GetColor((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16 + 6).ToVector3().Length() / (float)Math.Sqrt(3D); LightPower = MathHelper.Lerp(LightPower, lightPowerBelow, 0.15f); + + if (Projectile.timeLeft < 220) + { + Vector2 vel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(7f, 25f) * Projectile.Opacity * Projectile.scale; + + if (Main.rand.NextBool(40)) + { + Particle spark = new CustomSpark(Projectile.Center + vel * 4 * Projectile.Opacity, vel * 0.05f, "CalamityMod/Particles/ProvidenceMarkParticle", false, 25, Main.rand.NextFloat(0.9f, 1.2f) * (Ignited ? 1.8f : 1), FogColor * Projectile.Opacity * 0.4f, new Vector2(1.3f, 0.5f), true, false, (Ignited ? 0 : Main.rand.NextFloat(-4, 4)), false, false, (Ignited ? 0.5f : 0)); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Main.rand.NextBool(30)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), vel * 0.25f * (Ignited ? 2f : 1)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.55f, 0.95f) * Projectile.Opacity * (Ignited ? 2f : 1); + dust.color = FogColor; + } + } + if (Projectile.Opacity > 0.5f && Ignited) + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (Vector2.Distance(Projectile.Center, projectile.Center) <= 200 * Projectile.scale && projectile.active && ((projectile.type == ModContent.ProjectileType() && Projectile.ai[2] == 2 && projectile.ai[2] == 0 && projectile.Opacity > 0.5f)) && projectile != Projectile && Projectile.ai[1] < 100) + { + projectile.ai[2] = boomTime; + Projectile.ai[1] = Projectile.ai[1] + 1; + } + } + } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * ScaleFactor * 0.5f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.Opacity < 0.3f ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * ScaleFactor * 0.5f, targetHitbox); - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Ignited) + { + target.AddBuff(ModContent.BuffType(), 420); + } + } public override bool PreDraw(ref Color lightColor) { @@ -68,7 +137,7 @@ namespace CalamityMod.Projectiles.Ranged Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; - float opacity = Utils.GetLerpValue(0f, 0.08f, LightPower, true) * Projectile.Opacity * 0.5f; + float opacity = Utils.GetLerpValue(0f, 0.08f, LightPower, true) * Projectile.Opacity * 0.7f; Color drawColor = FogColor * opacity; Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, Projectile.rotation, texture.Size() * 0.5f, ScaleFactor, SpriteEffects.None); diff --git a/Projectiles/Ranged/PumplerHoldout.cs b/Projectiles/Ranged/PumplerHoldout.cs index 54844c1430..37048291e9 100644 --- a/Projectiles/Ranged/PumplerHoldout.cs +++ b/Projectiles/Ranged/PumplerHoldout.cs @@ -174,6 +174,8 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.myPlayer == Projectile.owner) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, this is only used to aim the Pumpler itself + float interpolant = Utils.GetLerpValue(5f, 25f, Owner.Distance(Main.MouseWorld), true); Vector2 oldVelocity = Projectile.velocity; Projectile.velocity = Vector2.Lerp(Projectile.velocity, Owner.SafeDirectionTo(Main.MouseWorld), interpolant); diff --git a/Projectiles/Ranged/ScorpioRocket.cs b/Projectiles/Ranged/ScorpioRocket.cs index 4b5e53b013..94e9965fc4 100644 --- a/Projectiles/Ranged/ScorpioRocket.cs +++ b/Projectiles/Ranged/ScorpioRocket.cs @@ -38,6 +38,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.width = Projectile.height = 34; Projectile.timeLeft = 600; Projectile.localNPCHitCooldown = -1; + Projectile.extraUpdates = 1; Projectile.friendly = true; Projectile.usesLocalNPCImmunity = true; } diff --git a/Projectiles/Ranged/SevensStrikerCherry.cs b/Projectiles/Ranged/SevensStrikerCherry.cs index 5bc834bd1d..62daf522cb 100644 --- a/Projectiles/Ranged/SevensStrikerCherry.cs +++ b/Projectiles/Ranged/SevensStrikerCherry.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Ranged; + +using CalamityMod.Items.Weapons.Ranged; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -16,6 +17,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.height = 20; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 1; Projectile.timeLeft = 300; } diff --git a/Projectiles/Ranged/SuperradiantSaw.cs b/Projectiles/Ranged/SuperradiantSaw.cs index 7104494023..b6e808d15f 100644 --- a/Projectiles/Ranged/SuperradiantSaw.cs +++ b/Projectiles/Ranged/SuperradiantSaw.cs @@ -81,7 +81,8 @@ namespace CalamityMod.Projectiles.Ranged if (Empowered && !Returning && Time > 30) { float homingTurnSpeed = 0.2f; - Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.SafeDirectionTo(Main.MouseWorld).ToRotation(), homingTurnSpeed).ToRotationVector2() * SuperradiantSlaughterer.ShootSpeed; + Vector2 mouse = Owner.ClampedMouseWorld(); + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.SafeDirectionTo(mouse).ToRotation(), homingTurnSpeed).ToRotationVector2() * SuperradiantSlaughterer.ShootSpeed; } // Saws automatically return 2 seconds after hitting an enemy diff --git a/Projectiles/Ranged/SuperradiantSlaughtererHoldout.cs b/Projectiles/Ranged/SuperradiantSlaughtererHoldout.cs index 02017800c3..24ba2a20b3 100644 --- a/Projectiles/Ranged/SuperradiantSlaughtererHoldout.cs +++ b/Projectiles/Ranged/SuperradiantSlaughtererHoldout.cs @@ -82,8 +82,9 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/MeatySlash"), GunTipPosition); // Throws a lingering saw at the cursor that deals 3x damage (since the holdout already deals 2x) - float mouseDist = Vector2.Distance(GunTipPosition, Owner.Calamity().mouseWorld) / 21f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * mouseDist, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner); + float clampedMouseDist = MathHelper.Clamp(Vector2.Distance(GunTipPosition, Owner.Calamity().mouseWorld), 0f, 960f); + float adjustedMouseDist = clampedMouseDist / 21f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * adjustedMouseDist, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner); // Special case: right-clicking while not holding left-click // This is to keep it friendly to use both fires at the same time, but end the animation early if not diff --git a/Projectiles/Ranged/SurgeDriverHoldout.cs b/Projectiles/Ranged/SurgeDriverHoldout.cs index b0542bac73..dbc776ec05 100644 --- a/Projectiles/Ranged/SurgeDriverHoldout.cs +++ b/Projectiles/Ranged/SurgeDriverHoldout.cs @@ -65,6 +65,7 @@ namespace CalamityMod.Projectiles.Ranged projectileType = ModContent.ProjectileType(); knockback = Owner.GetWeaponKnockback(heldItem, knockback); + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 shootDirection = (Main.MouseWorld - Projectile.Center).SafeNormalize(-Vector2.UnitY); Vector2 shootVelocity = shootDirection * shootSpeed; diff --git a/Projectiles/Ranged/TelluricGlareArrow.cs b/Projectiles/Ranged/TelluricGlareArrow.cs index b87de92696..5e6bb758a4 100644 --- a/Projectiles/Ranged/TelluricGlareArrow.cs +++ b/Projectiles/Ranged/TelluricGlareArrow.cs @@ -2,10 +2,10 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.Audio; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -18,9 +18,10 @@ namespace CalamityMod.Projectiles.Ranged public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; private const int Lifetime = 180; - private static Color ShaderColorOne = new Color(237, 194, 66); - private static Color ShaderColorTwo = new Color(235, 227, 117); - private static Color ShaderEndColor = new Color(199, 153, 26); + + public int time = 0; + public int fadeTime = 22; + public bool colorAlt = false; public override void SetStaticDefaults() { @@ -39,15 +40,68 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ignoreWater = true; Projectile.timeLeft = Lifetime; Projectile.MaxUpdates = 3; - Projectile.penetrate = 2; // Can hit up to two enemies. Will explode extremely soon after hitting the first, though. + Projectile.penetrate = -1; // Can hit many enemies. Will explode extremely soon after hitting the first, though. Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } - public override bool? CanDamage() => Projectile.timeLeft < Lifetime - 4 ? null : false; + public override bool? CanDamage() => (Projectile.timeLeft < Lifetime - 4) ? null : false; - public override void AI() => Lighting.AddLight(Projectile.Center, ShaderColorOne.ToVector3()); + public override void AI() + { + Lighting.AddLight(Projectile.Center, Color.Gold.ToVector3()); + if (time % 8 == 0 && time > 6) + { + bool isSpark = Main.rand.NextBool(3); + Dust dust = Dust.NewDustPerfect(Projectile.Center, isSpark ? 278 : ModContent.DustType(), (Projectile.velocity * 2).RotatedByRandom(0.2f) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.velocity *= (isSpark ? 0.5f : 1); + dust.scale = Main.rand.NextFloat(0.95f, 1.25f) * (isSpark ? 0.9f : 1); + dust.color = Main.rand.NextBool(5) ? Color.Khaki : Color.Goldenrod; + if (isSpark) + dust.noGravity = false; + else + dust.noLightEmittence = true; + } + if (time == 4) + { + for (int i = 0; i < 5; i++) + { + if (i < 3) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (Projectile.velocity).RotatedByRandom(0.8f) * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.85f, 1.15f); + dust.color = Main.rand.NextBool(5) ? Color.Khaki : Color.Goldenrod; + dust.noLightEmittence = true; + } + else + { + Particle spark = new CustomSpark(Projectile.Center, (Projectile.velocity).RotatedByRandom(0.8f) * Main.rand.NextFloat(0.2f, 1f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 17, Main.rand.NextFloat(1.15f, 1.3f), Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)), new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.3f, 0.4f)); + GeneralParticleHandler.SpawnParticle(spark); + } + + Particle spark2 = new GlowSparkParticle(Projectile.Center, (Projectile.velocity).RotatedByRandom(0.8f) * Main.rand.NextFloat(0.2f, 1f), false, 9, 0.017f, Color.Goldenrod, new Vector2(1.5f, 0.7f), true, false, 1.3f); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + if (time == 0) + colorAlt = Main.rand.NextBool(); + if (Projectile.timeLeft < 8 && fadeTime > 0) + { + Projectile.velocity *= 0.92f; + Projectile.scale -= 0.023f; + fadeTime--; + Projectile.timeLeft++; + if (fadeTime == 6) + { + Particle spark2 = new GlowSparkParticle(Projectile.Center, Projectile.velocity, false, 7, 0.012f, Color.Goldenrod, new Vector2(1.5f, 0.7f), true, false, 2); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + time++; + } private void RestrictLifetime() { @@ -68,12 +122,25 @@ namespace CalamityMod.Projectiles.Ranged { RestrictLifetime(); target.AddBuff(ModContent.BuffType(), 180); - } + // Explode into a bunch of holy fire. + for (int i = 0; i < 3; i++) + { + LineParticle spark2 = new LineParticle(Projectile.Center + Main.rand.NextVector2Circular(13, 13), Projectile.velocity * Main.rand.NextFloat(0.5f, 2.1f), false, 12, 1.1f, colorAlt ? (Main.rand.NextBool(5) ? Color.Khaki : Color.Goldenrod) : (Main.rand.NextBool(5) ? Color.Goldenrod : Color.DarkGoldenrod)); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.8f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } private float PrimitiveWidthFunction(float completionRatio) { float arrowheadCutoff = 0.36f; - float width = 39f; + float width = 29f * Projectile.scale; float minHeadWidth = 0.02f; float maxHeadWidth = width; if (completionRatio <= arrowheadCutoff) @@ -92,10 +159,10 @@ namespace CalamityMod.Projectiles.Ranged float cosArgument = completionRatio * completionRatioFactor - Main.GlobalTimeWrappedHourly * globalTimeFactor + endFadeTerm; float startingInterpolant = (float)Math.Cos(cosArgument) * 0.5f + 0.5f; - float colorLerpFactor = 0.6f; - Color startingColor = Color.Lerp(ShaderColorOne, ShaderColorTwo, startingInterpolant * colorLerpFactor); + float colorLerpFactor = 0.8f; + Color startingColor = Color.Lerp(colorAlt ? Color.DarkGoldenrod : Color.Goldenrod, Color.Khaki, startingInterpolant * colorLerpFactor); - return Color.Lerp(startingColor, ShaderEndColor, MathHelper.SmoothStep(0f, 1f, Utils.GetLerpValue(0f, endFadeRatio, completionRatio, true))); + return Color.Lerp(startingColor, colorAlt ? (Color.DarkGoldenrod with { A = 0 } * 0.8f) : (Color.Goldenrod * 0.8f), MathHelper.SmoothStep(0f, 1f, Utils.GetLerpValue(0f, endFadeRatio, completionRatio, true))); } public override bool PreDraw(ref Color lightColor) @@ -107,32 +174,5 @@ namespace CalamityMod.Projectiles.Ranged PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => overallOffset, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), numPoints); return false; } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - - // Explode into a bunch of holy fire on death. - for (int i = 0; i < 10; i++) - { - Dust holyFire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2f); - holyFire.velocity *= 3f; - - if (Main.rand.NextBool()) - { - holyFire.scale = 0.5f; - holyFire.fadeIn = Main.rand.NextFloat(1f, 2f); - } - } - for (int i = 0; i < 20; i++) - { - Dust holyFire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f); - holyFire.noGravity = true; - holyFire.velocity *= 5f; - - holyFire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); - holyFire.velocity *= 2f; - } - } } } diff --git a/Projectiles/Ranged/TheMaelstromShark.cs b/Projectiles/Ranged/TheMaelstromShark.cs index 56ba605ef4..5bb5ecb83f 100644 --- a/Projectiles/Ranged/TheMaelstromShark.cs +++ b/Projectiles/Ranged/TheMaelstromShark.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ignoreWater = true; Projectile.arrow = true; Projectile.penetrate = 1; + Projectile.extraUpdates = 1; Projectile.Opacity = 0f; Projectile.DamageType = DamageClass.Ranged; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; diff --git a/Projectiles/Ranged/TheStormLightningShot.cs b/Projectiles/Ranged/TheStormLightningShot.cs new file mode 100644 index 0000000000..8dc6f6328c --- /dev/null +++ b/Projectiles/Ranged/TheStormLightningShot.cs @@ -0,0 +1,124 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TheStormLightningShot : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int time = 0; + public bool homing = true; + public bool hasZaged = false; + public int zagDirection = 1; + public Vector2 effectVel; + public NPC closestTarget; + public float colorValue = 0; + public override void SetDefaults() + { + Projectile.width = 60; + Projectile.height = 60; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 3; + Projectile.extraUpdates = 4; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.ArmorPenetration = 20; // Fast weapon go brr + Projectile.timeLeft = 300; + } + + public override void AI() + { + if (time == 0) + { + if (Projectile.ai[0] == 5) + { + Projectile.extraUpdates = 60; + Projectile.penetrate = -1; + } + colorValue += Main.rand.Next(0, 20); + zagDirection = Main.rand.NextBool() ? 1 : -1; + effectVel = Projectile.velocity; + } + colorValue = MathHelper.Lerp(colorValue, 50, 0.035f); + Color usedColor = Color.Lerp(Color.Cyan, Color.Orchid, Utils.GetLerpValue(0, 50, colorValue)); + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (targetDist < 1400f) + { + if (Projectile.timeLeft % 2 == 0) + { + Particle spark2 = new BoltParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 7, 0.3f, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.7f); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (Main.rand.NextBool(35)) + { + Particle spark2 = new BoltParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 23, Main.rand.NextFloat(0.2f, 0.3f), usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + if (time % 15 == 0) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, (effectVel * 10) * Main.rand.NextFloat(-0.4f, -0.7f), 0, default, Main.rand.NextFloat(0.45f, 0.6f)); + dust.noGravity = true; + dust.color = usedColor; + effectVel = Projectile.velocity.RotatedBy(0.2f * zagDirection * (hasZaged ? 1 : 0.5f)) * 0.08f; + } + if (time % 20 == 0) + { + hasZaged = true; + zagDirection *= -1; + } + + closestTarget = Projectile.Center.ClosestNPCAt(900); + if (closestTarget != null && homing && Projectile.ai[0] < 5) + { + float moveSpeed = Utils.GetLerpValue(300, 250, Projectile.timeLeft, true); + CalamityUtils.HomeInOnSelectedNPC(Projectile, closestTarget, true, moveSpeed, 12, 0.97f, accelerate: true); + + colorValue = MathHelper.Lerp(50, 0, Utils.GetLerpValue(500, 0, Vector2.Distance(closestTarget.Center, Projectile.Center), true)); + } + if (!homing && Projectile.velocity.Length() < 12) + Projectile.velocity *= 1.01f; + + time++; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (target != closestTarget && Projectile.ai[0] < 5) + { + Projectile.numHits--; + Projectile.penetrate++; + } + else + { + colorValue = Main.rand.Next(0, 10); + homing = false; + } + + target.AddBuff(BuffID.Electrified, 90); + } + public override bool PreDraw(ref Color lightColor) + { + return false; + } + + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 2; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, (Projectile.velocity * 4).RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.3f, 1.8f), 0, default, Main.rand.NextFloat(0.6f, 0.8f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool(5) ? Color.Cyan : Color.Orchid; + } + } + } +} diff --git a/Projectiles/Ranged/TitaniumRailgunScope.cs b/Projectiles/Ranged/TitaniumRailgunScope.cs index d064c083d1..c9daab4596 100644 --- a/Projectiles/Ranged/TitaniumRailgunScope.cs +++ b/Projectiles/Ranged/TitaniumRailgunScope.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Ranged public Player Owner => Main.player[Projectile.owner]; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary. All uses are direction only. public Vector2 MousePosition => Owner.Calamity().mouseWorld - Owner.MountedCenter; public const float WeaponLength = 52f; public const float MaxSightAngle = MathHelper.Pi * (2f / 3f); diff --git a/Projectiles/Ranged/UltimaBowProjectile.cs b/Projectiles/Ranged/UltimaBowProjectile.cs index 4a7d7e186b..6dfb5da650 100644 --- a/Projectiles/Ranged/UltimaBowProjectile.cs +++ b/Projectiles/Ranged/UltimaBowProjectile.cs @@ -65,6 +65,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 shotPosition = player.RotatedRelativePoint(player.MountedCenter, true); shotPosition += Projectile.velocity.ToRotation().ToRotationVector2().RotatedByRandom(MathHelper.ToRadians(40f)).RotatedBy(-0.25f * Projectile.spriteDirection) * 42f; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = player.SafeDirectionTo(Main.MouseWorld); Vector2 shotVelocity = Projectile.velocity * shotSpeed; // The velocity should always be a unit vector. diff --git a/Projectiles/Ranged/UniversalGenesisStar.cs b/Projectiles/Ranged/UniversalGenesisStar.cs index 25b8a78224..119517a572 100644 --- a/Projectiles/Ranged/UniversalGenesisStar.cs +++ b/Projectiles/Ranged/UniversalGenesisStar.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; Projectile.penetrate = 5; Projectile.timeLeft = 180; + Projectile.extraUpdates = 1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } diff --git a/Projectiles/Rogue/AntumbraShardProjectile.cs b/Projectiles/Rogue/AntumbraShardProjectile.cs index 4109dbc7b8..c233a5a823 100644 --- a/Projectiles/Rogue/AntumbraShardProjectile.cs +++ b/Projectiles/Rogue/AntumbraShardProjectile.cs @@ -1,16 +1,11 @@ using System; -using CalamityMod.Buffs.Potions; using CalamityMod.Dusts; -using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Particles; -using CalamityMod.Projectiles.Ranged; -using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.Audio; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -63,6 +58,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.ai[2] > 0 && time == 0) { closestTarget = Projectile.Center.ClosestNPCAt(2000); + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction storedVelocity = ((closestTarget == null ? Owner.Calamity().mouseWorld : closestTarget.Center) - Projectile.Center).SafeNormalize(Vector2.UnitX); Projectile.alpha = 255; Projectile.velocity = Vector2.Zero; @@ -132,11 +128,7 @@ namespace CalamityMod.Projectiles.Rogue } if (closestTarget != null && Projectile.numHits < 1 && closestTarget.CanBeChasedBy(Projectile)) { - Vector2 moveTotarget = (closestTarget.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); - if (Projectile.velocity.Length() < 16) - Projectile.velocity += moveTotarget * 0.85f; - else - Projectile.velocity *= 0.8f; + CalamityUtils.HomeInOnSelectedNPC(Projectile, chosenTarget, true, 0.95f, 16, 0.96f); } } } @@ -207,6 +199,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.Center = portalSpot; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction if (closestTarget == null) Projectile.velocity = (Projectile.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * -16; else @@ -323,6 +316,8 @@ namespace CalamityMod.Projectiles.Rogue Main.EntitySpriteDraw(portal.Value, portalDrawPos, null, Color.Black * (1 - fading * 0.3f), 0, portal.Size() * 0.5f, 1.8f * portalFading, SpriteEffects.None); Main.EntitySpriteDraw(portal.Value, portalDrawPos, null, Color.LightGreen with { A = 0 } * (1 - fading), 0, portal.Size() * 0.5f, 1.1f * portalFading, SpriteEffects.None); + + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 expectedVel = ((closestTarget == null ? Owner.Calamity().mouseWorld : closestTarget.Center) - portalSpot).SafeNormalize(Vector2.UnitX); if (true) { diff --git a/Projectiles/Rogue/BouncyBol.cs b/Projectiles/Rogue/BouncyBol.cs deleted file mode 100644 index 32dfaba20c..0000000000 --- a/Projectiles/Rogue/BouncyBol.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class BouncyBol : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/BouncySpikyBall"; - - private bool hasHitEnemy = false; - private int targetNPC = -1; - private List previousNPCs = new List() { -1 }; - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.penetrate = 8; - Projectile.timeLeft = 600; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.aiStyle = ProjAIStyleID.GroundProjectile; - } - - public override void AI() - { - if (hasHitEnemy && Projectile.timeLeft < 575) - { - Projectile.velocity.X *= 1.005f; //you broke up, time to yeet yourself out - Projectile.velocity.Y *= 1.005f; - if (Projectile.velocity.X > 16f) - { - Projectile.velocity.X = 16f; - } - if (Projectile.velocity.Y > 16f) - { - Projectile.velocity.Y = 16f; - } - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - float minDist = 999f; - int index = 0; - foreach (NPC npc in Main.ActiveNPCs) - { - bool hasHitNPC = false; - for (int j = 0; j < previousNPCs.Count; j++) - { - if (previousNPCs[j] == npc.whoAmI) - { - hasHitNPC = true; - } - } - - if (npc == target) - { - previousNPCs.Add(npc.whoAmI); - } - if (npc.CanBeChasedBy(Projectile, false) && npc != target && !hasHitNPC) - { - float dist = (Projectile.Center - npc.Center).Length(); - if (dist < minDist) - { - minDist = dist; - index = npc.whoAmI; - } - } - } - - Vector2 velocityNew; - if (minDist < 999f) - { - Projectile.damage = (int)(Projectile.damage * 1.1f); - hasHitEnemy = true; - targetNPC = index; - velocityNew = Main.npc[index].Center - Projectile.Center; - velocityNew.Normalize(); - velocityNew *= 15f; - Projectile.velocity = velocityNew; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (Projectile.velocity.X != oldVelocity.X) - { - Projectile.velocity.X = -oldVelocity.X * 1.001f; - } - if (Projectile.velocity.Y != oldVelocity.Y) - { - Projectile.velocity.Y = -oldVelocity.Y * 1.001f; - } - return false; - } - } -} diff --git a/Projectiles/Rogue/CobaltKunaiProjectile.cs b/Projectiles/Rogue/CobaltKunaiProjectile.cs index ed004b2435..07c4e8ee65 100644 --- a/Projectiles/Rogue/CobaltKunaiProjectile.cs +++ b/Projectiles/Rogue/CobaltKunaiProjectile.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = 14; Projectile.height = 14; Projectile.friendly = true; - Projectile.penetrate = 3; + Projectile.penetrate = 2; Projectile.timeLeft = Lifetime; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Rogue/DestructionBolt.cs b/Projectiles/Rogue/DestructionBolt.cs index 1138898d74..b1f39306a7 100644 --- a/Projectiles/Rogue/DestructionBolt.cs +++ b/Projectiles/Rogue/DestructionBolt.cs @@ -49,8 +49,9 @@ namespace CalamityMod.Projectiles.Rogue } if (time == 180 + timerOffset) { - MouseX = Owner.Calamity().mouseWorld.X; - MouseY = Owner.Calamity().mouseWorld.Y; + Vector2 mouse = Owner.ClampedMouseWorld(); + MouseX = mouse.X; + MouseY = mouse.Y; } else if (time < 180) { diff --git a/Projectiles/Rogue/DestructionStar.cs b/Projectiles/Rogue/DestructionStar.cs index 19d352c4fd..4a0ca90ed7 100644 --- a/Projectiles/Rogue/DestructionStar.cs +++ b/Projectiles/Rogue/DestructionStar.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Rogue rot += (Utils.Remap(Projectile.timeLeft, 0, 240, 0.02f, 0.0015f)) * rotDirection; Player Owner = Main.player[Projectile.owner]; - Vector2 moveToMouse = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX); + Vector2 moveToMouse = (Owner.ClampedMouseWorld() - Projectile.Center).SafeNormalize(Vector2.UnitX); if (Projectile.numHits == 0 || Projectile.Calamity().stealthStrike) { if (Projectile.velocity.Length() < (Projectile.Calamity().stealthStrike ? 18 : 13) && time > 8) diff --git a/Projectiles/Rogue/ExplosiveSun.cs b/Projectiles/Rogue/ExplosiveSun.cs deleted file mode 100644 index ca0e3f46ed..0000000000 --- a/Projectiles/Rogue/ExplosiveSun.cs +++ /dev/null @@ -1,94 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class ExplosiveSun : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override void SetDefaults() - { - Projectile.width = 22; - Projectile.height = 22; - //Projectile.aiStyle = ProjAIStyleID.TerrarianBeam; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.light = 0.5f; - Projectile.alpha = 50; - Projectile.scale = 1.2f; - Projectile.timeLeft = 60; - Projectile.tileCollide = false; - Projectile.DamageType = RogueDamageClass.Instance; - } - - public override void AI() - { - Projectile.velocity.X *= 0.985f; - Projectile.velocity.Y *= 0.985f; - } - - public override bool PreDraw(ref Color lightColor) - { - //Changes the texture of the projectile - if (Projectile.ai[0] == 1f) - { - Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Rogue/ExplosiveSun2").Value; - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, texture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - return false; - } - if (Projectile.ai[0] == 2f) - { - Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Rogue/ExplosiveSun3").Value; - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, texture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - return false; - } - return true; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); - - public override void OnKill(int timeLeft) - { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 192; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.damage /= 2; - Projectile.Damage(); - if (Main.rand.NextBool(3)) - { - SoundEngine.PlaySound(SoundID.Item14 with { Volume = SoundID.Item14.Volume * 0.5f }, Projectile.Center); - } - for (int i = 0; i < 5; i++) - { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); - Main.dust[dust].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[dust].scale = 0.5f; - Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 10; j++) - { - int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 3f); - Main.dust[dust2].noGravity = true; - Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); - Main.dust[dust2].velocity *= 2f; - } - } - } -} diff --git a/Projectiles/Rogue/FantasyTalismanProj.cs b/Projectiles/Rogue/FantasyTalismanProj.cs index 8af3ec9732..ccbb12405c 100644 --- a/Projectiles/Rogue/FantasyTalismanProj.cs +++ b/Projectiles/Rogue/FantasyTalismanProj.cs @@ -25,6 +25,7 @@ namespace CalamityMod.Projectiles.Rogue AIType = ProjectileID.BulletHighVelocity; Projectile.penetrate = -1; Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; } @@ -42,10 +43,9 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.timeLeft % 10 == 0) { - if (Main.rand.NextBool()) + if (Main.rand.NextBool(8)) { - int spiritDamage = Projectile.damage / 2; - Projectile ghost = CalamityUtils.SpawnOrb(Projectile, spiritDamage, ProjectileID.SpectreWrath, 800f, 4f); + Projectile ghost = CalamityUtils.SpawnOrb(Projectile, (int)(Projectile.damage * 0.4f), ProjectileID.SpectreWrath, 1000f, 4f); if (ghost.whoAmI.WithinBounds(Main.maxProjectiles)) { ghost.DamageType = RogueDamageClass.Instance; @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(3); + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(12); public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { diff --git a/Projectiles/Rogue/FantasyTalismanStealth.cs b/Projectiles/Rogue/FantasyTalismanStealth.cs index bdc7db0f27..c15729eb34 100644 --- a/Projectiles/Rogue/FantasyTalismanStealth.cs +++ b/Projectiles/Rogue/FantasyTalismanStealth.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.BulletHighVelocity; Projectile.penetrate = -1; + Projectile.extraUpdates = 1; Projectile.timeLeft = 600; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; @@ -39,28 +40,14 @@ namespace CalamityMod.Projectiles.Rogue { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.SpectreStaff, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - if (Projectile.ai[0] != 1f) - { - if (Projectile.timeLeft % 10 == 0) - { - if (Projectile.owner == Main.myPlayer) - { - // Use a tiny velocity to ensure that rotation works correctly. - // The speed should be so low that it will make no meaningful mechanical difference. - Vector2 soulVelocity = Projectile.velocity.SafeNormalize(Vector2.Zero) * 0.0001f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, soulVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - } - } - } Projectile.StickyProjAI(4); if (Projectile.ai[0] == 1f) { if (Projectile.timeLeft % 4 == 0) { - if (Main.rand.NextBool()) + if (Main.rand.NextBool(3)) { - int spiritDamage = Projectile.damage / 2; - Projectile ghost = CalamityUtils.SpawnOrb(Projectile, spiritDamage, ProjectileID.SpectreWrath, 800f, 4f); + Projectile ghost = CalamityUtils.SpawnOrb(Projectile, (int)(Projectile.damage * 0.2f), ProjectileID.SpectreWrath, 1000f, 4f); if (ghost.whoAmI.WithinBounds(Main.maxProjectiles)) { ghost.DamageType = RogueDamageClass.Instance; @@ -77,7 +64,18 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(1); + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(9); + + public override void OnKill(int timeLeft) + { + if (Projectile.owner == Main.myPlayer) + { + for (int j = 0; j <= 3; j++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(12f, 12f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + } + } + } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { diff --git a/Projectiles/Rogue/FinalDawnProjectile.cs b/Projectiles/Rogue/FinalDawnProjectile.cs index 1678c054c7..a372fab743 100644 --- a/Projectiles/Rogue/FinalDawnProjectile.cs +++ b/Projectiles/Rogue/FinalDawnProjectile.cs @@ -36,6 +36,7 @@ namespace CalamityMod.Projectiles.Rogue if (Main.myPlayer == player.whoAmI) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, the result is immediately normalized Projectile.velocity = Main.MouseWorld - player.Center; Projectile.velocity.Normalize(); } @@ -99,6 +100,7 @@ namespace CalamityMod.Projectiles.Rogue // Stealth Strike if (player.Calamity().StealthStrikeAvailable() && Projectile.ai[1] != 1f) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction int stealth = Projectile.NewProjectile(Projectile.GetSource_FromThis(), player.Center, player.SafeDirectionTo(Main.MouseWorld) * 28f, ModContent.ProjectileType(), diff --git a/Projectiles/Rogue/HellsSunProj.cs b/Projectiles/Rogue/HellsSunProj.cs deleted file mode 100644 index b160d689a3..0000000000 --- a/Projectiles/Rogue/HellsSunProj.cs +++ /dev/null @@ -1,89 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class HellsSunProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/HellsSun"; - - public override void SetDefaults() - { - Projectile.width = 15; - Projectile.height = 15; - Projectile.friendly = true; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.penetrate = 20; - Projectile.timeLeft = 1200; - - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 40; - } - - public override void AI() - { - Projectile.ai[0] += 1f; - - if (Projectile.ai[0] >= 70f) - { - Projectile.velocity.X *= 0.96f; - Projectile.velocity.Y *= 0.96f; - Projectile.localAI[1]++; - if (Projectile.Calamity().stealthStrike) - { - if (Projectile.localAI[1] >= 30f) - { - Vector2 velocity = Projectile.velocity; - Vector2 vector2_1 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector2_1.Normalize(); - Vector2 vector2_2 = vector2_1 * ((float)Main.rand.Next(10, 41) * 0.1f); - if (Main.rand.NextBool(3)) - vector2_2 *= 2f; - Vector2 vector2_3 = velocity * 0.25f + vector2_2; - Vector2 vector2_5 = vector2_3 * 0.8f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X - vector2_5.X, Projectile.Center.Y - vector2_5.Y, vector2_5.X, vector2_5.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Main.rand.Next(3), 0.0f); - Projectile.localAI[1] = 0.0f; - } - } - else - { - if (Projectile.localAI[1] >= 60f) - { - Vector2 velocity = Projectile.velocity; - Vector2 vector2_1 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector2_1.Normalize(); - Vector2 vector2_2 = vector2_1 * ((float)Main.rand.Next(10, 41) * 0.1f); - if (Main.rand.NextBool(3)) - vector2_2 *= 2f; - Vector2 vector2_3 = velocity * 0.25f + vector2_2; - Vector2 vector2_5 = vector2_3 * 0.8f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X - vector2_5.X, Projectile.Center.Y - vector2_5.Y, vector2_5.X, vector2_5.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Main.rand.Next(3), 0.0f); - Projectile.localAI[1] = 0.0f; - } - } - } - else - { - Projectile.rotation += 0.3f * (float)Projectile.direction; - } - - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.killSpikyBalls == true) - { - Projectile.active = false; - Projectile.netUpdate = true; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); - } -} diff --git a/Projectiles/Rogue/KylieBoomerang.cs b/Projectiles/Rogue/KylieBoomerang.cs index 9c54b5bd30..578710b35c 100644 --- a/Projectiles/Rogue/KylieBoomerang.cs +++ b/Projectiles/Rogue/KylieBoomerang.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue if (TileBounceDelay > 0) TileBounceDelay--; - Vector2 mousePos = Owner.Calamity().mouseWorld; + Vector2 mousePos = Owner.ClampedMouseWorld(); if (Vector2.Distance(Projectile.Center, mousePos) > 115f && TileBounceDelay == 0) { float accelerationFactor = 12f; // Higher number = Takes longer to turn around. diff --git a/Projectiles/Rogue/LostSoulFriendly.cs b/Projectiles/Rogue/LostSoulFriendly.cs index 2afa877aae..1976f6b70e 100644 --- a/Projectiles/Rogue/LostSoulFriendly.cs +++ b/Projectiles/Rogue/LostSoulFriendly.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 16; Projectile.friendly = true; Projectile.ignoreWater = true; + Projectile.tileCollide = false; Projectile.penetrate = 1; Projectile.timeLeft = 240; Projectile.DamageType = RogueDamageClass.Instance; @@ -55,7 +56,7 @@ namespace CalamityMod.Projectiles.Rogue { if (!Projectile.CountsAsClass()) { - int cap = 5; + int cap = 10; float capDamageFactor = 0.05f; int excessCount = Main.player[Projectile.owner].ownedProjectileCounts[Type] - cap; modifiers.SourceDamage *= MathHelper.Clamp(1f - (capDamageFactor * excessCount), 0f, 1f); diff --git a/Projectiles/Rogue/MoltenAmputatorAnimated.png b/Projectiles/Rogue/MoltenAmputatorAnimated.png new file mode 100644 index 0000000000..05feb7d2aa Binary files /dev/null and b/Projectiles/Rogue/MoltenAmputatorAnimated.png differ diff --git a/Projectiles/Rogue/MoltenAmputatorProj.cs b/Projectiles/Rogue/MoltenAmputatorProj.cs index b2c7c1966d..85870c6c1c 100644 --- a/Projectiles/Rogue/MoltenAmputatorProj.cs +++ b/Projectiles/Rogue/MoltenAmputatorProj.cs @@ -1,6 +1,10 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Dusts; +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.ID; @@ -12,8 +16,18 @@ namespace CalamityMod.Projectiles.Rogue { public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/MoltenAmputator"; - private const int FramesBeforeReturning = 15; - private const int FramesPerBlob = 8; + + public int time = 0; + public Vector2 squash = new Vector2(1, 1); + public float fakeRot = 0; + public int returnTime = 180; + public bool pulled = false; + public bool returning = false; + public int direction = 0; + public int pulledTimer = 0; + public bool AMPUTATE = false; + + public float effectScale = 0; public override void SetStaticDefaults() { @@ -30,168 +44,278 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ignoreWater = true; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 4; - Projectile.timeLeft = 180; + Projectile.localNPCHitCooldown = 35 * Projectile.MaxUpdates; + Projectile.timeLeft = 900; + Projectile.extraUpdates = 4; Projectile.DamageType = RogueDamageClass.Instance; } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); - return false; - } - - private void SpawnBlobs(int blobCount) - { - for (int i = 0; i < blobCount; i++) - { - Vector2 iAmSpeed = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (iAmSpeed.X == 0f && iAmSpeed.Y == 0f) - { - iAmSpeed = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - iAmSpeed.Normalize(); - iAmSpeed *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, iAmSpeed.X, iAmSpeed.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), 0f, Projectile.owner, 0f, 0f); - } - } - - // Manually implemented boomerang AI copied from Ghoulish Gouger - // TODO -- this should be a utils function public override void AI() { - // Stealth strikes constantly spawn molten blobs. - if (Projectile.Calamity().stealthStrike) + Player Owner = Main.player[Projectile.owner]; + if (Projectile.ai[2] == 5 && Projectile.ai[2] < 10 && !Projectile.Calamity().stealthStrike) { - // If the stealth blob timer isn't set up yet, set it up - if (Projectile.ai[1] == 0f) - Projectile.ai[1] = FramesPerBlob; - else + if (time >= returnTime * 0.07f && time < returnTime * 1.4f) { - Projectile.ai[1]--; - if (Projectile.ai[1] <= 0f) + if (!pulled) { - SpawnBlobs(1); - Projectile.ai[1] = FramesPerBlob; + Projectile.localNPCHitCooldown = -1; + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + Projectile.ai[2] = 10; + Projectile.numHits = 0; + Projectile.velocity = Utils.DirectionTo(Projectile.Center, Owner.Center) * 3; + Projectile.extraUpdates += 4; + pulled = true; } } + else + Projectile.ai[2] = 0; + } + if (time >= returnTime) + returning = true; + + fakeRot += 0.13f * direction; + Projectile.rotation = (Projectile.velocity.ToRotation()) + MathHelper.PiOver2; + + if (Projectile.velocity.Length() < 5) + effectScale = MathHelper.Lerp(effectScale, 1, 0.05f); + else if (returning) + effectScale = MathHelper.Lerp(effectScale, 0, 0.05f); + + float x = MathHelper.Clamp(Utils.GetLerpValue(16, 2, Projectile.velocity.Length(), true), 0.3f, 1); + float y = 1; + squash = new Vector2(x, y); + + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame > 7) + { + Projectile.frame = 0; + } + + if (pulled) + { + if (time < returnTime * 1.5f) + time = (int)(returnTime * 1.5f); + if (pulledTimer > 20) + { + if (time % 2 == 0) + { + Particle spark2 = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 19, 0.05f, Color.Orchid * 0.3f, new Vector2(0.7f, 1.2f), true, false, 0.35f); + GeneralParticleHandler.SpawnParticle(spark2); + } + else + { + Particle spark2 = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 11, 0.07f, Color.Goldenrod * 0.45f, new Vector2(0.7f, 1.2f), true, false, 0.55f); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + + pulledTimer++; } // Frame 1, pick a direction for the scythe. This direction isn't changed from that point on - if (Projectile.ai[0] == 0f) - Projectile.spriteDirection = Projectile.direction; + if (direction == 0f) + { + direction = (Utils.DirectionTo(Projectile.Center, Owner.Calamity().mouseWorld).X > 0 ? 1 : -1); + } // Boomerang glows orange - Lighting.AddLight(Projectile.Center, 0.65f, 0.45f, 0f); + Lighting.AddLight(Projectile.Center, Color.Gold.ToVector3() * 1.5f); // Boomerang noises if (Projectile.soundDelay == 0) { - Projectile.soundDelay = 8; - SoundEngine.PlaySound(SoundID.Item7, Projectile.position); + Projectile.soundDelay = 7 * Projectile.MaxUpdates; + SoundStyle sound = new("CalamityMod/Sounds/Item/SwooshMid"); + SoundEngine.PlaySound(sound with { MaxInstances = -1, Volume = Projectile.Calamity().stealthStrike ? 0.15f : 0.3f }, Projectile.Center); } // Main boomerang logic. projectile.ai[0] is a frame counter. Projectile.ai[0] += 1f; // On the first returning frame, send a net update. - if (Projectile.ai[0] == FramesBeforeReturning) + if (time == returnTime) Projectile.netUpdate = true; // Once returning, use boomerang return AI. - if (Projectile.ai[0] >= FramesBeforeReturning) + if (returning) { - float returnSpeed = MoltenAmputator.Speed * 2f; - float acceleration = 1.15f; - - Player owner = Main.player[Projectile.owner]; - Vector2 delta = owner.Center - Projectile.Center; - float dx = delta.X; - float dy = delta.Y; - - // If the boomerang is excessively far away, destroy it. - float dist = delta.Length(); - if (dist > 3000f) - Projectile.Kill(); - - // Homing vector math (the boomerang homes in on the player using rather ugly code) - dist = returnSpeed / dist; - dx *= dist; - dy *= dist; - - // X/Y specific boomerang return code. This is what gives them their unique flight path. - if (Projectile.velocity.X < dx) - { - Projectile.velocity.X = Projectile.velocity.X + acceleration; - if (Projectile.velocity.X < 0f && dx > 0f) - { - Projectile.velocity.X = Projectile.velocity.X + acceleration; - } - } - else if (Projectile.velocity.X > dx) - { - Projectile.velocity.X = Projectile.velocity.X - acceleration; - if (Projectile.velocity.X > 0f && dx < 0f) - { - Projectile.velocity.X = Projectile.velocity.X - acceleration; - } - } - if (Projectile.velocity.Y < dy) - { - Projectile.velocity.Y = Projectile.velocity.Y + acceleration; - if (Projectile.velocity.Y < 0f && dy > 0f) - { - Projectile.velocity.Y = Projectile.velocity.Y + acceleration; - } - } - else if (Projectile.velocity.Y > dy) - { - Projectile.velocity.Y = Projectile.velocity.Y - acceleration; - if (Projectile.velocity.Y > 0f && dy < 0f) - { - Projectile.velocity.Y = Projectile.velocity.Y - acceleration; - } - } + Vector2 moveToTrackingPos = (Owner.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 3 + (8 * Utils.GetLerpValue(returnTime * 1.2f, returnTime * 1.5f, time, true))) + Projectile.velocity += moveToTrackingPos * (0.02f + (4 * Utils.GetLerpValue(returnTime * 1.2f, returnTime * 2.5f, time, true))); + else + Projectile.velocity *= 0.95f; // Destroy the boomerang when it returns to the player. if (Main.myPlayer == Projectile.owner) - if (Projectile.Hitbox.Intersects(owner.Hitbox)) + if (Projectile.Hitbox.Intersects(Owner.Hitbox)) Projectile.Kill(); } - - // Rotate the scythe as it flies. - float spin = Projectile.spriteDirection <= 0 ? -1f : 1f; - Projectile.rotation += spin * 0.38f; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - if (Projectile.owner == Main.myPlayer) + else { - int blobCount = Projectile.Calamity().stealthStrike ? 4 : 2; - SpawnBlobs(blobCount); + if (Projectile.Calamity().stealthStrike && time > returnTime * 0.2f) + { + Vector2 moveToTrackingPos = (Owner.ClampedMouseWorld() - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 16 * Utils.GetLerpValue(returnTime * 0.7f, 0, time, true)) + Projectile.velocity += moveToTrackingPos * (0.5f * Utils.GetLerpValue(returnTime * 0.7f, 0, time, true)); + else + Projectile.velocity *= 0.95f; + } + Projectile.velocity *= (time > returnTime * 0.4f ? 0.97f : 0.982f); } - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); - for (int k = 0; k < 10; k++) + + if (Main.rand.NextBool(5 * (Projectile.Calamity().stealthStrike ? 2 : 1))) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + int numParts = 2; + for (int i = 0; i < numParts; i++) + { + float fade = (Utils.GetLerpValue(5, 2, Projectile.velocity.Length(), true) * 3 + 1) * squash.X; + + float rot = fakeRot + (MathHelper.TwoPi * i / numParts); + Vector2 vel = (Utils.MoveTowards(-Projectile.velocity, new Vector2(0, -130).RotatedBy(rot).RotatedBy(-1.3f * direction), (Utils.GetLerpValue(5, 2, Projectile.velocity.Length(), true)))); + + if (Main.rand.NextBool(6)) + { + Particle spark2 = new CustomSpark(Projectile.Center + new Vector2(0, -70 * squash.X).RotatedBy(rot), vel.RotatedByRandom(0.4f) * fade, "CalamityMod/Particles/ProvidenceMarkParticle", false, 17, Main.rand.NextFloat(1.15f, 1.3f), Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)), new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.3f, 0.4f)); + GeneralParticleHandler.SpawnParticle(spark2); + } + else + { + Particle spark = new CustomSpark(Projectile.Center + new Vector2(0, -70 * squash.X).RotatedBy(rot), vel.RotatedByRandom(0.4f) * fade, "CalamityMod/Particles/ProvidenceMarkParticle", false, 17, Main.rand.NextFloat(0.75f, 0.82f), Main.rand.NextBool(4) ? Color.Khaki : Color.Orange, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.3f, 0.4f)); + GeneralParticleHandler.SpawnParticle(spark); + } + + if (Main.rand.NextBool(6)) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -70 * squash.X).RotatedBy(rot), Main.rand.NextBool(4) ? 278 : ModContent.DustType()); + dust2.noGravity = (dust2.type == 278 ? false : true); + dust2.scale = dust2.type == 278 ? 0.95f : 1.2f; + dust2.color = Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)); + dust2.velocity = (vel * 2).RotatedByRandom(0.4f) * fade; + } + else + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -70 * squash.X).RotatedBy(rot), Main.rand.NextBool(4) ? 278 : ModContent.DustType()); + dust.noGravity = (dust.type == 278 ? false : true); + dust.scale = dust.type == 278 ? 0.75f : 0.9f; + dust.color = Main.rand.NextBool(4) ? Color.Khaki : Color.Goldenrod; + dust.velocity = (vel * 2).RotatedByRandom(0.4f) * fade; + } + } + } + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(ModContent.BuffType(), 120); + + Player Owner = Main.player[Projectile.owner]; + if (Projectile.Calamity().stealthStrike) + { + if (Projectile.numHits == 0) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/FinalDawnSlash"); + SoundEngine.PlaySound(fire with { Volume = 0.5f, Pitch = Main.rand.NextFloat(0.4f, 0.85f), MaxInstances = -1 }, Projectile.Center); + } + + if (Projectile.numHits < 8) + { + int numParts = 2; + for (int i = 0; i < numParts; i++) + { + float fade = 4; + + float rot = fakeRot + (MathHelper.TwoPi * i / numParts) * 0.4f + Projectile.numHits * 5; + Vector2 vel = (new Vector2(0, -130).RotatedBy(rot).RotatedBy(-1.3f * direction)) * squash.X; + + Particle spark2 = new CustomSpark(Projectile.Center + new Vector2(0, -70 * squash.X).RotatedBy(rot), (vel * 0.02f).RotatedByRandom(1.4f) * fade, "CalamityMod/Particles/GlowSpark", false, 18, Main.rand.NextFloat(0.015f, 0.025f), Color.Goldenrod, new Vector2(2f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.6f, 0.7f)); + GeneralParticleHandler.SpawnParticle(spark2); + + BloodParticle blood = new BloodParticle(Projectile.Center + new Vector2(0, -70 * squash.X).RotatedBy(rot), (vel * 0.04f).RotatedByRandom(1.4f) * fade, Main.rand.Next(13, 24 + 1), Main.rand.NextFloat(0.85f, 1.2f), Main.rand.NextBool() ? Color.Goldenrod : Color.Orange); + GeneralParticleHandler.SpawnParticle(blood); + + if (Main.rand.NextBool(6)) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -70 * squash.X).RotatedBy(rot), Main.rand.NextBool(4) ? 278 : ModContent.DustType()); + dust2.noGravity = true; + dust2.scale = dust2.type == 278 ? 0.95f : 1.2f; + dust2.color = Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)); + dust2.velocity = (vel * 0.04f).RotatedByRandom(1.4f) * fade; + } + else + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -70 * squash.X).RotatedBy(rot), Main.rand.NextBool(4) ? 278 : ModContent.DustType()); + dust.noGravity = true; + dust.scale = dust.type == 278 ? 0.75f : 0.9f; + dust.color = Main.rand.NextBool(4) ? Color.Khaki : Color.Goldenrod; + dust.velocity = (vel * 0.04f).RotatedByRandom(1.4f) * fade; + } + } + } + } + if (pulled && (pulledTimer < 10 || Owner.Calamity().amputatorBuff > 0) && !AMPUTATE && !Projectile.Calamity().stealthStrike) + { + // Amputate them + Projectile strike = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage * 7, 0f, Owner.whoAmI, target.whoAmI, 1f); + Particle blastRingBase = new CustomPulse(target.Center, Vector2.Zero, Color.Orange, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1.1f, 1f, 18, true); + GeneralParticleHandler.SpawnParticle(blastRingBase); + for (int i = 0; i < 3; i++) + { + Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.7f * (i + 1), 1f, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.35f * (i + 1), 0.5f, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + + for (int i = 0; i < 6; i++) + { + Particle spark = new GlowSparkParticle(target.Center, (Projectile.velocity).SafeNormalize(Vector2.UnitY) * -5 * (i % 2 == 0 ? -1 : 1), false, 15, 0.08f - i * 0.01f, Color.Goldenrod, new Vector2(5, 0.8f), true, false, 1.2f); + GeneralParticleHandler.SpawnParticle(spark); + } + + for (int i = 0; i < 20; i++) + { + int dir = (i < 10 ? 1 : -1); + LineParticle spark2 = new LineParticle(Projectile.Center + Main.rand.NextVector2Circular(13, 13), (Projectile.velocity).SafeNormalize(Vector2.UnitY) * -25 * Main.rand.NextFloat(0.4f, 2f) * dir, false, 12, 1.1f, Main.rand.NextBool(5) ? Color.Khaki : Color.Goldenrod); + GeneralParticleHandler.SpawnParticle(spark2); + + BloodParticle blood = new BloodParticle(Projectile.Center, (((Projectile.velocity).SafeNormalize(Vector2.UnitY) * -25).RotatedByRandom(0.6f) + new Vector2(0, -1.5f)) * Main.rand.NextFloat(0.4f, 2f) * dir, Main.rand.Next(13, 24 + 1), Main.rand.NextFloat(0.85f, 1.2f), Main.rand.NextBool() ? Color.Goldenrod : Color.Orange); + GeneralParticleHandler.SpawnParticle(blood); + } + + SoundStyle slice = new("CalamityMod/Sounds/Item/HellkiteFullCharge"); + SoundEngine.PlaySound(slice with { Volume = 1f, Pitch = Main.rand.NextFloat(0.5f, 0.6f) }, target.Center); + SoundStyle cut = new("CalamityMod/Sounds/NPCKilled/PerfLargeDeath"); + SoundEngine.PlaySound(cut with { Volume = 1f, Pitch = Main.rand.NextFloat(0.5f, 0.6f) }, target.Center); + + AMPUTATE = true; } } - public override void OnHitPlayer(Player target, Player.HurtInfo info) + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 80, targetHitbox); + public override bool PreDraw(ref Color lightColor) { - target.AddBuff(ModContent.BuffType(), 180); - if (Projectile.owner == Main.myPlayer) + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation; + + Asset p = ModContent.Request("CalamityMod/Particles/CircularSmearFire2"); + Asset p2 = ModContent.Request("CalamityMod/Particles/CircularSmearFire3"); + for (int i = 0; i < 3; i++) { - int blobCount = Projectile.Calamity().stealthStrike ? 4 : 2; - SpawnBlobs(blobCount); - } - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Main.EntitySpriteDraw(p2.Value, drawPosition, null, Color.Orchid with { A = 0 } * 0.25f * effectScale, fakeRot * (Main.rand.NextFloat(1.5f, 1.55f) * (i * 0.5f + 0.2f)), p2.Size() * 0.5f, 1.1f * Main.rand.NextFloat(0.8f, 1.15f) * effectScale, direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Main.EntitySpriteDraw(p.Value, drawPosition, null, Color.Orange with { A = 0 } * 0.35f * effectScale, fakeRot * (Main.rand.NextFloat(1.1f, 1.15f) * (i * 0.5f + 0.2f)), p.Size() * 0.5f, 0.9f * effectScale, direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); } + + Asset tex3 = ModContent.Request("CalamityMod/Projectiles/Rogue/MoltenAmputatorAnimated"); + Rectangle frame = tex3.Frame(1, 8, 0, Projectile.frame); + Vector2 rotationPoint = frame.Size() * 0.5f; + Main.EntitySpriteDraw(tex3.Value, drawPosition, frame, lightColor, drawRotation, rotationPoint, squash * Projectile.scale, direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + return false; } } } diff --git a/Projectiles/Rogue/MonkeyDart.cs b/Projectiles/Rogue/MonkeyDart.cs deleted file mode 100644 index 727b4ffe66..0000000000 --- a/Projectiles/Rogue/MonkeyDart.cs +++ /dev/null @@ -1,106 +0,0 @@ -using CalamityMod.Items.Weapons.Rogue; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class MonkeyDart : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 6; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.penetrate = 6; - DrawOffsetX = -10; - DrawOriginOffsetY = 0; - DrawOriginOffsetX = 0; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 40; - Projectile.extraUpdates = 2; - Projectile.DamageType = RogueDamageClass.Instance; - } - - public override void AI() - { - //Code to make it not shoot backwards - Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); - Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - //Gravity - Projectile.velocity.Y = Projectile.velocity.Y + 0.04f; - if (Projectile.velocity.Y > 16f) - { - Projectile.velocity.Y = 16f; - } - //Dust trail - if (Main.rand.NextBool(25)) - { - int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.VilePowder, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 150, default, 0.9f); - Main.dust[d].position = Projectile.Center; - Main.dust[d].noLight = true; - } - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - //Dust splash - int dustsplash = 0; - while (dustsplash < 4) - { - int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Stone, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 100, default, 0.9f); - Main.dust[d].position = Projectile.Center; - dustsplash += 1; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - //This makes the projectile only bounce once - if (Projectile.ai[0] == 1) - { - if (Projectile.ai[1] >= 1f) - { - Projectile.Kill(); - } - else - { - //Code for bouncing - Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - if (Projectile.velocity.X != oldVelocity.X) - { - Projectile.velocity.X = -oldVelocity.X; - } - if (Projectile.velocity.Y != oldVelocity.Y) - { - Projectile.velocity.Y = -oldVelocity.Y; - } - Projectile.ai[1] += 1f; - } - return false; - } - return true; - } - - public override bool PreDraw(ref Color lightColor) - { - if (Projectile.ai[0] == 1) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - return true; - } - } -} diff --git a/Projectiles/Rogue/MonkeyDart.png b/Projectiles/Rogue/MonkeyDart.png deleted file mode 100644 index b6e8cce5da..0000000000 Binary files a/Projectiles/Rogue/MonkeyDart.png and /dev/null differ diff --git a/Projectiles/Rogue/NastyChollaBol.cs b/Projectiles/Rogue/NastyChollaBol.cs index 0ce92f488b..492b0a54db 100644 --- a/Projectiles/Rogue/NastyChollaBol.cs +++ b/Projectiles/Rogue/NastyChollaBol.cs @@ -86,8 +86,8 @@ namespace CalamityMod.Projectiles.Rogue for (int n = 0; n < needleAmt; n++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - // Since damage is reset on stick, this needs new damage calculations or stored damage in some way. - int damage = Projectile.Calamity().stealthStrike ? Projectile.originalDamage / 2 : (int)player.GetTotalDamage().ApplyTo(0.5f * NastyCholla.BaseDamage); + //The damage is set to 1 since anything more is an AP monster - Angel + int damage = 1; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), damage, 0f, Projectile.owner, 0f, 0f); } } diff --git a/Projectiles/Rogue/NastyChollaNeedle.cs b/Projectiles/Rogue/NastyChollaNeedle.cs index 41340217ce..f4e9383ae5 100644 --- a/Projectiles/Rogue/NastyChollaNeedle.cs +++ b/Projectiles/Rogue/NastyChollaNeedle.cs @@ -41,5 +41,9 @@ namespace CalamityMod.Projectiles.Rogue //So you can stick a needle up the Tinkerer's ass public override bool? CanHitNPC(NPC target) => target.type != NPCID.DD2EterniaCrystal && !target.immortal && !target.dontTakeDamage; + + // 18NOV2024: Ozzatron: Nasty Cholla needles are not allowed to deal more than 1 damage under any circumstances. + // This prevents them from becoming demonchungus when given flat damage boosts like Copper armor or Thorium's The Ring. + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SetMaxDamage(1); } } diff --git a/Projectiles/Rogue/PalladiumJavelinProjectile.cs b/Projectiles/Rogue/PalladiumJavelinProjectile.cs index a43502280a..515e6f14b1 100644 --- a/Projectiles/Rogue/PalladiumJavelinProjectile.cs +++ b/Projectiles/Rogue/PalladiumJavelinProjectile.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = 12; Projectile.height = 12; Projectile.friendly = true; - Projectile.penetrate = 3; + Projectile.penetrate = 2; Projectile.aiStyle = ProjAIStyleID.StickProjectile; Projectile.timeLeft = 600; Projectile.MaxUpdates = 2; diff --git a/Projectiles/Rogue/PoisonBol.cs b/Projectiles/Rogue/PoisonBol.cs deleted file mode 100644 index 61f1448c2e..0000000000 --- a/Projectiles/Rogue/PoisonBol.cs +++ /dev/null @@ -1,70 +0,0 @@ -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class PoisonBol : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/PoisonPack"; - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.penetrate = 5; - Projectile.timeLeft = 1200; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.aiStyle = ProjAIStyleID.GroundProjectile; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 45; - } - - public override void AI() - { - if (Main.rand.NextBool(20)) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.JungleSpore, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - } - - if (Projectile.timeLeft < 20) - Projectile.alpha += 13; - if (Projectile.Calamity().stealthStrike) - { - Projectile.localAI[1]++; - if (Projectile.localAI[1] % 35f == 0f) - { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 10f, 20f); - if (Main.rand.NextBool(3)) - velocity *= 2f; - velocity += Projectile.velocity * 0.25f; - velocity *= 0.8f; - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - velocity, velocity, Main.rand.Next(569, 572), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner); - if (proj.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[proj].DamageType = RogueDamageClass.Instance; - Main.projectile[proj].usesLocalNPCImmunity = true; - Main.projectile[proj].localNPCHitCooldown = 45; - } - } - } - - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.killSpikyBalls) - { - Projectile.active = false; - Projectile.netUpdate = true; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Poisoned, 240); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Poisoned, 240); - } -} - diff --git a/Projectiles/Rogue/RadiationRain.cs b/Projectiles/Rogue/RadiationRain.cs index cc11835bbd..b4d1c05c71 100644 --- a/Projectiles/Rogue/RadiationRain.cs +++ b/Projectiles/Rogue/RadiationRain.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Rogue if (targetedNPC != null) Projectile.velocity = (targetedNPC.Center - Projectile.Center + targetedNPC.velocity * 1.5f).SafeNormalize(Vector2.UnitX) * 8; else - Projectile.velocity = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * 8; + Projectile.velocity = (Owner.ClampedMouseWorld() - Projectile.Center).SafeNormalize(Vector2.UnitX) * 8; } if (targetDist < 1400 && time > 5) diff --git a/Projectiles/Rogue/ReaperProjectile.cs b/Projectiles/Rogue/ReaperProjectile.cs index 602a1d1119..b1a0068d11 100644 --- a/Projectiles/Rogue/ReaperProjectile.cs +++ b/Projectiles/Rogue/ReaperProjectile.cs @@ -1,18 +1,12 @@ using System; using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Dusts; -using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; -using Microsoft.CodeAnalysis; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Graphics.PackedVector; using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; -using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using static CalamityMod.CalamityUtils; @@ -117,6 +111,7 @@ namespace CalamityMod.Projectiles.Rogue } else { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for initial throw direction Projectile.velocity = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction) * 15; } Projectile.spriteDirection = Projectile.direction; @@ -184,20 +179,19 @@ namespace CalamityMod.Projectiles.Rogue } if (time >= 150) { - NPC target = Owner.Calamity().mouseWorld.ClosestNPCAt(4000); + NPC target = Owner.ClampedMouseWorld().ClosestNPCAt(1000); if (time == 150) { Projectile.extraUpdates = 25; } if (target != null) { - if (Projectile.numHits <= 0 && Projectile.velocity.Length() < 15) - Projectile.velocity += (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX) * 0.9f; - else if (Projectile.numHits <= 0) - Projectile.velocity *= 0.9f; + if (Projectile.numHits <= 0) + CalamityUtils.HomeInOnSelectedNPC(Projectile, target, true, 0.85f, 15, 0.97f); } else if (time == 150) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for immediate direction impulse Projectile.velocity = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX * Owner.direction) * 15; } Particle spark = new GlowSparkParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2, -1), -Projectile.velocity * 0.3f, false, 7, 0.13f, Color.Lerp(Color.Green, Color.Chartreuse, 0.8f) * 0.65f, new Vector2(1, 0.3f), true, false, 1.3f); diff --git a/Projectiles/Rogue/ShinobiBladeProjectile.cs b/Projectiles/Rogue/ShinobiBladeProjectile.cs index 7eee20f797..8ce4a2584a 100644 --- a/Projectiles/Rogue/ShinobiBladeProjectile.cs +++ b/Projectiles/Rogue/ShinobiBladeProjectile.cs @@ -1,7 +1,10 @@ using CalamityMod.Balancing; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -23,9 +26,9 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = Projectile.height = 16; Projectile.friendly = true; Projectile.penetrate = 1; - Projectile.timeLeft = 300; - Projectile.MaxUpdates = 5; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.MaxUpdates = 5; + Projectile.timeLeft = 60 * Projectile.MaxUpdates; } public override void AI() @@ -35,8 +38,8 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(5)) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.MagicMirror); - Main.dust[dust].noGravity = true; + Dust trail = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.MagicMirror); + trail.noGravity = true; } } @@ -50,8 +53,8 @@ namespace CalamityMod.Projectiles.Rogue { NPC firstTarget = Main.npc[(int)Projectile.ai[0]]; - // 7 hits total - if (Projectile.Calamity().stealthStrike && Projectile.ai[1] <= 7f && (Projectile.ai[1] == 0f || firstTarget != null)) + // 8 hits total + if (Projectile.Calamity().stealthStrike && Projectile.ai[1] < 8f && (Projectile.ai[1] == 0f || firstTarget != null)) { Vector2 targetPos = Projectile.ai[1] == 0f ? target.Center : firstTarget.Center; Vector2 offset = Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(80f, 120f); @@ -59,6 +62,13 @@ namespace CalamityMod.Projectiles.Rogue int realTarget = Projectile.ai[1] == 0f ? target.whoAmI : firstTarget.whoAmI; Projectile echo = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), targetPos + offset, eVelocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, realTarget, Projectile.ai[1] + 1); echo.Calamity().stealthStrike = true; + echo.tileCollide = false; + + Vector2 slashVel = Projectile.velocity.SafeNormalize(Vector2.UnitX); + GlowSparkParticle slash = new(Projectile.Center, slashVel, false, 12, 0.06f, Color.DarkBlue, Vector2.One, true, shrinkSpeed: 0.9f); + GeneralParticleHandler.SpawnParticle(slash); + + SoundEngine.PlaySound(WulfrumKnife.TileHitSound, Projectile.Center); } if (target.life <= 0 && target.lifeMax > 5) @@ -73,11 +83,11 @@ namespace CalamityMod.Projectiles.Rogue public override void OnKill(int timeLeft) { + int dustType = 42; for (int i = 0; i < 5; i++) { - int dustType = 42; - int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, Projectile.velocity.X / 2, Projectile.velocity.Y / 2, 0, default, 1.5f); - Main.dust[dust].noGravity = true; + Dust crumble = Dust.NewDustDirect(Projectile.Center, 1, 1, dustType, Projectile.velocity.X / 2, Projectile.velocity.Y / 2, 0, default, 1.5f); + crumble.noGravity = true; } } } diff --git a/Projectiles/Rogue/ShockGrenadeExplosion.cs b/Projectiles/Rogue/ShockGrenadeExplosion.cs index 0c39e224ee..b54e539381 100644 --- a/Projectiles/Rogue/ShockGrenadeExplosion.cs +++ b/Projectiles/Rogue/ShockGrenadeExplosion.cs @@ -48,7 +48,14 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Electrified, 180); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.Electrified, 180); + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.8f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Electrified, 180); diff --git a/Projectiles/Rogue/StickyBol.cs b/Projectiles/Rogue/StickyBol.cs deleted file mode 100644 index bfa90c3367..0000000000 --- a/Projectiles/Rogue/StickyBol.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class StickyBol : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/StickySpikyBall"; - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.penetrate = 5; - Projectile.timeLeft = 300; - Projectile.tileCollide = false; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 60; - } - - public override void AI() - { - Color color = new Color(0, 80, 255, 100); - if (Main.rand.NextBool(12)) - { - Dust.NewDust(Projectile.position + Vector2.One * 6f, Projectile.width - 12, Projectile.height - 12, DustID.TintableDust, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 175, color, 1.2f); - } - //Sticky Behaviour - Projectile.StickyProjAI(10); - if (Projectile.ai[0] != 1f) - { - Projectile.StickToTiles(true, false); - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] > 10f) - { - Projectile.localAI[1] = 10f; - if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) - { - Projectile.velocity.X *= 0.97f; - if (Math.Abs(Projectile.velocity.X) < 0.01f) - { - Projectile.velocity.X = 0f; - Projectile.netUpdate = true; - } - } - Projectile.velocity.Y += 0.2f; - } - Projectile.rotation += Projectile.velocity.X * 0.1f; - } - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(5); - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (targetHitbox.Width > 8 && targetHitbox.Height > 8) - { - targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); - } - return null; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Slimed, 120); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Slimed, 120); - } -} diff --git a/Projectiles/Rogue/TitaniumShurikenProjectile.cs b/Projectiles/Rogue/TitaniumShurikenProjectile.cs index d8f0da7267..08d4017caa 100644 --- a/Projectiles/Rogue/TitaniumShurikenProjectile.cs +++ b/Projectiles/Rogue/TitaniumShurikenProjectile.cs @@ -103,8 +103,7 @@ namespace CalamityMod.Projectiles.Rogue if (Main.myPlayer == Projectile.owner) if (Projectile.Hitbox.Intersects(owner.Hitbox)) { - Projectile.Kill(); //boomerangs return to you so you get a refund - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); + Projectile.Kill(); } } diff --git a/Projectiles/Rogue/ToxicantTwisterDust.cs b/Projectiles/Rogue/ToxicantTwisterDust.cs index c9117985f3..bbbcdc29ad 100644 --- a/Projectiles/Rogue/ToxicantTwisterDust.cs +++ b/Projectiles/Rogue/ToxicantTwisterDust.cs @@ -48,10 +48,10 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation += 0.2f; targetedNPC = (Projectile.ai[1] > 90) ? Projectile.Center.ClosestNPCAt(1200) : null; - float moveSpeed = Utils.GetLerpValue(200, 0, Projectile.timeLeft); + float moveSpeed = Utils.GetLerpValue(200, 0, Projectile.timeLeft) * 0.5f; if (targetedNPC == null) { - Vector2 position = (Owner.Calamity().mouseWorld + ((new Vector2(0, -250).RotatedBy(Projectile.rotation * 0.2f)).RotatedBy(MathHelper.ToRadians(90f) * Projectile.ai[2]))); + Vector2 position = (Owner.ClampedMouseWorld() + ((new Vector2(0, -250).RotatedBy(Projectile.rotation * 0.2f)).RotatedBy(MathHelper.ToRadians(90f) * Projectile.ai[2]))); Vector2 moveToMouse = (position - Projectile.Center).SafeNormalize(Vector2.UnitX); if (Projectile.velocity.Length() < 8) Projectile.velocity += moveToMouse * (0.7f); @@ -60,12 +60,7 @@ namespace CalamityMod.Projectiles.Rogue } else { - Vector2 position = targetedNPC.Center; - Vector2 moveToMouse = (position - Projectile.Center).SafeNormalize(Vector2.UnitX); - if (Projectile.velocity.Length() < 13 * moveSpeed) - Projectile.velocity += moveToMouse * moveSpeed; - else - Projectile.velocity *= 0.9f; + CalamityUtils.HomeInOnSelectedNPC(Projectile, targetedNPC, true, moveSpeed, 13, 0.98f); if (Projectile.ai[1] % 2 == 0) Projectile.timeLeft++; // Lasts longer if it has a target } diff --git a/Projectiles/Rogue/ToxicantTwisterProj.cs b/Projectiles/Rogue/ToxicantTwisterProj.cs index db053ab2f9..6e28dae06f 100644 --- a/Projectiles/Rogue/ToxicantTwisterProj.cs +++ b/Projectiles/Rogue/ToxicantTwisterProj.cs @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.ai[1] > 20f) { - Vector2 position = (Owner.Calamity().mouseWorld + ((new Vector2(0, circleRange).RotatedBy(Projectile.rotation * 0.2f)).RotatedBy(MathHelper.ToRadians(90f) * Projectile.ai[2]))); + Vector2 position = (Owner.ClampedMouseWorld() + ((new Vector2(0, circleRange).RotatedBy(Projectile.rotation * 0.2f)).RotatedBy(MathHelper.ToRadians(90f) * Projectile.ai[2]))); Vector2 moveToMouse = (position - Projectile.Center).SafeNormalize(Vector2.UnitX); if (Projectile.velocity.Length() < 18) Projectile.velocity += moveToMouse * circleSpeed; diff --git a/Projectiles/Rogue/WhitewaterAura.cs b/Projectiles/Rogue/WhitewaterAura.cs index 4b56d28857..ed96bfc15c 100644 --- a/Projectiles/Rogue/WhitewaterAura.cs +++ b/Projectiles/Rogue/WhitewaterAura.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ignoreWater = true; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 7; + Projectile.localNPCHitCooldown = 10; } public override void AI() @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Rogue Player player = Main.player[playerIndex]; float targetDist = Vector2.Distance(player.Center, Projectile.Center); - if (targetDist < 200f * areaScale && time % 6 == 0) + if (targetDist < 200f * areaScale && time % 12 == 0) { player.HealPlayer(1); } diff --git a/Projectiles/Rogue/WhitewaterProj.cs b/Projectiles/Rogue/WhitewaterProj.cs index f80670dde2..58ff0fc987 100644 --- a/Projectiles/Rogue/WhitewaterProj.cs +++ b/Projectiles/Rogue/WhitewaterProj.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Rogue if (time > 20 && !returning && !shattered) { - Vector2 moveToMouse = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX); + Vector2 moveToMouse = (Owner.ClampedMouseWorld() - Projectile.Center).SafeNormalize(Vector2.UnitX); if (Projectile.velocity.Length() < 12) Projectile.velocity += moveToMouse * ( 1 - (0.85f * Utils.GetLerpValue(returnTime / 2, 0, time, true))); else diff --git a/Projectiles/Rogue/WulfrumKnifeProj.cs b/Projectiles/Rogue/WulfrumKnifeProj.cs index ed3d183604..4f6a26f038 100644 --- a/Projectiles/Rogue/WulfrumKnifeProj.cs +++ b/Projectiles/Rogue/WulfrumKnifeProj.cs @@ -89,13 +89,9 @@ namespace CalamityMod.Projectiles.Rogue } } } - - public override void OnKill(int timeLeft) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Main.rand.NextBool()) - { - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); - } + SoundEngine.PlaySound(WulfrumKnife.TileHitSound, Projectile.Center); } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Summon/AmphibiansGuitarHoldout.cs b/Projectiles/Summon/AmphibiansGuitarHoldout.cs index f9920ae191..007716e2ee 100644 --- a/Projectiles/Summon/AmphibiansGuitarHoldout.cs +++ b/Projectiles/Summon/AmphibiansGuitarHoldout.cs @@ -61,6 +61,7 @@ namespace CalamityMod.Projectiles.Summon // The center of the player, taking into account if they have a mount or not. Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // The vector between the player and the mouse, used for pointing the holdout. Vector2 ownerToMouse = Owner.Calamity().mouseWorld - armPosition; diff --git a/Projectiles/Summon/AndromedaRegislash.cs b/Projectiles/Summon/AndromedaRegislash.cs index e24bd84df7..b536ddb8ea 100644 --- a/Projectiles/Summon/AndromedaRegislash.cs +++ b/Projectiles/Summon/AndromedaRegislash.cs @@ -42,6 +42,8 @@ namespace CalamityMod.Projectiles.Summon return; } SoundEngine.PlaySound(SoundID.DD2_DrakinShot, Projectile.Center); + + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.rotation = Projectile.AngleTo(Main.MouseWorld); Projectile.localAI[0] = 1f; } diff --git a/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs b/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs index be7518fde5..b7ef3f8fdb 100644 --- a/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs +++ b/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs @@ -282,6 +282,7 @@ namespace CalamityMod.Projectiles.Summon // Update the cannon direction. if (Main.myPlayer == Projectile.owner) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, this is only used to aim the Atlas cannon float interpolant = Utils.GetLerpValue(16f, 56f, Projectile.Distance(Main.MouseWorld), true) * Utils.GetLerpValue(3f, 10f, MathHelper.Distance(Main.MouseWorld.X, Owner.Center.X), true); Vector2 oldVelocity = Projectile.velocity; Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), interpolant).SafeNormalize(Vector2.UnitX * Owner.direction); diff --git a/Projectiles/Summon/CnidarianJellyfishOnTheString.cs b/Projectiles/Summon/CnidarianJellyfishOnTheString.cs index eaea017c3c..39cdaf9fdc 100644 --- a/Projectiles/Summon/CnidarianJellyfishOnTheString.cs +++ b/Projectiles/Summon/CnidarianJellyfishOnTheString.cs @@ -71,6 +71,7 @@ namespace CalamityMod.Projectiles.Summon public void Initialize() { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary -- the helper function caps this based on whip range //Initialize the segments SetOrigin(Owner.Calamity().mouseWorld); @@ -106,6 +107,7 @@ namespace CalamityMod.Projectiles.Summon if (Owner.channel) Projectile.timeLeft = FadeoutTime; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary -- the helper function caps this based on whip range SetOrigin(Projectile.Center.MoveTowards(Owner.Calamity().mouseWorld, 10f)); SimulateSegments(); diff --git a/Projectiles/Summon/DazzlingStabber.cs b/Projectiles/Summon/DazzlingStabber.cs index 45757eb7ee..9259dee6fd 100644 --- a/Projectiles/Summon/DazzlingStabber.cs +++ b/Projectiles/Summon/DazzlingStabber.cs @@ -1,8 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Summon; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -14,12 +18,17 @@ namespace CalamityMod.Projectiles.Summon public Player Owner => Main.player[Projectile.owner]; public ref float AttackDelay => ref Projectile.ai[0]; public ref float RestOffsetAngle => ref Projectile.ai[1]; + public ref float KnifeType => ref Projectile.ai[2]; // 1 - Crystal, 2 - Stone, 3 - Fire + public Color color1 = Color.White; + public int attackCooldown = 0; + public int attacksDone = 0; + public NPC potentialTarget; + public float moveSmoothing = 50; + public float damageMult = 1; + public Vector2 storedPos; public override void SetStaticDefaults() { - Main.projFrames[Type] = 4; - ProjectileID.Sets.TrailingMode[Type] = 2; - ProjectileID.Sets.TrailCacheLength[Type] = 25; - ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = false; // To prevent blade type desync ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -30,12 +39,11 @@ namespace CalamityMod.Projectiles.Summon Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.minionSlots = 1f; + Projectile.minionSlots = 0.333f; Projectile.timeLeft = 90000; Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.minion = true; - Projectile.light = 1f; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; Projectile.DamageType = DamageClass.Summon; @@ -43,19 +51,125 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { + switch (KnifeType) + { + case 1: // Crystal + color1 = Color.Orchid; + Projectile.extraUpdates = 1; + damageMult = 0.5f; + Projectile.ArmorPenetration = 40; + break; + case 2: // Rock + color1 = Color.OrangeRed; + Projectile.extraUpdates = 2; + damageMult = 3; + break; + default: // Flame + color1 = Color.Orange; + damageMult = 1; + Projectile.ArmorPenetration = 20; + break; + } + Lighting.AddLight(Projectile.Center, Color.White.ToVector3()); ApplyPlayerBuffs(); - UpdateFrames(); - NPC potentialTarget = Projectile.Center.MinionHoming(1100f, Owner); + potentialTarget = Projectile.Center.MinionHoming(1100f, Owner); + + if (potentialTarget != null && attackCooldown == 0 && AttackDelay <= 0) + { + storedPos = potentialTarget.Center; + } if (potentialTarget != null) - SliceTarget(potentialTarget); - else - ReturnToRestingPosition(); - } + { + if (KnifeType == 1 && attacksDone > 0 && Utils.Distance(Projectile.Center, storedPos) < 150 && attackCooldown == 0) + { + Particle spark = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.1f, false, 20, 0.03f, color1 * 0.55f, new Vector2(0.8f, 2.3f), true, false, 0.45f); + GeneralParticleHandler.SpawnParticle(spark); + } + if (KnifeType == 2 && attackCooldown == 0) + { + if (Main.rand.NextBool(4)) + { + Particle spark = new CustomSpark(Projectile.Center + Main.rand.NextVector2Circular(10, 10), -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.8f), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard6", false, Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.55f, 1.2f), Color.White, Vector2.One, false, false, Main.rand.NextFloat(-5, 5), false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + else + { + bool memesHatesLists = Main.rand.NextBool(5); + Dust dust = Dust.NewDustPerfect(Projectile.Center, memesHatesLists ? 278 : ModContent.DustType(), -Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.4f) * Main.rand.NextFloat(1f, 4f)); + dust.noGravity = !memesHatesLists; + dust.scale = Main.rand.NextFloat(0.55f, 1.1f); + dust.color = color1; + } + } + if (KnifeType == 3) + { + for (int i = 0; i < 2; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.4f) * Main.rand.NextFloat(2f, 8f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.65f, 1f); + dust.color = Color.Goldenrod; + dust.noLightEmittence = true; + } + Particle spark2 = new CustomSpark(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.5f) * Main.rand.NextFloat(1f, 5f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 14, Main.rand.NextFloat(0.9f, 1.2f), Color.Gold, new Vector2(1.3f, 0.5f), true, false, 0, false, false, 0); + GeneralParticleHandler.SpawnParticle(spark2); + for (int i = 0; i < 2; i++) + { + Particle trail = new GlowSparkParticle(Projectile.Center + i * Projectile.velocity * 0.4f, -Projectile.velocity * 0.05f, false, 9, 0.05f, Color.Orange * 0.5f, new Vector2(1, 0.3f), true, false, 0.85f); + GeneralParticleHandler.SpawnParticle(trail); + } + + } + if (attackCooldown == 0) + SliceTarget(potentialTarget); + else + { + manageAttackCooldown(); + } + } + else + { + manageAttackCooldown(); + ReturnToRestingPosition(); + } + } + public void manageAttackCooldown() + { + if (attackCooldown > 0) + { + attackCooldown--; + if (KnifeType == 1) + ReturnToRestingPosition(); + else if (KnifeType == 2) + Projectile.velocity *= 0.96f; + if (attackCooldown == 0) + { + attacksDone = 0; + + if (KnifeType == 1) + { + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.7f, 10); + GeneralParticleHandler.SpawnParticle(orb2); + Particle orb3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.35f, 15, true); + GeneralParticleHandler.SpawnParticle(orb3); + + for (int i = 0; i < 6; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(4f, 8f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.65f, 1.15f); + dust.color = Color.Orchid; + dust.noLightEmittence = true; + } + } + } + } + } public void ApplyPlayerBuffs() { Owner.AddBuff(ModContent.BuffType(), 3600); @@ -67,22 +181,24 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 2; } } - - public void UpdateFrames() - { - Projectile.frameCounter++; - if (Projectile.frameCounter % 6 == 0) - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; - } - public void SliceTarget(NPC target) { + moveSmoothing = 50; // Don't do anything if the attack delay is still passing. if (AttackDelay > -60f) { AttackDelay--; if (AttackDelay > 0f) + { + if (KnifeType == 1) + { + if (!Projectile.WithinRange(storedPos, 150f)) + Projectile.velocity = Projectile.velocity.RotatedBy(0.1f); + else + Projectile.velocity *= 1.004f; + } return; + } } // Reset the velocity to fly upward if there is very little motion to ensure @@ -91,23 +207,34 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity = Vector2.UnitY * -12f; // If close to the target, slow down dramatically. - if (Projectile.velocity.Length() > 5f && Projectile.WithinRange(target.Center, 90f)) + if (Projectile.velocity.Length() > 5f && Projectile.WithinRange(storedPos, 50f)) Projectile.velocity *= 0.93f; // Otherwise, if not close, speed up dramatically. - else if (Projectile.velocity.Length() < 40f) + else if (Projectile.velocity.Length() < (KnifeType == 2 ? 15 : 40f)) Projectile.velocity *= 1.03f; - float angularTurnSpeed = 0.35f; - float angleToTargetCoords = Projectile.AngleTo(target.Center); + float angularTurnSpeed = 0.25f; + float angleToTargetCoords = Projectile.AngleTo(storedPos); - if (!Projectile.WithinRange(target.Center, 200f)) - Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(angleToTargetCoords, angularTurnSpeed).ToRotationVector2() * Projectile.velocity.Length(); - - // If not super close to the target but the target is very much in the line of sight of the summon, charge. - if (!Projectile.WithinRange(target.Center, 75f) && Vector2.Dot(Projectile.SafeDirectionTo(target.Center), Projectile.velocity.SafeNormalize(Vector2.Zero)) > 0.85f) + if (KnifeType == 3) { - Projectile.velocity = Projectile.SafeDirectionTo(target.Center) * 36f; + if (!Projectile.WithinRange(storedPos, 100f)) + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(angleToTargetCoords, angularTurnSpeed).ToRotationVector2() * Projectile.velocity.Length(); + } + if (KnifeType == 2) + { + Projectile.velocity = Projectile.SafeDirectionTo(storedPos) * 15f; + } + if (KnifeType == 1) + { + if (!Projectile.WithinRange(storedPos, 400f)) + Projectile.velocity = Projectile.SafeDirectionTo(storedPos) * 20f; + } + // If not super close to the target but the target is very much in the line of sight of the summon, charge. + if (!Projectile.WithinRange(storedPos, 75f) && Vector2.Dot(Projectile.SafeDirectionTo(storedPos), Projectile.velocity.SafeNormalize(Vector2.Zero)) > 0.99f && KnifeType == 3) + { + Projectile.velocity = Projectile.SafeDirectionTo(storedPos) * 36f; AttackDelay = 15f; Projectile.netUpdate = true; @@ -118,46 +245,80 @@ namespace CalamityMod.Projectiles.Summon public void ReturnToRestingPosition() { - Projectile.rotation = Projectile.rotation.AngleTowards(RestOffsetAngle, 0.25f); + if (moveSmoothing > 2) + moveSmoothing--; + Projectile.rotation = Projectile.rotation.AngleTowards(RestOffsetAngle + Main.GlobalTimeWrappedHourly, 0.25f); + + float sine = Math.Abs((float)Math.Sin((Main.GlobalTimeWrappedHourly + RestOffsetAngle * 1.8f) * 8f / MathHelper.Pi)); // Rapidly approach the resting position. - Vector2 destination = Owner.Center + Vector2.UnitY.RotatedBy(RestOffsetAngle) * -120f; - Projectile.velocity = (destination - Projectile.Center) / 10f; + Vector2 destination = Owner.Center + Vector2.UnitY.RotatedBy(RestOffsetAngle + Main.GlobalTimeWrappedHourly) * -220f * (MathHelper.Lerp(sine, 0.8f, 0.8f)); + Projectile.velocity = (destination - Projectile.Center) / (potentialTarget == null ? moveSmoothing : 18); } - - public override void PostDraw(Color lightColor) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - for (int i = 1; i < Projectile.oldPos.Length; i++) - CalamityUtils.DistanceClamp(ref Projectile.oldPos[i - 1], ref Projectile.oldPos[i], 6f); - - Texture2D trailSegmentTexture = ModContent.Request("CalamityMod/Projectiles/StarProj").Value; - for (int i = 2; i < Projectile.oldPos.Length; i++) + if (KnifeType == 1) { - float completionRatio = i / (float)Projectile.oldPos.Length; - float rotation = (Projectile.oldPos[i - 1] - Projectile.oldPos[i]).ToRotation() + MathHelper.PiOver2; - float scale = MathHelper.Lerp(0.7f, 0.1f, completionRatio) * Projectile.scale; - Color color = Color.Lerp(Color.LightPink, Color.Goldenrod, completionRatio * 3f % 1f) * 1.5f; - - // Become dimmer the slower the projectile is moving. - color *= Utils.GetLerpValue(1f, 8f, Projectile.velocity.Length(), true); - - // As well as how close the projectile is to pointing away from its rotation. - color *= Utils.GetLerpValue(0.65f, 0.45f, Projectile.velocity.AngleBetween(-(Projectile.rotation + MathHelper.PiOver2).ToRotationVector2()) / MathHelper.Pi, true); - - Main.EntitySpriteDraw(trailSegmentTexture, - Projectile.oldPos[i] + Projectile.Size * 0.5f + new Vector2(0f, 8f).RotatedBy(Projectile.rotation) - Main.screenPosition, - null, - color, - rotation, - trailSegmentTexture.Size() * 0.5f, - scale, - SpriteEffects.None, - 0); + AttackDelay = 15; + attacksDone++; + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.7f, Pitch = attacksDone * 0.05f }, Projectile.Center); + if (attacksDone >= 6) + { + for (int i = 0; i < 9; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.5f) * Main.rand.NextFloat(10f, 20f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.25f, 1.75f); + dust.color = Color.Orchid; + dust.noLightEmittence = true; + } + for (int i = 0; i < 4; i++) + { + Particle spark = new CustomSpark(Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(15f, 20f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 25, Main.rand.NextFloat(1.35f, 1.6f), Color.Orchid, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.25f, 0.35f)); + GeneralParticleHandler.SpawnParticle(spark); + } + attackCooldown = Main.rand.Next(80, 95 + 1); + } + } + if (KnifeType == 2) + { + SoundStyle slam = new("CalamityMod/Sounds/NPCHit/RavagerRockPillarHit", 2); + SoundEngine.PlaySound(slam with { Volume = 0.4f, Pitch = Main.rand.NextFloat(-0.25f, -0.15f), MaxInstances = -1 }, Projectile.Center); + for (int i = 0; i < 7; i++) + { + Particle spark = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(1f, 5f), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard6", false, Main.rand.Next(15, 25 + 1), Main.rand.NextFloat(0.75f, 1.2f), Color.White, new Vector2(1.3f, 0.5f), false, false, Main.rand.NextFloat(-5, 5), false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + Projectile.velocity = (-Projectile.velocity.SafeNormalize(Vector2.UnitX) * 15).RotatedByRandom(0.7f); + attackCooldown = Main.rand.Next(45, 60 + 1); + } + if (KnifeType == 3) + { + if (attackCooldown == 0) + attackCooldown = 5; + target.AddBuff(ModContent.BuffType(), 180); } } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SourceDamage *= damageMult; + } public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); + public override bool? CanDamage() => attackCooldown == 0 ? null : false; + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + if (KnifeType == 1) + tex = ModContent.Request("CalamityMod/Projectiles/Summon/DazzlingStabber").Value; + if (KnifeType == 2) + tex = ModContent.Request("CalamityMod/Projectiles/Summon/DazzlingStabber2").Value; + if (KnifeType == 3) + tex = ModContent.Request("CalamityMod/Projectiles/Summon/DazzlingStabber3").Value; + + Projectile.DrawProjectileWithBackglow(color1 with { A = 0 }, lightColor, 3.5f, tex); + + return false; + } } } diff --git a/Projectiles/Summon/DazzlingStabber.png b/Projectiles/Summon/DazzlingStabber.png index 0a22d893bf..2c6181d243 100644 Binary files a/Projectiles/Summon/DazzlingStabber.png and b/Projectiles/Summon/DazzlingStabber.png differ diff --git a/Projectiles/Summon/DazzlingStabber2.png b/Projectiles/Summon/DazzlingStabber2.png new file mode 100644 index 0000000000..f94f5d4182 Binary files /dev/null and b/Projectiles/Summon/DazzlingStabber2.png differ diff --git a/Projectiles/Summon/DazzlingStabber3.png b/Projectiles/Summon/DazzlingStabber3.png new file mode 100644 index 0000000000..19e4e1d386 Binary files /dev/null and b/Projectiles/Summon/DazzlingStabber3.png differ diff --git a/Projectiles/Summon/FlameBlast.cs b/Projectiles/Summon/FlameBlast.cs index b4b5709f1e..4230820a80 100644 --- a/Projectiles/Summon/FlameBlast.cs +++ b/Projectiles/Summon/FlameBlast.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -24,64 +26,50 @@ namespace CalamityMod.Projectiles.Summon { Projectile.width = Projectile.height = 6; Projectile.friendly = true; - Projectile.tileCollide = true; - Projectile.timeLeft = 180; + Projectile.tileCollide = false; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 240; Projectile.DamageType = DamageClass.Summon; } public override void AI() { Player player = Main.player[Projectile.owner]; + NPC potentialTarget = Projectile.Center.MinionHoming(900f, Main.player[Projectile.owner]); + float velPower = Utils.GetLerpValue(2, 5, Projectile.velocity.Length(), true); if (count == 0f) { - SoundEngine.PlaySound(SoundID.Item73, Projectile.position); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 20; - Projectile.height = 20; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int i = 0; i < 10; i++) - { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); - Main.dust[dust].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[dust].scale = 0.5f; - Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 20; j++) - { - int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 3f); - Main.dust[dust2].noGravity = true; - Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f); - Main.dust[dust2].velocity *= 2f; - } + count += 1f; } Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - for (int k = 0; k < 5; k++) - { - int otherDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 0.75f); - Main.dust[otherDust].velocity *= 0f; - } + Particle beam = new CustomSpark(Projectile.Center, Projectile.velocity * 0.1f, "CalamityMod/Particles/SmallBloom", false, 8, 0.085f, Color.Lerp(Color.OrangeRed, Color.Goldenrod, Utils.GetLerpValue(270, 230, Projectile.timeLeft)), new Vector2(1f, (1 + 0.8f * velPower)), true, false, 0, false, false, 0.5f * velPower); + GeneralParticleHandler.SpawnParticle(beam); } - NPC potentialTarget = Projectile.Center.MinionHoming(300f, Main.player[Projectile.owner]); - if (potentialTarget != null) - Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(potentialTarget.Center) * 25f) / 21f; + + if (potentialTarget != null && (Projectile.localAI[0] % 100 <= 55 || Projectile.localAI[0] < 20)) + { + Projectile.timeLeft++; // Extend liftime so it doesnt fizzle out so fast while tracking something + Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(potentialTarget.Center) * 8f) / 21f; + } + else + Projectile.velocity *= Main.rand.NextFloat(0.96f, 0.97f); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); public override void OnKill(int timeLeft) { - for (int k = 0; k < 5; k++) + for (int j = 0; j < 9; j++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.oldVelocity.X * 0f, Projectile.oldVelocity.Y * 0f); + Dust c = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + c.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.5f) * Main.rand.NextFloat(7, 15); + c.scale = Main.rand.NextFloat(0.9f, 1.1f); + c.noGravity = true; + c.color = Main.rand.NextBool() ? Color.Orange : Color.Goldenrod; + c.noLightEmittence = true; } } } diff --git a/Projectiles/Summon/GiantIbanRobotOfDoom.cs b/Projectiles/Summon/GiantIbanRobotOfDoom.cs index 16d8746566..ccc2102d01 100644 --- a/Projectiles/Summon/GiantIbanRobotOfDoom.cs +++ b/Projectiles/Summon/GiantIbanRobotOfDoom.cs @@ -131,6 +131,7 @@ namespace CalamityMod.Projectiles.Summon ExitChargeModeEarly(player); } + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction player.velocity = Vector2.Lerp(player.velocity, Projectile.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY) * RightIconLungeSpeed, 0.225f); Projectile.rotation = player.velocity.ToRotation() + MathHelper.PiOver2; } @@ -331,7 +332,10 @@ namespace CalamityMod.Projectiles.Summon { SoundEngine.PlaySound(GaussRifle.FireSound, Projectile.Center); int damage = (int)player.GetTotalDamage().ApplyTo(LaserBaseDamage); + + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 laserVelocity = (Main.MouseWorld - (Main.player[Projectile.owner].Center + new Vector2(Projectile.spriteDirection == 1 ? 48f : 22f, -28f))).SafeNormalize(Vector2.UnitX * Projectile.spriteDirection); + Projectile deathLaser = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, laserVelocity, diff --git a/Projectiles/Summon/PlantationStaffSeed.cs b/Projectiles/Summon/PlantationStaffSeed.cs index b454f87a61..6932140534 100644 --- a/Projectiles/Summon/PlantationStaffSeed.cs +++ b/Projectiles/Summon/PlantationStaffSeed.cs @@ -20,7 +20,8 @@ namespace CalamityMod.Projectiles.Summon ProjectileID.Sets.MinionShot[Type] = true; ProjectileID.Sets.TrailingMode[Type] = 2; ProjectileID.Sets.TrailCacheLength[Type] = 3; - Main.instance.LoadProjectile(ProjectileID.PoisonSeedPlantera); + if (!Main.dedServ) + Main.instance.LoadProjectile(ProjectileID.PoisonSeedPlantera); } public override void SetDefaults() diff --git a/Projectiles/Summon/ProfanedEnergy.cs b/Projectiles/Summon/ProfanedEnergy.cs index 29c66a829a..ae5a03e61c 100644 --- a/Projectiles/Summon/ProfanedEnergy.cs +++ b/Projectiles/Summon/ProfanedEnergy.cs @@ -1,5 +1,9 @@ using System; +using System.Collections.Generic; using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -14,6 +18,18 @@ namespace CalamityMod.Projectiles.Summon public override string Texture => "CalamityMod/NPCs/NormalNPCs/ImpiousImmolator"; private float count = 0f; + public bool flapping = false; + public NPC targeted; + public int maxTargetDistance = 500; // Since they move, the targeting distance is lower than normal + + public int maxRechargeTime = 180; + + public ref float attackTimer => ref Projectile.ai[0]; + public ref float attackCooldown => ref Projectile.ai[1]; + public int attacks = 0; + public int maxAttacks = 10; + + public int reactTimer = 0; public override void SetStaticDefaults() { @@ -36,122 +52,170 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; Projectile.frameCounter++; + flapping = false; if (Projectile.frameCounter > 5) { Projectile.frame++; + if (Projectile.frame == 2) + flapping = true; Projectile.frameCounter = 0; } if (Projectile.frame > 3) { Projectile.frame = 0; } - if (count == 0f) + + if (flapping) + Projectile.velocity += -Vector2.UnitY * 4.6f; + else + Projectile.velocity += Vector2.UnitY * 0.2f; + + // Anticlump + for (int x = 0; x < Main.maxProjectiles; x++) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); - for (int i = 0; i < 5; i++) + Projectile projectile = Main.projectile[x]; + if (Vector2.Distance(Projectile.Center, projectile.Center) <= 70 && projectile.active && projectile.type == Projectile.type && projectile != Projectile) { - int holy = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2f); - Main.dust[holy].velocity *= 3f; - Main.dust[holy].position = Projectile.Center; - if (Main.rand.NextBool()) + Projectile.velocity += Utils.DirectionFrom(Projectile.Center, projectile.Center) * 0.02f; + } + } + + float rate = Main.GlobalTimeWrappedHourly * 2; + List eColors = new List() + { + Color.Gold, + Color.Khaki + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + Lighting.AddLight(Projectile.Center, usedColor.ToVector3() * 0.8f); + + if (targeted == null) // Find target or move closer to the player + { + Vector2 moveDir = Utils.DirectionTo(Projectile.Center, player.Center); + // If there's no target and the player isnt too close, flap closer them a bit (woah non stationary sentry crazy) + if (flapping && Utils.Distance(player.Center, Projectile.Center) > 300) + { + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.3f, Pitch = 0.8f }, Projectile.Center); + Projectile.velocity += (moveDir * Main.rand.NextFloat(3f, 5f)).RotatedByRandom(0.4f); + + for (int j = 0; j < 8; j++) { - Main.dust[holy].scale = 0.5f; - Main.dust[holy].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Dust c = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(35, 35), ModContent.DustType()); + c.velocity = -Projectile.velocity.SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(3, 7); + c.scale = Main.rand.NextFloat(0.5f, 0.7f); + c.noGravity = true; + c.color = Color.Orchid; + c.noLightEmittence = true; } } - for (int j = 0; j < 10; j++) + + if (reactTimer < 600) { - int fire = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 3f); - Main.dust[fire].noGravity = true; - Main.dust[fire].velocity *= 5f; - Main.dust[fire].position = Projectile.Center; - fire = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f); - Main.dust[fire].velocity *= 2f; - Main.dust[fire].position = Projectile.Center; + if (Utils.Distance(player.Center, Projectile.Center) < 120) + reactTimer++; + } + else + { + SoundStyle happy = new("CalamityMod/Sounds/Item/SanctifiedSparkHappy"); + SoundEngine.PlaySound(happy with { Volume = 0.5f, PitchVariance = 0.3f }, Projectile.Center); + for (int i = 0; i < 3; i++) + { + Particle spark = new CustomSpark(Projectile.Center, (-Vector2.UnitY * Main.rand.NextFloat(3f, 5f)).RotatedByRandom(0.6f), "CalamityMod/Particles/HeartParticle", false, 75, Main.rand.NextFloat(1.3f, 1.8f), Color.Lerp(Color.Goldenrod, Color.OrangeRed, i * 0.5f), Vector2.One, true, true, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + reactTimer = Main.rand.Next(0, 120 + 1); + } + + if (player.HasMinionAttackTargetNPC) + { + targeted = Main.npc[player.MinionAttackTargetNPC]; + if (!targeted.CanBeChasedBy(Projectile, false) || Utils.Distance(Projectile.Center, targeted.Center) > maxTargetDistance) + targeted = null; + } + else + { + targeted = Projectile.Center.ClosestNPCAt(maxTargetDistance); + } + + Projectile.spriteDirection = Math.Sign(-moveDir.X); + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, 0, 0.05f); + } + if (targeted != null && ((Utils.Distance(Projectile.Center, targeted.Center) > maxTargetDistance) || attackCooldown > 0 || targeted.active == false || targeted.life <= 0)) // Reset targeting if they leave aggro range or are on attack cooldown + { + targeted = null; + } + if (targeted != null) // Attacks + { + reactTimer = Main.rand.Next(0, 120 + 1); + if (Projectile.owner == Main.myPlayer) + { + Vector2 shootVel = Utils.DirectionTo(Projectile.Center, targeted.Center) * 8; + Projectile.spriteDirection = Math.Sign(-shootVel.X); + if (attackTimer <= 0) + { + SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (shootVel * Main.rand.NextFloat(0.8f, 1.2f)).RotatedBy(0.75f * (attacks % 2 == 0 ? -1 : 1)).RotatedByRandom(0.4f), ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); + + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Goldenrod, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, Main.rand.NextFloat(0.75f, 1f), 15); + GeneralParticleHandler.SpawnParticle(orb2); + + attackTimer = 8; + attacks++; + } + else + attackTimer--; + + if (attacks >= 18) + { + attackCooldown = maxRechargeTime; + attacks = 0; + } + + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, shootVel.ToRotation() + (Projectile.spriteDirection == -1 ? 0 : MathHelper.ToRadians(180f)), 0.07f); + } + } + if (attackTimer > 0) + attackTimer--; + if (attackCooldown > 0) + { + int healShots = (int)(player.maxMinions / 4); + if (healShots != 0 && attackCooldown != maxRechargeTime && (attackCooldown % (maxRechargeTime / (healShots + 1)) == 0)) + { + Vector2 vel = ((Projectile.Center - player.Center) - player.velocity * 10).SafeNormalize(Vector2.UnitX) * -10; + Projectile healStar = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, vel, ModContent.ProjectileType(), 0, Projectile.knockBack, Projectile.owner, 0, 10, 5); + healStar.extraUpdates = 2; + SoundStyle fireHeal = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash"); + SoundEngine.PlaySound(fireHeal with { Volume = 0.7f, Pitch = 0.3f }, Projectile.Center); + + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, new Color(54, 209, 54), "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 1.3f, 24); + GeneralParticleHandler.SpawnParticle(orb2); + } + attackCooldown--; + } + + Projectile.velocity *= 0.97f; + + if (count == 0f) // Spawn effects + { + reactTimer += Main.rand.Next(0, 120 + 1); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + for (int i = 0; i < 20; i++) + { + Dust c = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + c.velocity = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 15.5f * (i % 2 == 0 ? 0.88f : 1f); + c.scale = Main.rand.NextFloat(1.3f, 1.6f) * 0.8f * (i % 2 == 0 ? 2.2f : 1.8f); + c.noGravity = true; + c.color = Color.Goldenrod; + c.noLightEmittence = true; } count += 1f; } - if (Projectile.owner == Main.myPlayer) - { - if (Projectile.ai[0] != 0f) - { - Projectile.ai[0] -= 1f; - return; - } - bool canAttack = false; - float projX = Projectile.Center.X; - float projY = Projectile.Center.Y; - float attackDistance = 1000f; - int target = 0; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(Projectile, false)) - { - float targetX = npc.Center.X; - float targetY = npc.Center.Y; - float targetDist = Math.Abs(Projectile.Center.X - targetX) + Math.Abs(Projectile.Center.Y - targetY); - if (targetDist < attackDistance && Collision.CanHit(Projectile.Center, Projectile.width, Projectile.height, npc.Center, npc.width, npc.height)) - { - projX = targetX; - projY = targetY; - canAttack = true; - target = npc.whoAmI; - } - } - } - if (!canAttack) - { - foreach (NPC n in Main.ActiveNPCs) - { - if (n.CanBeChasedBy(Projectile, false)) - { - float npcX = n.position.X + (float)(n.width / 2); - float npcY = n.position.Y + (float)(n.height / 2); - float npcDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcY); - if (npcDist < attackDistance && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, n.position, n.width, n.height)) - { - attackDistance = npcDist; - projX = npcX; - projY = npcY; - canAttack = true; - target = n.whoAmI; - } - } - } - } - if (canAttack) - { - float projXStore = projX; - float projYStore = projY; - projX -= Projectile.Center.X; - projY -= Projectile.Center.Y; - if (projX < 0f) - { - Projectile.spriteDirection = 1; - } - else - { - Projectile.spriteDirection = -1; - } - int projectileType = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ProjectileType(), - ModContent.ProjectileType() - }); - float speed = 25f; - Vector2 fireDirection = Projectile.Center; - float fireXVel = projXStore - fireDirection.X; - float fireYVel = projYStore - fireDirection.Y; - float fireVelocity = (float)Math.Sqrt((double)(fireXVel * fireXVel + fireYVel * fireYVel)); - fireVelocity = speed / fireVelocity; - fireXVel *= fireVelocity; - fireYVel *= fireVelocity; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, fireXVel, fireYVel, projectileType, Projectile.damage, Projectile.knockBack, Projectile.owner, (float)target, 0f); - - Projectile.ai[0] = 16f; - } - } + } public override bool? CanDamage() => false; diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs index 9a86d97a56..34bb7bed25 100644 --- a/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs @@ -104,6 +104,8 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms Vector2 connectPosition = Main.LocalPlayer.Center + ConnectOffset; connectPosition.X += (OwnerRestingOffset.X > 0f).ToDirectionInt() * Projectile.scale * 20f; Vector2 endPosition = Owner.Center + OwnerRestingOffset; + + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, the limb system caps the resulting possible length endPosition += (Main.MouseWorld - endPosition) * 0.075f; ClampFirstLimbRotation(ref Limbs[0].Rotation); @@ -126,7 +128,9 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms // Look at the mouse if not targetting anything. // If something is being targeted, look at them instead. + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction float idealRotation = Main.myPlayer != Projectile.owner ? Projectile.rotation : Projectile.AngleTo(Main.MouseWorld); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(AresExoskeleton.TargetingDistance); if (potentialTarget != null) { diff --git a/Projectiles/Summon/VoidConcentrationAura.cs b/Projectiles/Summon/VoidConcentrationAura.cs index 051bfc1b6a..37970e73a4 100644 --- a/Projectiles/Summon/VoidConcentrationAura.cs +++ b/Projectiles/Summon/VoidConcentrationAura.cs @@ -48,6 +48,7 @@ namespace CalamityMod.Projectiles.Summon public void HandleRightClick() { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 velocity = Main.MouseWorld - Main.player[Projectile.owner].Center; velocity.Normalize(); velocity *= 2f; diff --git a/Projectiles/Summon/WulfrumDroid.cs b/Projectiles/Summon/WulfrumDroid.cs index a71d1b10fa..cc8d4f7eee 100644 --- a/Projectiles/Summon/WulfrumDroid.cs +++ b/Projectiles/Summon/WulfrumDroid.cs @@ -310,6 +310,7 @@ namespace CalamityMod.Projectiles.Summon AyeAyeCaptainCooldown = 50f; Player playerToBuff = Owner; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, this is used to determine "player intent" for buffing and healing float mouseDistanceToOwner = (Owner.MountedCenter - Owner.Calamity().mouseWorld).Length(); if (Main.netMode == NetmodeID.MultiplayerClient && mouseDistanceToOwner > 120f) diff --git a/Projectiles/Typeless/ArtifactOfResilienceShards.cs b/Projectiles/Typeless/ArtifactOfResilienceShards.cs index a9f0af6ded..dd74b76ed3 100644 --- a/Projectiles/Typeless/ArtifactOfResilienceShards.cs +++ b/Projectiles/Typeless/ArtifactOfResilienceShards.cs @@ -1,332 +1,223 @@ -using System.IO; +using System; +using System.Collections.Generic; +using System.IO; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; -using CalamityMod.Projectiles.Damageable; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { - // TODO -- Make this one projectile with multiple frames instead of multiple projectiles with one frame. - public class ArtifactOfResilienceShard1 : ModProjectile, ILocalizedModType + public class ArtifactOfResilienceShards : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; - public int Timer = 0; - public Vector2 StartingPosition; - public const int MaxTimeLeft = 360; - public const int FallTime = 240; - public const float OutwardMovementTime = 85f; - public const float InwardReturnMovementTime = 100f; - public const float MaxRadius = 240f; - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 1; - } + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + public bool orbiting => Projectile.ai[1] == 0; + public Player Owner => Main.player[Projectile.owner]; + public Vector2 goalPosition; + public bool behind = false; + public int relicType = 1; + public float orbitSine = 0; + + public int burstTimer = 0; + public float speedMult = 1; + public float placementMult = 1; + public float orbitRot = 0; + public bool isAttacking => (burstTimer == 0 && !orbiting && Projectile.ai[1] != -1); public override void SetDefaults() { - Projectile.width = 30; - Projectile.height = 30; + Projectile.width = 50; + Projectile.height = 50; Projectile.friendly = true; Projectile.penetrate = -1; + Projectile.extraUpdates = 4; Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.timeLeft = MaxTimeLeft; + Projectile.timeLeft = 230; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; + Projectile.localNPCHitCooldown = 30 * Projectile.MaxUpdates; + Projectile.ContinuouslyUpdateDamageStats = true; } - - public override void SendExtraAI(BinaryWriter writer) + public override void AI() { - writer.Write(Projectile.frameCounter); - writer.WriteVector2(StartingPosition); - } + float sine = (float)Math.Sin(time * 0.03f * speedMult / MathHelper.Pi); + float sine2 = (float)Math.Sin(time * (0.03f * 0.5f * speedMult) / MathHelper.Pi); + float sineNumberThreeSurelyWeNeedAThirdSineYouWillNotRegretAThirdSine = (float)Math.Sin((Main.GlobalTimeWrappedHourly + Owner.Calamity().rOfResilienceOrbitOffset) * (4.5f) / MathHelper.Pi); - public override void ReceiveExtraAI(BinaryReader reader) - { - Projectile.frameCounter = reader.ReadInt32(); - StartingPosition = reader.ReadVector2(); - } + orbitSine = MathHelper.Lerp(Math.Abs(sine2), 0.1f, 1 - Math.Abs(sine2)); + float shardNumMult = Utils.GetLerpValue(-10, 30, Owner.ownedProjectileCounts[ModContent.ProjectileType()], true) * (Owner.Calamity().profanedSoulRelicBuff ? 2 : 1); - public static void ArtifactOfResilienceShardAI(Projectile projectile, ref Vector2 StartingPosition, ref int Timer) - { - // Spinning - if (projectile.localAI[1] == 0f) + float displace = new Vector2(25, 0).RotatedBy(sineNumberThreeSurelyWeNeedAThirdSineYouWillNotRegretAThirdSine * 0.5f).ToRotation(); + orbitRot = Utils.AngleLerp(orbitRot, displace, 0.01f); + goalPosition = Owner.Center + (new Vector2(250 * sine * shardNumMult * placementMult, (125 * orbitSine - 45) * shardNumMult * placementMult)).RotatedBy(orbitRot); + + Lighting.AddLight(Projectile.Center, Color.Lerp(Color.White, Color.Sienna, 0.5f).ToVector3() * 0.8f); + + if (Owner.Calamity().rOfResilienceCooldown > 0 && Projectile.ai[1] == 0) { - if (projectile.localAI[0] == 0f) + burstTimer = 120; + Projectile.ai[1] = 1; + Projectile.netUpdate = true; + } + if (Owner.Calamity().rOfResilienceEffect == 0 && Projectile.ai[1] == 0) + { + Projectile.ai[1] = -1; + Projectile.timeLeft = 95; + Projectile.velocity = Utils.DirectionTo(Projectile.Center, goalPosition) * Main.rand.NextFloat(1f, 3f); + } + + if (time == 0) + { + relicType = Main.rand.Next(1, 6 + 1); + speedMult = (Owner.Calamity().profanedSoulRelicBuff ? Main.rand.NextFloat(0.6f, 1.5f) : Main.rand.NextFloat(0.8f, 1.2f)); + placementMult = Main.rand.NextFloat(0.75f, 1.15f); + } + + if (orbiting) + { + Projectile.scale = 0.8f + orbitSine * 0.5f; + Projectile.rotation += 0.02f * sine; + + Projectile.timeLeft++; + + Projectile.Center = goalPosition; + Projectile.velocity = Vector2.Zero; + + if (Projectile.scale < 0.9f) { - StartingPosition = projectile.Center; - projectile.netUpdate = true; - projectile.localAI[0] = 1f; + behind = true; + Projectile.Opacity = MathHelper.Lerp(Projectile.Opacity, 0.15f, 0.057f); } - Timer++; - if (Timer < OutwardMovementTime) + else { - projectile.ai[1] = MathHelper.Lerp(0f, MaxRadius, Timer / OutwardMovementTime); + behind = false; + Projectile.Opacity = MathHelper.Lerp(Projectile.Opacity, 0.7f, 0.027f); } - if (Timer > MaxTimeLeft - InwardReturnMovementTime) + } + else + { + Projectile.Opacity = Utils.GetLerpValue(0, 90, Projectile.timeLeft, true); + if (Projectile.ai[1] == -1) { - projectile.ai[1] = MathHelper.Lerp(0f, MaxRadius, (Timer - MaxTimeLeft) / -InwardReturnMovementTime); + Projectile.velocity *= 0.98f; } - projectile.ai[0] += MathHelper.Pi / (projectile.ai[1] / MathHelper.Pi + 1); - projectile.Center = StartingPosition + projectile.ai[0].ToRotationVector2() * projectile.ai[1]; - projectile.rotation = projectile.ai[0]; - if (projectile.timeLeft == 1) + else { - for (int i = 0; i < 50; i++) + if (burstTimer > 0) { - Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.ProfanedFire); - dust.velocity = Utils.NextVector2Circular(Main.rand, 36f, 36f); - dust.scale = Main.rand.NextFloat(1.9f, 2.45f); - dust.noGravity = true; - } - projectile.timeLeft = FallTime; - projectile.tileCollide = true; - projectile.velocity = Utils.NextVector2Circular(Main.rand, 18f, 9f); - projectile.localAI[1] = 1; - } - if (projectile.ModProjectile is ArtifactOfResilienceShard1) - { - foreach (var n in Main.ActiveNPCs) - { - if (n.Distance(StartingPosition) < projectile.ai[1] && - n.damage > 0) + Projectile.extraUpdates = 1; + Projectile.velocity *= 0.9f; + if (Utils.Distance(Projectile.Center, Owner.Center) < 15) { - if (n.Calamity().relicOfResilienceCooldown <= 0) + behind = true; + Projectile.Center = Owner.Center; + } + else + { + Projectile.Center += Utils.DirectionTo(Projectile.Center, Owner.Center) * 40f * Utils.GetLerpValue(90, 0, burstTimer); + if (time % 8 == 0) { - n.Calamity().relicOfResilienceCooldown = 600; - n.Calamity().relicOfResilienceWeakness = 180; - n.AddBuff(ModContent.BuffType(), n.Calamity().relicOfResilienceWeakness); + Particle spark = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3, 8), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard" + Main.rand.Next(1, 6 + 1).ToString(), true, Main.rand.Next(20, 32 + 1), Main.rand.NextFloat(0.65f, 1.1f), Color.White * Main.rand.NextFloat(0.4f, 0.9f), Vector2.One, false, false, Main.rand.NextFloat(-5, 5), false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + } + burstTimer--; + if (burstTimer == 0) + { + Projectile.Opacity = 1; + + int projNum = Owner.ownedProjectileCounts[ModContent.ProjectileType()] - 4; + + Projectile.velocity = ((MathHelper.TwoPi * Projectile.ai[2] / projNum).ToRotationVector2()) * 15 * speedMult; + + if (Projectile.ai[2] == 1) + { + SoundStyle boom = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate"); + SoundEngine.PlaySound(boom with { Volume = 0.7f, Pitch = 0.1f }, Owner.Center); + SoundStyle boom2 = new("CalamityMod/Sounds/Item/MagicRockSound"); + SoundEngine.PlaySound(boom2 with { Volume = 0.7f, Pitch = 0f }, Owner.Center); + } + for (int i = 0; i < 3; i++) + { + Particle spark = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(6, 28), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard" + Main.rand.Next(1, 6 + 1).ToString(), Main.rand.NextBool(3), Main.rand.Next(25, 55 + 1), Main.rand.NextFloat(1.2f, 1.7f), Color.White, new Vector2(0.9f, 1.1f), false, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5, 38)); + dust.noGravity = Main.rand.NextBool(); + dust.scale = Main.rand.NextFloat(1.35f, 2.8f); + dust.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Sienna; } } } - } - } - // Falling - else - { - if (projectile.frameCounter <= ArtifactOfResilienceBulwark.MaxReformations) - { - // Reform - if (projectile.ModProjectile is ArtifactOfResilienceShard1 && Main.myPlayer == projectile.owner) + else { - Projectile reformedBulwark = Projectile.NewProjectileDirect(projectile.GetSource_FromThis(), - projectile.Center, - Vector2.Zero, - ModContent.ProjectileType(), - projectile.damage, - projectile.knockBack, - projectile.owner); - reformedBulwark.frameCounter = projectile.frameCounter; // Incremented on death, not reformation. + Projectile.velocity *= 0.97f; } - projectile.Kill(); - return; - } - if (projectile.velocity.Y < 12f) - { - projectile.velocity.Y += 0.25f; - } - projectile.velocity.X *= 0.95f; - projectile.rotation = projectile.velocity.ToRotation(); - if (projectile.timeLeft < 60f) - { - projectile.alpha = 255 - (int)MathHelper.Lerp(0, 255, projectile.timeLeft / 60f); } } - } - public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); - } - public class ArtifactOfResilienceShard2 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public int Timer = 0; - public Vector2 StartingPosition; - public const float MaxRadius = 660f; - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 1; - } + if (isAttacking && Main.rand.NextBool(4)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), -Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.6f) * Main.rand.NextFloat(4f, 8f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.55f, 1.1f) * Projectile.Opacity; + dust.color = Main.rand.NextBool() ? Color.Orange : Color.Goldenrod; + } - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 40; + time++; } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SourceDamage *= (isAttacking ? 1 : 0.45f); + if (isAttacking) + target.AddBuff(ModContent.BuffType(), 520); + } + public override void OnKill(int timeLeft) + { + + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = relicType switch + { + 1 => ModContent.Request("CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard1").Value, + 2 => ModContent.Request("CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard2").Value, + 3 => ModContent.Request("CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard3").Value, + 4 => ModContent.Request("CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard4").Value, + 5 => ModContent.Request("CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard5").Value, + _ => ModContent.Request("CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard6").Value + }; + if (isAttacking) + Projectile.DrawProjectileWithBackglow(Color.Goldenrod with { A = 0 } * Projectile.Opacity, Color.White * Projectile.Opacity, 3 * Projectile.scale, tex); + else + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); + + return false; + } + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + if (behind) + behindProjectiles.Add(index); + else + overPlayers.Add(index); + } + public override bool? CanDamage() => (Projectile.ai[1] == -1 || burstTimer > 0) ? false : null; public override void SendExtraAI(BinaryWriter writer) { - writer.Write(Projectile.frameCounter); - writer.WriteVector2(StartingPosition); + writer.Write7BitEncodedInt(burstTimer); + writer.Write7BitEncodedInt(Owner.Calamity().rOfResilienceCooldown); } public override void ReceiveExtraAI(BinaryReader reader) { - Projectile.frameCounter = reader.ReadInt32(); - StartingPosition = reader.ReadVector2(); + burstTimer = reader.Read7BitEncodedInt(); + Owner.Calamity().rOfResilienceCooldown = reader.Read7BitEncodedInt(); } - - public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); - } - public class ArtifactOfResilienceShard3 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public int Timer = 0; - public Vector2 StartingPosition; - public const float MaxRadius = 660f; - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 40; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Projectile.frameCounter); - writer.WriteVector2(StartingPosition); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - Projectile.frameCounter = reader.ReadInt32(); - StartingPosition = reader.ReadVector2(); - } - public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); - } - public class ArtifactOfResilienceShard4 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public int Timer = 0; - public Vector2 StartingPosition; - public const float MaxRadius = 660f; - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 40; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Projectile.frameCounter); - writer.WriteVector2(StartingPosition); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - Projectile.frameCounter = reader.ReadInt32(); - StartingPosition = reader.ReadVector2(); - } - public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); - } - public class ArtifactOfResilienceShard5 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public int Timer = 0; - public Vector2 StartingPosition; - public const float MaxRadius = 660f; - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 40; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Projectile.frameCounter); - writer.WriteVector2(StartingPosition); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - Projectile.frameCounter = reader.ReadInt32(); - StartingPosition = reader.ReadVector2(); - } - public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); - } - public class ArtifactOfResilienceShard6 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public int Timer = 0; - public Vector2 StartingPosition; - public const float MaxRadius = 660f; - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 40; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Projectile.frameCounter); - writer.WriteVector2(StartingPosition); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - Projectile.frameCounter = reader.ReadInt32(); - StartingPosition = reader.ReadVector2(); - } - public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); } } diff --git a/Projectiles/Typeless/BasicBurst.cs b/Projectiles/Typeless/BasicBurst.cs new file mode 100644 index 0000000000..df59243a41 --- /dev/null +++ b/Projectiles/Typeless/BasicBurst.cs @@ -0,0 +1,95 @@ +using System; +using System.IO; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class BasicBurst : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Vector2 pushVelocity; + public float customKnockback = 0; + + public bool hasStongDisplacement = false; // If you set Knockback to anything below zero, the custom knockback will be able to effect enemies that normally ignore knockback. + + // Projectile.ai[0] is the size of the circular hitbox. + // Projectile.ai[1] is the minimum multiplier on pierce damage. + // Projectile.ai[2] is the number of hits to reach minimum pierce damage. + + // You can use the local ai variables 0 - 2 to inflict up to two debuffs, if you need more than two debuffs just make your own projectile + // 0 and 2 are what debuff is being inflicted + // 1 is the debuff duration + public override void SetDefaults() + { + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.timeLeft = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + // Get custom knockback strength. + // Takes the knockback applied to the projectile to determine strength, then sets regular knockback to zero + // Negative knockback is Abs'd and turns on strong knockback that effects more kinds of enemies + if (customKnockback == 0) + { + if (Projectile.knockBack < 0) + hasStongDisplacement = true; + customKnockback = Math.Abs(Projectile.knockBack); + Projectile.knockBack = 0; + } + if (Projectile.ai[0] == 0) + Projectile.ai[0] = 50; // The base size for explosions is 50. + if (Projectile.ai[1] == 0) + Projectile.ai[1] = 0.1f; // The base minimum damage multiplier is 0.1f. + if (Projectile.ai[2] == 0) + Projectile.ai[2] = 5; // The base number of hit to reach minimum damage is 5. + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.localAI[0] != 0) // Debuff 1 + { + target.AddBuff((int)(Projectile.localAI[0]), (int)(Projectile.localAI[1])); + } + if (Projectile.localAI[2] != 0) // Debuff 2 + { + target.AddBuff((int)(Projectile.localAI[2]), (int)(Projectile.localAI[1])); + } + pushVelocity = Utils.DirectionTo(Projectile.Center, target.Center) * customKnockback; + float minMult = Projectile.ai[1]; + int hitsToMinMult = (int)Projectile.ai[2]; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + + if (customKnockback != 0 && target.CanBeMoved(hasStongDisplacement)) + { + target.velocity = (pushVelocity * (target.knockBackResist == 0 ? 0.5f : 1)); + } + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.ai[0], targetHitbox); + } + public override void SendExtraAI(BinaryWriter writer) // Sending extra ai for the debuff infliction + { + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); + writer.Write(Projectile.localAI[2]); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[2] = reader.ReadSingle(); + } + } +} diff --git a/Projectiles/Typeless/BasicPlagueBee.cs b/Projectiles/Typeless/BasicPlagueBee.cs index 584818b179..dbdc38363a 100644 --- a/Projectiles/Typeless/BasicPlagueBee.cs +++ b/Projectiles/Typeless/BasicPlagueBee.cs @@ -32,6 +32,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 10; Projectile.friendly = true; Projectile.penetrate = 2; + Projectile.extraUpdates = 1; Projectile.timeLeft = 300; Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Typeless/BlazingStarHeal.cs b/Projectiles/Typeless/BlazingStarHeal.cs index e8c2d75b79..813cd82252 100644 --- a/Projectiles/Typeless/BlazingStarHeal.cs +++ b/Projectiles/Typeless/BlazingStarHeal.cs @@ -1,9 +1,15 @@ using System; +using CalamityMod.Dusts; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -12,23 +18,35 @@ namespace CalamityMod.Projectiles.Typeless public class BlazingStarHeal : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Particles/Sparkle"; - public override string Texture => "CalamityMod/Projectiles/StarProj"; + public static Asset Bloom; + public override void Load() => Bloom = ModContent.Request("CalamityMod/Particles/BloomCircle"); + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 25; + ProjectileID.Sets.TrailingMode[Type] = 2; + } public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; + Projectile.width = Projectile.height = 30; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.alpha = 255; Projectile.penetrate = 1; Projectile.timeLeft = 200; } public override void AI() { + if (Projectile.timeLeft == 200) + Projectile.rotation = Projectile.velocity.ToRotation(); + + Projectile.rotation += MathHelper.ToRadians(6f) * Utils.GetLerpValue(0f, 30f, Projectile.timeLeft, true); + Projectile.scale = Utils.GetLerpValue(-10f, 30f, Projectile.timeLeft, true); // Gets smaller but not completely invisible while dying out + if (Projectile.timeLeft % 4 == 0) //only once per 4 frames Lighting.AddLight(Projectile.Center, 0f, 0.6f, 0f); if (Projectile.timeLeft > 190) @@ -44,7 +62,7 @@ namespace CalamityMod.Projectiles.Typeless return; float playerDist = Vector2.Distance(player.Center, Projectile.Center); - if (!player.immune && playerDist < 50f && !player.dead && Projectile.position.X < player.position.X + player.width && Projectile.position.X + Projectile.width > player.position.X && Projectile.position.Y < player.position.Y + player.height && Projectile.position.Y + Projectile.height > player.position.Y) + if (!player.immune && playerDist < 30f * Projectile.scale && Projectile.timeLeft <= 190) { int healAmt = Utils.Clamp((200 - Projectile.timeLeft) / 10, 1, 10); //min heal is 5, max heal is 10, achievable after 2 seconds player.HealPlayer(healAmt, HealTextType.Local); @@ -55,67 +73,56 @@ namespace CalamityMod.Projectiles.Typeless } } + internal float WidthFunction(float completionRatio) => (1f - completionRatio) * Projectile.scale * 16f; + internal Color ColorFunction(float completionRatio) + { + float hue = 0.35f + 0.1f * completionRatio * CalamityUtils.Convert01To010((Main.GlobalTimeWrappedHourly * 0.25f) % 1f); + Color trailColor = Main.hslToRgb(hue, 0.6f, 0.5f); + return trailColor * Projectile.Opacity; + } + public override bool PreDraw(ref Color lightColor) { - Texture2D starTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Color healGreen = new Color(54, 209, 54, 0); - Vector2 projPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - Color healGreenDraw = healGreen; - Vector2 colorSize = starTexture.Size() / 2f; - Color lesserHealGreen = healGreen * 0.5f; - float colorLerp = Utils.GetLerpValue(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.GetLerpValue(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 30f / 0.5f * ((float)Math.PI * 2f) * 3f)) * 0.8f; - Vector2 scaledColorLerp1 = new Vector2(0.5f, 1f) * colorLerp; - Vector2 scaledColorLerp2 = new Vector2(0.5f, 1f) * colorLerp; - healGreenDraw *= colorLerp; - lesserHealGreen *= colorLerp; + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 25); - Vector2 drawPos = projPos + Projectile.velocity.SafeNormalize(Vector2.Zero) * Utils.GetLerpValue(0.5f, 1f, Projectile.localAI[0] / 60f, clamped: true) * 0; + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + Texture2D sparkleTex = TextureAssets.Projectile[Type].Value; + Texture2D bloomTex = Bloom.Value; + float bloomScale = (sparkleTex.Height / (float)bloomTex.Height) * Projectile.scale; + float sparkleScale = (0.5f + CalamityUtils.Convert01To010((Main.GlobalTimeWrappedHourly % 2f) / 2f) * 0.2f) * Projectile.scale; - SpriteEffects spriteEffects = SpriteEffects.None; - if (Projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Main.EntitySpriteDraw(starTexture, drawPos, null, healGreenDraw, (float)Math.PI / 2f, colorSize, scaledColorLerp1, spriteEffects, 0); - Main.EntitySpriteDraw(starTexture, drawPos, null, healGreenDraw, 0f, colorSize, scaledColorLerp2, spriteEffects, 0); - Main.EntitySpriteDraw(starTexture, drawPos, null, lesserHealGreen, (float)Math.PI / 2f, colorSize, scaledColorLerp1 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(starTexture, drawPos, null, lesserHealGreen, 0f, colorSize, scaledColorLerp2 * 0.6f, spriteEffects, 0); - - Main.EntitySpriteDraw(starTexture, drawPos, null, healGreenDraw, MathHelper.PiOver4, colorSize, scaledColorLerp1 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(starTexture, drawPos, null, healGreenDraw, MathHelper.PiOver4 * 3f, colorSize, scaledColorLerp2 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(starTexture, drawPos, null, lesserHealGreen, MathHelper.PiOver4, colorSize, scaledColorLerp1 * 0.36f, spriteEffects, 0); - Main.EntitySpriteDraw(starTexture, drawPos, null, lesserHealGreen, MathHelper.PiOver4 * 3f, colorSize, scaledColorLerp2 * 0.36f, spriteEffects, 0); + Color color = ColorFunction(0f); + Vector2 drawPos = Projectile.Center - Main.screenPosition; + Main.EntitySpriteDraw(bloomTex, drawPos, null, color * 0.5f, 0, bloomTex.Size() * 0.5f, 5f * bloomScale, SpriteEffects.None); + Main.EntitySpriteDraw(sparkleTex, drawPos, null, Color.Lerp(color, Color.White, 0.7f), Projectile.rotation, sparkleTex.Size() * 0.5f, 2.2f * sparkleScale, SpriteEffects.None); + Main.EntitySpriteDraw(sparkleTex, drawPos, null, color, Projectile.rotation + MathHelper.PiOver4, sparkleTex.Size() * 0.5f, 1.6f * sparkleScale, SpriteEffects.None); + Main.spriteBatch.ExitShaderRegion(); return false; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - Projectile.position.X = Projectile.position.X + (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); - Projectile.width = 40; - Projectile.height = 40; - Projectile.position.X = Projectile.position.X - (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - for (int i = 0; i < 5; i++) + SoundEngine.PlaySound(SoundID.Item14 with { Pitch = -0.3f, Volume = 0.7f }, Projectile.Center); + SoundStyle fireHeal = new("CalamityMod/Sounds/Custom/PlantyMushMine", 3); + SoundEngine.PlaySound(fireHeal with { Volume = 0.5f, Pitch = 0.3f }, Projectile.Center); + + Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, ColorFunction(0f), "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.04f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + Color smokeColor = Color.Lerp(ColorFunction(0f), Color.DarkSlateGray, 0.5f); + for (int i = 0; i < 7; i++) { - int duster = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f); - Main.dust[duster].velocity *= 3f; - Main.dust[duster].noGravity = true; - if (Main.rand.NextBool()) - { - Main.dust[duster].scale = 0.5f; - Main.dust[duster].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } + Particle smoke = new HeavySmokeParticle(Projectile.Center, (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(7f), smokeColor, 30, Main.rand.NextFloat(0.4f, 1f), 0.5f, Main.rand.NextFloat(-0.03f, 0.03f), true); + GeneralParticleHandler.SpawnParticle(smoke); } - for (int j = 0; j < 8; j++) + for (int i = 0; i < 8; i++) { - int duster2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PlatinumCoin, 0f, 0f, 100, default, 3f); - Main.dust[duster2].noGravity = true; - Main.dust[duster2].velocity *= 5f; - duster2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f); - Main.dust[duster2].velocity *= 2f; - Main.dust[duster2].noGravity = true; + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(1.8f, 10f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.5f); + dust.color = ColorFunction(0f); + dust.noLightEmittence = true; } } diff --git a/Projectiles/Typeless/BlazingStarThatDoesNotHeal.cs b/Projectiles/Typeless/BlazingStarThatDoesNotHeal.cs index 3414996386..d782b2b97d 100644 --- a/Projectiles/Typeless/BlazingStarThatDoesNotHeal.cs +++ b/Projectiles/Typeless/BlazingStarThatDoesNotHeal.cs @@ -1,11 +1,15 @@ using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; -using CalamityMod.NPCs.Providence; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -14,7 +18,16 @@ namespace CalamityMod.Projectiles.Typeless public class BlazingStarThatDoesNotHeal : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; - public override string Texture => "CalamityMod/Projectiles/StarProj"; + public override string Texture => "CalamityMod/Particles/Sparkle"; + + public static Asset Bloom; + public override void Load() => Bloom = ModContent.Request("CalamityMod/Particles/BloomCircle"); + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 2; + } public override void SetDefaults() { @@ -22,107 +35,72 @@ namespace CalamityMod.Projectiles.Typeless Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.alpha = 255; Projectile.penetrate = 1; - Projectile.timeLeft = 200; + Projectile.timeLeft = 180; } public override void AI() { + Projectile.rotation = Projectile.velocity.ToRotation(); + if (Projectile.timeLeft % 4 == 0) //only once per 4 frames Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); - if (Projectile.ai[0] < 240f) - { - Projectile.ai[0] += 1f; + if (Projectile.velocity.Length() < 18f) + Projectile.velocity *= 1.015f; + } - if (Projectile.timeLeft < 160) - Projectile.timeLeft = 160; - } - - if (Projectile.velocity.Length() < 16f) - Projectile.velocity *= 1.01f; + internal float WidthFunction(float completionRatio) => (1f - completionRatio) * Projectile.scale * 16f; + internal Color ColorFunction(float completionRatio) + { + float hue = 0.04f * (Projectile.ai[0] % 4f) + 0.1f * completionRatio * CalamityUtils.Convert01To010((Main.GlobalTimeWrappedHourly * 0.25f) % 1f); + Color trailColor = Main.hslToRgb(hue, 0.8f, 0.6f); + return trailColor * Projectile.Opacity * 0.5f; } public override bool PreDraw(ref Color lightColor) { - float lerpMult = Utils.GetLerpValue(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.GetLerpValue(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 30f / 0.5f * (MathHelper.Pi * 2f) * 3f)) * 0.8f; + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 8); - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - Color baseColor = new Color(250, 100, 100, 255); - baseColor *= 0.5f; - baseColor.A = 0; - Color colorA = baseColor; - Color colorB = baseColor * 0.5f; - colorA *= lerpMult; - colorB *= lerpMult; - Vector2 origin = texture.Size() / 2f; - Vector2 scale = new Vector2(0.5f, 1.5f) * lerpMult; + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + Texture2D sparkleTex = TextureAssets.Projectile[Type].Value; + Texture2D bloomTex = Bloom.Value; + float bloomScale = (float)sparkleTex.Height / (float)bloomTex.Height; + float sparkleScale = 0.5f + CalamityUtils.Convert01To010((Main.GlobalTimeWrappedHourly % 2f) / 2f) * 0.2f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (Projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; - - float upRight = MathHelper.PiOver4; - float up = MathHelper.PiOver2; - float upLeft = 3f * MathHelper.PiOver4; - float left = MathHelper.Pi; - Main.EntitySpriteDraw(texture, drawPos, null, colorA, upLeft, origin, scale, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorA, upRight, origin, scale, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, upLeft, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, upRight, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorA, up, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorA, left, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, up, origin, scale * 0.36f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, left, origin, scale * 0.36f, spriteEffects, 0); + Color color = ColorFunction(0f); + float rotation = Projectile.rotation + Main.GlobalTimeWrappedHourly * 8f; + Vector2 drawPos = Projectile.Center - Main.screenPosition; + Main.EntitySpriteDraw(bloomTex, drawPos, null, color * 0.5f, 0, bloomTex.Size() * 0.5f, 5f * bloomScale, SpriteEffects.None); + Main.EntitySpriteDraw(sparkleTex, drawPos, null, Color.Lerp(color, Color.White, 0.7f), rotation, sparkleTex.Size() * 0.5f, 2.2f * sparkleScale, SpriteEffects.None); + Main.EntitySpriteDraw(sparkleTex, drawPos, null, color, rotation + MathHelper.PiOver4, sparkleTex.Size() * 0.5f, 1.6f * sparkleScale, SpriteEffects.None); + Main.spriteBatch.ExitShaderRegion(); return false; } public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - Projectile.ExpandHitboxBy(50); - int dustType = (int)CalamityDusts.ProfanedFire; - for (int d = 0; d < 5; d++) + Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, ColorFunction(0f), "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.04f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + Color smokeColor = Color.Lerp(ColorFunction(0f), Color.DarkSlateGray, 0.5f); + for (int i = 0; i < 7; i++) { - int holy = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[holy].velocity *= 3f; - Main.dust[holy].noGravity = true; - if (Main.rand.NextBool()) - { - Main.dust[holy].scale = 0.5f; - Main.dust[holy].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } + Particle smoke = new HeavySmokeParticle(Projectile.Center, (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(7f), smokeColor, 30, Main.rand.NextFloat(0.4f, 1f), 0.5f, Main.rand.NextFloat(-0.03f, 0.03f), true); + GeneralParticleHandler.SpawnParticle(smoke); } - for (int d = 0; d < 8; d++) + for (int i = 0; i < 8; i++) { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); - Main.dust[fire].noGravity = true; - Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[fire].velocity *= 2f; - Main.dust[fire].noGravity = true; + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(1.8f, 10f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.5f); + dust.color = ColorFunction(0f); + dust.noLightEmittence = true; } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 60 * 5); - - Projectile.Kill(); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - // If the player is dodging, don't apply debuffs - if (target.creativeGodMode) - return; - - target.AddBuff(ModContent.BuffType(), 60 * 5, false); - - Projectile.Kill(); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60 * 5); } } diff --git a/Projectiles/Typeless/ExoTankHoverThrust.cs b/Projectiles/Typeless/ExoTankHoverThrust.cs new file mode 100644 index 0000000000..8c13df1ed1 --- /dev/null +++ b/Projectiles/Typeless/ExoTankHoverThrust.cs @@ -0,0 +1,62 @@ +using CalamityMod.Items.Mounts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ExoTankHoverThrust : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + + public Player Owner => Main.player[Projectile.owner]; + + public override void SetStaticDefaults() => Main.projFrames[Type] = 5; + + public override void SetDefaults() + { + Projectile.width = 186; + Projectile.height = 74; + Projectile.friendly = true; + } + + public override void AI() + { + if (Owner is null || Owner.dead || Owner.mount is null || !Owner.mount.Active) + Projectile.Kill(); + + if (Owner.mount._type != ModContent.MountType()) + Projectile.Kill(); + + var data = (ExoTank.ExoTankData)Owner.mount._mountSpecificData; + if (!data.Hovering) + Projectile.Kill(); + + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 3 % Main.projFrames[Type]; + + Projectile.Center = Owner.Bottom + Vector2.UnitY * (Projectile.height / 2); + Projectile.spriteDirection = Projectile.direction = Owner.direction; + Projectile.timeLeft = 2; + + // Left thruster + Dust flame = Dust.NewDustPerfect(Projectile.Top - Vector2.UnitX * Main.rand.NextFloat(44f, 64f) * Owner.direction, DustID.BlueTorch); + flame.noGravity = true; + flame.noLight = true; + flame.velocity = Owner.velocity + Vector2.UnitY.RotatedByRandom(MathHelper.ToRadians(6f)) * Main.rand.NextFloat(5f, 12f); + flame.scale = Main.rand.NextFloat(0.5f, 1.5f); + + // Right thruster + flame = Dust.NewDustPerfect(Projectile.Top + Vector2.UnitX * Main.rand.NextFloat(30f, 50f) * Owner.direction, DustID.BlueTorch); + flame.noGravity = true; + flame.noLight = true; + flame.velocity = Owner.velocity + Vector2.UnitY.RotatedByRandom(MathHelper.ToRadians(6f)) * Main.rand.NextFloat(5f, 12f); + flame.scale = Main.rand.NextFloat(0.5f, 1.5f); + } + + public override bool ShouldUpdatePosition() => false; + + public override Color? GetAlpha(Color lightColor) => Color.White; + } +} diff --git a/Projectiles/Typeless/ExoTankHoverThrust.png b/Projectiles/Typeless/ExoTankHoverThrust.png new file mode 100644 index 0000000000..680ed14a37 Binary files /dev/null and b/Projectiles/Typeless/ExoTankHoverThrust.png differ diff --git a/Projectiles/Typeless/ExoTankLaser.cs b/Projectiles/Typeless/ExoTankLaser.cs new file mode 100644 index 0000000000..484ff94ef3 --- /dev/null +++ b/Projectiles/Typeless/ExoTankLaser.cs @@ -0,0 +1,71 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + // Modified clone of Atlas Munitions Laser to circumvent the minion attack type tag + public class ExoTankLaser : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/Summon/AtlasMunitionsLaserOverdrive"; + + public override void SetStaticDefaults() => Main.projFrames[Type] = 4; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 18; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.MaxUpdates = 3; + Projectile.timeLeft = 240; + Projectile.Opacity = 0f; + } + + public override void AI() + { + Lighting.AddLight(Projectile.Center, Color.Red.ToVector3() * Projectile.Opacity * 0.5f); + + Projectile.Opacity = Utils.GetLerpValue(240f, 235f, Projectile.timeLeft, true); + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; + + if (Projectile.velocity.Length() < 18f) + Projectile.velocity *= 1.03f; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Main.rand.NextBool()) + { + int dustCount = 16; + bool sideways = Main.rand.NextBool(6); + float generalAngularOffset = Main.rand.NextFloatDirection() * MathHelper.Pi / 24f; + if (sideways) + dustCount += 36; + + for (int i = 0; i < dustCount; i++) + { + float offsetAngle = MathHelper.TwoPi * i / dustCount; + + float unitOffsetX = MathF.Pow(MathF.Cos(offsetAngle), 3f); + float unitOffsetY = MathF.Pow(MathF.Sin(offsetAngle), 3f); + + Vector2 puffDustVelocity = new Vector2(unitOffsetX, unitOffsetY) * 5f; + if (sideways) + puffDustVelocity = puffDustVelocity.RotatedBy(MathHelper.PiOver4) * 1.7f; + else + puffDustVelocity = puffDustVelocity.RotatedBy(generalAngularOffset); + + Dust magic = Dust.NewDustPerfect(target.Center, 182, puffDustVelocity); + magic.scale = sideways ? 1.8f : 1f; + magic.fadeIn = 0.5f; + magic.noGravity = true; + } + } + } + } +} diff --git a/Projectiles/Typeless/ExoTankMissile.cs b/Projectiles/Typeless/ExoTankMissile.cs new file mode 100644 index 0000000000..7976c7f7bc --- /dev/null +++ b/Projectiles/Typeless/ExoTankMissile.cs @@ -0,0 +1,72 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ExoTankMissile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + + public static Asset Glow; + public override void Load() => Glow = ModContent.Request(Texture + "Glow"); + + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + } + + public override void SetDefaults() + { + Projectile.width = 66; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.MaxUpdates = 3; + Projectile.timeLeft = 90 * Projectile.MaxUpdates; + } + + public override void AI() + { + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; + + CalamityUtils.HomeInOnNPC(Projectile, false, 1200f, 15f, 20f); + Projectile.rotation = Projectile.velocity.ToRotation(); + } + + public override void OnKill(int timeLeft) + { + Color boomColor = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.4f) * 0.6f; + CustomPulse boom = new (Projectile.Center, Vector2.Zero, boomColor, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.08f, 24); + GeneralParticleHandler.SpawnParticle(boom); + + for (int i = 0; i < 5; i++) + { + Vector2 velocity = Vector2.UnitX.RotatedBy(MathHelper.TwoPi * 0.2f * (i + Main.rand.NextFloat(-0.5f, 0.5f))) * (Main.rand.NextFloat(3f, 10f)); + Color energyColor = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.4f); + SquishyLightParticle energy = new (Projectile.Center, velocity, Main.rand.NextFloat(0.1f, 0.5f), energyColor, 15, 1f, 2.5f); + GeneralParticleHandler.SpawnParticle(energy); + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 300); + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); + + public override void PostDraw(Color lightColor) + { + if (Glow != null) + { + Rectangle frame = Glow.Value.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Main.EntitySpriteDraw(Glow.Value, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + } + } +} diff --git a/Projectiles/Typeless/ExoTankMissile.png b/Projectiles/Typeless/ExoTankMissile.png new file mode 100644 index 0000000000..20caaad2d9 Binary files /dev/null and b/Projectiles/Typeless/ExoTankMissile.png differ diff --git a/Projectiles/Typeless/ExoTankMissileGlow.png b/Projectiles/Typeless/ExoTankMissileGlow.png new file mode 100644 index 0000000000..7fb9064031 Binary files /dev/null and b/Projectiles/Typeless/ExoTankMissileGlow.png differ diff --git a/Projectiles/Typeless/ExoTankMuzzleFlash.cs b/Projectiles/Typeless/ExoTankMuzzleFlash.cs new file mode 100644 index 0000000000..5d35148268 --- /dev/null +++ b/Projectiles/Typeless/ExoTankMuzzleFlash.cs @@ -0,0 +1,32 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ExoTankMuzzleFlash : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + + public override void SetStaticDefaults() => Main.projFrames[Type] = 3; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 10; + Projectile.friendly = true; + } + + public override void AI() + { + Projectile.frameCounter++; + if (Projectile.frameCounter >= 3 * Main.projFrames[Type]) + Projectile.Kill(); + Projectile.frame = Projectile.frameCounter / 3; + Projectile.rotation = Projectile.velocity.ToRotation(); + } + + public override bool ShouldUpdatePosition() => false; + + public override Color? GetAlpha(Color lightColor) => Color.White; + } +} diff --git a/Projectiles/Typeless/ExoTankMuzzleFlash.png b/Projectiles/Typeless/ExoTankMuzzleFlash.png new file mode 100644 index 0000000000..954368bbca Binary files /dev/null and b/Projectiles/Typeless/ExoTankMuzzleFlash.png differ diff --git a/Projectiles/Typeless/FlashBolt.cs b/Projectiles/Typeless/FlashBolt.cs new file mode 100644 index 0000000000..3f86de4862 --- /dev/null +++ b/Projectiles/Typeless/FlashBolt.cs @@ -0,0 +1,126 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class FlashBolt : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int time = 0; + public float colorValue = 0; + public float sizeMult = 1; + public bool invalidTarget => (Projectile.ai[0] < 0f || Projectile.ai[0] > 199f); + public override void SetDefaults() + { + Projectile.width = 60; + Projectile.height = 60; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = AverageDamageClass.Instance; + Projectile.penetrate = 1; // Survives through its first hit by "cheating" and incrementing its own pierce counter + Projectile.extraUpdates = 75; + Projectile.timeLeft = 200; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + // Visibility/Sound toggle on acc visibility + bool visible = Owner.Calamity().arcFlashRingVisual; + colorValue = MathHelper.Lerp(colorValue, 50, 0.025f); + Color usedColor = Color.Lerp(Color.Cyan, Color.Orchid, Utils.GetLerpValue(0, 50, colorValue)); + + if (time == 0) + { + colorValue += Main.rand.Next(0, 20); + sizeMult = 1; + if (visible) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/ArcFlash"); + SoundEngine.PlaySound(fire with { Volume = 0.6f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Owner.Center); + } + } + + // If the target is dead, remove them as a target and hit anything + NPC target = (invalidTarget ? null : Main.npc[(int)Projectile.ai[0]]); + if (target == null || !target.active || target.life <= 0) + Projectile.ai[0] = -1; + + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (targetDist < 1400f) + { + Vector2 pos = Projectile.Center - Projectile.velocity * 15; + if (Projectile.timeLeft % 4 == 0) + { + Particle spark2 = new BoltParticle(pos, -Projectile.velocity * 0.05f, false, 30, 0.6f * sizeMult, usedColor * (visible ? 1 : 0.25f), new Vector2(1.8f, 0.8f), true, true, false, 0.3f); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (Main.rand.NextBool(35)) + { + Particle spark2 = new BoltParticle(pos, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 23, Main.rand.NextFloat(0.2f, 0.25f) * sizeMult, usedColor * (visible ? 1 : 0.3f), new Vector2(1.8f, 0.8f), true, true, false, 0.3f); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (Main.rand.NextBool(10) && visible) + { + Particle spark2 = new CustomSpark(pos, Projectile.velocity * Main.rand.NextFloat(-0.4f, 0.4f), "CalamityMod/Particles/DrainLineBloom", false, 80, Main.rand.NextFloat(1.2f, 1.3f) * sizeMult, usedColor * (visible ? 1 : 0.3f), new Vector2(1, 4), true, true); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (time % 5 == 0 && visible) + { + Dust dust = Dust.NewDustPerfect(pos, 278, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), 0, default, Main.rand.NextFloat(0.45f, 0.6f)); + dust.noGravity = true; + dust.color = usedColor; + } + } + if (Projectile.numHits > 0) + { + sizeMult *= 0.97f; + } + time++; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // Stops the projectile from deleting itself, while maintaining the masquerade + Projectile.penetrate++; + + //colorValue = Main.rand.Next(0, 10); + target.AddBuff(BuffID.Electrified, 180); + Projectile.timeLeft = 25; + Player Owner = Main.player[Projectile.owner]; + if (Owner.Calamity().arcFlashRingVisual && Projectile.numHits == 0) + { + Vector2 pos = target.Center; + for (int i = 0; i < 10; i++) + { + Particle spark2 = new BoltParticle(pos, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.9f), true, 13, Main.rand.NextFloat(0.2f, 0.3f) * sizeMult, Main.rand.NextBool(5) ? Color.Cyan : Color.Orchid, new Vector2(1.8f, 0.8f), true, true, false, 0.8f); + GeneralParticleHandler.SpawnParticle(spark2); + Dust dust = Dust.NewDustPerfect(pos, 278, new Vector2(14, 14).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), 0, default, Main.rand.NextFloat(0.8f, 0.9f)); + dust.noGravity = false; + dust.color = Main.rand.NextBool(5) ? Color.Cyan : Color.Orchid; + } + Particle pulse2 = new CustomPulse(pos, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/HighResFoggyCircleHardEdge", new Vector2(1, 1), 0, 0f, 0.0715f, 10); + GeneralParticleHandler.SpawnParticle(pulse2); + Particle orb = new CustomPulse(pos, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.78f, 0.5f, 14); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new CustomPulse(pos, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.325f, 0.2f, 14); + GeneralParticleHandler.SpawnParticle(orb2); + } + } + public override bool? CanHitNPC(NPC target) + { + if (invalidTarget || Projectile.ai[0] == target.whoAmI) + return null; + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.numHits > 0 ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, 60 * sizeMult, targetHitbox); + public override bool? CanCutTiles() => false; + } +} diff --git a/Projectiles/Typeless/HolyExplosionSupreme.cs b/Projectiles/Typeless/HolyExplosionSupreme.cs index 07be3430a7..29bed8cabb 100644 --- a/Projectiles/Typeless/HolyExplosionSupreme.cs +++ b/Projectiles/Typeless/HolyExplosionSupreme.cs @@ -1,9 +1,9 @@ -using Microsoft.CodeAnalysis.CSharp.Syntax; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.Graphics.Shaders; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -36,11 +36,12 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 90; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int i = 0; i < 24; i++) + for (int i = 0; i < 14; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, 228, new Vector2(4.5f, 4.5f).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.9f), 0, default, Main.rand.NextFloat(1.5f, 2.8f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), new Vector2(7.5f, 7.5f).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.9f), 0, default, Main.rand.NextFloat(1.1f, 1.9f)); dust.shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); dust.noGravity = true; + dust.color = Color.Goldenrod; } for (int j = 0; j < 12; j++) { @@ -48,6 +49,9 @@ namespace CalamityMod.Projectiles.Typeless Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel * 2, 259, dustVel, 0, default, 1f); dust.shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); + + Particle spark = new CustomSpark(Projectile.Center, (new Vector2(15, 15).RotatedByRandom(100)) * Main.rand.NextFloat(0.2f, 1f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 37, Main.rand.NextFloat(1.35f, 1.5f), Main.rand.NextBool(4) ? Color.Khaki : Color.Orange, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); + GeneralParticleHandler.SpawnParticle(spark); } } } diff --git a/Projectiles/Typeless/HolyStarDamage.cs b/Projectiles/Typeless/HolyStarDamage.cs new file mode 100644 index 0000000000..455d337210 --- /dev/null +++ b/Projectiles/Typeless/HolyStarDamage.cs @@ -0,0 +1,178 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.NPCs; +using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Melee; +using CalamityMod.World; +using Humanizer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class HolyStarDamage : ModProjectile, ILocalizedModType + { + bool started = false; + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/StarProj"; + + public int time = 0; + public bool reachedMaxDamage = false; + public override void SetDefaults() + { + Projectile.localAI[1] = Main.rand.NextFloat(30f); + Projectile.width = Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 200; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); + + if (!started) + { + Color cl = Color.Goldenrod; + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, cl, "CalamityMod/Particles/BlastCone", new Vector2(Main.rand.NextFloat(2f, 4f), 1.5f), Vector2.Zero.AngleTo(Projectile.velocity), 1f * Projectile.scale, 0f, 30)); + started = true; + } + + if (Projectile.ai[0] < 240f) + { + Projectile.ai[0] += 1f; + + if (Projectile.timeLeft < 160) + Projectile.timeLeft = 160; + } + + if (Projectile.ai[1] == 5) + { + // Homing stars from burning revalation + if (Projectile.ai[2] != -1 && time > 20) + { + NPC targeted = Projectile.ai[2] == -1 ? null : Main.npc[(int)Projectile.ai[2]]; + if (targeted != null && targeted.life <= 0) + targeted = null; + else + Projectile.timeLeft++; + CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.5f, 12, 0.975f); + } + if (Projectile.scale < 1) + Projectile.scale += 0.0035f; + if (Projectile.scale >= 1 && !reachedMaxDamage) + { + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.5f, 8); + GeneralParticleHandler.SpawnParticle(orb2); + reachedMaxDamage = true; + } + } + + if (Projectile.velocity.Length() < 16f) + Projectile.velocity *= 1.01f; + + Projectile.localAI[1] += (Projectile.velocity.Length() / 20); + + Color col = Projectile.ai[1] == 5 ? (Color.Lerp(Color.Goldenrod, Color.Orchid, Utils.GetLerpValue(0.85f, 1f, Projectile.scale))) : Color.Goldenrod; + + float vel = MathHelper.Clamp(Projectile.velocity.Length() / 5, 0, 1.5f); + + Particle spark = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.8f, false, 5, 0.06f * Projectile.scale, col * 0.7f, new Vector2(1, 0.3f), true, false, 1.5f); + GeneralParticleHandler.SpawnParticle(spark); + + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(ModContent.BuffType(), 240); + if (Projectile.ai[1] == 5) + { + modifiers.SourceDamage *= Projectile.scale; + } + } + + public override bool PreDraw(ref Color lightColor) + { + float lerpMult = MathHelper.Lerp(0.5f, 1.5f, Math.Abs((float)Math.Sin(Projectile.localAI[1] / 10f))); + + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Color baseColor = Color.Goldenrod with { A = 0 }; + Color baseColor2 = Color.Khaki with { A = 0 }; + baseColor.A = 0; + baseColor *= lerpMult; + baseColor2 *= lerpMult; + Vector2 origin = texture.Size() / 2f; + Vector2 scale = new Vector2(0.5f, 1.5f) * lerpMult; + + SpriteEffects spriteEffects = SpriteEffects.None; + if (Projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Projectile.rotation += MathHelper.ToRadians(lerpMult * 4f); + + float upRight = MathHelper.PiOver4; + float up = MathHelper.PiOver2; + float upLeft = 3f * MathHelper.PiOver4; + float left = MathHelper.Pi; + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upLeft + Projectile.rotation, origin, scale * Projectile.scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upRight - Projectile.rotation, origin, scale * Projectile.scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upLeft + Projectile.rotation, origin, scale * 0.6f * Projectile.scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upRight - Projectile.rotation, origin, scale * 0.6f * Projectile.scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, up + Projectile.rotation, origin, scale * 0.6f * Projectile.scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, left - Projectile.rotation, origin, scale * 0.6f * Projectile.scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, up + Projectile.rotation, origin, scale * 0.36f * Projectile.scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, left - Projectile.rotation, origin, scale * 0.36f * Projectile.scale, spriteEffects, 0); + + return false; + } + + public override void OnKill(int timeLeft) + { + int dustType = ModContent.DustType(); + for (int i = 0; i < 7; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustType, ((new Vector2(7, 7) * Projectile.scale).RotatedByRandom(100) + (reachedMaxDamage ? Vector2.Zero : Projectile.velocity)) * Main.rand.NextFloat(0.2f, 1f) * (reachedMaxDamage ? 2 : 1)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.95f, 1.45f) * Projectile.scale; + dust.color = Main.rand.NextBool(4) ? (reachedMaxDamage ? Color.Orchid : Color.Khaki) : Color.Goldenrod; + dust.noLightEmittence = true; + } + if (reachedMaxDamage) + { + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.7f }, Projectile.Center); + + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Goldenrod, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 1.5f, 10); + GeneralParticleHandler.SpawnParticle(orb2); + Particle orb3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.65f, 15, true); + GeneralParticleHandler.SpawnParticle(orb3); + + for (int i = 0; i < 4; i++) + { + Particle spark = new CustomSpark(Projectile.Center, new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 17, Main.rand.NextFloat(1.15f, 1.3f), Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)), new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.3f, 0.4f)); + GeneralParticleHandler.SpawnParticle(spark); + } + + // Sub projectiles spawning sub explosions... yea it needs armor pen + Projectile explo = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.2f), Projectile.knockBack, Projectile.owner, 0.75f); + explo.ArmorPenetration = 30; + } + } + public override bool? CanDamage() => time > 15 ? null : false; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 50, targetHitbox); + } +} diff --git a/Projectiles/Typeless/LeviAmberDash.cs b/Projectiles/Typeless/LeviAmberDash.cs index ceba1eb532..1a8559097a 100644 --- a/Projectiles/Typeless/LeviAmberDash.cs +++ b/Projectiles/Typeless/LeviAmberDash.cs @@ -37,6 +37,7 @@ namespace CalamityMod.Projectiles.Typeless { if (target.CanBeMoved(true)) { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // Launch Vector2 launchVel = (Owner.Calamity().mouseWorld - target.Center).SafeNormalize(Vector2.UnitY) * 16; target.velocity = launchVel; diff --git a/Projectiles/Typeless/RelicGuard.cs b/Projectiles/Typeless/RelicGuard.cs new file mode 100644 index 0000000000..42c242cfe4 --- /dev/null +++ b/Projectiles/Typeless/RelicGuard.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using CalamityMod.Items; +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.Typeless +{ + public class RelicGuard : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public CalamityPlayer moddedOwner => Owner.Calamity(); + public Color bColor = Color.White; + public int time = 0; + public float rotMult = 0.05f; + public int direction = 1; + public float rot2 = 0; + public Vector2 aimVel; + public float xLerp = 0; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 1; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + } + + public override void AI() + { + float sine = (float)Math.Sin(time * 0.13f / MathHelper.Pi); + float rate = Main.GlobalTimeWrappedHourly * 2; + List eColors = new List() + { + Color.Sienna, + Color.Peru + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + bColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + xLerp = MathHelper.Lerp(xLerp, (30 + 10 * sine) * Math.Sign(aimVel.X), 0.05f); + Projectile.Center = Owner.MountedCenter + new Vector2(xLerp, -25 + 12 * sine); + Owner.direction = Math.Sign(aimVel.X); + + if (Owner.HeldItem.type == ModContent.ItemType()) + Projectile.timeLeft++; + else + Projectile.Kill(); + if (Owner.dead) + Projectile.Kill(); + + // Emit some light + Lighting.AddLight(Projectile.Center, Color.Goldenrod.ToVector3() * 1.5f); + + rot2 = Math.Abs((float)Math.Sin(time * 0.15f / MathHelper.Pi) * 0.2f) + 0.8f; + + if (time % 2 == 0 && false) + { + Vector2 dustVel = new Vector2(15, 15).RotatedByRandom(100); + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel, ModContent.DustType(), dustVel * Main.rand.NextFloat(0.1f, 0.4f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.7f, 0.9f) * Utils.GetLerpValue(300, 0, Owner.Calamity().rOfResilienceCooldown, true); + dust.color = bColor; + dust.noLightEmittence = true; + } + + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + aimVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + float adjustedRot = aimVel.ToRotation(); + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, adjustedRot + (MathHelper.ToRadians(90)), 0.05f); + + float rot = Utils.DirectionFrom(Owner.Center, Projectile.Center).ToRotation() + (MathHelper.ToRadians(90)); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rot); + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, rot); + + time++; + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D rTexture = ModContent.Request("CalamityMod/Items/RelicOfResilience").Value; + Texture2D bTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Color drawColor = bColor; + float CDScale = Utils.GetLerpValue(300, 0, Owner.Calamity().rOfResilienceCooldown, true); + + for (int i = 0; i < 2; i++) + { + float bScale2 = 0.55f; + Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, i * 0.15f) with { A = 0 }, 0, bTexture.Size() * 0.5f, (bScale2 - i * 0.15f) * rot2 * CDScale, SpriteEffects.None, 0); + } + + Projectile.DrawProjectileWithBackglow(Color.OrangeRed with { A = 0 } * CDScale, Color.White, 3 * rot2 * CDScale, rTexture, null, Math.Sign(aimVel.X) < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + return false; + } + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Typeless/RelicOfConvergenceCrystal.cs b/Projectiles/Typeless/RelicOfConvergenceCrystal.cs index e33b4a43b6..027e3bebea 100644 --- a/Projectiles/Typeless/RelicOfConvergenceCrystal.cs +++ b/Projectiles/Typeless/RelicOfConvergenceCrystal.cs @@ -1,6 +1,10 @@ -using CalamityMod.Dusts; +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Dusts; using CalamityMod.Enums; using CalamityMod.Items; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -14,11 +18,20 @@ namespace CalamityMod.Projectiles.Typeless public class RelicOfConvergenceCrystal : ModProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public const int SoundInterval = 15; - public const int TotalCrystalsToDraw = 3; - public const int CrystalsDrawTime = 90; - public const float MaxCrystalOffsetRadius = 80f; - public const float MaxDustOffsetRadius = 70f; + public int SoundInterval = 25; + public int TotalCrystalsToDraw = 3; + public int CrystalsDrawTime = 40; + public float MaxCrystalOffsetRadius = 80f; + public float MaxDustOffsetRadius = 70f; + + private Player Owner => Main.player[Projectile.owner]; + public List healList = new List(new bool[Main.maxPlayers]); + + public ref float time => ref Projectile.ai[0]; + public float completion = 0; + public float fade = 0; + public Vector2 mousePos; + public bool playSound = true; public override void SetDefaults() { Projectile.width = 32; @@ -26,110 +39,159 @@ namespace CalamityMod.Projectiles.Typeless Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.timeLeft = 240; + Projectile.timeLeft = 125; } public override void AI() { - Player player = Main.player[Projectile.owner]; - if (!player.channel) + completion = Utils.GetLerpValue(120, 0, Projectile.timeLeft, true); + fade = MathHelper.Lerp(fade, 0, 0.04f); + if (Projectile.timeLeft >= 5) + mousePos = Owner.ClampedMouseWorld(); + + if (!Owner.channel) { Projectile.Kill(); return; } - // Restrict player movement (as a penalty). - player.velocity.X = MathHelper.Clamp(player.velocity.X, -5f, 5f); - if (player.velocity.Y < 0f) - { - player.velocity.Y = MathHelper.Clamp(player.velocity.Y, -6f, 0f); - } - UpdatePlayerVisuals(player); + if (Owner.Calamity().profanedSoulRelicBuff) + Projectile.extraUpdates = 1; + + UpdatePlayerVisuals(Owner); + // Make a constant "magical" sound. if (Projectile.soundDelay <= 0) { - SoundEngine.PlaySound(SoundID.Item4, Projectile.Center); - Projectile.soundDelay = SoundInterval; - } - Projectile.ai[0]++; - // Make a sound when fully charged. - if (Projectile.ai[0] == CrystalsDrawTime) - { - SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact, Projectile.Center); - } - // Create a circle of dust. The circle expands outward at first until it reaches its "destination" radius. - // Once the circle is at its maximum size, some of the dust moves inward. - if (Projectile.ai[0] >= CrystalsDrawTime) - { - GeneratePassiveDust(player); - } - if (Projectile.timeLeft == 1) - { - for (int i = 0; i < 45; i++) + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.5f * (time >= CrystalsDrawTime ? 1 : 2), Pitch = 0.5f * completion }, Projectile.Center); + + if (time >= CrystalsDrawTime) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.ProfanedFire); - dust.velocity = Utils.NextVector2Circular(Main.rand, 28f, 28f); - dust.fadeIn = Main.rand.NextFloat(3f, 4f); - dust.noGravity = true; + SoundStyle h = new("CalamityMod/Sounds/Item/NullHit"); + SoundEngine.PlaySound(h with { Volume = 0.4f, Pitch = -0.3f + 0.7f * completion }, Projectile.Center); + + float numberOfDusts = 10f; + for (int i = 0; i < numberOfDusts; i++) + { + Particle energy = new VelChangingSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(9f, 18f), Utils.DirectionFrom(mousePos, Projectile.Center) * 35, "CalamityMod/Particles/BloomCircle", 25, Main.rand.NextFloat(0.1f, 0.35f) * completion, Color.Lerp(Color.Orange, Color.Orchid, completion), new Vector2(1f, 1f), lerpRate: 0.04f, shrinkSpeed: 0.15f); + GeneralParticleHandler.SpawnParticle(energy); + } } - player.HealPlayer(RelicOfConvergence.HealValue, HealTextType.Local); - SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact, Projectile.Center); + + Projectile.soundDelay = (int)(SoundInterval * (time >= CrystalsDrawTime ? 1 - 0.9f * completion : 0.5f)); + fade = 1; } + + if (Projectile.timeLeft == 5) + { + //if (Projectile.owner != Main.myPlayer) + //return; + + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player player = Main.player[playerIndex]; + float targetDist = player.Center.DistanceSQ(mousePos); + + if (targetDist < 138f * 138f && player.team == Owner.team) + { + if (healList[playerIndex] == false) + { + healList[playerIndex] = true; + int trueHealValue = (int)(RelicOfConvergence.HealValue * (player.whoAmI == Owner.whoAmI ? 1f : 1.5f) * (Owner.Calamity().profanedSoulRelicBuff ? 1.25f : 1f)); + player.HealPlayer(trueHealValue, HealTextType.Local); + + if (playSound) + { + SoundStyle heal = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianHeal"); + SoundEngine.PlaySound(heal with { Volume = 1, MaxInstances = -1 }, Projectile.Center); + playSound = false; + } + + for (int i = 0; i < 5; i++) + { + Particle spark = new CustomSpark(player.Center + Main.rand.NextVector2Circular(15, 15), (-Vector2.UnitY * Main.rand.NextFloat(0.2f, 3f)), "CalamityMod/Particles/HealingPlus", false, Main.rand.Next(35, 50 + 1), Main.rand.NextFloat(1.1f, 1.9f), Color.Lerp(Color.Orchid, Color.White, i * 0.1f), Vector2.One, true, true, 0, false, false, 0.1f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } + } + } + + if (time >= CrystalsDrawTime) + { + GeneratePassiveDust(Owner); + + Lighting.AddLight(Projectile.Center, Color.Lerp(Color.Orange, Color.Orchid, completion).ToVector3() * (2.5f * (completion - 0.375f) + fade)); + } + + time++; } public void UpdatePlayerVisuals(Player player) { - Projectile.Center = player.Center + Vector2.UnitX * 15f * player.direction; + Vector2 vel = Utils.DirectionTo(player.Center, mousePos); + float rot = vel.ToRotation() + (player.direction == -1 ? MathHelper.ToRadians(270f) : MathHelper.ToRadians(-90f)); + + player.ChangeDir(MathF.Sign(vel.X)); + + Projectile.Center = player.Center + vel * 15f; // The crystal is a holdout projectile, so change the player's variables to reflect that player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rot); + player.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, rot); } public void GeneratePassiveDust(Player player) { float radius = 45f; - if (Projectile.ai[0] < CrystalsDrawTime + 30f) - { - radius = MathHelper.Lerp(0f, 45f, (Projectile.ai[0] - CrystalsDrawTime) / 30f); - } + radius = MathHelper.Lerp(0f, 200f, completion - 0.375f); + for (float angle = 0f; angle <= MathHelper.TwoPi; angle += MathHelper.ToRadians(Main.rand.NextFloat(6f, 8f))) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + angle.ToRotationVector2() * radius, (int)CalamityDusts.ProfanedFire); - dust.position = Projectile.Center + angle.ToRotationVector2() * radius; - dust.scale = Main.rand.NextFloat(0.8f, 1.1f); - dust.noGravity = true; - dust.velocity = player.velocity; - if (Main.rand.NextBool(15) || Projectile.timeLeft == 1) + Vector2 drawPos = mousePos + angle.ToRotationVector2() * radius; + Color useColor = Color.Lerp(Color.Orange, Color.Orchid, completion) * (completion - 0.25f); + float particleScale = 0.01f + fade * 0.08f + completion * 0.08f; + Particle aura = new CustomSpark(drawPos, Utils.DirectionTo(mousePos, drawPos), "CalamityMod/Particles/SmallBloom", false, 4, particleScale, useColor, new Vector2(0.5f + completion, (2f - completion) * 7 - completion * 7)); + GeneralParticleHandler.SpawnParticle(aura); + + if (Main.rand.NextBool(70)) { - dust.velocity = Projectile.DirectionFrom(dust.position) * Main.rand.NextFloat(4f, 5f); - if (Projectile.timeLeft == 1) - dust.velocity *= 1.7f; + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + angle.ToRotationVector2() * radius, ModContent.DustType()); + dust2.position = mousePos + angle.ToRotationVector2() * radius; + dust2.scale = Main.rand.NextFloat(1.4f, 1.9f) * completion; + dust2.noGravity = false; + dust2.velocity = new Vector2(0, Main.rand.NextFloat(1, 5)); + dust2.color = useColor; + } + + if (Projectile.timeLeft == 5) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + angle.ToRotationVector2() * radius, ModContent.DustType()); + dust.position = drawPos; + dust.scale = Main.rand.NextFloat(1.6f, 1.9f); + dust.noGravity = !Main.rand.NextBool(5); + dust.velocity = Utils.DirectionTo(mousePos, drawPos) * Main.rand.NextFloat(2f, 4f); + dust.color = Color.Orchid; + dust.noLightEmittence = true; } } } public override bool PreDraw(ref Color lightColor) { - if (Projectile.ai[0] >= CrystalsDrawTime) - return true; - float opacity = Projectile.ai[0] / CrystalsDrawTime; + float opacity = time / CrystalsDrawTime; Texture2D crystalTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; for (int i = 0; i < TotalCrystalsToDraw; i++) { - float angle = MathHelper.TwoPi / TotalCrystalsToDraw * i + Projectile.ai[0] / 10f; - float radius = MathHelper.Lerp(MaxCrystalOffsetRadius, 0f, Projectile.ai[0] / CrystalsDrawTime); + float angle = MathHelper.TwoPi / TotalCrystalsToDraw * i + time / 10f; + float radius = MathHelper.Lerp(MaxCrystalOffsetRadius, 0f, time / CrystalsDrawTime); Vector2 drawPositionOffset = angle.ToRotationVector2() * radius; - Vector2 drawPosition = Projectile.Center + drawPositionOffset; - Main.EntitySpriteDraw(crystalTexture, - drawPosition - Main.screenPosition, - null, - Color.White * opacity, - Projectile.rotation, - Projectile.Size * 0.5f, - Projectile.scale, - SpriteEffects.None, - 0); + Vector2 drawPosition = (time >= CrystalsDrawTime ? Projectile.Center : Projectile.Center + drawPositionOffset + Main.rand.NextVector2Circular(12, 12)); + + Projectile.DrawProjectileWithBackglow(Color.Lerp(Color.Orchid, Color.Goldenrod, fade) with { A = 0 } * completion * 0.5f, Color.Lerp(Color.White, Color.White with { A = 0 }, fade * 0.5f) * MathHelper.Clamp(completion * 1.5f, time >= CrystalsDrawTime ? 0.8f : 0f, 1), 4f * completion + (fade * 3), crystalTexture, xPos: drawPosition.X, yPos: drawPosition.Y); } return false; } diff --git a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs index 0353aa8d9a..1a86a5260a 100644 --- a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs +++ b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs @@ -1,9 +1,14 @@ using System; using System.Collections.Generic; using System.IO; +using CalamityMod.CalPlayer; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Typeless; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Utilities; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -15,13 +20,41 @@ namespace CalamityMod.Projectiles.Typeless public class RelicOfDeliveranceSpear : ModProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public Vector2 IdealVelocity = -Vector2.UnitY * MinChargeSpeed; - public const int MaxCharges = 3; - public const float DustSpawnInterval = 3f; - public const float WaitTimeRequiredForCharge = 40f; - public const float WaitTimeRequiredForMaximumCharge = 180f; - public const float MinChargeSpeed = 16f; - public const float MaxChargeSpeed = 30f; + public ref float time => ref Projectile.ai[0]; + + public Vector2 idealVel; + public int driftFrames = 0; + public bool flying = false; + public Player Owner => Main.player[Projectile.owner]; + + public int boostTimer = 0; + public bool boosted => boostTimer > 0; + + public int driftTimer = 0; + public bool drifting => Main.mouseLeft; + public int driftPower = 1; + public float driftPowerScaling = 1; + public float driftBadMult = 1; + public bool killed = false; + + public float iframeLevel = 0.2f; // Decides the level of dash iframes it gives when starting a dash, lower is less + + public float velX; + public float velY; + + public Vector2 respawnPoint; + public int respawnTimer = 0; + public bool inTiles = false; + public float respawnMult = 0; + + int postHitTimer = 0; + public Color bColor = Color.White; + public SlotId digSoundSlot; + public int digFXCooldown = 0; + public float ramLerp; + + public float damageMult = 1; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Type] = 5; @@ -36,37 +69,41 @@ namespace CalamityMod.Projectiles.Typeless Projectile.penetrate = -1; Projectile.friendly = true; Projectile.ignoreWater = true; + Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; + Projectile.localNPCHitCooldown = 50 * Projectile.MaxUpdates; + Projectile.extraUpdates = 3; + Projectile.ContinuouslyUpdateDamageStats = true; } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Projectile.localAI[0]); - writer.Write(Projectile.localAI[1]); - writer.WriteVector2(IdealVelocity); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - Projectile.localAI[0] = reader.ReadSingle(); - Projectile.localAI[1] = reader.ReadSingle(); - IdealVelocity = reader.ReadVector2(); - } - public override void AI() { - Player player = Main.player[Projectile.owner]; - if (player.dead || - Projectile.Center.Y < 200f || - Projectile.Center.X < 200f || - Projectile.Center.X > Main.maxTilesX * 16f - 200f) - { - Projectile.Kill(); + if (killed) return; + + ramLerp = Utils.GetLerpValue(120 * driftPower, 0, boostTimer, true); + Owner.Calamity().rOfDelivarenceRam = false; + + float rate = Main.GlobalTimeWrappedHourly * 7; + Color powerColor = Color.Khaki; + List eColors = new List() + { + Color.Goldenrod, + Color.OrangeRed, + Color.Orange, + Color.Gold + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + bColor = Color.Lerp(Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f), powerColor, Utils.Remap(ramLerp, iframeLevel, 0.17f, 0.5f, 0, true) * (driftPower == 1 ? 0 : 1)); + + if (Owner.dead || Owner.Calamity().mouseRight || !WorldGen.InWorld(Owner.Center.ToTileCoordinates().X, Owner.Center.ToTileCoordinates().Y, 20)) // Die if Owner dies or right clicks to exit + { + KillProj(); } Projectile.frameCounter++; - if (Projectile.frameCounter > 4) + if (Projectile.frameCounter > 4 * Projectile.MaxUpdates) { Projectile.frame++; Projectile.frameCounter = 0; @@ -75,158 +112,402 @@ namespace CalamityMod.Projectiles.Typeless { Projectile.frame = 0; } - Projectile.ai[0]++; - if (Projectile.velocity == Vector2.Zero) + + // Immediately die if the Owner is not holding the spear + if (Owner.ActiveItem() == null) { - // Immediately die if the player is not holding the spear - if (player.ActiveItem() == null) + KillProj(); + return; + } + if (Owner.ActiveItem().type != ModContent.ItemType()) + { + KillProj(); + return; + } + + float speed = (CalamityPlayer.areThereAnyDamnBosses ? 3f : 6f) * driftBadMult * (inTiles ? 0.65f : 1); + + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Vector2 aimDir = Owner.Calamity().mouseWorld; + + idealVel = Utils.DirectionTo(Owner.Center, aimDir) * speed * driftPower; + driftPowerScaling = MathHelper.Lerp(driftPowerScaling, driftPower * 0.7f, (driftPowerScaling > driftPower * 0.7f) ? 0.005f : 0.04f); + + if (time == 0) + { + Projectile.velocity = idealVel * 0.2f; + velX = Projectile.velocity.X; + velY = Projectile.velocity.Y; + } + + float lerpPower = (drifting ? 0 : (boosted && driftPower > 1) ? 0.01f * ramLerp : 0.02f); + velX = MathHelper.Lerp(Projectile.velocity.X, idealVel.X, lerpPower); + velY = MathHelper.Lerp(Projectile.velocity.Y, idealVel.Y, lerpPower); + + Projectile.velocity = new Vector2(velX, velY); + if (Projectile.velocity.Length() <= speed && !drifting) + { + Projectile.velocity *= 1.05f; + } + + if (drifting) + { + if (driftTimer == 0) + driftPower = 1; + + boostTimer = 0; + + if (time % Projectile.MaxUpdates == 0) { - Projectile.Kill(); - return; - } - if (player.ActiveItem().type != ModContent.ItemType()) - { - Projectile.Kill(); - return; - } - Projectile.rotation = Projectile.AngleTo(Main.MouseWorld); - Projectile.Center = player.Center; - if (Projectile.ai[0] >= WaitTimeRequiredForCharge) - { - // Begin the lunge - bool noObstaclesInWay = Collision.CanHitLine(Projectile.Center, 1, 1, Projectile.Center + Projectile.SafeDirectionTo(Main.MouseWorld) * 25f, 1, 1); - if (Main.myPlayer == Projectile.owner && Main.mouseLeft && !Main.blockMouse && !player.mouseInterface && noObstaclesInWay) + if (Projectile.velocity.Length() > 1) { - float chargeSpeed = MathHelper.Lerp(MinChargeSpeed, MaxChargeSpeed, (Projectile.ai[0] - WaitTimeRequiredForCharge) / WaitTimeRequiredForMaximumCharge); - if (chargeSpeed > MaxChargeSpeed) - chargeSpeed = MaxChargeSpeed; - Projectile.velocity = Projectile.SafeDirectionTo(Main.MouseWorld) * chargeSpeed; - IdealVelocity = Projectile.velocity; - Projectile.ai[1] = chargeSpeed; - SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); - Projectile.netUpdate = true; + driftBadMult = 1; + driftTimer++; + driftPower = (driftTimer > 100 ? 3 : driftTimer > 40 ? 2 : 1); } - // Charge-up dust - if (Projectile.ai[0] <= WaitTimeRequiredForCharge + WaitTimeRequiredForMaximumCharge) + else { - for (int i = 0; i < 3; i++) + driftPower = 1; + driftTimer = (int)(MathHelper.Clamp(driftTimer * 0.94f, 1, 300)); + } + Projectile.velocity *= (1f - 0.02f * (CalamityPlayer.areThereAnyDamnBosses ? 0.5f : 1)); + } + + Projectile.extraUpdates = 3; + float sparkPower = Utils.GetLerpValue(0, 100, driftTimer); + if (time % Projectile.MaxUpdates * 2 == 0) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/NullImpact"); + SoundEngine.PlaySound(sound with { Volume = 0.045f, Pitch = (Main.rand.NextFloat(-0.2f, -0.4f) + sparkPower * 0.4f) + (driftPower == 2 ? 0.3f : driftPower == 3 ? 0.7f : 0), MaxInstances = -1 }, Projectile.Center); + } + for (int i = 0; i < 2; i++) + { + Color sparkColor = (driftPower == 2 ? Color.Orange : driftPower == 3 ? Color.OrangeRed : Color.Khaki); + Vector2 baseVel = Vector2.Lerp(Projectile.velocity, -idealVel, sparkPower); + Vector2 vel = baseVel.RotatedByRandom(1.5f - sparkPower * 0.5f) * Main.rand.NextFloat(0.5f, 3f); + Particle energy = new VelChangingSpark(Projectile.Center + idealVel * 3, vel + baseVel.SafeNormalize(Vector2.UnitX) * 15, vel, "CalamityMod/Particles/BloomCircle", Main.rand.Next(6, 9 + 1), Main.rand.NextFloat(0.25f, 0.65f) * sparkPower, Color.Lerp(sparkColor, Color.Goldenrod, Main.rand.NextFloat(0, 0.3f)), new Vector2(0.2f, 1f), lerpRate: 0.35f, shrinkSpeed: 0.3f); + GeneralParticleHandler.SpawnParticle(energy); + } + } + if (!drifting) + { + // Iframes for the ram + if (driftPower > 1 && ramLerp < iframeLevel && !killed) + { + Owner.Calamity().rOfDelivarenceRam = true; + if (Main.rand.NextBool() || driftPower == 3) + { + Particle spark = new CustomSpark(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 30 + Main.rand.NextVector2Circular(30, 30) * driftPowerScaling, Projectile.velocity * Main.rand.NextFloat(0.2f, 5), "CalamityMod/Particles/FullStar", false, Main.rand.Next(15, 25 + 1), Main.rand.NextFloat(0.6f, 1.2f), Color.Khaki, new Vector2(2, 1), true, false, 0, false, false, 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + + if (driftPower > 2) + Projectile.extraUpdates = 5; + else + Projectile.extraUpdates = 3; + + if (driftPower == 1 && driftBadMult == 1 && driftTimer > 0) + { + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile.velocity = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) * (speed * 0.1f); + driftBadMult = 0.1f; + } + + if (time % Projectile.MaxUpdates == 0) + { + if (driftBadMult < 1) + driftBadMult += 0.005f; + + if (boostTimer == 0 && driftTimer > 0) + { + driftBadMult = (driftPower > 1 ? 1 : time < 60 ? 0 : 0.35f); + driftTimer = 0; + + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Projectile.velocity = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) * speed * driftPower; + + Particle pulse2 = new CustomPulse(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitX) * 3.1f * driftPower, Color.Goldenrod * 0.8f, "CalamityMod/Particles/BloomRing", new Vector2(0.4f, 1f), Projectile.velocity.ToRotation(), 0f, 1.33f * driftPower, 25); + GeneralParticleHandler.SpawnParticle(pulse2); + Particle pulse = new CustomPulse(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitX) * 8.4f * driftPower, Color.OrangeRed * 0.8f, "CalamityMod/Particles/BloomRing", new Vector2(0.4f, 1f), Projectile.velocity.ToRotation(), 0f, 0.92f * driftPower, 25); + GeneralParticleHandler.SpawnParticle(pulse); + + float volume = 0.1f + 0.3f * driftPower; + SoundStyle sound = new("CalamityMod/Sounds/Item/HolyColliderSmallHit"); + SoundEngine.PlaySound(sound with { Volume = volume, Pitch = (-0.7f + 0.1f * driftPower) }, Projectile.Center); + if (driftPower > 1) { - Vector2 dustPosition = Utils.NextVector2Circular(Main.rand, Projectile.width * 1.6f, Projectile.height * 2.3f) / 2f + Projectile.Center; - Dust dust = Dust.NewDustPerfect(dustPosition, (int)CalamityDusts.ProfanedFire); - dust.velocity = Projectile.SafeDirectionTo(dust.position) * Projectile.Distance(dust.position) / -11f; - dust.velocity += player.velocity; - dust.noGravity = true; - dust.fadeIn = 1.6f; + SoundStyle sound2 = new("CalamityMod/Sounds/Item/LauncherHeavyShot"); + SoundEngine.PlaySound(sound2 with { Volume = volume * 2, Pitch = (-0.3f - 0.1f * driftPower) }, Projectile.Center); } - Projectile.Center += Utils.NextVector2Circular(Main.rand, 1.8f, 1.8f); - } - // Full charge dust indicator - if (Projectile.ai[0] == WaitTimeRequiredForCharge + WaitTimeRequiredForMaximumCharge) - { - for (int i = 0; i < 60; i++) + if (driftPower > 2) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.ProfanedFire); - dust.velocity = Utils.NextVector2Circular(Main.rand, 9f, 9f) * Main.rand.NextFloat(0.8f, 1.2f); - dust.velocity += player.velocity; - dust.noGravity = true; - dust.fadeIn = 1.6f; + SoundStyle sound3 = new("CalamityMod/Sounds/Item/OpalChargedFire"); + for (int i = 0; i < 3; i++) + SoundEngine.PlaySound(sound3 with { Volume = 0.7f, Pitch = 0.4f, MaxInstances = 3 }, Projectile.Center); } - SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact, Projectile.Center); + if (driftPower > 1) + Owner.Calamity().GeneralScreenShakePower = (driftPower == 2 ? 6 : 9); + else if (driftBadMult > 0.15f) + driftBadMult -= 0.15f; + + + boostTimer = 120 * driftPower; + Projectile.numHits = 0; } - player.ChangeDir((Math.Cos(Projectile.rotation) > 0).ToDirectionInt()); + if (boostTimer > 0) + boostTimer--; + if (boostTimer == 0) + driftPower = 1; } + + if (driftBadMult > 0.2f) + { + float sine = (float)Math.Sin(time * 0.085f / MathHelper.Pi); + float mult = driftBadMult * driftPowerScaling; + Vector2 tipPos = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 125 * mult; + Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 15.5f; + for (int i = 0; i < 2; i++) + { + offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 15.5f * (i == 0 ? -1 : 1); + Particle spark = new VelChangingSpark(tipPos + offset, (-Projectile.velocity.SafeNormalize(Vector2.UnitX) + offset * 0.05f) * 20.5f * mult, -Projectile.velocity.SafeNormalize(Vector2.UnitX), "CalamityMod/Particles/SmallBloom", 15, 0.11f * mult, bColor * 0.65f, new Vector2(1, 3.8f), true, false, shrinkSpeed: 0.42f, lerpRate: 0.4f); + GeneralParticleHandler.SpawnParticle(spark); + } + if (driftPower == 3) + { + Vector2 vel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(1, 10); + Particle energy = new VelChangingSpark(Projectile.Center + vel, -Projectile.velocity.SafeNormalize(Vector2.UnitX), -Projectile.velocity.SafeNormalize(Vector2.UnitX) + vel * Main.rand.NextFloat(0.01f, 0.02f), "CalamityMod/Particles/BloomCircle", Main.rand.Next(12, 19 + 1), Main.rand.NextFloat(0.55f, 0.95f), Color.Lerp(Color.OrangeRed, Color.Goldenrod, Main.rand.NextFloat(0, 1f)), new Vector2(0.2f, 1f), lerpRate: 0.25f, shrinkSpeed: 0.35f); + GeneralParticleHandler.SpawnParticle(energy); + } + if (time % Projectile.MaxUpdates == 0) + { + Vector2 vel = (Projectile.velocity.SafeNormalize(Vector2.UnitX) + (offset * (Main.rand.NextBool() ? 1 : -1)) * 0.03f) * 50.5f * mult; + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + (offset * (Main.rand.NextBool() ? 1 : -1)).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.6f, 1.4f), ModContent.DustType()); + dust2.scale = Main.rand.NextFloat(0.7f, 1.2f) * mult; + dust2.noGravity = true; + dust2.velocity = vel * Main.rand.NextFloat(0.6f, 1.4f); + dust2.color = bColor; + } + } + } + + if (Collision.SolidCollision(Projectile.Center, 20, 20)) + inTiles = true; + else + inTiles = false; + if (inTiles) + { + if (respawnTimer == 0 && time % Projectile.MaxUpdates == 0) + { + SoundStyle digSound = new("CalamityMod/Sounds/Item/HeavyDig"); + digSoundSlot = SoundEngine.PlaySound(digSound with { Volume = 0.7f, IsLooped = true }, Projectile.Center); + if (digFXCooldown == 0) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/MagicRockImpact"); + SoundEngine.PlaySound(sound with { Volume = 0.4f, Pitch = Main.rand.NextFloat(0.3f, 0.7f) }, Projectile.Center); + for (int i = 0; i < 13; i++) + { + Particle spark = new CustomSpark(Projectile.Center, -Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.6f) * Main.rand.NextFloat(2f, 24f), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard6", true, Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.85f, 2.3f), Color.White, new Vector2(1.1f, 0.8f), false, false, Main.rand.NextFloat(-5, 5), false, false); + GeneralParticleHandler.SpawnParticle(spark); + if (i % 2 == 0) + { + MediumMistParticle RockCloud = new MediumMistParticle(Projectile.Center + Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(1f, 7f), -Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.6f) * Main.rand.NextFloat(1, 12), Color.Peru, Color.Sienna, Main.rand.NextFloat(1.4f, 2.3f), 120f, Main.rand.NextFloat(0.03f, -0.03f)); + GeneralParticleHandler.SpawnParticle(RockCloud); + } + } + digFXCooldown = 5; + } + } + + if (time % Projectile.MaxUpdates == 0) + { + respawnTimer++; + Projectile.soundDelay--; + } + if (respawnTimer >= 180) + { + Projectile.Center = respawnPoint; + Owner.Center = respawnPoint; + Projectile.velocity *= 0.01f; + for (int i = 0; i < 15; i++) + { + Vector2 vel = (MathHelper.TwoPi * i / 15f).ToRotationVector2() * 15.5f * (i % 4 == 0 ? 0.88f : 1f) * Main.rand.NextFloat(0.8f, 1f); + float scale = Main.rand.NextFloat(1.3f, 1.6f) * 0.6f * (i % 4 == 0 ? 2.2f : 1.8f); + + Particle aura = new VelChangingSpark(respawnPoint, vel.RotatedBy(0.02f) * 3, -vel.RotatedBy(-0.04f) * 4, "CalamityMod/Particles/SmallBloom", 27, 0.2f, Color.Goldenrod, new Vector2(1.8f, 1.5f), lerpRate: 0.07f, shrinkSpeed: 0.25f); + GeneralParticleHandler.SpawnParticle(aura); + + } + Particle orb2 = new CustomPulse(respawnPoint, Vector2.Zero, Color.Khaki, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 2, 0.5f, 28); + GeneralParticleHandler.SpawnParticle(orb2); + + SoundStyle sound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianHeal"); + SoundEngine.PlaySound(sound with { Volume = 0.6f, Pitch = Main.rand.NextFloat(-0.7f, -0.9f) }, respawnPoint); + + KillProj(); + } + if (respawnPoint == Vector2.Zero) + respawnPoint = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 60; + + if (SoundEngine.TryGetActiveSound(digSoundSlot, out var zound) && zound.IsPlaying) + { + zound.Position = Projectile.Center; + zound.Pitch = 0.4f * respawnMult - (drifting ? 0.5f : 0); + zound.Volume = (drifting ? 0.6f : 1f); + } + + respawnMult = Utils.GetLerpValue(60, 180, respawnTimer); } else { - // Adjust direction so that the spear is always launching in the direction of the mouse. - // However, if the mouse position is really close to the projectile, don't do anything. - // Being close to the target may cause erratic movements. - // The projectile.localAI[1] part is to prevent the projectile from redirecting on a frame-by-frame basis (Main.mouseLeft seems to mean mouse hold, not release). - if (Projectile.Distance(Main.MouseWorld) > 60f && - Main.mouseLeft && !Main.blockMouse && !player.mouseInterface && - Projectile.localAI[0] <= MaxCharges && - Projectile.localAI[1] <= 0f) + if (SoundEngine.TryGetActiveSound(digSoundSlot, out var zound)) + zound?.Stop(); + respawnPoint = Projectile.Center; + if (respawnTimer > 0) { - IdealVelocity = Projectile.SafeDirectionTo(Main.MouseWorld) * Projectile.ai[1]; - Projectile.localAI[0]++; - Projectile.localAI[1] = 40f; - SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); - Projectile.netUpdate = true; - } - else if (Projectile.localAI[0] > MaxCharges) - { - if (Projectile.timeLeft > 120) + if (digFXCooldown == 0) { - Projectile.timeLeft = 120; + SoundStyle sound = new("CalamityMod/Sounds/Item/MagicRockSound"); + SoundEngine.PlaySound(sound with { Volume = 0.4f, Pitch = Main.rand.NextFloat(0.3f, 0.7f) }, Projectile.Center); + for (int i = 0; i < 13; i++) + { + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.6f) * Main.rand.NextFloat(2f, 24f), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard6", true, Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.85f, 2.3f), Color.White, new Vector2(1.1f, 0.8f), false, false, Main.rand.NextFloat(-5, 5), false, false); + GeneralParticleHandler.SpawnParticle(spark); + if (i % 2 == 0) + { + MediumMistParticle RockCloud = new MediumMistParticle(Projectile.Center + Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(1f, 7f), Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.6f) * Main.rand.NextFloat(1, 12), Color.Peru, Color.Sienna, Main.rand.NextFloat(1.4f, 2.3f), 120f, Main.rand.NextFloat(0.03f, -0.03f)); + GeneralParticleHandler.SpawnParticle(RockCloud); + } + } + digFXCooldown = 5; } - Projectile.alpha = (int)MathHelper.Lerp(0, 255, 1f - Projectile.timeLeft / 120f); - } - if (Projectile.velocity != IdealVelocity) - { - Projectile.velocity = Vector2.Lerp(Projectile.velocity, IdealVelocity, 0.125f); } + respawnTimer = 0; + respawnMult = 0f; - player.velocity = Projectile.velocity; - // Count down the charge cooldown - if (Projectile.localAI[1] > 0f) - Projectile.localAI[1]--; - Projectile.rotation = Projectile.velocity.ToRotation(); - // Player manipulations (setting the center point and disallowing mounts). - player.Center = Projectile.Center; - // Adjust the player's held projectile type. - if (player.heldProj == -1) - player.heldProj = Projectile.whoAmI; - player.mount?.Dismount(player); - player.ChangeDir(Math.Sign(Projectile.velocity.X) <= 0 ? -1 : 1); - // Generate dust - if (Projectile.ai[0] % DustSpawnInterval == DustSpawnInterval - 1f) + if (time % Projectile.MaxUpdates * 2 == 0 && !drifting) { - for (int i = 0; i < 12; i++) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center + (Projectile.Size / 2f).RotatedBy(Projectile.rotation), (int)CalamityDusts.ProfanedFire); - dust.velocity = Projectile.velocity.RotatedBy(MathHelper.ToRadians(20f * (i % 2 == 0).ToDirectionInt())); - dust.noGravity = true; - dust.fadeIn = 1.8f; - } + SoundStyle sound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash"); + SoundEngine.PlaySound(sound with { Volume = 0.065f * driftPowerScaling, Pitch = Main.rand.NextFloat(-0.4f, -0.9f) + (driftPower == 3 ? 1.4f : 0), MaxInstances = -1 }, Owner.Center); } } - // Don't die when colliding with tiles unless the spear is lunging (and after a bit of time has passed). - Projectile.tileCollide = Projectile.velocity != Vector2.Zero && Projectile.ai[0] >= WaitTimeRequiredForCharge + 10f; + if (time % Projectile.MaxUpdates == 0 && digFXCooldown > 0) + digFXCooldown--; - // Die immediately if the owner of this projectile is clipping into tiles because of its movement. - if (Collision.SolidCollision(player.position, player.width, player.height) && Projectile.velocity != Vector2.Zero) + Owner.Center = Projectile.Center; + Owner.velocity = Projectile.velocity * Projectile.MaxUpdates; + Owner.dashDelay = 0; + Projectile.timeLeft++; + Owner.RemoveAllGrapplingHooks(); + + Lighting.AddLight(Projectile.Center, Color.Gold.ToVector3() * (driftPowerScaling + 0.5f)); + + Owner.mount?.Dismount(Owner); + Owner.ChangeDir(Math.Sign(drifting ? idealVel.X : Projectile.velocity.X) <= 0 ? -1 : 1); + + if (!killed) { - player.velocity.Y = 0f; - DoDeathDust(Projectile.oldVelocity); + float idealRot = (drifting ? idealVel : Projectile.velocity).ToRotation(); + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, idealRot, (boostTimer > 0 ? 1 : 0.15f)); + + Owner.fullRotationOrigin = Owner.Center - Owner.position; + Owner.fullRotation = (Owner.direction == -1 ? MathHelper.ToRadians(180f) : 0) + Projectile.rotation + MathHelper.ToRadians(65f * Owner.direction); + + float rot = (drifting ? idealVel : Projectile.velocity).ToRotation() + (Owner.direction == -1 ? MathHelper.ToRadians(270f) : MathHelper.ToRadians(-90f)); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rot - Owner.fullRotation); + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, rot - Owner.fullRotation); - Projectile.Kill(); } - Lighting.AddLight(Projectile.Center, Color.LightGoldenrodYellow.ToVector3()); + time++; + + // I pray for the fate of this thing in multiplayer dear god + Projectile.netUpdate = true; + Projectile.netSpam = 0; } - public void DoDeathDust(Vector2 oldVelocity) + public void KillProj() { - if (Main.dedServ) - return; + if (SoundEngine.TryGetActiveSound(digSoundSlot, out var sound)) + sound?.Stop(); - for (int i = 0; i < 60; i++) + if (inTiles && respawnPoint != Vector2.Zero) { - Vector2 spawnOffset = (Projectile.Size / 2f).RotatedBy(Projectile.rotation); - spawnOffset += Utils.NextVector2Circular(Main.rand, 10f, 10f); - Dust dust = Dust.NewDustPerfect(Projectile.Center + spawnOffset, (int)CalamityDusts.ProfanedFire); - dust.velocity = Utils.NextVector2Circular(Main.rand, 5f, 5f) + oldVelocity; - dust.noGravity = true; - dust.fadeIn = 1.9f; + Projectile.Center = respawnPoint; + if (!Owner.dead) + Owner.Center = respawnPoint; } - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + killed = true; + Owner.fullRotationOrigin = Owner.Center - Owner.position; + Owner.fullRotation = 0; + Owner.Calamity().rOfDelivarenceRam = false; + Projectile.netUpdate = true; + Projectile.Kill(); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.01f; + int hitsToMinMult = 15; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + float driftMult = (driftPower == 1 ? 0.3f : driftPower == 2 ? 1.6f : 2.5f) * damageMult; // Drift power scaling is lower than regular + + float totalMult = driftMult * ((Projectile.numHits == 0 && driftPower > 1) ? 1.9f : 1) * (Owner.Calamity().profanedSoulRelicBuff ? 8 : 1); + modifiers.SourceDamage *= totalMult; - public override bool? CanDamage() => Projectile.velocity != Vector2.Zero ? null : false; - + if (Projectile.numHits == 0 && driftPower > 1) + { + for (int i = 0; i < 5; i++) + { + Particle spark = new GlowSparkParticle(Projectile.Center, Projectile.velocity, false, 18, 0.05f * driftPower, Color.Lerp(Color.White, Color.Orange, i * 0.2f) * 0.85f, new Vector2(4 + i * 0.55f, 0.4f + i * 0.1f), true, false, 1f); + GeneralParticleHandler.SpawnParticle(spark); + } + SoundStyle sound = new("CalamityMod/Sounds/Item/FinalDawnSlash"); + SoundEngine.PlaySound(sound with { Volume = 1, Pitch = Main.rand.NextFloat(0.2f, 0.4f) * damageMult }, Projectile.Center); + } + if (Projectile.soundDelay <= 0) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/HolyColliderBigHit"); + SoundEngine.PlaySound(sound with { Volume = 1, Pitch = Main.rand.NextFloat(-0.2f, -0.4f) * damageMult }, Projectile.Center); + Projectile.soundDelay = 25; + } + } + public override bool? CanDamage() => (Projectile.velocity == Vector2.Zero || drifting) ? false : null; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 30 * driftPowerScaling, 60 * driftPowerScaling, targetHitbox); public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + Vector2 drawPos = Owner.MountedCenter + (drifting ? idealVel : Projectile.velocity).SafeNormalize(Vector2.UnitX) * (55 - 35 * Utils.GetLerpValue(0, 25, driftTimer, true)); + Projectile.DrawProjectileWithBackglow(Color.Goldenrod with { A = 0 }, Color.White, 3f * driftPowerScaling, effects: Math.Sign((drifting ? idealVel.X : Projectile.velocity.X)) == -1 ? Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipVertically : Microsoft.Xna.Framework.Graphics.SpriteEffects.None, xPos: drawPos.X, yPos: drawPos.Y); + + Texture2D texture = ModContent.Request("CalamityMod/Particles/BloomRing").Value; + Texture2D texture2 = ModContent.Request("CalamityMod/Particles/GlowSpark").Value; + Texture2D texture3 = ModContent.Request("CalamityMod/Particles/HalfStar").Value; + if (inTiles) + { + float randSize = Main.rand.NextFloat(0.9f, 1.1f); + Vector2 vel = Utils.DirectionTo(Projectile.Center, respawnPoint); + for (int i = 0; i < 4; i++) + Main.EntitySpriteDraw(texture2, Projectile.Center - Main.screenPosition + vel * 80 * respawnMult, null, Color.Goldenrod with { A = 0 } * respawnMult, vel.ToRotation() + MathHelper.ToRadians(90f), texture2.Size() * 0.5f, new Vector2(1.2f - i * 0.2f, (1.2f + i * 0.3f) * respawnMult) * (0.7f + i * 0.07f) * 0.05f, SpriteEffects.None, 0); + for (int i = 0; i < 3; i++) + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, (i == 0 ? Color.White : Color.Goldenrod) with { A = 0 } * respawnMult, vel.ToRotation(), texture.Size() * 0.5f, (0.43f + i * 0.08f) * respawnMult, SpriteEffects.None, 0); + + for (int i = 0; i < 2; i++) + { + Main.EntitySpriteDraw(texture, respawnPoint - Main.screenPosition, null, bColor with { A = 0 } * MathHelper.Clamp(respawnMult + 0.5f, 0.5f, 1), vel.ToRotation(), texture.Size() * 0.5f, 0.15f + respawnMult * 0.5f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture3, respawnPoint - Main.screenPosition, null, bColor with { A = 0 }, i == 0 ? MathHelper.ToRadians(90f) : 0, texture3.Size() * 0.5f, new Vector2(0.8f, 1.5f) * 1.65f * randSize, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture3, respawnPoint - Main.screenPosition, null, Color.White with { A = 0 } * 0.65f, i == 0 ? MathHelper.ToRadians(90f) : 0, texture3.Size() * 0.5f, new Vector2(0.8f, 1.5f) * 1.25f * randSize, SpriteEffects.None, 0); + } + } + if (!drifting) + { + Vector2 placement = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * (-20 + 80 * (driftPowerScaling <= 1 ? driftPowerScaling : 1)); + Asset tex = ModContent.Request("CalamityMod/Particles/VerticalSmear"); + Asset tex2 = ModContent.Request("CalamityMod/Particles/SemiCircularSmearSwipe"); + for (int i = 0; i < 6; i++) + { + Vector2 scale = new Vector2(0.5f - i * 0.1f, (1.5f + i * 0.15f) * driftBadMult) * (0.75f * driftPowerScaling * Main.rand.NextFloat(0.9f, 1.1f) + 0.25f); + Main.EntitySpriteDraw(tex.Value, placement - Main.screenPosition, null, bColor with { A = 0 } * 0.5f * driftBadMult, Projectile.rotation + MathHelper.ToRadians(90f), tex.Size() * 0.5f, scale, SpriteEffects.None); + } + } return false; } // Force the spear to have "priority" when drawing so that it draws over the player. @@ -234,11 +515,16 @@ namespace CalamityMod.Projectiles.Typeless { overWiresUI.Add(index); } - - public override bool OnTileCollide(Vector2 oldVelocity) + public override void SendExtraAI(BinaryWriter writer) { - DoDeathDust(oldVelocity); - return base.OnTileCollide(oldVelocity); + writer.Write7BitEncodedInt(driftPower); + writer.Write(driftPowerScaling); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + driftPower = reader.Read7BitEncodedInt(); + driftPowerScaling = reader.Read(); } } } diff --git a/Projectiles/Typeless/WarbannerDamage.cs b/Projectiles/Typeless/WarbannerDamage.cs new file mode 100644 index 0000000000..a43011216e --- /dev/null +++ b/Projectiles/Typeless/WarbannerDamage.cs @@ -0,0 +1,20 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + // 13NOV2024: Ozzatron: Literally just a DirectStrike that inflicts holy flames. + // Because it's a separate projectile, it has its own name in the localization files. + public class WarbannerDamage : DirectStrike, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 30); + } + + } +} diff --git a/Projectiles/Typeless/WarbannerLight.cs b/Projectiles/Typeless/WarbannerLight.cs new file mode 100644 index 0000000000..dfdcde65c0 --- /dev/null +++ b/Projectiles/Typeless/WarbannerLight.cs @@ -0,0 +1,94 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +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.Typeless +{ + public class WarbannerLight : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public CalamityPlayer moddedOwner => Owner.Calamity(); + public Color bColor = Color.White; + public int time = 0; + public float rotMult = 0.05f; + public int direction = 1; + public float rot2 = 0; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 1; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + } + + public override void AI() + { + float rate = Main.GlobalTimeWrappedHourly * 5; + List eColors = new List() + { + Color.Goldenrod, + Color.Orange + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + bColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + Projectile.Center = Owner.MountedCenter; + + if (moddedOwner.warbannerGlow && moddedOwner.WarbanneroftheRighteous) + Projectile.timeLeft++; + else + Projectile.Kill(); + if (Owner.dead) + Projectile.Kill(); + + // Emit some light + Lighting.AddLight(Projectile.Center, Color.Goldenrod.ToVector3() * 1.5f); + + rot2 = Math.Abs((float)Math.Sin(time * 0.15f / MathHelper.Pi) * 0.2f) + 0.8f; + + if (time % 2 == 0) + { + Vector2 dustVel = new Vector2(10, 10).RotatedByRandom(100); + Dust dust = Dust.NewDustPerfect(Owner.Center + dustVel, ModContent.DustType(), dustVel * Main.rand.NextFloat(0.1f, 0.4f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 0.7f); + dust.color = bColor; + dust.noLightEmittence = true; + } + time++; + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D rTexture = ModContent.Request("CalamityMod/Particles/ShatteredExplosion").Value; + Texture2D bTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Color drawColor = bColor; + + for (int i = 0; i < 5; i++) + { + float bScale2 = 0.75f; + Main.EntitySpriteDraw(bTexture, Owner.Center - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, i * 0.15f) with { A = 0 }, 0, bTexture.Size() * 0.5f, (bScale2 - i * 0.15f) * rot2 * Projectile.scale, SpriteEffects.None, 0); + } + + Main.EntitySpriteDraw(rTexture, Owner.Center - Main.screenPosition, null, drawColor with { A = 0 }, Main.rand.NextFloat(-2, 2), rTexture.Size() * 0.5f, 0.03f * rot2 * Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rTexture, Owner.Center - Main.screenPosition, null, drawColor with { A = 0 }, Main.rand.NextFloat(-2, 2), rTexture.Size() * 0.5f, 0.04f * rot2 * Projectile.scale, SpriteEffects.None, 0); + return false; + } + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Typeless/WulfrumDrillProj.cs b/Projectiles/Typeless/WulfrumDrillProj.cs index 17d6d0cd41..0bc98e5c28 100644 --- a/Projectiles/Typeless/WulfrumDrillProj.cs +++ b/Projectiles/Typeless/WulfrumDrillProj.cs @@ -58,7 +58,9 @@ namespace CalamityMod.Projectiles.Typeless Projectile.soundDelay = 30; } + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.velocity = (Owner.Calamity().mouseWorld - Owner.MountedCenter).SafeNormalize(Vector2.One); + //Projectile.spriteDirection = Math.Sign(Projectile.velocity.X); Owner.heldProj = Projectile.whoAmI; Owner.ChangeDir(Math.Sign(Projectile.velocity.X)); diff --git a/Projectiles/Typeless/WulfrumScaffoldKitHoldout.cs b/Projectiles/Typeless/WulfrumScaffoldKitHoldout.cs index ec144b568c..cb061bacb7 100644 --- a/Projectiles/Typeless/WulfrumScaffoldKitHoldout.cs +++ b/Projectiles/Typeless/WulfrumScaffoldKitHoldout.cs @@ -83,6 +83,8 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { + // 15NOV2024: Ozzatron: Intentionally not clamping Wulfrum Scaffolds despite combat applicability due to them being mechanically closer to a UI feature. + if (Owner.channel && CanOwnerGoOn) { //Initialize the position diff --git a/Projectiles/Typeless/YanmeisKnifeSlash.cs b/Projectiles/Typeless/YanmeisKnifeSlash.cs index fd0b13508e..8d9ccaaf70 100644 --- a/Projectiles/Typeless/YanmeisKnifeSlash.cs +++ b/Projectiles/Typeless/YanmeisKnifeSlash.cs @@ -79,6 +79,8 @@ namespace CalamityMod.Projectiles.Typeless { speed = player.ActiveItem().shootSpeed * Projectile.scale; } + + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 newVelocity = (Main.MouseWorld - playerRotatedPoint).SafeNormalize(Vector2.UnitX * player.direction) * speed; // Sync if a velocity component changes. diff --git a/Sounds/Custom/ProfanedGuardians/GuardianHeal.ogg b/Sounds/Custom/ProfanedGuardians/GuardianHeal.ogg new file mode 100644 index 0000000000..ba3e96c6c8 Binary files /dev/null and b/Sounds/Custom/ProfanedGuardians/GuardianHeal.ogg differ diff --git a/Sounds/Item/ArcFlash.ogg b/Sounds/Item/ArcFlash.ogg new file mode 100644 index 0000000000..a21e314e73 Binary files /dev/null and b/Sounds/Item/ArcFlash.ogg differ diff --git a/Sounds/Item/FireImplosion.ogg b/Sounds/Item/FireImplosion.ogg new file mode 100644 index 0000000000..ef5da14382 Binary files /dev/null and b/Sounds/Item/FireImplosion.ogg differ diff --git a/Sounds/Item/FrigidflashCharge.ogg b/Sounds/Item/FrigidflashCharge.ogg new file mode 100644 index 0000000000..04145628c5 Binary files /dev/null and b/Sounds/Item/FrigidflashCharge.ogg differ diff --git a/Sounds/Item/HeavyDig.ogg b/Sounds/Item/HeavyDig.ogg new file mode 100644 index 0000000000..97a41ba4e6 Binary files /dev/null and b/Sounds/Item/HeavyDig.ogg differ diff --git a/Sounds/Item/HolyColliderBigHit.ogg b/Sounds/Item/HolyColliderBigHit.ogg new file mode 100644 index 0000000000..a51d0503c6 Binary files /dev/null and b/Sounds/Item/HolyColliderBigHit.ogg differ diff --git a/Sounds/Item/HolyColliderProjectileHit.ogg b/Sounds/Item/HolyColliderProjectileHit.ogg new file mode 100644 index 0000000000..f090228a14 Binary files /dev/null and b/Sounds/Item/HolyColliderProjectileHit.ogg differ diff --git a/Sounds/Item/HolyColliderSmallHit.ogg b/Sounds/Item/HolyColliderSmallHit.ogg new file mode 100644 index 0000000000..05d728a6f4 Binary files /dev/null and b/Sounds/Item/HolyColliderSmallHit.ogg differ diff --git a/Sounds/Item/LauncherHeavyShot.ogg b/Sounds/Item/LauncherHeavyShot.ogg new file mode 100644 index 0000000000..3d3e042d2d Binary files /dev/null and b/Sounds/Item/LauncherHeavyShot.ogg differ diff --git a/Sounds/Item/MetalScrape.ogg b/Sounds/Item/MetalScrape.ogg new file mode 100644 index 0000000000..2f1963610a Binary files /dev/null and b/Sounds/Item/MetalScrape.ogg differ diff --git a/Sounds/Item/MissileNearing.ogg b/Sounds/Item/MissileNearing.ogg new file mode 100644 index 0000000000..544e1697f0 Binary files /dev/null and b/Sounds/Item/MissileNearing.ogg differ diff --git a/Sounds/Item/MoltenAmputatorRecall.ogg b/Sounds/Item/MoltenAmputatorRecall.ogg new file mode 100644 index 0000000000..87bbd1fcb7 Binary files /dev/null and b/Sounds/Item/MoltenAmputatorRecall.ogg differ diff --git a/Sounds/Item/SanctifiedSparkHappy.ogg b/Sounds/Item/SanctifiedSparkHappy.ogg new file mode 100644 index 0000000000..fad4b549d1 Binary files /dev/null and b/Sounds/Item/SanctifiedSparkHappy.ogg differ diff --git a/Sounds/Item/SkytideSwing.ogg b/Sounds/Item/SkytideSwing.ogg new file mode 100644 index 0000000000..4559d5f4e2 Binary files /dev/null and b/Sounds/Item/SkytideSwing.ogg differ diff --git a/Sounds/Item/SkytiedBolt.ogg b/Sounds/Item/SkytiedBolt.ogg new file mode 100644 index 0000000000..e32426f331 Binary files /dev/null and b/Sounds/Item/SkytiedBolt.ogg differ diff --git a/Sounds/Item/SwooshMid.ogg b/Sounds/Item/SwooshMid.ogg new file mode 100644 index 0000000000..79a8433dfb Binary files /dev/null and b/Sounds/Item/SwooshMid.ogg differ diff --git a/Systems/Collections/PierceResistExceptionList.cs b/Systems/Collections/PierceResistExceptionList.cs index acbb5de9ca..d42001f90d 100644 --- a/Systems/Collections/PierceResistExceptionList.cs +++ b/Systems/Collections/PierceResistExceptionList.cs @@ -81,7 +81,6 @@ namespace CalamityMod.Systems.Collections ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), diff --git a/Systems/Collections/VeneratedLocketBanList.cs b/Systems/Collections/VeneratedLocketBanList.cs index bc241f08ac..04175434a6 100644 --- a/Systems/Collections/VeneratedLocketBanList.cs +++ b/Systems/Collections/VeneratedLocketBanList.cs @@ -16,10 +16,8 @@ namespace CalamityMod.Systems.Collections { List = [ - ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), diff --git a/Utilities/ExtraArmAnimations.cs b/Utilities/ExtraArmAnimations.cs index 4556398e2d..64a657db85 100644 --- a/Utilities/ExtraArmAnimations.cs +++ b/Utilities/ExtraArmAnimations.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Utilities { player.Calamity().mouseWorldListener = true; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 mW = player.Calamity().mouseWorld; float value1 = player.direction * -90; @@ -36,6 +37,7 @@ namespace CalamityMod.Utilities { player.Calamity().mouseWorldListener = true; + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 mW = player.Calamity().mouseWorld; float value1 = player.direction * -90; diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index f804ba792d..0230959ea1 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using System.Reflection; using CalamityMod.Balancing; @@ -875,6 +876,21 @@ namespace CalamityMod } #endregion + /// + /// Used to limit the cursor up to a 1080p monitor. A similar method is used for items such as Zenith in vanilla. + /// + /// The player to check. + /// The current position of the player's mouse, clamped to a 1920x1080 screen. + public static Vector2 ClampedMouseWorld(this Player player) + { + Vector2 mouseWorld = player.Calamity().mouseWorld; + + // Clamp each axis + mouseWorld.X = mouseWorld.X >= player.MountedCenter.X ? MathF.Min(mouseWorld.X, player.MountedCenter.X + 960f) : MathF.Max(mouseWorld.X, player.MountedCenter.X - 960f); + mouseWorld.Y = mouseWorld.Y >= player.MountedCenter.Y ? MathF.Min(mouseWorld.Y, player.MountedCenter.Y + 540f) : MathF.Max(mouseWorld.Y, player.MountedCenter.Y - 540f); + return mouseWorld; + } + /// /// A shorthand bool to check if the player can continue using the holdout or not. /// diff --git a/Utilities/ProjectileUtils.cs b/Utilities/ProjectileUtils.cs index 03d5cff92b..23ccce13f9 100644 --- a/Utilities/ProjectileUtils.cs +++ b/Utilities/ProjectileUtils.cs @@ -131,6 +131,31 @@ namespace CalamityMod } } + /// + /// Xyk's version of homing code
+ /// Gives a projectile homing on a selected npc. It is recommended to use to get a target. + ///
+ /// The multiplier applied to the movement towards the target. + /// The cap on velocity for the projectile. + /// The inertia of the homing. Generally you want to keep this anywhere from 1 (high inertia), to 0.9f (low inertia). + /// The speed reduction applied to the projectile if it goes above max speed. + /// If the projectile should accelerate to max speed when there is no target. Good for projectiles with small homing range. + public static void HomeInOnSelectedNPC(Projectile projectile, NPC target, bool ignoreTiles = true, float homingVelocity = 0.5f, float maxSpeed = 10, float inertia = 0.985f, float overspeedReduction = 0.95f, bool accelerate = false) + { + NPC targetedNPC = target; + if (targetedNPC != null && (ignoreTiles || Collision.CanHit(projectile.Center, 1, 1, targetedNPC.Center, 1, 1))) + { + Vector2 position = targetedNPC.Center; + Vector2 moveToNPC = (position - projectile.Center).SafeNormalize(Vector2.UnitX); + if (projectile.velocity.Length() < maxSpeed) + projectile.velocity = projectile.velocity * inertia + moveToNPC * homingVelocity; + else + projectile.velocity *= overspeedReduction; + } + if (targetedNPC == null && projectile.velocity.Length() < maxSpeed && accelerate) + projectile.velocity *= 1.0055f; + } + // NOTE - Do not under any circumstance use these predictive methods for enemies or bosses. It is intended for minions and player-created projectiles. // Due to its extremely precise nature, it will have little openings that allow players to react without dashing through the enemy. // The results will be neither fun nor fair. @@ -674,14 +699,14 @@ namespace CalamityMod return false; } - public static void DrawBackglow(this Projectile projectile, Color backglowColor, float backglowArea, Texture2D? texture = null, Rectangle? frame = null, SpriteEffects effects = SpriteEffects.None) + public static void DrawBackglow(this Projectile projectile, Color backglowColor, float backglowArea, Texture2D? texture = null, Rectangle? frame = null, SpriteEffects effects = SpriteEffects.None, float xPos = 0, float yPos = 0) { texture ??= TextureAssets.Projectile[projectile.type].Value; // Use a fallback for the frame. frame ??= texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Vector2 drawPosition = projectile.Center - Main.screenPosition; + Vector2 drawPosition = ((xPos == 0 && yPos == 0) ? projectile.Center : new Vector2(xPos, yPos)) - Main.screenPosition; Vector2 origin = frame.Value.Size() * 0.5f; Color backAfterimageColor = backglowColor * projectile.Opacity; for (int i = 0; i < 10; i++) @@ -710,17 +735,17 @@ namespace CalamityMod } } - public static void DrawProjectileWithBackglow(this Projectile projectile, Color backglowColor, Color lightColor, float backglowArea, Texture2D? texture = null, Rectangle? frame = null, SpriteEffects effects = SpriteEffects.None) + public static void DrawProjectileWithBackglow(this Projectile projectile, Color backglowColor, Color lightColor, float backglowArea, Texture2D? texture = null, Rectangle? frame = null, SpriteEffects effects = SpriteEffects.None, float xPos = 0, float yPos = 0) { texture ??= TextureAssets.Projectile[projectile.type].Value; // Use a fallback for the frame. frame ??= texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Vector2 drawPosition = projectile.Center - Main.screenPosition; + Vector2 drawPosition = ((xPos == 0 && yPos == 0) ? projectile.Center : new Vector2(xPos, yPos)) - Main.screenPosition; Vector2 origin = frame.Value.Size() * 0.5f; - projectile.DrawBackglow(backglowColor, backglowArea, texture, frame, effects); + projectile.DrawBackglow(backglowColor, backglowArea, texture, frame, effects, xPos, yPos); Main.spriteBatch.Draw(texture, drawPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, effects, 0f); } diff --git a/Utilities/RicoshotUtils.cs b/Utilities/RicoshotUtils.cs index 697fba3fc1..1f54d392cb 100644 --- a/Utilities/RicoshotUtils.cs +++ b/Utilities/RicoshotUtils.cs @@ -62,6 +62,8 @@ namespace CalamityMod { // As 0,0 in world coordinates is the top left of the world (+Y = down instead of up), // we have to flip the Y here to do valid trigonometry. + // + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 vectorToMouse = player.Calamity().mouseWorld - player.MountedCenter; vectorToMouse.Y *= -1f;