diff --git a/.gitignore b/.gitignore index 1d485231df..673a87ca2b 100644 --- a/.gitignore +++ b/.gitignore @@ -305,3 +305,4 @@ $RECYCLE.BIN/ # Windows shortcuts *.lnk +*.slnx diff --git a/Buffs/DamageOverTime/DemonicFlames.cs b/Buffs/DamageOverTime/DemonicFlames.cs index 82b6e11979..7f6827f0bb 100644 --- a/Buffs/DamageOverTime/DemonicFlames.cs +++ b/Buffs/DamageOverTime/DemonicFlames.cs @@ -29,6 +29,8 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; + } public override void Update(Player player, ref int buffIndex) @@ -76,7 +78,7 @@ namespace CalamityMod.Buffs.DamageOverTime for (int i = 0; i < 2; i++) { Vector2 sparkVel = new Vector2(Main.rand.NextFloat(-npc.width / 6, npc.width / 6), Main.rand.NextFloat(-npc.height / 20, -npc.height / 17)); - Particle sparks = new VelChangingSpark(npc.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), npc.height / 2) + sparkVel * 0.5f, sparkVel + npc.velocity, new Vector2(-sparkVel.X * 0.5f, sparkVel.Y * 2) * 3.5f, "CalamityMod/Particles/SmallBloom", Main.rand.Next(13, 20 + 1), Main.rand.NextFloat(0.1f, 0.25f) * MathHelper.Lerp(Math.Max(npc.height, npc.width) / 120, 0.5f, 0.7f), (Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet) * 0.75f, new Vector2(0.7f, 1), true, false, 0, false, 0.3f, 0.055f); + Particle sparks = new VelChangingSpark(npc.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), npc.height / 2) + sparkVel * 0.5f, sparkVel + npc.velocity, new Vector2(-sparkVel.X * 0.5f, sparkVel.Y * 2) * 3.5f, "CalamityMod/Particles/SmallBloom", Main.rand.Next(13, 20 + 1), Main.rand.NextFloat(0.1f, 0.25f) * MathHelper.Lerp(Math.Max(npc.height, npc.width) / 120, 0.5f, 0.7f), (Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet) * 0.75f, new Vector2(0.7f, 1), true, false, 0, false, 0.3f, 0.055f); GeneralParticleHandler.SpawnParticle(sparks); } } diff --git a/Buffs/StatBuffs/HallowedRuneDefense.cs b/Buffs/StatBuffs/HallowedRuneDefense.cs index f307c99e49..75e9d6ad06 100644 --- a/Buffs/StatBuffs/HallowedRuneDefense.cs +++ b/Buffs/StatBuffs/HallowedRuneDefense.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class HallowedRuneDefense : ModBuff { - public override LocalizedText Description => base.Description.WithFormatArgs(HallowedRune.DefenseBoost, HallowedRune.DamageReductionBoost.ToPercent()); + public override LocalizedText Description => base.Description.WithFormatArgs(HallowedRune.DefenseBoost); public override void SetStaticDefaults() { @@ -20,7 +20,6 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { player.statDefense += HallowedRune.DefenseBoost; - player.endurance += HallowedRune.DamageReductionBoost; // TODO -- is this applied too late to be affected by the DR softcap? } } } diff --git a/Buffs/StatBuffs/PhantomicShield.cs b/Buffs/StatBuffs/PhantomicShield.cs index dc8d920fad..b44b498755 100644 --- a/Buffs/StatBuffs/PhantomicShield.cs +++ b/Buffs/StatBuffs/PhantomicShield.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class PhantomicShield : ModBuff { - public override LocalizedText Description => base.Description.WithFormatArgs(PhantomicArtifact.DefenseBoost, PhantomicArtifact.DamageReductionBoost.ToPercent()); + public override LocalizedText Description => base.Description.WithFormatArgs(PhantomicArtifact.DefenseBoost); public override void SetStaticDefaults() { @@ -19,7 +19,6 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.endurance += PhantomicArtifact.DamageReductionBoost; // TODO -- is this applied too late to be affected by the DR softcap? player.statDefense += PhantomicArtifact.DefenseBoost; } } diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 394b655aeb..fd3a1b94d5 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -935,7 +935,6 @@ namespace CalamityMod.CalPlayer public bool seraphTracers = false; public bool frostFlare = false; public bool evolution = false; - public int evolutionLifeRegenCounter = 0; public bool nanotech = false; public bool deadshotBrooch = false; public bool shadowMinions = false; @@ -3429,8 +3428,9 @@ namespace CalamityMod.CalPlayer if (Player.armor[i].type == itemID) return Player.armor[i]; } - return new Item(); + return ContentSamples.ItemsByType[itemID]; } + public Item FindAccessory() where T : ModItem => FindAccessory(ItemType()); public override void ProcessTriggers(TriggersSet triggersSet) { @@ -3440,7 +3440,7 @@ namespace CalamityMod.CalPlayer if (ascendantInsignia && Main.myPlayer == Player.whoAmI && CalamityKeybinds.AscendantInsigniaHotKey.JustPressed && ascendantInsigniaCooldown <= 0) { - var source = Player.GetSource_Accessory(FindAccessory(ItemType())); + var source = Player.GetSource_Accessory(FindAccessory()); Projectile.NewProjectile(source, Player.Center - Vector2.UnitY * 45f, Vector2.Zero, ProjectileType(), 0, 0f); SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/AscendantActivate")); ascendantInsigniaCooldown = AscendantInsignia.AbilityCooldown; @@ -3538,7 +3538,7 @@ namespace CalamityMod.CalPlayer angelAmt += 1f; } - var source = Player.GetSource_Accessory(FindAccessory(ItemType())); + var source = Player.GetSource_Accessory(FindAccessory()); for (int projIndex = 0; projIndex < angelAmt; projIndex++) { Projectile proj = Main.projectile[projIndex]; @@ -4045,7 +4045,7 @@ namespace CalamityMod.CalPlayer } if (Player.statMana >= stormMana && !Player.silence) { - var source = Player.GetSource_ItemUse(ContentSamples.ItemsByType[ItemType()]); + var source = Player.GetSource_ItemUse(FindAccessory()); Player.manaRegenDelay = (int)Player.maxRegenDelay; Player.statMana -= stormMana; @@ -4316,7 +4316,7 @@ namespace CalamityMod.CalPlayer // Check if player hit some form of solid resistance (the ground) if (0 == Player.velocity.Y) { - var source = Player.GetSource_Accessory(FindAccessory(ItemType())); + var source = Player.GetSource_Accessory(FindAccessory()); // Spawn explosion. ai[0] is used for transferring the recorded falling time int damage = Player.CalcIntDamage(InterstellarStompers.SlamDamage); @@ -5294,7 +5294,7 @@ namespace CalamityMod.CalPlayer } if (veneratedLocket) { - var LocketSource = Player.GetSource_Accessory(FindAccessory(ItemType())); + var LocketSource = Player.GetSource_Accessory(FindAccessory()); if (item.CountsAsClass()) { if (!CalamityItemSets.DisablesVeneratedLocketEffect[item.type]) diff --git a/CalPlayer/CalamityPlayerDashEffects.cs b/CalPlayer/CalamityPlayerDashEffects.cs index 865f7c97e3..35995aaf7c 100644 --- a/CalPlayer/CalamityPlayerDashEffects.cs +++ b/CalPlayer/CalamityPlayerDashEffects.cs @@ -130,8 +130,8 @@ namespace CalamityMod.CalPlayer dashDelayToApply = BalancingConstants.UniversalShieldSlamCooldown; else if (UsedDash.CollisionType == DashCollisionType.ShieldBonk) dashDelayToApply = BalancingConstants.UniversalShieldBonkCooldown; - if (DashID == DeepDiverDash.ID) - dashDelayToApply = 23; + if (DashID == DeepDiverDash.ID || (evasionScarf && DashID == CounterScarfDash.ID)) + dashDelayToApply = (int)(dashDelayToApply * 0.75f); if (DashID == StatisNinjaBeltDash.ID || DashID == StatisVoidSashDash.ID || Player.dashType == 1) dashDelayToApply = BalancingConstants.UniversalSashDashCooldown; diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index b78cba5989..ed2c691226 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -57,6 +57,7 @@ using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using CalamityMod.Projectiles.Melee; namespace CalamityMod.CalPlayer { @@ -143,7 +144,7 @@ namespace CalamityMod.CalPlayer NetMessage.SendData(MessageID.Dodge, -1, -1, null, Player.whoAmI, 1f, 0f, 0f, 0, 0, 0); } - public void AbyssMirrorDodge(double dodgeDamageGateValuePercent, int dodgeDamageGateValue, int hitDamage) + public void AbyssMirrorDodge(double dodgeDamageGateValuePercent, int dodgeDamageGateValue, int hitDamage, Player.HurtInfo info) { double maxCooldownDurationDamagePercent = 0.5; int maxCooldownDurationDamageValue = (int)Math.Round(Player.statLifeMax2 * (maxCooldownDurationDamagePercent - dodgeDamageGateValuePercent)); @@ -166,7 +167,7 @@ namespace CalamityMod.CalPlayer rogueStealth += 0.5f; SoundEngine.PlaySound(SilvaArmor.ActivationSound, Player.Center); - var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + var source = Player.GetSource_Accessory_OnHurt(FindAccessory(), info.DamageSource); for (int i = 0; i < 10; i++) { int damage = (int)Player.GetTotalDamage().ApplyTo(55); @@ -186,7 +187,7 @@ namespace CalamityMod.CalPlayer } } - public void EclipseMirrorDodge(double dodgeDamageGateValuePercent, int dodgeDamageGateValue, int hitDamage) + public void EclipseMirrorDodge(double dodgeDamageGateValuePercent, int dodgeDamageGateValue, int hitDamage, Player.HurtInfo info) { double maxCooldownDurationDamagePercent = 0.5; int maxCooldownDurationDamageValue = (int)Math.Round(Player.statLifeMax2 * (maxCooldownDurationDamagePercent - dodgeDamageGateValuePercent)); @@ -209,7 +210,7 @@ namespace CalamityMod.CalPlayer rogueStealth += 0.5f; SoundEngine.PlaySound(SoundID.Item68, Player.Center); - var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + var source = Player.GetSource_Accessory_OnHurt(FindAccessory(), info.DamageSource); int damage = (int)Player.GetTotalDamage().ApplyTo(2000); int eclipse = Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0, Player.whoAmI); @@ -883,7 +884,7 @@ namespace CalamityMod.CalPlayer return; } } - if (!CalamityProjectileSets.ShouldNotBeReflected[proj.type] && proj.active && !proj.friendly && proj.hostile && proj.damage > 0 && !modifiers.PvP) + if (proj.active && proj.hostile && modifiers.Dodgeable && proj.damage > 0) { double dodgeDamageGateValuePercent = 0.05; int dodgeDamageGateValue = (int)Math.Round(Player.statLifeMax2 * dodgeDamageGateValuePercent); @@ -924,19 +925,21 @@ namespace CalamityMod.CalPlayer // The Evolution if (evolution) { - proj.hostile = false; - proj.friendly = true; - proj.damage = 10 * actualProjDamage; - proj.velocity *= -2f; - proj.extraUpdates += 1; - proj.penetrate = 1; + if (Player.whoAmI == Main.myPlayer) + { + var source = Player.GetSource_Accessory_OnHurt(FindAccessory(), modifiers.DamageSource); + int mirrorDamage = (int)MathHelper.Min(actualProjDamage, 1000) * 50; + for (var i = 0; i < 5; i++) + { + Projectile.NewProjectile(source, Player.Center + Vector2.UnitX.RotatedBy(MathHelper.TwoPi * (i / 10f)), Vector2.Zero, ModContent.ProjectileType(), mirrorDamage, 5, Main.myPlayer, 1); + } + } - // 17APR2024: Ozzatron: The Evolution is a reflect which also functions as a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace. - int evolutionIFrames = Player.ComputeReflectIFrames(); + //Doze - This gives the same iframes as vanilla dodges, including accounting for cross necklace. + int evolutionIFrames = Player.ComputeDodgeIFrames(); Player.GiveUniversalIFrames(evolutionIFrames, true); modifiers.Cancel(); - evolutionLifeRegenCounter = 600; projTypeJustHitBy = proj.type; int cooldownDuration = (int)MathHelper.Lerp(BalancingConstants.EvolutionReflectCooldownMin, BalancingConstants.EvolutionReflectCooldownMax, cooldownDurationScalar); @@ -944,7 +947,7 @@ namespace CalamityMod.CalPlayer return; } - else if (daedalusReflect) + else if (daedalusReflect && !CalamityProjectileSets.ShouldNotBeReflected[proj.type] && !modifiers.PvP && !proj.friendly) { proj.hostile = false; proj.friendly = true; @@ -1132,7 +1135,7 @@ namespace CalamityMod.CalPlayer if (!npc.dontTakeDamage) { int onHitDamage = (int)Player.GetBestClassDamage().ApplyTo(CrawCarapace.ThornsDamage); - Projectile revenge = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, 0f, Player.whoAmI, npc.whoAmI, pushVel.X, pushVel.Y); + Projectile.NewProjectile(Player.GetSource_Accessory_OnHurt(FindAccessory(), npc), npc.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, 0f, Player.whoAmI, npc.whoAmI, pushVel.X, pushVel.Y); } SoundEngine.PlaySound(SoundID.NPCHit33 with { Volume = 0.5f }, Player.Center); @@ -1157,8 +1160,8 @@ namespace CalamityMod.CalPlayer if (!npc.dontTakeDamage) { int onHitDamage = (int)Player.GetBestClassDamage().ApplyTo(Baroclaw.ThornsDamage); - Projectile revenge = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, -1f, Player.whoAmI, npc.whoAmI, pushVel.X, pushVel.Y); - + Projectile.NewProjectile(Player.GetSource_Accessory_OnHurt(FindAccessory(), npc), npc.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, -1f, Player.whoAmI, npc.whoAmI, pushVel.X, pushVel.Y); + npc.AddBuff(ModContent.BuffType(), 900); npc.AddBuff(ModContent.BuffType(), 900); } @@ -1192,8 +1195,8 @@ namespace CalamityMod.CalPlayer if (!npc.dontTakeDamage) { int onHitDamage = (int)Player.GetBestClassDamage().ApplyTo(TheAbsorber.ThornsDamage); - Projectile revenge = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, -1f, Player.whoAmI, npc.whoAmI, pushVel.X, pushVel.Y); - + Projectile.NewProjectile(Player.GetSource_Accessory_OnHurt(FindAccessory(), npc), npc.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, -1f, Player.whoAmI, npc.whoAmI, pushVel.X, pushVel.Y); + npc.AddBuff(ModContent.BuffType(), 900); } SoundEngine.PlaySound(AbsorberHit, Player.Center); @@ -1391,7 +1394,7 @@ namespace CalamityMod.CalPlayer { int seekerDamage = (int)Player.GetBestClassDamage().ApplyTo(15); - Projectile bee = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.2f), ModContent.ProjectileType(), seekerDamage, 0f, Player.whoAmI, -20, 30, 2); + Projectile bee = Projectile.NewProjectileDirect(Player.GetSource_Accessory_OnHurt(FindAccessory(), hurtInfo.DamageSource), Player.Center, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.2f), ModContent.ProjectileType(), seekerDamage, 0f, Player.whoAmI, -20, 30, 2); bee.ArmorPenetration = 35; bee.penetrate = 6; bee.extraUpdates = 2; @@ -1422,7 +1425,7 @@ namespace CalamityMod.CalPlayer { float speed = 2f; int damage = 40; - int cloud = Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, ModContent.ProjectileType(), damage, 0f, Player.whoAmI); + int cloud = Projectile.NewProjectile(Player.GetSource_Accessory_OnHurt(FindAccessory(), hurtInfo.DamageSource), Player.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, ModContent.ProjectileType(), damage, 0f, Player.whoAmI); if (cloud.WithinBounds(Main.maxProjectiles)) Main.projectile[cloud].DamageType = DamageClass.Generic; } @@ -1469,7 +1472,7 @@ namespace CalamityMod.CalPlayer { int damage = Player.CalcIntDamage(InterstellarStompers.PassthroughDamage); - Projectile.NewProjectile(Player.GetSource_FromThis(), n.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0, Main.myPlayer); + Projectile.NewProjectile(Player.GetSource_Accessory(FindAccessory()), n.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0, Main.myPlayer); // 17APR2024: Ozzatron: Gravistar Sabaton 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. @@ -1575,12 +1578,12 @@ namespace CalamityMod.CalPlayer { if (eclipseMirror) { - EclipseMirrorDodge(dodgeDamageGateValuePercent, dodgeDamageGateValue, actualDamageTaken); + EclipseMirrorDodge(dodgeDamageGateValuePercent, dodgeDamageGateValue, actualDamageTaken, info); return true; } else if (abyssalMirror) { - AbyssMirrorDodge(dodgeDamageGateValuePercent, dodgeDamageGateValue, actualDamageTaken); + AbyssMirrorDodge(dodgeDamageGateValuePercent, dodgeDamageGateValue, actualDamageTaken, info); return true; } } @@ -2138,7 +2141,7 @@ namespace CalamityMod.CalPlayer rageCombatFrames = BalancingConstants.RageCombatDelayTime; // Regenerator has been CANCLED on TWITTER.COM!!!! (Just keeping this here since it's a neat effect and I'll probably yoink it for something else later) - if (regenerator && false) + /*if (regenerator) { // Projectile damage and count is based on source damage of the hit float hitPower = (hurtInfo.SourceDamage / (Player.statLifeMax2 * 0.5f)); @@ -2148,9 +2151,9 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < projCount; i++) { Vector2 vel = (MathHelper.TwoPi * i / projCount).ToRotationVector2() * (i % 2 == 0 ? 0.75f : 1f) * 10; - Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, vel.RotatedBy(-0.2f * (i % 2 == 0 ? -1 : 1)), ModContent.ProjectileType(), projDamage, 0f, Player.whoAmI, 0, (i % 2 == 0 ? -1 : 1), -5); + Projectile.NewProjectile(Player.GetSource_Accessory_OnHurt(FindAccessory(), hurtInfo.DamageSource), Player.Center, vel.RotatedBy(-0.2f * (i % 2 == 0 ? -1 : 1)), ModContent.ProjectileType(), projDamage, 0f, Player.whoAmI, 0, (i % 2 == 0 ? -1 : 1), -5); } - } + }*/ // Hide of Astrum Deus' melee boost if (hideOfDeus) @@ -2350,7 +2353,7 @@ namespace CalamityMod.CalPlayer } // Spawn the harmless brain images that are actually projectiles - var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + var source = Player.GetSource_Accessory_OnHurt(amalgam ? FindAccessory() : FindAccessory(), hurtInfo.DamageSource); Projectile.NewProjectile(source, Player.Center.X + Main.rand.Next(-40, 40), Player.Center.Y - Main.rand.Next(20, 60), Player.velocity.X * 0.3f, Player.velocity.Y * 0.3f, ProjectileID.BrainOfConfusion, 0, 0f, Player.whoAmI); } } @@ -2376,7 +2379,7 @@ namespace CalamityMod.CalPlayer // Drop some bones for visual effects if (!Main.dedServ && Player.wingTime > 0) { - var source = Player.GetSource_Accessory(FindAccessory(ItemID.BoneWings)); + var source = Player.GetSource_Accessory_OnHurt(FindAccessory(ItemID.BoneWings), hurtInfo.DamageSource); for (int i = 0; i < 6; i++) { Vector2 boneVelocity = Vector2.UnitY.RotatedByRandom(MathHelper.ToRadians(30f)) * Main.rand.NextFloat(1.5f, 2.5f); @@ -2431,7 +2434,7 @@ namespace CalamityMod.CalPlayer } if (hideOfDeus) { - var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + var source = Player.GetSource_Accessory_OnHurt(FindAccessory(), hurtInfo.DamageSource); SoundEngine.PlaySound(SoundID.Item74, Player.Center); int blazeDamage = (int)Player.GetBestClassDamage().ApplyTo(HideofAstrumDeus.BlazeDamage); @@ -2442,7 +2445,7 @@ namespace CalamityMod.CalPlayer // This also serves to make the Honeycomb in Sweetheart Necklace make sense if (dAmulet) { - var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + var source = Player.GetSource_Accessory_OnHurt(FindAccessory(), hurtInfo.DamageSource); int projAmount = (rampartOfDeities ? 12 : 6); for (int n = 0; n < projAmount; n++) { @@ -2502,7 +2505,7 @@ namespace CalamityMod.CalPlayer { if (!(CalamityUtils.AnyProjectiles(ModContent.ProjectileType()) || CalamityUtils.AnyProjectiles(ModContent.ProjectileType()))) { - var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + var source = Player.GetSource_Accessory_OnHurt(amalgam ? FindAccessory() : aBrain ? FindAccessory() : FindAccessory(), hurtInfo.DamageSource); int effectStrength = amalgam ? 3 : aBrain ? 2 : 1; int effectDamage = amalgam ? TheAmalgam.NimbusDamage : aBrain ? AmalgamatedBrain.NimbusDamage : RottenBrain.NimbusDamage; effectDamage = (int)Player.GetBestClassDamage().ApplyTo(effectDamage); @@ -2522,11 +2525,11 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(SoundID.NPCDeath28 with { Volume = 2f }, Player.Center); } - var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + var source = Player.GetSource_Accessory_OnHurt(FindAccessory(), hurtInfo.DamageSource); SoundEngine.PlaySound(SoundID.Item1, Player.Center); for (int i = 0; i < 3; i++) { - int ink = Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 2f, ModContent.ProjectileType(), 0, 0, Player.whoAmI); + int ink = Projectile.NewProjectile(source, Player.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 2f, ModContent.ProjectileType(), 0, 0, Player.whoAmI); if (ink.WithinBounds(Main.maxProjectiles)) Main.projectile[ink].DamageType = DamageClass.Generic; } @@ -2534,7 +2537,7 @@ namespace CalamityMod.CalPlayer } if (ataxiaBlaze) { - var fuckYouBitch = Player.GetSource_Misc("21"); + var fuckYouBitch = Player.GetSource_OnHurt(hurtInfo.DamageSource); if (hurtInfo.Damage > 0) { SoundEngine.PlaySound(SoundID.Item74, Player.Center); @@ -2552,7 +2555,7 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI == Main.myPlayer) { - var source = Player.GetSource_Misc("22"); + var source = Player.GetSource_OnHurt(hurtInfo.DamageSource); float offset = Main.rand.NextFloat(MathHelper.TwoPi); int sDamage = (int)Player.GetTotalDamage().ApplyTo(DaedalusHeadRanged.ShardDamage); for (int i = 0; i < 10; i++) @@ -2567,7 +2570,7 @@ namespace CalamityMod.CalPlayer } else if (godSlayerDamage) //god slayer melee helm { - var source = Player.GetSource_Misc("24"); + var source = Player.GetSource_OnHurt(hurtInfo.DamageSource); if (hurtInfo.Damage > GodSlayerHeadMelee.SetBonusHurtDamageThreshold) { SoundEngine.PlaySound(SoundID.Item73, Player.Center); diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 45c25d2761..a485eae7a6 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -116,7 +116,7 @@ namespace CalamityMod.CalPlayer ApplyDoTDebuff(astralInfection, 24, infectedJewel || hideOfDeus || purity); ApplyDoTDebuff(shadowflame, 30, purity); ApplyDoTDebuff(brimstoneFlames, (int)MathF.Round(30 * (abaddon ? (1f - Abaddon.BrimstoneFlamesReduction) : 1f)), purity); - ApplyDoTDebuff(plague, (int)MathF.Round(30 * (abaddon ? (1f - AlchemicalFlask.PlagueReduction) : 1f)), purity); + ApplyDoTDebuff(plague, (int)MathF.Round(30 * (abaddon ? (1f - AlchemicalDecanter.PlagueReduction) : 1f)), purity); ApplyDoTDebuff(vHex, 30); // Has other effects ApplyDoTDebuff(searingLava, 30); ApplyDoTDebuff(demonicFlames, 33, purity); // Never inflicted on the player @@ -564,12 +564,6 @@ namespace CalamityMod.CalPlayer if (trinketOfChi || chiRegen) Player.lifeRegen += 2; - if (evolutionLifeRegenCounter > 0) - { - if (Player.lifeRegenTime < 3600f) - Player.lifeRegenTime = 3600f; - } - if (darkSunRing) { if (Main.eclipse || Main.dayTime) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 3d99e31790..37e1665bfb 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -203,12 +203,12 @@ namespace CalamityMod.CalPlayer if (Player.HeldItem.type != ModContent.ItemType()) saharaSlicersBolts = 0; - if (Player.whoAmI == Main.myPlayer && Player.HeldItem.type == ModContent.ItemType() && (Player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) && !Player.dead) + if (Player.whoAmI == Main.myPlayer && Player.HeldItem.type == ModContent.ItemType() && (Player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) && !Player.dead && !Main.mapFullscreen && !Player.mouseInterface) { int damage = (int)Player.GetTotalDamage().ApplyTo(Player.HeldItem.damage); Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Player.Center.DirectionTo(Player.Calamity().mouseWorld), ModContent.ProjectileType(), damage, Player.HeldItem.knockBack, Player.whoAmI); } - if (Player.whoAmI == Main.myPlayer && Player.HeldItem.type == ModContent.ItemType() && (Player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) && !Player.dead) + if (Player.whoAmI == Main.myPlayer && Player.HeldItem.type == ModContent.ItemType() && (Player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) && !Player.dead && !Main.mapFullscreen && !Player.mouseInterface) { int damage = (int)Player.GetTotalDamage().ApplyTo(Player.HeldItem.damage); Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Player.Center.DirectionTo(Player.Calamity().mouseWorld), ModContent.ProjectileType(), damage, Player.HeldItem.knockBack, Player.whoAmI); @@ -1297,6 +1297,9 @@ namespace CalamityMod.CalPlayer } } + if (brittleStar && brittleStarBuffMode) + Player.statDefense += 4 * Player.ownedProjectileCounts[ModContent.ProjectileType()]; + // Reduce the rate of recovery of the Lifesteal variable // Classic Mode: 36 HP/s to 12 HP/s // Expert Mode: 30 HP/s to 9 HP/s @@ -1708,7 +1711,7 @@ namespace CalamityMod.CalPlayer } if (rOfResilienceEffect > 0) { - if (Player.Calamity().mouseRight && rOfResilienceCooldown == 0) + if (Player.Calamity().mouseRight && !Player.mouseInterface && rOfResilienceCooldown == 0) { int cooldownTime = (Player.Calamity().profanedSoulRelicBuff ? 300 : 600); rOfResilienceCooldown = cooldownTime; @@ -1784,9 +1787,10 @@ namespace CalamityMod.CalPlayer if (p.type == ModContent.ProjectileType() && p.owner == Player.whoAmI) { - float insanityValue = ((p.ai[1] % 10) + 1); + int blobNum = Player.ownedProjectileCounts[ModContent.ProjectileType()] + 1; + float insanityValue = (p.ai[1] % 10); if (p.ai[0] == layer) - p.ai[2] = insanityValue / Player.ownedProjectileCounts[ModContent.ProjectileType()] * (angleMax) - (angleMax) / 2f; + p.ai[2] = (insanityValue / blobNum) * angleMax - angleMax / 2f; p.netUpdate = true; } @@ -1835,9 +1839,10 @@ namespace CalamityMod.CalPlayer if (p.type == ModContent.ProjectileType() && p.owner == Player.whoAmI) { - float insanityValue = (p.ai[1] % 10) + 1; + int blobNum = Player.ownedProjectileCounts[ModContent.ProjectileType()] + 1; + float insanityValue = (p.ai[1] % 10); if (p.ai[0] == layer) - p.ai[2] = insanityValue / Player.ownedProjectileCounts[ModContent.ProjectileType()] * angleMax - angleMax / 2f; + p.ai[2] = (insanityValue / blobNum) * angleMax - angleMax / 2f; p.netUpdate = true; index++; @@ -2237,8 +2242,6 @@ namespace CalamityMod.CalPlayer raiderSoundCooldown--; if (astralStarRainCooldown > 0) astralStarRainCooldown--; - if (AbaddonCooldown > 0) - AbaddonCooldown--; if (VoidCooldown > 0) VoidCooldown--; if (ursaSergeantCooldown > 0) @@ -2318,8 +2321,6 @@ namespace CalamityMod.CalPlayer xerocDmg = 0f; if (hideOfDeusMeleeBoostTimer > 0) hideOfDeusMeleeBoostTimer--; - if (evolutionLifeRegenCounter > 0) - evolutionLifeRegenCounter--; if (hurtSoundTimer > 0) hurtSoundTimer--; if (wingProjectileCooldown > 0) diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index ebb43fc131..8c2c3712ba 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -67,6 +67,10 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI != Main.myPlayer) return; + // Apply this to player equippable sources ie. Orichalcum set bonus petal spawns + // Do not apply if this effect is an extension of a weapon ie. Pearl God round effect as it will mess up Old Fashioned + var source = Player.GetSource_OnHit(target); + // Handle on-hit melee effects for the gem tech armor set. if (item.CountsAsClass()) GemTechState.MeleeOnHitEffects(target); @@ -145,7 +149,7 @@ namespace CalamityMod.CalPlayer bool targetIsDummy = target.type == NPCID.TargetDummy || target.type == NPCType(); ItemLifesteal(target, item, damageDone); - ItemOnHit(item, damageDone, target.Center, hit.Crit, target.IsAnEnemy(false, true), targetIsDummy); + ItemOnHit(item, damageDone, target, hit.Crit, target.IsAnEnemy(false, true), targetIsDummy); NPCDebuffs(target, item.CountsAsClass(), item.CountsAsClass(), item.CountsAsClass(), item.CountsAsClass(), item.CountsAsClass(), item.CountsAsClass(), hit.Crit); // Ursa Sergeant slash cooldown is reset on kill @@ -157,16 +161,14 @@ namespace CalamityMod.CalPlayer int cooldown = 0; if (bGlassBand) { - var source = item.GetSource_FromThis(); int damage = (int)Player.GetBestClassDamage().ApplyTo(BlackGlassBand.damage); Vector2 launchVel = Utils.DirectionTo(Player.Center, target.Center) * 6; - Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI, launchVel.X, launchVel.Y); + Projectile.NewProjectile(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI, launchVel.X, launchVel.Y); if (cooldown < BlackGlassBand.cooldown) cooldown = BlackGlassBand.cooldown; } if (protolithBangle && item.DamageType == DamageClass.Ranged) { - var source = item.GetSource_FromThis(); int damage = (int)Player.GetBestClassDamage().ApplyTo(ProtolithBangle.damage); Projectile band = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI); band.DamageType = DamageClass.Ranged; @@ -175,7 +177,6 @@ namespace CalamityMod.CalPlayer } if (batholithBangle && item.DamageType == DamageClass.Magic) { - var source = item.GetSource_FromThis(); int damage = (int)Player.GetBestClassDamage().ApplyTo(BatholithBangle.damage); Projectile band = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI); band.DamageType = DamageClass.Magic; @@ -186,7 +187,7 @@ namespace CalamityMod.CalPlayer if (cooldown > 0) // Check if a band effect went off, and apply the highest cooldown { generalBandCooldown = cooldown; - Player.AddCooldown(Cooldowns.GenericBandCooldown.ID, cooldown); + Player.AddCooldown(GenericBandCooldown.ID, cooldown); } } @@ -204,8 +205,7 @@ namespace CalamityMod.CalPlayer bool spawnChance = (Main.rand.Next(100) < ArcFlashRing.LightningSpawnPercent); if (arcFlashRing && spawnChance) { - var source = item.GetSource_FromThis(); - int damage = (int)(((hit.Damage * ArcFlashRing.LightningDamageMult) * (hit.Crit ? 0.5f : 1)) / (Player.Calamity().adrenalineModeActive ? Player.Calamity().GetAdrenalineDamage() + 1 : 1)); // 400% damage (uneffected by crits and adrenaline) + int damage = (int)(hit.Damage * ArcFlashRing.LightningDamageMult * (hit.Crit ? 0.5f : 1) / (Player.Calamity().adrenalineModeActive ? Player.Calamity().GetAdrenalineDamage() + 1 : 1)); // 400% damage (uneffected by crits and adrenaline) Projectile bolt = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, 0f, Player.whoAmI, target.whoAmI); bolt.DamageType = hit.DamageType; @@ -226,6 +226,9 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI != Main.myPlayer) return; + // Apply this to player equippable sources ie. Orichalcum set bonus petal spawns + // Do not apply if this effect is an extension of a weapon ie. Pearl God round effect as it will mess up Old Fashioned + var source = Player.GetSource_OnHit(target); CalamityGlobalNPC cgn = target.Calamity(); // Handle on-hit melee effects for the gem tech armor set. @@ -362,16 +365,14 @@ namespace CalamityMod.CalPlayer // No clue why this happens or how to fix it, but it just breaks using multiple band types together on these two weapons if (bGlassBand) { - var source = proj.GetSource_FromThis(); int damage = (int)Player.GetBestClassDamage().ApplyTo(BlackGlassBand.damage); Vector2 launchVel = Utils.DirectionTo(Player.Center, target.Center) * 6; - Projectile band = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI, launchVel.X, launchVel.Y); + Projectile.NewProjectile(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI, launchVel.X, launchVel.Y); if (cooldown < BlackGlassBand.cooldown) cooldown = BlackGlassBand.cooldown; } if (protolithBangle && proj.DamageType == DamageClass.Ranged) { - var source = proj.GetSource_FromThis(); int damage = (int)Player.GetBestClassDamage().ApplyTo(ProtolithBangle.damage); Projectile band = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI); band.DamageType = DamageClass.Ranged; @@ -380,7 +381,6 @@ namespace CalamityMod.CalPlayer } if (batholithBangle && proj.DamageType == DamageClass.Magic) { - var source = proj.GetSource_FromThis(); int damage = (int)Player.GetBestClassDamage().ApplyTo(BatholithBangle.damage); Projectile band = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI); band.DamageType = DamageClass.Magic; @@ -391,11 +391,11 @@ namespace CalamityMod.CalPlayer if (cooldown > 0) // Check if a band effect went off, and apply the highest cooldown { generalBandCooldown = cooldown; - Player.AddCooldown(Cooldowns.GenericBandCooldown.ID, cooldown); + Player.AddCooldown(GenericBandCooldown.ID, cooldown); } } - if (luxorsGift && proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType()) + if (luxorsGift && proj.type != ProjectileType() && proj.type != ProjectileType() && proj.type != ProjectileType() && proj.type != ProjectileType() && proj.type != ProjectileType() && proj.type != ProjectileType()) luxorHit = true; // Transformer gives +2 blobs on kill, which are stored then given to you one by one (so it can't spawn more than one on a single frame) @@ -406,13 +406,12 @@ namespace CalamityMod.CalPlayer CalamityGlobalProjectile globalProj = proj.Calamity(); // Arc Flash Ring lightning strike (Remember to change the one for item hits if applicable when you change this one!) - bool spawnChance = (Main.rand.Next(0, 100) < 6); + bool spawnChance = (Main.rand.Next(0, 100) < ArcFlashRing.LightningSpawnPercent); if (arcFlashRing && spawnChance && proj.type != ProjectileType()) { 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)) / (Player.Calamity().adrenalineModeActive ? Player.Calamity().GetAdrenalineDamage() + 1 : 1)); // 400% damage (uneffected by crits and adrenaline) + int damage = (int)(hit.Damage * ArcFlashRing.LightningDamageMult * (hit.Crit ? 0.5f : 1) / (Player.Calamity().adrenalineModeActive ? Player.Calamity().GetAdrenalineDamage() + 1 : 1)); // 400% damage (uneffected by crits and adrenaline) Projectile bolt = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, 0f, Player.whoAmI, target.whoAmI, (globalProj.showArcFlash ? 0 : 1)); bolt.DamageType = hit.DamageType; @@ -424,7 +423,7 @@ namespace CalamityMod.CalPlayer if (forbiddenCirclet && globalProj.stealthStrike) { - target.AddBuff(ModContent.BuffType(), ForbiddenCirclet.TagDuration); + target.AddBuff(BuffType(), ForbiddenCirclet.TagDuration); } if (!proj.npcProj && !proj.trap && proj.friendly) @@ -520,7 +519,7 @@ namespace CalamityMod.CalPlayer } int onHitDamage = Player.CalcIntDamage(0.2f * proj.damage); - Projectile shock = Projectile.NewProjectileDirect(proj.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, 0f, Player.whoAmI, target.whoAmI); + Projectile shock = Projectile.NewProjectileDirect(proj.GetSource_FromThis(), target.Center, Vector2.Zero, ProjectileType(), onHitDamage, 0f, Player.whoAmI, target.whoAmI); shock.DamageType = proj.DamageType; SoundStyle hitSound = new("CalamityMod/Sounds/Item/ElectricHit"); SoundEngine.PlaySound(hitSound with { Volume = 0.2f, Pitch = 0.7f, PitchVariance = 0.2f }, proj.Center); @@ -552,14 +551,14 @@ namespace CalamityMod.CalPlayer GeneralParticleHandler.SpawnParticle(subTrail); } - int pearls = (int)(MathHelper.Clamp(7 - (int)(proj.numHits * 0.5f), 2, 7)); + int pearls = (int)MathHelper.Clamp(7 - (int)(proj.numHits * 0.5f), 2, 7); for (int k = 0; k < pearls; k++) { Vector2 velocity = new Vector2(1, 1).RotatedByRandom(100) * Main.rand.NextFloat(0.7f, 1.2f); PearlParticle subTrail = new PearlParticle(Position + velocity * 11f, velocity * 10, true, 50, 0.85f, color, 0.95f, Main.rand.NextFloat(2, -2), true); GeneralParticleHandler.SpawnParticle(subTrail); } - int dusts = (int)(MathHelper.Clamp(10 - (int)(proj.numHits * 0.5f), 2, 10)); + int dusts = (int)MathHelper.Clamp(10 - (int)(proj.numHits * 0.5f), 2, 10); for (int i = 0; i <= dusts; i++) { Dust dust2 = Dust.NewDustPerfect(Position, DustID.FireworksRGB, new Vector2(5, 5).RotatedByRandom(100f) * Main.rand.NextFloat(0.1f, 2.9f)); @@ -569,7 +568,7 @@ namespace CalamityMod.CalPlayer } int onHitDamage = Player.CalcIntDamage(0.2f * proj.damage); - Projectile blast = Projectile.NewProjectileDirect(proj.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, 0f, Player.whoAmI, target.whoAmI); + Projectile blast = Projectile.NewProjectileDirect(proj.GetSource_FromThis(), target.Center, Vector2.Zero, ProjectileType(), onHitDamage, 0f, Player.whoAmI, target.whoAmI); blast.DamageType = proj.DamageType; SoundStyle hitSound = new("CalamityMod/Sounds/Item/HadalUrnClose"); @@ -612,7 +611,7 @@ namespace CalamityMod.CalPlayer bool targetIsDummy = target.type == NPCID.TargetDummy || target.type == NPCType(); ProjLifesteal(target, proj, damageDone, hit.Crit); - ProjOnHit(proj, target.Center, hit.Crit, target.IsAnEnemy(false), targetIsDummy); + ProjOnHit(proj, target, hit.Crit, target.IsAnEnemy(false), targetIsDummy); NPCDebuffs(target, proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), hit.Crit, true, proj.noEnchantments); // Shattered Community tracks all damage dealt with Rage Mode (ignoring dummies). @@ -626,9 +625,10 @@ namespace CalamityMod.CalPlayer #endregion #region Item - public void ItemOnHit(Item item, int damage, Vector2 position, bool crit, bool npcCheck, bool targetIsDummy) + public void ItemOnHit(Item item, int damage, NPC target, bool crit, bool npcCheck, bool targetIsDummy) { - var source = Player.GetSource_ItemUse(item); + Vector2 position = target.Center; + var source = Player.GetSource_OnHit(target); if (!item.CountsAsClass() && Player.meleeEnchant == 7) Projectile.NewProjectile(source, position, Player.velocity, ProjectileID.ConfettiMelee, 0, 0f, Player.whoAmI); @@ -682,10 +682,11 @@ namespace CalamityMod.CalPlayer #endregion #region Proj On Hit - public void ProjOnHit(Projectile proj, Vector2 position, bool crit, bool npcCheck, bool targetIsDummy) + public void ProjOnHit(Projectile proj, NPC target, bool crit, bool npcCheck, bool targetIsDummy) { CalamityGlobalProjectile modProj = proj.Calamity(); - var source = proj.GetSource_FromThis(); + Vector2 position = target.Center; + var source = Player.GetSource_OnHit(target); bool hasClass = proj.CountsAsClass() || proj.CountsAsClass() || proj.CountsAsClass() || proj.CountsAsClass() || proj.CountsAsClass(); //flask of party affects all types of weapons, !proj.CountsAsClass() is to prevent double flask effects @@ -749,29 +750,26 @@ namespace CalamityMod.CalPlayer if (ursaSergeant && ursaSergeantCooldown <= 0) { ursaSergeantCooldown = UrsaSergeant.MaxCooldown; - int ursaSlashdamage = (int)Player.GetBestClassDamage().ApplyTo(UrsaSergeant.BaseSwipeDamage); - Projectile.NewProjectile(source, position, Vector2.Zero, ProjectileType(), ursaSlashdamage, 0f, Player.whoAmI); } if (proj.CountsAsClass()) - MeleeOnHit(proj, modProj, position, crit, npcCheck, targetIsDummy); + MeleeOnHit(proj, modProj, target, crit, npcCheck, targetIsDummy); if (proj.CountsAsClass()) - RangedOnHit(proj, modProj, position, crit, npcCheck); + RangedOnHit(proj, modProj, target, crit, npcCheck); if (proj.CountsAsClass()) - MagicOnHit(proj, modProj, position, crit, npcCheck); + MagicOnHit(proj, modProj, target, crit, npcCheck); if (proj.CountsAsClass() && !proj.CountsAsClass()) - SummonOnHit(proj, modProj, position, crit, npcCheck); + SummonOnHit(proj, modProj, target, crit, npcCheck); if (proj.CountsAsClass()) - RogueOnHit(proj, modProj, position, crit, npcCheck); + RogueOnHit(proj, modProj, target, crit, npcCheck); } #region Melee - private void MeleeOnHit(Projectile proj, CalamityGlobalProjectile modProj, Vector2 position, bool crit, bool npcCheck, bool targetIsDummy) + private void MeleeOnHit(Projectile proj, CalamityGlobalProjectile modProj, NPC target, bool crit, bool npcCheck, bool targetIsDummy) { - var source = proj.GetSource_FromThis(); - Item heldItem = Player.HeldItem; + var source = Player.GetSource_OnHit(target); if (proj.IsTrueMelee()) { @@ -801,9 +799,10 @@ namespace CalamityMod.CalPlayer #endregion #region Ranged - private void RangedOnHit(Projectile proj, CalamityGlobalProjectile modProj, Vector2 position, bool crit, bool npcCheck) + private void RangedOnHit(Projectile proj, CalamityGlobalProjectile modProj, NPC target, bool crit, bool npcCheck) { - var source = proj.GetSource_FromThis(); + Vector2 position = target.Center; + var source = Player.GetSource_OnHit(target); if (npcCheck) { @@ -845,14 +844,15 @@ namespace CalamityMod.CalPlayer #endregion #region Magic - private void MagicOnHit(Projectile proj, CalamityGlobalProjectile modProj, Vector2 position, bool crit, bool npcCheck) + private void MagicOnHit(Projectile proj, CalamityGlobalProjectile modProj, NPC target, bool crit, bool npcCheck) { - var source = proj.GetSource_FromThis(); + Vector2 position = target.Center; + var source = Player.GetSource_OnHit(target); if (ataxiaMage && ataxiaDmg <= 0) { int orbDamage = (int)(proj.damage * HydrothermicHeadMagic.OrbDamageRatio); - - CalamityUtils.SpawnOrb(proj, orbDamage, ProjectileType(), 800f, 20f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 20f, 20f, 1f); + Projectile.NewProjectile(source, proj.Center, velocity, ProjectileType(), orbDamage, 0f, proj.owner); int cooldown = (int)(orbDamage * HydrothermicHeadMagic.OrbDamageCooldownMult); ataxiaDmg += cooldown; } @@ -886,9 +886,10 @@ namespace CalamityMod.CalPlayer #endregion #region Summon - private void SummonOnHit(Projectile proj, CalamityGlobalProjectile modProj, Vector2 position, bool crit, bool npcCheck) + private void SummonOnHit(Projectile proj, CalamityGlobalProjectile modProj, NPC target, bool crit, bool npcCheck) { - var source = proj.GetSource_FromThis(); + Vector2 position = target.Center; + var source = Player.GetSource_OnHit(target); if (phantomicArtifact) { @@ -906,10 +907,10 @@ namespace CalamityMod.CalPlayer { if (phantomicHeartRegen == 1000 && Player.ownedProjectileCounts[ProjectileType()] == 0) { - Vector2 target = proj.Center; - target.Y += Main.rand.Next(-50, 50); - target.X += Main.rand.Next(-50, 50); - Projectile.NewProjectile(source, target, Vector2.Zero, ProjectileType(), 0, 0f, Player.whoAmI); + Vector2 spawnPos = proj.Center; + spawnPos.Y += Main.rand.Next(-50, 50); + spawnPos.X += Main.rand.Next(-50, 50); + Projectile.NewProjectile(source, spawnPos, Vector2.Zero, ProjectileType(), 0, 0f, Player.whoAmI); } } else if (buffType == empowerBuff) @@ -1014,9 +1015,10 @@ namespace CalamityMod.CalPlayer #endregion #region Rogue - private void RogueOnHit(Projectile proj, CalamityGlobalProjectile modProj, Vector2 position, bool crit, bool npcCheck) + private void RogueOnHit(Projectile proj, CalamityGlobalProjectile modProj, NPC target, bool crit, bool npcCheck) { - var spawnSource = proj.GetSource_FromThis(); + Vector2 position = target.Center; + var spawnSource = Player.GetSource_OnHit(target); int Type = ProjectileType(); if (modProj.stealthStrike && dragonScales && Main.projectile.Count(proj => proj.type == Type && proj.active) < 1) { @@ -1235,7 +1237,7 @@ namespace CalamityMod.CalPlayer } if (summon && !whip) { - if (profanedCrystal && (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs)) + if (profanedCrystal && DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs) target.AddBuff(BuffType(), 600); else if (pSoulArtifact) target.AddBuff(BuffType(), 300); @@ -1316,7 +1318,7 @@ namespace CalamityMod.CalPlayer target.Calamity().gladiatorOnKill = false; if (healPower >= 1) { - Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center, target.velocity * 0.5f, ProjectileType(), 0, 0, -1, (int)healPower); + Projectile.NewProjectile(Player.GetSource_OnHit(target), target.Center, target.velocity * 0.5f, ProjectileType(), 0, 0, -1, (int)healPower); gladiatorTimer = 300; } } @@ -1335,7 +1337,7 @@ namespace CalamityMod.CalPlayer Player.SpawnLifeStealProjectile(target, proj, ProjectileID.VampireHeal, electricianGlove ? 10 : 5, 2f); if (bloodflareThrowing && proj.CountsAsClass() && crit) - Projectile.NewProjectile(proj.GetSource_OnHit(target), proj.Center, proj.velocity.SafeNormalize(Vector2.Zero) * Math.Min(((proj.velocity.Length() * proj.MaxUpdates) / 4f), 4f) * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), 4, 0f, proj.owner); + Projectile.NewProjectile(Player.GetSource_OnHit(target), proj.Center, proj.velocity.SafeNormalize(Vector2.Zero) * Math.Min(proj.velocity.Length() * proj.MaxUpdates / 4f, 4f) * Main.rand.NextFloat(0.75f, 1.25f), ProjectileType(), 4, 0f, proj.owner); if (proj.CountsAsClass() && Player.HeldItem.CountsAsClass()) { @@ -1373,7 +1375,7 @@ namespace CalamityMod.CalPlayer target.Calamity().gladiatorOnKill = false; if (healPower >= 1) { - Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center, target.velocity * 0.5f, ProjectileType(), 0, 0, -1, (int)healPower); + Projectile.NewProjectile(Player.GetSource_OnHit(target), target.Center, target.velocity * 0.5f, ProjectileType(), 0, 0, -1, (int)healPower); gladiatorTimer = 300; } } diff --git a/CalPlayer/Dashes/CounterScarfDash.cs b/CalPlayer/Dashes/CounterScarfDash.cs index 5926ca2462..95506c0ed7 100644 --- a/CalPlayer/Dashes/CounterScarfDash.cs +++ b/CalPlayer/Dashes/CounterScarfDash.cs @@ -19,7 +19,7 @@ namespace CalamityMod.CalPlayer.Dashes ID = DashID; } - public override float CalculateDashSpeed(Player player) => player.Calamity().evasionScarf ? 16.3f : 15f; + public override float CalculateDashSpeed(Player player) => player.Calamity().evasionScarf ? 19f : 15f; public override void OnDashEffects(Player player) { diff --git a/CalamityNetcode.cs b/CalamityNetcode.cs index 33c5e2f016..c45f917b22 100644 --- a/CalamityNetcode.cs +++ b/CalamityNetcode.cs @@ -212,5 +212,9 @@ namespace CalamityMod SyncPlayerDrawParameter, DialogueDisplayStart, + + WulfrumAcrobaticsSync, + WulfrumAcrobaticsJumpSync, + WulfrumAcrobaticsLengthSync, } } diff --git a/DataStructures/GemTechArmorState.cs b/DataStructures/GemTechArmorState.cs index 9dd38a605e..19274a48c6 100644 --- a/DataStructures/GemTechArmorState.cs +++ b/DataStructures/GemTechArmorState.cs @@ -151,7 +151,7 @@ namespace CalamityMod.DataStructures for (int i = 0; i < 14; i++) { Vector2 shootVelocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(0.5f, 3.25f); - Projectile.NewProjectile(Owner.GetSource_ItemUse(Owner.HeldItem), target.Center, shootVelocity, ModContent.ProjectileType(), damage, 0f, OwnerIndex); + Projectile.NewProjectile(Owner.GetSource_OnHit(target), target.Center, shootVelocity, ModContent.ProjectileType(), damage, 0f, OwnerIndex); } MeleeCrystalCountdown = GemTechHeadgear.MeleeShardDelay; @@ -171,7 +171,7 @@ namespace CalamityMod.DataStructures shootVelocity = shootVelocity.SafeNormalize(Vector2.UnitY) * 6f; spawnPosition -= shootVelocity.SafeNormalize(Vector2.Zero) * Main.rand.NextFloat(15f, 50f); - Projectile.NewProjectile(Owner.GetSource_ItemUse(Owner.HeldItem), spawnPosition, shootVelocity, ModContent.ProjectileType(), damage, 0f, OwnerIndex); + Projectile.NewProjectile(Owner.GetSource_OnHit(target), spawnPosition, shootVelocity, ModContent.ProjectileType(), damage, 0f, OwnerIndex); } public void OnItemUseEffects(Item item) diff --git a/Dialogues/en-US/Dialogue.Mods.CalamityMod.DevourerOfGods.Head.json b/Dialogues/en-US/Dialogue.Mods.CalamityMod.DevourerOfGods.Head.json index 93da2b43ff..c7448406c9 100644 --- a/Dialogues/en-US/Dialogue.Mods.CalamityMod.DevourerOfGods.Head.json +++ b/Dialogues/en-US/Dialogue.Mods.CalamityMod.DevourerOfGods.Head.json @@ -1,4 +1,4 @@ -{ +{ "Revision": 1, "DefaultColor": "6383FF", "DefaultSpeaker": "DevourerOfGods", @@ -82,7 +82,7 @@ { "TextDelay": 0, "Lines": [ - "[Shaking:[Scale(1.5):[Colors(2, 0.5, 00FFFF, FF00FF):BEGON!]]]" + "[Shaking:[Scale(1.5):[Colors(2, 0.5, 00FFFF, FF00FF):BEGONE!]]]" ] }, { diff --git a/ILEditing/BalancingILChanges.cs b/ILEditing/BalancingILChanges.cs index 8807cc2714..bb03985b48 100644 --- a/ILEditing/BalancingILChanges.cs +++ b/ILEditing/BalancingILChanges.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Balancing; using CalamityMod.Enums; +using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; using Mono.Cecil.Cil; using MonoMod.Cil; @@ -673,5 +674,17 @@ namespace CalamityMod.ILEditing cursor.Emit(OpCodes.And); } #endregion + + #region Make GFB Nurse Meteor Undodgeable + private static bool GFBNurseMeteorUndodgeable(On_Projectile.orig_IsDamageDodgable orig, Projectile self) + { + // Make the Leviathan meteor that spawns when talking to the Nurse in GFB undodgeable + // Unfortunately the Dodgeable value in HurtModifiers cannot be set in the hook, thus On editing a vanilla function + if (self.type == ModContent.ProjectileType() && self.damage == 9999) + return false; + else + return orig(self); + } + #endregion } } diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index ab581d62db..f9f33ff54f 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -108,6 +108,7 @@ namespace CalamityMod.ILEditing IL_Projectile.AI_099_2 += LimitTerrarianProjectiles; IL_Projectile.AI_120_StardustGuardian += StardustGuardianAttackBuffs; On_Player.ConsumeSolarFlare += SolarWingsDashChange; + On_Projectile.IsDamageDodgable += GFBNurseMeteorUndodgeable; IL_Player.UpdateBuffs += UpdateBuffsBalancingChanges; IL_Player.ApplyVanillaHurtEffectModifiers += RemoveBeetleAndSolarFlareMultiplicativeDR; @@ -144,7 +145,6 @@ namespace CalamityMod.ILEditing IL_Player.ItemCheck_EmitUseVisuals += MakeMagmaStoneFireGauntletDustToggleable; IL_Projectile.EmitEnchantmentVisualsAt += MakeMagmaStoneFireGauntletProjectileDustToggleable; IL_Sandstorm.HasSufficientWind += DecreaseSandstormWindSpeedRequirement; - IL_Player.ItemCheck_Shoot += RemoveForcedInaccuracyFromChainGunAndGatligator; IL_Item.TryGetPrefixStatMultipliersForItem += RelaxPrefixRequirements; On_NPC.SlimeRainSpawns += PreventBossSlimeRainSpawns; On_ShimmerTransforms.IsItemTransformLocked += AdjustShimmerRequirements; diff --git a/ILEditing/VanillaStupidityFixingILChanges.cs b/ILEditing/VanillaStupidityFixingILChanges.cs index f3ac7a3fac..cb7a639227 100644 --- a/ILEditing/VanillaStupidityFixingILChanges.cs +++ b/ILEditing/VanillaStupidityFixingILChanges.cs @@ -125,33 +125,6 @@ namespace CalamityMod.ILEditing } #endregion Reforge Requirement Relaxation - #region Remove Forced Inaccuracy from Chain Gun and Gatligator - private static void RemoveForcedInaccuracyFromChainGunAndGatligator(ILContext il) - { - var cursor = new ILCursor(il); - - // Go to the load of the Chain Gun's item ID (1929). - if (!cursor.TryGotoNext(MoveType.AfterLabel, i => i.MatchLdcI4(1929))) - { - LogFailure("Remove Chain Gun and Gatligator Inaccuracy", "Could not locate the ID of the Chain Gun."); - return; - } - - // Change this item ID check to check for -1048576. This will never occur. - cursor.Next.Operand = -1048576; - - // Go to the load of the Gatligator's item ID (2270). - if (!cursor.TryGotoNext(MoveType.AfterLabel, i => i.MatchLdcI4(2270))) - { - LogFailure("Remove Chain Gun and Gatligator Inaccuracy", "Could not locate the ID of the Gatligator."); - return; - } - - // Change this item ID check to check for -1048576. This will never occur. - cursor.Next.Operand = -1048576; - } - #endregion - #region Prevention of Slime Rain Spawns When Near Bosses private static void PreventBossSlimeRainSpawns(On_NPC.orig_SlimeRainSpawns orig, int plr) { diff --git a/Items/Accessories/AlchemicalFlask.cs b/Items/Accessories/AlchemicalDecanter.cs similarity index 95% rename from Items/Accessories/AlchemicalFlask.cs rename to Items/Accessories/AlchemicalDecanter.cs index c106a10937..a463957cae 100644 --- a/Items/Accessories/AlchemicalFlask.cs +++ b/Items/Accessories/AlchemicalDecanter.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - public class AlchemicalFlask : ModItem, ILocalizedModType + public class AlchemicalDecanter : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; diff --git a/Items/Accessories/AlchemicalFlask.png b/Items/Accessories/AlchemicalDecanter.png similarity index 100% rename from Items/Accessories/AlchemicalFlask.png rename to Items/Accessories/AlchemicalDecanter.png diff --git a/Items/Accessories/CounterScarf.cs b/Items/Accessories/CounterScarf.cs index e244c74806..0d211b9d97 100644 --- a/Items/Accessories/CounterScarf.cs +++ b/Items/Accessories/CounterScarf.cs @@ -18,12 +18,8 @@ namespace CalamityMod.Items.Accessories Item.rare = ItemRarityID.Orange; Item.accessory = true; } - - public override bool CanEquipAccessory(Player player, int slot, bool modded) => !player.Calamity().dodgeScarf; - public override void UpdateAccessory(Player player, bool hideVisual) { - player.GetDamage() += 0.1f; CalamityPlayer modPlayer = player.Calamity(); modPlayer.dodgeScarf = true; modPlayer.DashID = CounterScarfDash.ID; diff --git a/Items/Accessories/EvasionScarf.cs b/Items/Accessories/EvasionScarf.cs index cf9f6bdeef..02ee2fdc81 100644 --- a/Items/Accessories/EvasionScarf.cs +++ b/Items/Accessories/EvasionScarf.cs @@ -20,11 +20,8 @@ namespace CalamityMod.Items.Accessories Item.Calamity().donorItem = true; } - public override bool CanEquipAccessory(Player player, int slot, bool modded) => !player.Calamity().dodgeScarf; - public override void UpdateAccessory(Player player, bool hideVisual) { - player.GetDamage() += 0.15f; CalamityPlayer modPlayer = player.Calamity(); modPlayer.dodgeScarf = true; modPlayer.evasionScarf = true; diff --git a/Items/Accessories/HallowedRune.cs b/Items/Accessories/HallowedRune.cs index 814c76a378..2630de753f 100644 --- a/Items/Accessories/HallowedRune.cs +++ b/Items/Accessories/HallowedRune.cs @@ -9,8 +9,7 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public static int RegenBoost = 3; - public static int DefenseBoost = 4; - public static float DamageReductionBoost = 0.04f; + public static int DefenseBoost = 5; public static float SummonDamageBoost = 0.1f; public override void SetDefaults() diff --git a/Items/Accessories/PhantomicArtifact.cs b/Items/Accessories/PhantomicArtifact.cs index 12171a8034..ab6f1b20eb 100644 --- a/Items/Accessories/PhantomicArtifact.cs +++ b/Items/Accessories/PhantomicArtifact.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Items.Accessories public static int RegenBoost = 2; public static int DefenseBoost = 10; - public static float DamageReductionBoost = 0.05f; public static float SummonDamageBoost = 0.1f; public override void SetStaticDefaults() diff --git a/Items/Accessories/SpiritGlyph.cs b/Items/Accessories/SpiritGlyph.cs index 4c5bd25543..c190df2877 100644 --- a/Items/Accessories/SpiritGlyph.cs +++ b/Items/Accessories/SpiritGlyph.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public static int RegenBoost = 2; - public static int DefenseBoost = 4; + public static int DefenseBoost = 3; public static float SummonDamageBoost = 0.1f; public override void SetDefaults() diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index 1ca645f00b..d54b5c5e34 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -39,7 +39,6 @@ namespace CalamityMod.Items.Accessories modPlayer.rBrain = true; // Handles shaderain cloud spawning on hit modPlayer.amalgam = true; player.brainOfConfusionItem = Item; - player.GetDamage() += 0.1f; modPlayer.HeatDebuffMultiplier += 2f; modPlayer.ColdDebuffMultiplier += 2f; modPlayer.SicknessDebuffMultiplier += 2f; diff --git a/Items/Accessories/CorruptFlask.cs b/Items/Accessories/UnholyTonic.cs similarity index 94% rename from Items/Accessories/CorruptFlask.cs rename to Items/Accessories/UnholyTonic.cs index db6a38b7fb..38c3be3023 100644 --- a/Items/Accessories/CorruptFlask.cs +++ b/Items/Accessories/UnholyTonic.cs @@ -5,7 +5,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - public class CorruptFlask : ModItem, ILocalizedModType + public class UnholyTonic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() diff --git a/Items/Accessories/CorruptFlask.png b/Items/Accessories/UnholyTonic.png similarity index 100% rename from Items/Accessories/CorruptFlask.png rename to Items/Accessories/UnholyTonic.png diff --git a/Items/Accessories/Vanity/XyksBlessingBlue.cs b/Items/Accessories/Vanity/XyksBlessingBlue.cs index d4a8ddfda1..3c0954a148 100644 --- a/Items/Accessories/Vanity/XyksBlessingBlue.cs +++ b/Items/Accessories/Vanity/XyksBlessingBlue.cs @@ -2,7 +2,9 @@ using CalamityMod.Items.BaseItems; using CalamityMod.Rarities; using Terraria; +using Terraria.GameContent.NetModules; using Terraria.ModLoader; +using Terraria.Net; namespace CalamityMod.Items.Accessories.Vanity { @@ -47,5 +49,22 @@ namespace CalamityMod.Items.Accessories.Vanity modPlayer.XykVisualsBlue = true; } } + + // Also research the other variant + public override void OnResearched(bool fullyResearched) + { + if (fullyResearched) + { + if (!Main.ServerSideCharacter) + { + Main.LocalPlayerCreativeTracker.ItemSacrifices.RegisterItemSacrifice(ModContent.ItemType(), 1); + } + else + { + NetPacket packet = NetCreativeUnlocksPlayerReportModule.SerializeSacrificeRequest(ModContent.ItemType(), 1); + NetManager.Instance.SendToServerOrLoopback(packet); + } + } + } } } diff --git a/Items/Accessories/Vanity/XyksBlessingOrange.cs b/Items/Accessories/Vanity/XyksBlessingOrange.cs index a856246f4d..940278db9e 100644 --- a/Items/Accessories/Vanity/XyksBlessingOrange.cs +++ b/Items/Accessories/Vanity/XyksBlessingOrange.cs @@ -2,7 +2,9 @@ using CalamityMod.Items.BaseItems; using CalamityMod.Rarities; using Terraria; +using Terraria.GameContent.NetModules; using Terraria.ModLoader; +using Terraria.Net; namespace CalamityMod.Items.Accessories.Vanity { @@ -47,5 +49,22 @@ namespace CalamityMod.Items.Accessories.Vanity modPlayer.XykVisualsOrange = true; } } + + // Also research the other variant + public override void OnResearched(bool fullyResearched) + { + if (fullyResearched) + { + if (!Main.ServerSideCharacter) + { + Main.LocalPlayerCreativeTracker.ItemSacrifices.RegisterItemSacrifice(ModContent.ItemType(), 1); + } + else + { + NetPacket packet = NetCreativeUnlocksPlayerReportModule.SerializeSacrificeRequest(ModContent.ItemType(), 1); + NetManager.Instance.SendToServerOrLoopback(packet); + } + } + } } } diff --git a/Items/Accessories/CrimsonFlask.cs b/Items/Accessories/ViciousTonic.cs similarity index 94% rename from Items/Accessories/CrimsonFlask.cs rename to Items/Accessories/ViciousTonic.cs index dc1d4c038c..70908f43dd 100644 --- a/Items/Accessories/CrimsonFlask.cs +++ b/Items/Accessories/ViciousTonic.cs @@ -5,7 +5,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - public class CrimsonFlask : ModItem, ILocalizedModType + public class ViciousTonic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() diff --git a/Items/Accessories/CrimsonFlask.png b/Items/Accessories/ViciousTonic.png similarity index 100% rename from Items/Accessories/CrimsonFlask.png rename to Items/Accessories/ViciousTonic.png diff --git a/Items/Accessories/WulfrumAcrobaticsPack.cs b/Items/Accessories/WulfrumAcrobaticsPack.cs index e8723b67b3..9f5dced437 100644 --- a/Items/Accessories/WulfrumAcrobaticsPack.cs +++ b/Items/Accessories/WulfrumAcrobaticsPack.cs @@ -1,13 +1,18 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; +using System.Net.Sockets; using CalamityMod.DataStructures; using CalamityMod.Items.Materials; +using CalamityMod.Packets; using CalamityMod.Projectiles.Typeless; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent.UI; using Terraria.GameInput; using Terraria.ID; using Terraria.ModLoader; @@ -23,7 +28,6 @@ namespace CalamityMod.Items.Accessories public static readonly SoundStyle GrabSound = new("CalamityMod/Sounds/Custom/WulfrumHookGrapple") { Volume = 0.7f, MaxInstances = 1, SoundLimitBehavior = SoundLimitBehavior.ReplaceOldest }; public static readonly SoundStyle ReleaseSound = new("CalamityMod/Sounds/Custom/WulfrumHookDisengage") { Volume = 0.7f, MaxInstances = 1, SoundLimitBehavior = SoundLimitBehavior.ReplaceOldest }; - public override void SetDefaults() { Item.width = 20; @@ -33,6 +37,11 @@ namespace CalamityMod.Items.Accessories Item.rare = ItemRarityID.Blue; } + public override bool CanUseItem(Player player) + { + return player.TryGetModPlayer(out var mp) && mp.hookCooldown <= 0; + } + public override void UpdateAccessory(Player player, bool hideVisual) { player.moveSpeed += 0.08f; @@ -73,6 +82,7 @@ namespace CalamityMod.Items.Accessories } //Prevent players with a wulfrum pack to spawn any non-wulfrum hooks. + /* public override void OnSpawn(Projectile projectile, IEntitySource source) { Player owner = Main.player[projectile.owner]; @@ -80,7 +90,7 @@ namespace CalamityMod.Items.Accessories { projectile.active = false; } - } + }*/ } public class WulfrumPackPlayer : ModPlayer @@ -226,6 +236,104 @@ namespace CalamityMod.Items.Accessories public bool PlayerOnGround => Collision.SolidCollision(Player.position + Vector2.UnitY * 2f * Player.gravDir, Player.width, Player.height, false); + public override void Load() + { + base.Load(); + + // On_Player.QuickGrapple_GetItemToUse += QuickGrapple_GetItemToUse_PrioritizeAcrobaticsPack; + On_Player.QuickGrapple += QuickGrapple_UseCustomGrapple; + } + + private static void QuickGrapple_UseCustomGrapple(On_Player.orig_QuickGrapple orig, Player self) + { + if (!self.TryGetModPlayer(out var mp) || !mp.WulfrumPackEquipped) + { + orig(self); + return; + } + + if (mp.hookCooldown > 0) + { + return; + } + + if (self.frozen || self.tongued || self.webbed || self.stoned || self.dead) + { + return; + } + + if (PlayerInput.GrappleAndInteractAreShared) + { + if (Main.HoveringOverAnNPC || Main.SmartInteractShowingGenuine || Main.SmartInteractShowingFake || (WiresUI.Settings.DrawToolModeUI && PlayerInput.UsingGamepad)) + { + return; + } + + var ctrlTile = self.controlUseTile; + var ctrlItem = self.controlUseItem; + if (!ctrlTile && !ctrlItem) + { + return; + } + + var tile = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY); + if ((tile.HasTile && (tile.TileType is 4 or 33 or 372 or 174 or 646 or 49)) || (self.HeldItem.type == ItemID.PortalGun && PlayerInput.UsingGamepad)) + { + return; + } + } + + if (self.noItems) + { + return; + } + + if (self.mount.Active) + { + self.mount.Dismount(self); + } + + self.UpdateBlacklistedTilesForGrappling(); + + foreach (var proj in Main.ActiveProjectiles) + { + if (proj.owner != self.whoAmI || proj.aiStyle != ProjAIStyleID.Hook || proj.type == ProjectileType()) + { + continue; + } + + proj.Kill(); + } + + if (Main.projectile.Count(n => n.active && n.owner == self.whoAmI && n.type == ProjectileType()) <= 1) + { + SoundEngine.PlaySound(WulfrumAcrobaticsPack.ShootSound, self.Center); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Vector2 velocity = (Main.MouseWorld - self.Center).SafeNormalize(Vector2.One) * mp.ActualLaunchVelocity; + Projectile.NewProjectile(self.GetSource_ItemUse(mp.PackItem), self.Center, velocity, ProjectileType(), 0, 0, self.whoAmI); + + float angleToRightBelow = velocity.AngleBetween(Vector2.UnitY); + if (angleToRightBelow < MathHelper.PiOver2) //Put a cooldown on hooking down below. + { + int extraCooldown = (int)(Utils.GetLerpValue(MathHelper.PiOver2, 0f, angleToRightBelow) * 15); //Get more cooldown the straightest down youre aiming + mp.hookCooldown = 15 + extraCooldown; + } + } + } + + /* + private static Item QuickGrapple_GetItemToUse_PrioritizeAcrobaticsPack(On_Player.orig_QuickGrapple_GetItemToUse orig, Player self) + { + if (self.TryGetModPlayer(out var mPlayer) && mPlayer.WulfrumPackEquipped && mPlayer.PackItem is not null) + { + return mPlayer.PackItem; + } + + return orig(self); + } + */ + public override void ResetEffects() { WulfrumPackEquipped = false; @@ -529,7 +637,8 @@ namespace CalamityMod.Items.Accessories if (!WulfrumPackEquipped) return; - //Shoot a new hook + //Shoot a new hook + /* if (triggersSet.Grapple && Player.releaseHook) { //Clear any previous non-wulfrum hooks / Any hooks that just got shot (should already be handled by the global proj @@ -560,11 +669,16 @@ namespace CalamityMod.Items.Accessories } } } + */ + + bool setControlUpFalse = false; if (Grappled && triggersSet.Up) { SwingLength -= (strongerReel ? StaticHookReelSpeed : ReelSpeed); Player.controlUp = false; //This is required to stop the player from bouncing off platforms when falling down and reeling in. Also prevents gravity swapping while hooked. + setControlUpFalse = true; } + if (triggersSet.Down) //Static Hook doesn't effect this speed because it would be faster than your fall speed and feel janky. { float length = ActualMaxLength; @@ -575,9 +689,12 @@ namespace CalamityMod.Items.Accessories SwingLength = length; } } + //Jumping out of the hook if (triggersSet.Jump && Player.releaseJump) { + var syncData = new WulfrumAcrobaticsJumpSync.Data(); + foreach (Projectile p in Main.ActiveProjectiles) { if (p.owner != Player.whoAmI || p.type != ProjectileType()) @@ -586,10 +703,11 @@ namespace CalamityMod.Items.Accessories //Only clear hooks that are attached to stuff if (p.ModProjectile is WulfrumHook claw && claw.State == WulfrumHook.HookState.Grappling) { - float angleToUpright = (Player.Center - p.Center).AngleBetween(-Vector2.UnitY); bool canJumpOffHook = angleToUpright > MathHelper.PiOver2 || Player.Distance(p.Center) < 38;// Don't do any jump stuff if the player is jumping from above the hook. + syncData = syncData with { CanJumpOffHook = canJumpOffHook }; + if (canJumpOffHook) { Vector2 velocityBoost = Vector2.Zero; @@ -630,6 +748,28 @@ namespace CalamityMod.Items.Accessories } } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + WulfrumAcrobaticsJumpSync.Send( + syncData with + { + PlayerWhoAmI = (byte)Player.whoAmI, + SwingLength = SwingLength, + PlayerVelocity = Player.velocity, + PlayerJump = Player.jump, + SetControlUpFalse = setControlUpFalse, + } + ); + } + } + else + { + if (Main.netMode == NetmodeID.MultiplayerClient) + { + WulfrumAcrobaticsLengthSync.Send( + new WulfrumAcrobaticsLengthSync.Data((byte)Player.whoAmI, SwingLength, setControlUpFalse) + ); + } } } @@ -646,4 +786,185 @@ namespace CalamityMod.Items.Accessories } } } + + internal sealed class WulfrumAcrobaticsSync : CalamityPacket + { + public static WulfrumAcrobaticsSync Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.WulfrumAcrobaticsSync; + + public static void Send(Player player, WulfrumPackPlayer mPlayer, Projectile proj, int toClient = -1, int ignoreClient = -1) + { + Send( + (byte)player.whoAmI, + mPlayer.SwingLength, + mPlayer.OldPosition, + proj.Center, + (byte)proj.whoAmI + ); + } + + private static void Send( + byte playerWhoAmI, + float swingLength, + Vector2 playerOldPos, + Vector2 projCenter, + byte projWhoAmI, + int toClient = -1, + int ignoreClient = -1 + ) + { + var packet = Instance.CreateBasePacket(); + packet.Write(playerWhoAmI); + packet.Write(swingLength); + packet.WriteVector2(playerOldPos); + packet.WriteVector2(projCenter); + packet.Write(projWhoAmI); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var playerWhoAmI = packet.ReadByte(); + var swingLength = packet.ReadSingle(); + var playerOldPos = packet.ReadVector2(); + var projCenter = packet.ReadVector2(); + var projWhoAmI = packet.ReadByte(); + + if (Main.player[playerWhoAmI].TryGetModPlayer(out var mPlayer)) + { + mPlayer.SwingLength = swingLength; + mPlayer.OldPosition = playerOldPos; + mPlayer.SetSegments(projCenter); + mPlayer.Grapple = projWhoAmI; + } + + if (Main.netMode == NetmodeID.Server) + { + Send( + playerWhoAmI, + swingLength, + playerOldPos, + projCenter, + projWhoAmI, + ignoreClient: sender + ); + } + } + } + + internal sealed class WulfrumAcrobaticsJumpSync : CalamityPacket + { + public readonly record struct Data( + byte PlayerWhoAmI, + float SwingLength, + bool CanJumpOffHook, + Vector2 PlayerVelocity, + int PlayerJump, + bool SetControlUpFalse + ); + + public static WulfrumAcrobaticsJumpSync Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.WulfrumAcrobaticsJumpSync; + + public static void Send(Data data, int toClient = -1, int ignoreClient = -1) + { + var packet = Instance.CreateBasePacket(); + packet.Write(data.PlayerWhoAmI); + packet.Write(data.SwingLength); + packet.Write(data.CanJumpOffHook); + packet.WriteVector2(data.PlayerVelocity); + packet.Write(data.PlayerJump); + packet.Write(data.SetControlUpFalse); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var playerWhoAmI = packet.ReadByte(); + var swingLength = packet.ReadSingle(); + var canJumpOffHook = packet.ReadBoolean(); + var playerVelocity = packet.ReadVector2(); + var playerJump = packet.ReadInt32(); + var setControlUpFalse = packet.ReadBoolean(); + + var player = Main.player[playerWhoAmI]; + if (player.TryGetModPlayer(out var mPlayer)) + { + mPlayer.SwingLength = swingLength; + } + + if (canJumpOffHook) + { + player.jump = playerJump; + player.velocity = playerVelocity; + } + else + { + player.releaseJump = false; + } + + if (setControlUpFalse) + { + player.controlUp = false; + } + + if (Main.netMode == NetmodeID.Server) + { + Send( + new Data(playerWhoAmI, swingLength, canJumpOffHook, playerVelocity, playerJump, setControlUpFalse), + ignoreClient: sender + ); + } + } + } + + internal sealed class WulfrumAcrobaticsLengthSync : CalamityPacket + { + public readonly record struct Data( + byte PlayerWhoAmI, + float SwingLength, + bool SetControlUpFalse + ); + + public static WulfrumAcrobaticsLengthSync Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.WulfrumAcrobaticsLengthSync; + + public static void Send(Data data, int toClient = -1, int ignoreClient = -1) + { + var packet = Instance.CreateBasePacket(); + packet.Write(data.PlayerWhoAmI); + packet.Write(data.SwingLength); + packet.Write(data.SetControlUpFalse); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var playerWhoAmI = packet.ReadByte(); + var swingLength = packet.ReadSingle(); + var setControlUpFalse = packet.ReadBoolean(); + + var player = Main.player[playerWhoAmI]; + if (player.TryGetModPlayer(out var mPlayer)) + { + mPlayer.SwingLength = swingLength; + } + + if (setControlUpFalse) + { + player.controlUp = false; + } + + if (Main.netMode == NetmodeID.Server) + { + Send( + new Data(playerWhoAmI, swingLength, setControlUpFalse), + ignoreClient: sender + ); + } + } + } } diff --git a/Items/Armor/Plaguebringer/PlaguebringerCarapace.cs b/Items/Armor/Plaguebringer/PlaguebringerCarapace.cs index 612d748fa8..43566922ae 100644 --- a/Items/Armor/Plaguebringer/PlaguebringerCarapace.cs +++ b/Items/Armor/Plaguebringer/PlaguebringerCarapace.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Armor.Plaguebringer { CreateRecipe(). AddIngredient(ItemID.BeeBreastplate). - AddIngredient(2). + AddIngredient(2). AddIngredient(7). AddIngredient(7). AddTile(TileID.MythrilAnvil). diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 8209aa18b2..02d7ae8ce4 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -498,76 +498,6 @@ namespace CalamityMod.Items } } - // 23APR2025: Ozzatron: make late game vanilla guns significantly more accurate - // Currently applies to Gatligator, Tactical Shotgun and Chain Gun - #region Vanilla Item Shoot Overrides - if (item.type == ItemID.Gatligator) - { - // Vanilla Gatligator: X/Y velocity += -2 to 2 in steps of 0.05 (-40 to 40 x 0.05) - // Calamity Gatligator: Velocity gets randomly rotated by up to 0.05 radians and multiplied by 0.87 to 1.13 - // This logic is lifted from Onyxia - // - // Gatligator has an additional inaccuracy effect where bullets have a 1 in 3 chance to have their velocity totally fucked - // When this happens, the X and Y components of the velocity are multiplied by 0.4 to 1.6, with separate random calls for each - // This has been replicated by giving bullets a 1 in 3 chance to go much faster, but be more inaccurate - // - // Vanilla Gatligator gets additional hardcoded inaccuracy to produce the gun jittering visual - // Extra inaccuracy: X/Y velocity += -1.5 to 1.5 in steps of 0.03 (-50 to 50 x 0.03) - // This is IL edited out - - Vector2 spreadVel; - if (Main.rand.NextBool(3)) // Xtra Inaccurate - { - float radianInaccuracy = 0.09f; - float randAngle = Main.rand.NextFloat(-radianInaccuracy, radianInaccuracy); - float randVelMultiplier = Main.rand.NextFloat(1.3f, 1.63f); - spreadVel = velocity.RotatedBy(randAngle) * randVelMultiplier; - } - else - { - float radianInaccuracy = 0.05f; - float randAngle = Main.rand.NextFloat(-radianInaccuracy, radianInaccuracy); - float randVelMultiplier = Main.rand.NextFloat(0.87f, 1.13f); - spreadVel = velocity.RotatedBy(randAngle) * randVelMultiplier; - } - - Projectile.NewProjectile(source, position, spreadVel, type, damage, knockBack, player.whoAmI); - return false; - } - - if (item.type == ItemID.TacticalShotgun) - { - // Vanilla Tactical Shotgun: X/Y velocity += -2 to 2 in steps of 0.05 (-40 to 40 x 0.05) - // Calamity Tactical Shotgun: Velocity gets a random vector of magnitude 0-1 added to it, anywhere on the unit circle - - int tacticalShotgunNumBullets = 6; - for (int i = 0; i < tacticalShotgunNumBullets; i++) - { - Vector2 spreadVel = velocity + Main.rand.NextVector2Circular(0.5f, 0.5f); - Projectile.NewProjectile(source, position, spreadVel, type, damage, knockBack, player.whoAmI); - } - return false; - } - - if (item.type == ItemID.ChainGun) - { - // Vanilla Chain Gun: X/Y velocity += -1.2 to 1.2 in steps of 0.03 (-40 to 40 x 0.03) - // Calamity Chain Gun: Velocity gets randomly rotated by up to 0.035 radians and multiplied by 0.92 to 1.08 - // This logic is lifted from Onyxia - // - // Vanilla Chain Gun gets additional hardcoded accuracy to produce the gun jittering visual - // Extra inaccuracy: X/Y velocity += -1.5 to 1.5 in steps of 0.03 (-50 to 50 x 0.03) - // This is IL edited out - - float radianInaccuracy = 0.035f; - float randAngle = Main.rand.NextFloat(-radianInaccuracy, radianInaccuracy); - float randVelMultiplier = Main.rand.NextFloat(0.92f, 1.08f); - Vector2 spreadVel = velocity.RotatedBy(randAngle) * randVelMultiplier; - Projectile.NewProjectile(source, position, spreadVel, type, damage, knockBack, player.whoAmI); - return false; - } - #endregion - return true; } #endregion diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 0f05be4ef6..23720f97f6 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -156,7 +156,7 @@ namespace CalamityMod.Items { ItemID.MagicalHarp, Do(DamageExact(50), ShootSpeedExact(12f)) }, { ItemID.MagicMissile, Do(DamageExact(23), ManaExact(10), UseAnimationExact(20), UseTimeExact(10)) }, { ItemID.Marrow, Do(DamageExact(60)) }, - { ItemID.MedusaHead, Do(ManaExact(6), DamageExact(48)) }, + { ItemID.MedusaHead, Do(ManaExact(6), DamageExact(75)) }, { ItemID.Meowmere, Do(UseMeleeSpeed, DamageExact(240)) }, { ItemID.MeteorStaff, Do(DamageExact(58), ManaExact(7), ShootSpeedExact(13f)) }, { ItemID.MiniNukeI, Do(DamageExact(90)) }, diff --git a/Items/Potions/Alcohol/GrapeBeer.cs b/Items/Potions/Alcohol/GrapeBeer.cs index d34f5d2866..934254c049 100644 --- a/Items/Potions/Alcohol/GrapeBeer.cs +++ b/Items/Potions/Alcohol/GrapeBeer.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Potions.Alcohol { public new string LocalizationCategory => "Items.Potions"; - public static float CritLoss = 10; + public static float CritLoss = 75; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(CritLoss); public override void SetStaticDefaults() diff --git a/Items/Potions/Food/DeliciousMeat.cs b/Items/Potions/Food/DeliciousMeat.cs index 8af8418510..fcc87fc022 100644 --- a/Items/Potions/Food/DeliciousMeat.cs +++ b/Items/Potions/Food/DeliciousMeat.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Tools; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -11,6 +12,7 @@ namespace CalamityMod.Items.Potions.Food public new string LocalizationCategory => "Items.Potions"; public override void SetStaticDefaults() { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); Item.ResearchUnlockCount = 5; Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.FoodParticleColors[Type] = new Color[2] { diff --git a/Items/Tools/DisgustingMeat.cs b/Items/Tools/DisgustingMeat.cs index 38205ad2ed..8a32de7347 100644 --- a/Items/Tools/DisgustingMeat.cs +++ b/Items/Tools/DisgustingMeat.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.PermanentBoosters; +using CalamityMod.Items.Potions.Food; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,9 +10,13 @@ namespace CalamityMod.Items.Tools { public new string LocalizationCategory => "Items.Tools"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { - Item.DefaultToFood(32, 30, 0, 0); + Item.DefaultToFood(26, 36, 0, 0); Item.value = 0; Item.UseSound = SoundID.NPCDeath13; Item.maxStack = 1; diff --git a/Items/Tools/DisgustingMeat.png b/Items/Tools/DisgustingMeat.png index 6d743191e2..9e015178f3 100644 Binary files a/Items/Tools/DisgustingMeat.png and b/Items/Tools/DisgustingMeat.png differ diff --git a/Items/VanillaArmorChanges/MythrilArmorSetChange.cs b/Items/VanillaArmorChanges/MythrilArmorSetChange.cs index 47d11890d2..5ed1269dab 100644 --- a/Items/VanillaArmorChanges/MythrilArmorSetChange.cs +++ b/Items/VanillaArmorChanges/MythrilArmorSetChange.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.VanillaArmorChanges int flareDamage = CalamityUtils.DamageSoftCap(originalDamage * 0.3, FlareDamageSoftcap); Vector2 flareSpawnPosition = victim.Center + Main.rand.NextVector2Circular(10f, 10f); - Projectile.NewProjectile(owner.GetSource_ItemUse(owner.HeldItem), flareSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), flareDamage, 0f, owner.whoAmI); + Projectile.NewProjectile(owner.GetSource_OnHit(victim), flareSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), flareDamage, 0f, owner.whoAmI); } } } diff --git a/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs b/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs index 7361d5bda7..f6738e8073 100644 --- a/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs +++ b/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs @@ -41,10 +41,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 21f; - - modItem.UsesCharge = true; - modItem.MaxCharge = 135f; - modItem.ChargePerUse = 0.075f; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; diff --git a/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs b/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs index 8fce78b1c8..44004d9aa0 100644 --- a/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs +++ b/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs @@ -12,8 +12,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public class HydraulicVoltCrasher : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; - // This is the amount of charge consumed every frame the holdout projectile is summoned, i.e. the weapon is in use. - public const float HoldoutChargeUse = 0.002f; public override void SetStaticDefaults() { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; @@ -43,10 +41,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noUseGraphic = true; Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; Item.channel = true; - - modItem.UsesCharge = true; - modItem.MaxCharge = 85f; - modItem.ChargePerUse = 0f; // This weapon is a holdout. Charge is consumed by the holdout projectile. } public override bool AltFunctionUse(Player player) => true; @@ -62,7 +56,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { Item.hammer = 100; } - return player.ownedProjectileCounts[Item.shoot] <= 0 && Item.Calamity().Charge > 0; + return player.ownedProjectileCounts[Item.shoot] <= 0; } public override void HoldItem(Player player) { diff --git a/Items/Weapons/DraedonsArsenal/MountedScanner.cs b/Items/Weapons/DraedonsArsenal/MountedScanner.cs index f3ccae861e..597c31346b 100644 --- a/Items/Weapons/DraedonsArsenal/MountedScanner.cs +++ b/Items/Weapons/DraedonsArsenal/MountedScanner.cs @@ -36,11 +36,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 1f; - - modItem.UsesCharge = true; - modItem.MaxCharge = 85f; - modItem.ChargePerUse = 0.85f; - modItem.ChargePerAltUse = 0f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs index 551e98efe1..986806d251 100644 --- a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs +++ b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs @@ -20,10 +20,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public const float SizeChargeThreshold = 0.25f; // The small sword barely affects damage on its own because damage is already dropping significantly at low charge. public const float SmallDamageMultiplier = 0.9f; - // This is the amount of charge consumed every frame the holdout projectile is summoned, i.e. the weapon is in use. - public const float HoldoutChargeUse = 0.005f; - // This is the amount of charge consumed every time a sword beam is fired. - public const float SwordBeamChargeUse = 0.1f; public override void SetDefaults() { @@ -50,13 +46,9 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.shoot = ModContent.ProjectileType(); Item.channel = true; - - modItem.UsesCharge = true; - modItem.MaxCharge = 250f; - modItem.ChargePerUse = 0f; // This weapon is a holdout. Charge is consumed by the holdout projectile. } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && Item.Calamity().Charge > 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs index cbeeac183f..7520d358ee 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs @@ -47,11 +47,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5f; - - modItem.UsesCharge = true; - modItem.MaxCharge = 190f; - modItem.ChargePerUse = 0.32f; - modItem.ChargePerAltUse = 0.12f; // turbo mode is more energy inefficient } public override bool AltFunctionUse(Player player) => true; diff --git a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs index 97d941da05..c2394b7a95 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs @@ -42,10 +42,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 11f; Item.DamageType = RogueDamageClass.Instance; - - modItem.UsesCharge = true; - modItem.MaxCharge = 250f; - modItem.ChargePerUse = 0.2f; } public override float StealthVelocityMultiplier => 1.2f; diff --git a/Items/Weapons/DraedonsArsenal/PoleWarper.cs b/Items/Weapons/DraedonsArsenal/PoleWarper.cs index 58497b24b0..574881ee74 100644 --- a/Items/Weapons/DraedonsArsenal/PoleWarper.cs +++ b/Items/Weapons/DraedonsArsenal/PoleWarper.cs @@ -38,11 +38,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; - - modItem.UsesCharge = true; - modItem.MaxCharge = 250f; - modItem.ChargePerUse = 1f; - modItem.ChargePerAltUse = 0f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockBack) diff --git a/Items/Weapons/DraedonsArsenal/PulseDragon.cs b/Items/Weapons/DraedonsArsenal/PulseDragon.cs index 321f65a022..47de2e064d 100644 --- a/Items/Weapons/DraedonsArsenal/PulseDragon.cs +++ b/Items/Weapons/DraedonsArsenal/PulseDragon.cs @@ -36,10 +36,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.channel = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; - - modItem.UsesCharge = true; - modItem.MaxCharge = 190f; - modItem.ChargePerUse = 0.32f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockBack) diff --git a/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs index 5d73429d8c..96d5975e9a 100644 --- a/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs +++ b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs @@ -36,11 +36,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; - - modItem.UsesCharge = true; - modItem.MaxCharge = 135f; - modItem.ChargePerUse = 1f; - modItem.ChargePerAltUse = 0f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs index 358b4ff00d..5b65b1c0a3 100644 --- a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs +++ b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs @@ -40,12 +40,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.DamageType = DamageClass.Summon; - - CalamityGlobalItem modItem = Item.Calamity(); - modItem.UsesCharge = true; - modItem.MaxCharge = 190f; - modItem.ChargePerUse = 1f; - modItem.ChargePerAltUse = 0f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/DraedonsArsenal/SystemBane.cs b/Items/Weapons/DraedonsArsenal/SystemBane.cs index aaa42e66ec..2578cc8d2f 100644 --- a/Items/Weapons/DraedonsArsenal/SystemBane.cs +++ b/Items/Weapons/DraedonsArsenal/SystemBane.cs @@ -19,8 +19,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { - CalamityGlobalItem modItem = Item.Calamity(); - Item.width = 42; Item.height = 36; Item.damage = 45; @@ -38,10 +36,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.shootSpeed = 16f; Item.shoot = ModContent.ProjectileType(); - - modItem.UsesCharge = true; - modItem.MaxCharge = 135f; - modItem.ChargePerUse = 0.085f; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] < MaxDeployedProjectiles; diff --git a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs index 97c516d6de..4abbc9858a 100644 --- a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs +++ b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs @@ -21,8 +21,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { - CalamityGlobalItem modItem = Item.Calamity(); - Item.width = 78; Item.height = 28; Item.DamageType = DamageClass.Magic; @@ -41,10 +39,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5f; - - modItem.UsesCharge = true; - modItem.MaxCharge = 250f; - modItem.ChargePerUse = 0.7f; } public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) diff --git a/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs b/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs index 94cb74b490..6f168ec2b7 100644 --- a/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs +++ b/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs @@ -41,11 +41,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); modItem.donorItem = true; - - modItem.UsesCharge = true; - modItem.MaxCharge = 250f; - modItem.ChargePerUse = 0.3f; - modItem.ChargePerAltUse = 0.15f; } public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 4); diff --git a/Items/Weapons/DraedonsArsenal/WavePounder.cs b/Items/Weapons/DraedonsArsenal/WavePounder.cs index 26be6ef44b..97cc9f80b3 100644 --- a/Items/Weapons/DraedonsArsenal/WavePounder.cs +++ b/Items/Weapons/DraedonsArsenal/WavePounder.cs @@ -18,8 +18,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; public override void SetDefaults() { - CalamityGlobalItem modItem = Item.Calamity(); - Item.width = 26; Item.height = 44; Item.damage = 75; @@ -37,10 +35,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); - - modItem.UsesCharge = true; - modItem.MaxCharge = 190f; - modItem.ChargePerUse = 0.5f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Magic/AlphaDraconis.cs b/Items/Weapons/Magic/AlphaDraconis.cs index ae908a8aee..72744cabc0 100644 --- a/Items/Weapons/Magic/AlphaDraconis.cs +++ b/Items/Weapons/Magic/AlphaDraconis.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Magic var p = Main.projectile.First(x => x.type == ModContent.ProjectileType() && x.active && x.owner == player.whoAmI); p.timeLeft = (int)MathHelper.Min(p.timeLeft, 60); } else - Projectile.NewProjectile(source, player.Center + new Vector2(-125,-100), -Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.Center + new Vector2(-125,-100), -Vector2.Zero, ModContent.ProjectileType(), damage * 3, knockback, player.whoAmI); return false; } var mousePos = player.Calamity().mouseWorld; diff --git a/Items/Weapons/Melee/DevilsDevastation.cs b/Items/Weapons/Melee/DevilsDevastation.cs index ea28e02412..7fb483872b 100644 --- a/Items/Weapons/Melee/DevilsDevastation.cs +++ b/Items/Weapons/Melee/DevilsDevastation.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void HoldItem(Player player) { player.Calamity().mouseWorldListener = true; - if (player.Calamity().mouseRight && player.Calamity().killModeCooldown == 0 && !Main.mapFullscreen && !Main.blockMouse) + if (player.Calamity().mouseRight && !player.mouseInterface && player.Calamity().killModeCooldown == 0 && !Main.mapFullscreen && !Main.blockMouse) { SoundStyle buff = new("CalamityMod/Sounds/Item/DemonSwordKillMode"); SoundEngine.PlaySound(buff with { Volume = 0.95f }, player.Center); diff --git a/Items/Weapons/Melee/ExaltedOathblade.cs b/Items/Weapons/Melee/ExaltedOathblade.cs index 53acac0db6..79ab3c3b90 100644 --- a/Items/Weapons/Melee/ExaltedOathblade.cs +++ b/Items/Weapons/Melee/ExaltedOathblade.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void HoldItem(Player player) { player.Calamity().mouseWorldListener = true; - if (player.Calamity().mouseRight && player.Calamity().killModeCooldown == 0 && !Main.mapFullscreen && !Main.blockMouse) + if (player.Calamity().mouseRight && !player.mouseInterface && player.Calamity().killModeCooldown == 0 && !Main.mapFullscreen && !Main.blockMouse) { SoundStyle buff = new("CalamityMod/Sounds/Item/DemonSwordKillMode"); SoundEngine.PlaySound(buff with { Volume = 0.95f }, player.Center); diff --git a/Items/Weapons/Melee/ForbiddenOathblade.cs b/Items/Weapons/Melee/ForbiddenOathblade.cs index e62114382d..aed26bb46f 100644 --- a/Items/Weapons/Melee/ForbiddenOathblade.cs +++ b/Items/Weapons/Melee/ForbiddenOathblade.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void HoldItem(Player player) { player.Calamity().mouseWorldListener = true; - if (player.Calamity().mouseRight && player.Calamity().killModeCooldown == 0 && !Main.mapFullscreen && !Main.blockMouse) + if (player.Calamity().mouseRight && !player.mouseInterface && player.Calamity().killModeCooldown == 0 && !Main.mapFullscreen && !Main.blockMouse) { SoundStyle buff = new("CalamityMod/Sounds/Item/DemonSwordKillMode"); SoundEngine.PlaySound(buff with { Volume = 0.95f }, player.Center); diff --git a/Items/Weapons/Melee/GalileoGladius.cs b/Items/Weapons/Melee/GalileoGladius.cs index aeebf858bb..108b448374 100644 --- a/Items/Weapons/Melee/GalileoGladius.cs +++ b/Items/Weapons/Melee/GalileoGladius.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 44; Item.height = 44; Item.useStyle = ItemUseStyleID.Rapier; - Item.damage = 202; + Item.damage = 600; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 8; Item.knockBack = 10f; @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Melee } if (player.altFunctionUse == 2) { - Projectile.NewProjectile(source,position,velocity,ModContent.ProjectileType(),damage,knockback,player.whoAmI); + Projectile.NewProjectile(source,position,velocity*2,ModContent.ProjectileType(),damage,knockback,player.whoAmI); return false; } return base.Shoot(player, source, position, velocity, type, damage, knockback); diff --git a/Items/Weapons/Melee/GeliticBlade.cs b/Items/Weapons/Melee/GeliticBlade.cs index d76f5da1b8..5747f80feb 100644 --- a/Items/Weapons/Melee/GeliticBlade.cs +++ b/Items/Weapons/Melee/GeliticBlade.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +11,9 @@ namespace CalamityMod.Items.Weapons.Melee public class GeliticBlade : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/GeliticBladeSwing", 2); + public override void SetDefaults() { Item.width = 44; @@ -21,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 5.25f; - Item.UseSound = SoundID.Item1; + Item.UseSound = UseSound; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; diff --git a/Items/Weapons/Ranged/FreedomStar.cs b/Items/Weapons/Ranged/FreedomStar.cs index 2f24196d9f..e237779ec0 100644 --- a/Items/Weapons/Ranged/FreedomStar.cs +++ b/Items/Weapons/Ranged/FreedomStar.cs @@ -12,11 +12,6 @@ namespace CalamityMod.Items.Weapons.Ranged public class FreedomStar : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - // This is the amount of charge consumed every time the holdout projectile fires various projectiles. - public const float HoldoutChargeUse_Orb = 0.004f; - public const float HoldoutChargeUse_OrbLarge = 0.005f; - public const float HoldoutChargeUse_Laser = 0.006f; - public const float HoldoutChargeUse_LaserLarge = 0.01f; public override void SetDefaults() { @@ -38,9 +33,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.UseSound = SoundID.Item75; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; - modItem.UsesCharge = true; - modItem.MaxCharge = 150f; - modItem.ChargePerUse = 0f; // This weapon is a holdout. Charge is consumed by the holdout projectile. } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); diff --git a/Items/Weapons/Ranged/HalleysInferno.cs b/Items/Weapons/Ranged/HalleysInferno.cs index f72ae367c7..eb384c5077 100644 --- a/Items/Weapons/Ranged/HalleysInferno.cs +++ b/Items/Weapons/Ranged/HalleysInferno.cs @@ -7,6 +7,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.Graphics; using Terraria.ID; using Terraria.ModLoader; @@ -14,16 +15,30 @@ namespace CalamityMod.Items.Weapons.Ranged { public class HalleysInferno : ModItem, ILocalizedModType { + public class HalleyZoom : ModSystem + { + public static float halleyZoomAmount = 0; + public override void ModifyTransformMatrix(ref SpriteViewMatrix Transform) + { + if (Main.LocalPlayer.HeldItem.type == ModContent.ItemType()) + halleyZoomAmount += 0.05f; + else + halleyZoomAmount -= 0.05f; + halleyZoomAmount = MathHelper.Clamp(halleyZoomAmount, 0, 1); + Transform.Zoom *= 1 - 0.25f*halleyZoomAmount; + } + } + public new string LocalizationCategory => "Items.Weapons.Ranged"; public static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Item/HalleysInfernoShoot") { Volume = 0.68f }; public static readonly SoundStyle Hit = new("CalamityMod/Sounds/Item/HalleysInfernoHit") { Volume = 0.75f }; public static float MaxStarburstPerComet => 1; - public static float MaxStarburstPerStar => 0.5f; - public static float LostAccuracyPerMiss => 5; + public static float MaxStarburstPerStar => 0.25f; + public static float LostAccuracyPerMiss => 4; public static float MaxAccuracy => 50; - public static float StarburstDmgMult => 1f; + public static float StarburstDmgMult => 1.25f; public static float StarburstVelMult = 0.75f; public override void SetDefaults() diff --git a/Items/Weapons/Ranged/OntologicalDespoiler.cs b/Items/Weapons/Ranged/OntologicalDespoiler.cs index 9230171e4d..577180c67e 100644 --- a/Items/Weapons/Ranged/OntologicalDespoiler.cs +++ b/Items/Weapons/Ranged/OntologicalDespoiler.cs @@ -77,7 +77,8 @@ namespace CalamityMod.Items.Weapons.Ranged holdout2.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); SoundStyle fire = new("CalamityMod/Sounds/Item/DudFire"); SoundEngine.PlaySound(fire with { Volume = 0.7f, Pitch = aiType == 20 ? -0.7f : (-0.5f + (shotType ? 0.5f : 0)) }, player.Center); - shotType = !shotType; + if (aiType != 20) + shotType = !shotType; } else { diff --git a/Items/Weapons/Ranged/TauCannon.cs b/Items/Weapons/Ranged/TauCannon.cs index 5340b61651..5028dacd09 100644 --- a/Items/Weapons/Ranged/TauCannon.cs +++ b/Items/Weapons/Ranged/TauCannon.cs @@ -13,8 +13,6 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - CalamityGlobalItem modItem = Item.Calamity(); - Item.damage = 620; Item.DamageType = DamageClass.Ranged; Item.useTime = Item.useAnimation = 180; @@ -30,12 +28,9 @@ namespace CalamityMod.Items.Weapons.Ranged Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); Item.useStyle = ItemUseStyleID.Shoot; - - modItem.UsesCharge = true; - modItem.MaxCharge = 200f; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0 && Item.Calamity().Charge > 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0; public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; diff --git a/Items/Weapons/Rogue/DynamicPursuer.cs b/Items/Weapons/Rogue/DynamicPursuer.cs index 373ab128c9..e625e2d5b1 100644 --- a/Items/Weapons/Rogue/DynamicPursuer.cs +++ b/Items/Weapons/Rogue/DynamicPursuer.cs @@ -15,8 +15,6 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetDefaults() { - CalamityGlobalItem modItem = Item.Calamity(); - Item.width = 30; Item.height = 34; Item.damage = 2850; @@ -38,10 +36,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 17f; - - modItem.UsesCharge = true; - modItem.MaxCharge = 300f; // Tesla Cannon = 250f - modItem.ChargePerUse = 0.4f; // Tesla Cannon = 0.9f } public static float StealthDmgMult = 0.3f; //So I can edit it directly via DragonLens instead of having to do math with CalTestHelpers public override float StealthDamageMultiplier => StealthDmgMult; diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index 911c78facb..f5950f439d 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -314,7 +314,7 @@ VermillionFlux: { Voidfrost: { DisplayName: Voidfrost Description: The emptiness of space devours all warmth and life - ItemTooltip: Cold - 100 DPS + ItemTooltip: Cold - 200 DPS } VulnerabilityHex: { @@ -825,7 +825,7 @@ GreenJellyRegen: { HallowedRuneDefense: { DisplayName: Hallowed Defense - Description: Increased defense by {0} and damage reduction by {1}% + Description: Increased defense by {0} } HallowedRunePower: { @@ -868,7 +868,7 @@ PhantomicShield: { DisplayName: Phantomic Shield Description: ''' - Defense increased by {0} and damage reduction increased by {1}% + Increased defense by {0} An ephemeral bulwark protects you ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 4f2edd1b4f..fe173c4673 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -65,8 +65,8 @@ Affliction: { Tooltip: Gives all teammates +{0} HP/s life regen, +{1}% max life, {2}% damage reduction, {3} defense and {4}% increased damage } -AlchemicalFlask: { - DisplayName: Alchemical Flask +AlchemicalDecanter: { + DisplayName: Alchemical Decanter Tooltip: ''' All attacks inflict the [cbuff:CalamityMod/Plague] and reduces damage taken from the [cbuff:CalamityMod/Plague] by {0}% @@ -440,8 +440,8 @@ CorrosiveSpine: { ''' } -CorruptFlask: { - DisplayName: Corrupt Flask +UnholyTonic: { + DisplayName: Unholy Tonic Tooltip: ''' Increases damage reduction by 4% and defense by 6 while in the corruption @@ -453,7 +453,6 @@ CounterScarf: { DisplayName: Counter Scarf Tooltip: ''' - 10% increased true melee damage Grants the ability to dash; dashing into an attack will cause you to dodge it After a successful dodge you must wait 30 seconds before you can dodge again ''' @@ -468,8 +467,8 @@ CrawCarapace: { ''' } -CrimsonFlask: { - DisplayName: Crimson Flask +ViciousTonic: { + DisplayName: Vicious Tonic Tooltip: ''' Increases damage reduction by 4% and defense by 6 while in the crimson @@ -761,9 +760,9 @@ EvasionScarf: { DisplayName: Evasion Scarf Tooltip: ''' - 15% increased true melee damage Grants the ability to dash; dashing into an attack will cause you to dodge it After a successful dodge you must wait 30 seconds before you can dodge again + Has a shorter dash cooldown than most dashes ''' } @@ -925,7 +924,7 @@ HallowedRune: { HoldShiftTooltip: ''' [c/8ce0ff: Hallowed Power] [c/ccf1ff: grants 10% increased summon damage and rains stars on enemies] - [c/d08aff: Hallowed Defense] [c/eed4ff: grants 4 defense and 4% damage reduction] + [c/d08aff: Hallowed Defense] [c/eed4ff: grants 5 defense] [c/ff8cb5: Hallowed Regen] [c/ffccde: grants +1.5 HP/s life regen] ''' } @@ -1304,7 +1303,7 @@ PhantomicArtifact: { HoldShiftTooltip: ''' [c/8ce0ff: Phantomic Empowerment] [c/ccf1ff: grants 10% increased summon damage and throws knives at enemies] - [c/d08aff: Phantomic Shield] [c/eed4ff: grants 10 defense, 5% damage reduction and a 20% damage reduction bulwark] + [c/d08aff: Phantomic Shield] [c/eed4ff: grants 10 defense and a 20% damage reduction bulwark] [c/ff8cb5: Phantomic Regen] [c/ffccde: grants 1 HP/s life regen and occasionally drops phantom hearts which grant an additional 1 HP/s life regen] ''' } @@ -1683,7 +1682,7 @@ SpiritGlyph: { HoldShiftTooltip: ''' [c/8ce0ff: Spirit Power] [c/ccf1ff:grants 10% increased summon damage] - [c/d08aff: Spirit Defense] [c/eed4ff:grants 4 defense] + [c/d08aff: Spirit Defense] [c/eed4ff:grants 3 defense] [c/ff8cb5: Spirit Regen] [c/ffccde:grants +1 HP/s life regeneration] ''' } @@ -1876,7 +1875,6 @@ TheAmalgam: { DisplayName: The Amalgam Tooltip: ''' - 10% increased damage All attacks inflict a variety of debuffs, 200% increased elemental debuff damage Most buffs last twice as long, and persist after dying Taking damage confuses nearby enemies and spawns a dank creeper @@ -1933,9 +1931,8 @@ TheEvolution: { DisplayName: The Evolution Tooltip: ''' - Reflects projectiles that hit you, negating their damage and dealing 10x damage to enemies - {$Common.ReflectInformation} - Reflecting a projectile grants maximum natural life regen for 10 seconds + Allows you to dodge projectiles, reflecting highly damaging mirror shards back at enemies + {$Common.DodgeInformation} Getting hit by the same enemy projectile type during cooldown will resist its damage by 25% ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index 4cad6c3aea..e429042221 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -93,7 +93,7 @@ HadalStew: { Tooltip: ''' Only gives [S] seconds of {$BuffName.PotionSickness} - {$CommonItemTooltip.MediumStats} + {$CommonItemTooltip.MajorStats} {$CommonItemTooltip.MinuteDuration} ''' } @@ -241,7 +241,6 @@ GrapeBeer: { Tooltip: ''' Bullets, Arrows, Darts, and Rockets gain homing - If many are fired at the same time, this only applies to five of them {0}% reduced critical strike damage {$Common.AlcoholWarning} ''' diff --git a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson index dd5573460f..71e0a20134 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson @@ -175,7 +175,6 @@ DisgustingMeat: { DisplayName: Disgusting Meat Tooltip: ''' - Debug item, spawn and use to remove permanent upgrades will remove health and mana upgrades, use with no Calamity upgrades to remove vanilla upgrades will remove rage and adrenaline upgrades, plus other miscellaneous boosters Removed boosters will be vomited out of you as items diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index b9497aaff2..20a314c465 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -40,6 +40,7 @@ AlphaDraconis: { Successful hits sometimes create Starbursts that can be picked up with enough Starbursts to summon Draco to protect you Draco burns Starbursts over time, and can be disspelled with + Draco inflicts [cbuff:CalamityMod/Voidfrost] ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index af5101070b..14a6fbf308 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -308,7 +308,7 @@ CrescentMoon: { Throws a lunar flail that releases homing moons at the apex of its path Holding spins the flail around you, generating Starbursts With 20 Starbursts, hold again after throwing the flail to cause it to explode - Instead of releasing moons, this explosion summons Scorpius to do immense damage + Instead of releasing moons, this explosion summons Scorpius to do immense damage and inflict [cbuff:CalamityMod/Voidfrost] ''' } @@ -360,7 +360,7 @@ DevilsDevastation: { ''' [c/d13ca2:The perfect blade of the Underworld, wielding the power of Brimstone directly.] [c/d13ca2:Humans understand this force as Havoc, the inevitable sundering of all order in fire.] - [c/d13ca2:Perhaps this is why the Brimstone Elemental had strength unrivaled by her sisters.] + [c/d13ca2:Perhaps this is why the Brimstone Elemental had strength unrivaled by her sisters.] ''' } @@ -617,7 +617,7 @@ GalileoGladius: { Tooltip: ''' Rapidly stabs in front of the player, generating Starbursts on hit - to throw the gladius on a constellation chain, impaling foes + to throw the gladius on a constellation chain, impaling foes and inflicting [cbuff:CalamityMod/Voidfrost] When the blade is impaled, use or to free it pulls it free and deals high damage, consuming 10 Starbursts pulls youself to the blade, allowing you to jump off the foe diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 128b99fcbd..0c6a68ee65 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -543,8 +543,9 @@ HalleysInferno: { Tooltip: ''' Fires a burst of intensely concentrated lunar fire jets - Generates Starbursts over time when hitting enemies - to rapid-fire Starbursts + to rapid-fire Starbursts that inflict [cbuff:CalamityMod/Voidfrost] + Generates Starbursts when hitting enemies, depending on your accuracy + Increases view range by 33% while held Uses gel for ammo 'Halley arrived sooner than expected' ''' @@ -970,7 +971,7 @@ PristineFury: { ''' 'I and many others lost everything in this world's darkest hour. I saw a beast descend from the heavens. A hulking cosmic monstrosity that 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. + My family was torn from me, my people forsake me. Even our supposed protectors did nothing to aid us. And thus I swore to those I lost that I would do what is right, that my blaze's light would dwarf even that of Zeratros' Sun; That one day, this cruel world would know nothing less than My perfect fury.' ''' diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index bd2548708d..6102778f3e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -1327,7 +1327,7 @@ Vega: { Throws a spear that shatters into star fragments on impact and generates Starbursts Stealth strikes conjure an image of Lyra to deal immense damage in an area to consume 20 Starbursts and immediately perform a stealth strike, regardless of your current Stealth - This strike calls all star fragments to attack the damaged foe + This strike calls all star fragments to attack the damaged foe and inflicts [cbuff:CalamityMod/Voidfrost] 'The final song of a misunderstood genius... or just a madman' ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index 8ad894a69d..95b7fab844 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -704,8 +704,8 @@ Sirius: { Summons the brightest star in the sky, Sirius, to protect you Continue summoning to complete Canis Major Repeated summons increase its power greatly, even after the constellation is complete - Sirius passively generates Starbursts when near enemies - When Starbursts are full, Sirius consumes them to launch a powerful piercing quasar + Sirius passively generates Starbursts when targeting enemies + When Starbursts are full, Sirius consumes them to launch a powerful piercing quasar that inflicts [cbuff:CalamityMod/Voidfrost] ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index 46c00c7e4c..ae1e83a420 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -68,7 +68,7 @@ CosmicShivBlade.DisplayName: Cosmic Beam CosmicShivTrail.DisplayName: Cosmic Shiv Trail CosmicSpiritBomb.DisplayName: Cosmic Bomb CrescentMoonFlail.DisplayName: Crescent Moon -CrescentMoonProj.DisplayName: Crescent Moon +CrescentMoonProj.DisplayName: Seeking Moon CrystylCrusherRay.DisplayName: Crystyl Crusher Ray Cyclone.DisplayName: Cyclone DarkBall.DisplayName: Dark Ball @@ -133,6 +133,7 @@ GalaxySmasherHammer.DisplayName: Galaxy Smasher GalaxySmasherMini.DisplayName: Cosmic Shard GalileosMoon.DisplayName: Crescent Moon GalileosPlanet.DisplayName: Planet +GalileoGladiusThrown.DisplayName: Galileo Gladius (Thrown) GayBeam.DisplayName: Iridescent Beam GelWave.DisplayName: Gelitic Wave GemTechYellowShard.DisplayName: Trireme's Yellow Gem diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index a2f1b61a2d..fa87ef4718 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1272,7 +1272,7 @@ namespace CalamityMod.NPCs // GFB Lavaproof Bug Net and Alchemical Flask drop GFB.Add(DropHelper.PerPlayer(ItemID.FireproofBugNet), hideLootReport: true); - GFB.Add(DropHelper.PerPlayer(ModContent.ItemType()), hideLootReport: true); + GFB.Add(DropHelper.PerPlayer(ModContent.ItemType()), hideLootReport: true); // Lore npcLoot.AddConditionalPerPlayer(() => !NPC.downedQueenBee, ModContent.ItemType(), desc: DropHelper.FirstKillText); diff --git a/NPCs/CalamityVanillaAIOverrideNPC.Global.cs b/NPCs/CalamityVanillaAIOverrideNPC.Global.cs index 87a35a5a30..33061a02d0 100644 --- a/NPCs/CalamityVanillaAIOverrideNPC.Global.cs +++ b/NPCs/CalamityVanillaAIOverrideNPC.Global.cs @@ -22,13 +22,18 @@ public sealed partial class CalamityVanillaAIOverrideNPC : GlobalNPC // Don't do damage for 42 frames after spawning in if (npc.type == NPCID.Sharkron || npc.type == NPCID.Sharkron2) + { npc.damage = npc.alpha > 0 ? 0 : npc.defDamage; + } // Servant of Cthulhu light - if (npc.type == NPCID.ServantofCthulhu) + else if (npc.type == NPCID.ServantofCthulhu) + { Lighting.AddLight(npc.Center, 0.2f, 0.2f, 0.2f); + } - if (npc.type == NPCID.CultistBoss) + // Cultist Boss light and hitbox changes + else if (npc.type == NPCID.CultistBoss) { // Emit light float lifeRatio = npc.life / (float)npc.lifeMax; @@ -45,7 +50,9 @@ public sealed partial class CalamityVanillaAIOverrideNPC : GlobalNPC if (npc.Size != hitboxSize) npc.Size = hitboxSize; } - if (npc.type == NPCID.CultistBossClone) + + // Cultist Clone Light + else if (npc.type == NPCID.CultistBossClone) { if (Main.npc[(int)npc.ai[3]].active) { diff --git a/NPCs/CalamityVanillaAIOverrideNPC.cs b/NPCs/CalamityVanillaAIOverrideNPC.cs index 353c355c11..fed957b35c 100644 --- a/NPCs/CalamityVanillaAIOverrideNPC.cs +++ b/NPCs/CalamityVanillaAIOverrideNPC.cs @@ -52,6 +52,18 @@ public sealed partial class CalamityVanillaAIOverrideNPC : GlobalNPC /// public static bool Enabled { get; set; } = true; + /// + /// Blacklist for non difficulty specific AI changes. External mods can add NPC type to opt-out global changes. + /// Example: Destroyer Probe's Telegraph Drawing + /// + public static HashSet GlobalChangeBlacklist { get; private set; } = []; + + /// + /// Hook to Modify AI Overrides on External mods demand.
+ /// Modifying will result in NPCs to use that specific AI. + ///
+ public static event Action ModifyAIOverride; + /// /// Specify the AI Override to work with. This handles AI, SendExtraAI and ReceiveExtraAI in instaned manner. /// @@ -874,6 +886,8 @@ public sealed partial class CalamityVanillaAIOverrideNPC : GlobalNPC } #endregion + internal static bool IsGlobalChangeBlacklisted(NPC npc) => GlobalChangeBlacklist.Contains(npc.type); + internal static void RegisterNetID(VanillaAIOverride aiOverride) { var id = NetIDLookup.Count + 1; @@ -883,6 +897,8 @@ public sealed partial class CalamityVanillaAIOverrideNPC : GlobalNPC public override void Unload() { NetIDLookup.Clear(); + GlobalChangeBlacklist.Clear(); + ModifyAIOverride = null; } public override void SetDefaults(NPC npc) @@ -895,6 +911,21 @@ public sealed partial class CalamityVanillaAIOverrideNPC : GlobalNPC return; AIOverride = GetVanillaAIOverrideToApply(npc); + if (ModifyAIOverride != null) + { + var context = new VanillaAIOverrideContext() + { + NPC = npc, + NPCType = npc.type, + InRevengeanceWorld = CalamityWorld.revenge, + InDeathWorld = CalamityWorld.death, + InBossRush = BossRushEvent.BossRushActive, + OverrideToApply = AIOverride + }; + ModifyAIOverride.Invoke(context); + AIOverride = context.OverrideToApply; + } + if (AIOverride != null) { AIOverride.NPC = npc; @@ -918,7 +949,7 @@ public sealed partial class CalamityVanillaAIOverrideNPC : GlobalNPC return base.PreAI(npc); bool result = true; - result &= GlobalPreAI(npc); + if (!IsGlobalChangeBlacklisted(npc)) result &= GlobalPreAI(npc); if (AIOverride != null) { result &= AIOverride.AI(Mod); @@ -938,7 +969,7 @@ public sealed partial class CalamityVanillaAIOverrideNPC : GlobalNPC if (!Enabled) return; - GlobalAI(npc); + if (!IsGlobalChangeBlacklisted(npc)) GlobalAI(npc); } public override void PostAI(NPC npc) @@ -1019,7 +1050,7 @@ public sealed partial class CalamityVanillaAIOverrideNPC : GlobalNPC base.PreDraw(npc, spriteBatch, screenPos, drawColor); bool result = true; - result &= GlobalPreDraw(npc, spriteBatch, screenPos, drawColor); + if (!IsGlobalChangeBlacklisted(npc)) result &= GlobalPreDraw(npc, spriteBatch, screenPos, drawColor); result &= AIOverride?.PreDraw(Mod, spriteBatch, screenPos, drawColor) ?? true; return result; } @@ -1029,7 +1060,7 @@ public sealed partial class CalamityVanillaAIOverrideNPC : GlobalNPC if (!Enabled) return; - GlobalPostDraw(npc, spriteBatch, screenPos, drawColor); + if (!IsGlobalChangeBlacklisted(npc)) GlobalPostDraw(npc, spriteBatch, screenPos, drawColor); AIOverride?.PostDraw(Mod, spriteBatch, screenPos, drawColor); } diff --git a/NPCs/Deconstructors/Burrower.cs b/NPCs/Deconstructors/Burrower.cs index e5d3a05607..6f8c89f837 100644 --- a/NPCs/Deconstructors/Burrower.cs +++ b/NPCs/Deconstructors/Burrower.cs @@ -32,11 +32,11 @@ namespace CalamityMod.NPCs.Deconstructors } public override void SetDefaults() { - NPC.damage = 50; + NPC.damage = 0; NPC.width = 88; NPC.height = 88; NPC.lifeMax = 100; - NPC.value = Item.buyPrice(0, 2, 0, 0); + NPC.value = 0; NPC.HitSound = ThanatosHead.ThanatosHitSoundClosed; NPC.DeathSound = CommonCalamitySounds.WulfrumNPCDeathSound; @@ -115,8 +115,8 @@ namespace CalamityMod.NPCs.Deconstructors NPC.damage = 0; NPC.width = 38; NPC.height = 38; - NPC.lifeMax = 1000; - NPC.value = Item.buyPrice(1, 0, 0, 0); + NPC.lifeMax = 500; + NPC.value = Item.buyPrice(0, 0, 50, 0); NPC.rarity = 3; NPC.HitSound = ThanatosHead.ThanatosHitSoundClosed; NPC.DeathSound = SoundID.NPCDeath44; diff --git a/NPCs/NormalNPCs/EarthElemental.cs b/NPCs/NormalNPCs/EarthElemental.cs index 079ff1b9d4..d5c0c8b6f1 100644 --- a/NPCs/NormalNPCs/EarthElemental.cs +++ b/NPCs/NormalNPCs/EarthElemental.cs @@ -15,6 +15,7 @@ using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.NormalNPCs { + [LegacyName("Horse")] public class EarthElemental : ModNPC { public override void SetStaticDefaults() diff --git a/NPCs/VanillaNPCAIOverrides/VanillaAIOverrideContext.cs b/NPCs/VanillaNPCAIOverrides/VanillaAIOverrideContext.cs new file mode 100644 index 0000000000..24e5af1645 --- /dev/null +++ b/NPCs/VanillaNPCAIOverrides/VanillaAIOverrideContext.cs @@ -0,0 +1,13 @@ +using Terraria; + +namespace CalamityMod.NPCs.VanillaNPCAIOverrides; + +public class VanillaAIOverrideContext +{ + public NPC NPC { get; init; } + public int NPCType { get; init; } + public bool InRevengeanceWorld { get; init; } + public bool InDeathWorld { get; init; } + public bool InBossRush { get; init; } + public VanillaAIOverride OverrideToApply { get; set; } +} diff --git a/Projectiles/BaseProjectiles/BaseSwordHoldoutProjectile.cs b/Projectiles/BaseProjectiles/BaseSwordHoldoutProjectile.cs index 4d6cab5a10..ffbdbf9df0 100644 --- a/Projectiles/BaseProjectiles/BaseSwordHoldoutProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseSwordHoldoutProjectile.cs @@ -1,4 +1,6 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; +using System.IO; using System.Linq; using CalamityMod.Graphics.Primitives; using CalamityMod.NPCs; @@ -6,14 +8,11 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; -using Terraria.DataStructures; +using Terraria.Audio; using Terraria.GameContent.Prefixes; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using System; -using System.IO; namespace CalamityMod.Projectiles.BaseProjectiles { @@ -57,19 +56,19 @@ namespace CalamityMod.Projectiles.BaseProjectiles } public override bool CanUseItem(Player player) { - if (player.itemTime > 0) + if (player.itemTime > 0) + { + return false; + } + for (int i = 0; i < 1000; i++) + { + var proj = Main.projectile[i]; + if (proj.type == ProjectileType && proj.owner == player.whoAmI && proj.active) { return false; } - for (int i = 0; i < 1000; i++) - { - var proj = Main.projectile[i]; - if (proj.type == ProjectileType && proj.owner == player.whoAmI && proj.active) - { - return false; - } - } + } return base.CanUseItem(player); } } @@ -172,7 +171,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// /// What sound to use when the sword begins the actual swing (after startup frames) /// - public virtual SoundStyle? UseSound {get; set;} = null; + public virtual SoundStyle? UseSound { get; set; } = null; /// /// The length (from the player) of the projectile's line collision. /// This helps to prevent blindspots. @@ -230,6 +229,8 @@ namespace CalamityMod.Projectiles.BaseProjectiles public float SwingCompletion => swingTimer / (float)swingTime; public float CooldownCompletion => CooldownTimer / (float)CooldownTime; + private bool hasFakedOnSpawn = false; + #endregion #region Overridable Methods @@ -238,10 +239,10 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// public virtual void AdditionalAI() { } /// - /// happens after OnSpawn. Use as not to cancel the default OnSpawn behavior. + /// happens at the beginning of AI the first frame. /// /// - public virtual void Spawn(IEntitySource source) { } + public virtual void Spawn() { } /// /// happens after SetDefaults. Use as not to cancel default SetDefaults behavior. /// @@ -287,7 +288,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles Projectile.timeLeft = swingTime * 2; if (UsesBaseItem) { - Projectile.width = Projectile.height = Math.Max(BaseItem.height,BaseItem.width); + Projectile.width = Projectile.height = Math.Max(BaseItem.height, BaseItem.width); } Projectile.friendly = true; Projectile.penetrate = -1; @@ -302,14 +303,12 @@ namespace CalamityMod.Projectiles.BaseProjectiles Defaults(); } /// - /// DO NOT OVERRIDE IN MOST SITUATIONS - /// use Spawn(IEntitySource) instead - /// That will run spawn code in the proper timing. + /// This hook runs at the beginning of AI the first time through. /// - public override void OnSpawn(IEntitySource source) + private void FakeOnSpawn() { var player = Main.player[Projectile.owner]; - angle = (player.Center - Main.MouseWorld).SafeNormalize(Vector2.One); + angle = (player.Center - player.Calamity().mouseWorld).SafeNormalize(Vector2.One); Projectile.velocity = Vector2.Zero; if (angle.X < 0) { @@ -330,7 +329,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles player.GetModPlayer().swingNum++; } swingTime = Main.player[Projectile.owner].HeldItem.useTime; - Spawn(source); + Spawn(); StartupTime *= Projectile.MaxUpdates; CooldownTime *= Projectile.MaxUpdates; swingTime *= Projectile.MaxUpdates; @@ -369,16 +368,22 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// public override void AI() { + if (!hasFakedOnSpawn) + { + FakeOnSpawn(); + hasFakedOnSpawn = true; + } var player = Main.player[Projectile.owner]; Projectile.gfxOffY = player.gfxOffY; + player.Calamity().mouseWorldListener = true; var modplayer = player.GetModPlayer(); float adust = MathHelper.ToRadians(225); if (timer < StartupTime || timer > StartupTime + swingTime) { if (inStartup) - angle = Vector2.Lerp(angle, (player.Center - Main.MouseWorld).SafeNormalize(Vector2.One), RotateInStartup); + angle = Vector2.Lerp(angle, (player.Center - player.Calamity().mouseWorld).SafeNormalize(Vector2.One), RotateInStartup); if (inCooldown) - angle = Vector2.Lerp(angle, (player.Center - Main.MouseWorld).SafeNormalize(Vector2.One), RotateInCooldown); + angle = Vector2.Lerp(angle, (player.Center - player.Calamity().mouseWorld).SafeNormalize(Vector2.One), RotateInCooldown); if (angle.X < 0) { player.direction = 1; @@ -409,9 +414,9 @@ namespace CalamityMod.Projectiles.BaseProjectiles oldProjectilePos.RemoveAt(0); } } - if (inSwing && swingTimer == 1 && UseSound != null) + if (inSwing && swingTimer == 1 && UseSound != null) { - SoundEngine.PlaySound((SoundStyle)UseSound,player.Center); + SoundEngine.PlaySound((SoundStyle)UseSound, player.Center); } var angle2 = (AlternateSwings && modplayer.swingNum % 2 == 1 ? SwingFunction() : SwingFunction()); Projectile.Center = armCenter - (angle * OffsetDistance * (1 + (Projectile.scale - 1) * 0.75f)).RotatedBy(Projectile.spriteDirection * angle2); @@ -478,13 +483,13 @@ namespace CalamityMod.Projectiles.BaseProjectiles GameShaders.Misc["CalamityMod:ExobladeSlash"].Shader.Parameters["flipped"].SetValue(Projectile.spriteDirection == -1 ? false : true); GameShaders.Misc["CalamityMod:ExobladeSlash"].Apply(); - var positionsToUse = Projectile.oldPos.Take((int)MathHelper.Min(trailLength,swingTimer)).ToArray(); + var positionsToUse = Projectile.oldPos.Take((int)MathHelper.Min(trailLength, swingTimer)).ToArray(); for (var i = 0; i < positionsToUse.Length; i++) { if (i >= timer) break; positionsToUse[i] += (Projectile.oldRot[i] - MathHelper.PiOver4 * (Projectile.spriteDirection == -1 ? 3 : 1)).ToRotationVector2() * this.trailOffset * oldScale[i]; } - PrimitiveRenderer.RenderTrail(positionsToUse, new(trailWidth, trailColor, (_,_) => trailOffset, shader: GameShaders.Misc["CalamityMod:ExobladeSlash"]), 25); + PrimitiveRenderer.RenderTrail(positionsToUse, new(trailWidth, trailColor, (_, _) => trailOffset, shader: GameShaders.Misc["CalamityMod:ExobladeSlash"]), 25); Main.spriteBatch.ExitShaderRegion(); Main.player[Projectile.owner].heldProj = Projectile.whoAmI; @@ -508,7 +513,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles var player = Main.player[Projectile.owner]; var armcenter = player.Center - new Vector2(5 * player.direction, 2); var swordDir = armcenter.DirectionTo(Projectile.Center); - var collisionline = new Vector2(lineCollisionLength / 2f, 0).RotatedBy(swordDir.ToRotation())*Projectile.scale; + var collisionline = new Vector2(lineCollisionLength / 2f, 0).RotatedBy(swordDir.ToRotation()) * Projectile.scale; bool c = Collision.CheckAABBvLineCollision(targetHitbox.Location.ToVector2(), targetHitbox.Size(), Projectile.Center, Projectile.Center + collisionline); if (c && !float.IsNaN(collisionline.X) && !float.IsNaN(collisionline.Y)) return true; @@ -528,27 +533,11 @@ namespace CalamityMod.Projectiles.BaseProjectiles public override void SendExtraAI(BinaryWriter writer) { writer.WriteVector2(angle); - writer.Write(swingTime); - writer.Write(StartupTime); - writer.Write(CooldownTime); - writer.Write(timer); - writer.Write(swingTimer); - writer.Write(ExistsTime); - writer.Write(baseScale); - writer.Write(Projectile.scale); } public override void ReceiveExtraAI(BinaryReader reader) { angle = reader.ReadVector2(); - swingTime = reader.Read(); - StartupTime = reader.Read(); - CooldownTime = reader.Read(); - timer = reader.Read(); - swingTimer = reader.Read(); - ExistsTime = reader.Read(); - baseScale = reader.ReadSingle(); - Projectile.scale = reader.ReadSingle(); } #endregion diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 94261d614c..3ea620c65f 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -327,14 +327,12 @@ namespace CalamityMod.Projectiles void ApplyGrapeBeer() { - conditionalHomingRange = 600; if (projectile.timeLeft > 300 * projectile.MaxUpdates) projectile.timeLeft = 300 * projectile.MaxUpdates; hybridIframes = true; projectile.localNPCHitCooldown = -1; projectile.usesLocalNPCImmunity = true; - Main.player[projectile.owner].Calamity().grapeBeerTimer++; } if (source is EntitySource_ItemUse_WithAmmo {Item: Item item}) { @@ -3068,9 +3066,12 @@ namespace CalamityMod.Projectiles var totalTime = 60 - speedup; if (TimerToCatch + 90 >= 160 - owner.HeldItem.fishingPole && CatchTime >= 0) { + // TODO: Implications of rand here? if (PersistentFishingData == 0) PersistentFishingData = Main.rand.NextBool() ? 1 : -1; var timer = TimerToCatch - 160 - owner.HeldItem.fishingPole; + + // TODO: Fine for others to see? SmallSplashAtOffset(new Vector2(200 * PersistentFishingData * (timer / 90f), 0)); } if (TimerToCatch >= 160 - owner.HeldItem.fishingPole && CatchTime >= 0) @@ -3086,10 +3087,16 @@ namespace CalamityMod.Projectiles } if (CatchTime < 0 && CatchTime % totalTime == 0) { + // TODO: Fine for others to see? Splash(); + // TODO: Implications of rand here? PersistentFishingData = Main.rand.Next(0, 4); - var particle = new CustomSpark(projectile.Center, Vector2.UnitX.RotatedBy(PersistentFishingData * MathHelper.PiOver2) * 10, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 45 - speedup, 0.04f, Color.Blue, new(1, 2), shrinkSpeed: -0.2f); - GeneralParticleHandler.SpawnParticle(particle); + + if (owner.whoAmI == Main.myPlayer) + { + var particle = new CustomSpark(projectile.Center, Vector2.UnitX.RotatedBy(PersistentFishingData * MathHelper.PiOver2) * 10, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 45 - speedup, 0.04f, Color.Blue, new(1, 2), shrinkSpeed: -0.2f); + GeneralParticleHandler.SpawnParticle(particle); + } } if (CatchTime < 0 && CatchTime % totalTime == -15) { @@ -3116,16 +3123,18 @@ namespace CalamityMod.Projectiles } else { - - if (playerDir >= 0) + if (owner.whoAmI == Main.myPlayer) { - var particle = new CustomSpark(projectile.Center, Vector2.UnitX.RotatedBy(playerDir * MathHelper.PiOver2) * 10, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 15, 0.04f, Color.Red, new(1, 2), shrinkSpeed: -0.2f); - GeneralParticleHandler.SpawnParticle(particle); - } - else - { - var particle = new CustomSpark(projectile.Center, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 15, 0.06f, Color.Red, Vector2.One); - GeneralParticleHandler.SpawnParticle(particle); + if (playerDir >= 0) + { + var particle = new CustomSpark(projectile.Center, Vector2.UnitX.RotatedBy(playerDir * MathHelper.PiOver2) * 10, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 15, 0.04f, Color.Red, new(1, 2), shrinkSpeed: -0.2f); + GeneralParticleHandler.SpawnParticle(particle); + } + else + { + var particle = new CustomSpark(projectile.Center, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 15, 0.06f, Color.Red, Vector2.One); + GeneralParticleHandler.SpawnParticle(particle); + } } TimerToCatch = 0; CatchTime = 0; @@ -3147,8 +3156,6 @@ namespace CalamityMod.Projectiles } if (projectile.ai[0] == 0) { - - projectile.ai[1] = CatchTime; projectile.localAI[1] = TimerToCatch; if (CaughtItemID != -1 && isReelingIn == 0) @@ -3179,13 +3186,28 @@ namespace CalamityMod.Projectiles { owner.Calamity().ShouldHideControls = true; if (owner.Calamity().pressedUp) + { projectile.velocity.Y -= 0.125f; + projectile.netUpdate = true; + } + if (owner.Calamity().pressedDown) + { projectile.velocity.Y += 0.125f; + projectile.netUpdate = true; + } + if (owner.Calamity().pressedLeft) + { projectile.velocity.X -= 0.125f; + projectile.netUpdate = true; + } + if (owner.Calamity().pressedRight) + { projectile.velocity.X += 0.125f; + projectile.netUpdate = true; + } } projectile.velocity *= 0.975f; @@ -3197,32 +3219,35 @@ namespace CalamityMod.Projectiles projectile.FishingCheck(); if (projectile.ai[1] < 0) { - CaughtItemID = (int)projectile.localAI[1]; projectile.ai[1] = 0; projectile.localAI[1] = 0; - for (var i = 0; i < 1000; i++) + + if (owner.whoAmI == Main.myPlayer) { - var vectorToCheck = projectile.Center + new Vector2(Main.rand.Next(-200, 201), Main.rand.Next(-200, 201)); - var tileCoordsToCheck = vectorToCheck.ToSafeTileCoordinates(); - if (new Rectangle((int)Main.screenPosition.X, (int)Main.screenPosition.Y, Main.screenWidth, Main.screenHeight).Contains((int)vectorToCheck.X, (int)vectorToCheck.Y) && !Main.tile[tileCoordsToCheck.X, tileCoordsToCheck.Y].IsTileSolid() && Main.tile[tileCoordsToCheck.X, tileCoordsToCheck.Y].LiquidAmount > 0) + for (var i = 0; i < 1000; i++) { - if (projectile.localAI[2] >= 1) + var vectorToCheck = projectile.Center + new Vector2(Main.rand.Next(-200, 201), Main.rand.Next(-200, 201)); + var tileCoordsToCheck = vectorToCheck.ToSafeTileCoordinates(); + if (new Rectangle((int)Main.screenPosition.X, (int)Main.screenPosition.Y, Main.screenWidth, Main.screenHeight).Contains((int)vectorToCheck.X, (int)vectorToCheck.Y) && !Main.tile[tileCoordsToCheck.X, tileCoordsToCheck.Y].IsTileSolid() && Main.tile[tileCoordsToCheck.X, tileCoordsToCheck.Y].LiquidAmount > 0) { - int customSonarText = (int)(projectile.localAI[2] - 1); - if (Main.popupText[customSonarText].sonar) + if (projectile.localAI[2] >= 1) { - Main.popupText[customSonarText].position = vectorToCheck - FontAssets.MouseText.Value.MeasureString(Main.popupText[customSonarText].name) / 2f; + int customSonarText = (int)(projectile.localAI[2] - 1); + if (Main.popupText[customSonarText].sonar) + { + Main.popupText[customSonarText].position = vectorToCheck - FontAssets.MouseText.Value.MeasureString(Main.popupText[customSonarText].name) / 2f; + } } + PersistentFishingDataVector2 = vectorToCheck; + TimerToCatch = 600; + break; } - PersistentFishingDataVector2 = vectorToCheck; - TimerToCatch = 600; - break; } } } } - if (PersistentFishingDataVector2 != Vector2.Zero) + if (PersistentFishingDataVector2 != Vector2.Zero && owner.whoAmI == Main.myPlayer) { Dust.NewDustPerfect(PersistentFishingDataVector2, DustID.Smoke); if (Main.rand.NextBool(3)) @@ -3234,7 +3259,7 @@ namespace CalamityMod.Projectiles } //When in lava, give the bobber a particle over it to show its location - if (projectile.lavaWet) + if (projectile.lavaWet && owner.whoAmI == Main.myPlayer) { var particle = new CustomSpark(projectile.Center, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 2, 0.01f, Color.DarkGray, Vector2.One); GeneralParticleHandler.SpawnParticle(particle); @@ -3361,10 +3386,13 @@ namespace CalamityMod.Projectiles { if (PersistentFishingData == 0) PersistentFishingData = Main.rand.NextBool() ? 1 : -1; - var timer = TimerToCatch - 300; - SmallSplashAtOffset(new Vector2(200 * PersistentFishingData * (timer / 90f), 0)); - SmallDustAtOffset(new Vector2(200 * PersistentFishingData * (timer / 90f), 0), DustID.BlueCrystalShard); + if (owner.whoAmI == Main.myPlayer) + { + var timer = TimerToCatch - 300; + SmallSplashAtOffset(new Vector2(200 * PersistentFishingData * (timer / 90f), 0)); + SmallDustAtOffset(new Vector2(200 * PersistentFishingData * (timer / 90f), 0), DustID.BlueCrystalShard); + } } if (TimerToCatch >= 300 && CatchTime >= 0) { @@ -3377,7 +3405,7 @@ namespace CalamityMod.Projectiles } TimerToCatch = 0; } - if (CatchTime < 0 && CatchTime % totalTime == 0) + if (CatchTime < 0 && CatchTime % totalTime == 0 && owner.whoAmI == Main.myPlayer) { Splash(); PersistentFishingData = Main.rand.Next(0, 2); @@ -3401,16 +3429,18 @@ namespace CalamityMod.Projectiles } else { - - if (playerDir >= 0) + if (owner.whoAmI == Main.myPlayer) { - var particle = new CustomSpark(projectile.Center, Vector2.UnitX.RotatedBy(playerDir * MathHelper.Pi) * 10, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 15, 0.04f, Color.Red, new(1, 2), shrinkSpeed: -0.2f); - GeneralParticleHandler.SpawnParticle(particle); - } - else - { - var particle = new CustomSpark(projectile.Center, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 15, 0.06f, Color.Red, Vector2.One); - GeneralParticleHandler.SpawnParticle(particle); + if (playerDir >= 0) + { + var particle = new CustomSpark(projectile.Center, Vector2.UnitX.RotatedBy(playerDir * MathHelper.Pi) * 10, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 15, 0.04f, Color.Red, new(1, 2), shrinkSpeed: -0.2f); + GeneralParticleHandler.SpawnParticle(particle); + } + else + { + var particle = new CustomSpark(projectile.Center, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 15, 0.06f, Color.Red, Vector2.One); + GeneralParticleHandler.SpawnParticle(particle); + } } TimerToCatch = 0; CatchTime = 0; @@ -3524,7 +3554,7 @@ namespace CalamityMod.Projectiles projectile.velocity *= 0.99f; //When in lava, give the bobber a particle over it to show its location - if (projectile.lavaWet) + if (projectile.lavaWet && owner.whoAmI == Main.myPlayer) { var particle = new CustomSpark(projectile.Center, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 2, 0.01f, Color.DarkGray, Vector2.One); GeneralParticleHandler.SpawnParticle(particle); @@ -3533,15 +3563,35 @@ namespace CalamityMod.Projectiles { if (owner.Calamity().pressedUp && projectile.velocity.Y < 0) + { projectile.velocity.Y -= 0.3f; + projectile.netUpdate = true; + } + if (owner.Calamity().pressedUp && Waterline.Y < projectile.Center.Y) + { projectile.velocity.Y -= 0.3f; + projectile.netUpdate = true; + } + if (owner.Calamity().pressedDown) + { projectile.velocity.Y += 0.25f; + projectile.netUpdate = true; + } + if (owner.Calamity().pressedLeft) + { projectile.velocity.X -= 0.25f; + projectile.netUpdate = true; + } + if (owner.Calamity().pressedRight) + { projectile.velocity.X += 0.25f; + projectile.netUpdate = true; + } + if (Waterline.Y <= projectile.Center.Y - 8) TimerToCatch -= Main.rand.Next(1, 5); if (TimerToCatch <= 0) @@ -3574,7 +3624,7 @@ namespace CalamityMod.Projectiles } } } - if (PersistentFishingDataVector2 != Vector2.Zero && owner.miscCounter % 15 == 0) + if (PersistentFishingDataVector2 != Vector2.Zero && owner.miscCounter % 15 == 0 && owner.whoAmI == Main.myPlayer) { var particle = new CustomSpark(PersistentFishingDataVector2, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 25, 0.02f, Color.Green, Vector2.One); diff --git a/Projectiles/CalamityGlobalProjectileTweaks.cs b/Projectiles/CalamityGlobalProjectileTweaks.cs index 590d769244..9d21db0c48 100644 --- a/Projectiles/CalamityGlobalProjectileTweaks.cs +++ b/Projectiles/CalamityGlobalProjectileTweaks.cs @@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles { ProjectileID.BlueCounterweight, counterweightTweaks }, { ProjectileID.BlueMoon, Do(ExtraUpdatesExact(1)) }, { ProjectileID.Bullet, Do(ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, - { ProjectileID.BulletHighVelocity, Do(LocalIFrames(-1)) }, + { ProjectileID.BulletHighVelocity, Do(ExtraUpdatesDelta(+2), LocalIFrames(-1)) }, { ProjectileID.ButchersChainsaw, Do(TrueMeleeNoSpeed, ArmorPenetrationDelta(+15), LocalIFrames(7), ScaleExact(1.5f)) }, { ProjectileID.ChlorophyteChainsaw, standardChainsawTweaks }, { ProjectileID.ChlorophyteDrill, standardDrillTweaks }, diff --git a/Projectiles/DraedonsArsenal/AugerHoldout.cs b/Projectiles/DraedonsArsenal/AugerHoldout.cs index 733550f829..55dc54e885 100644 --- a/Projectiles/DraedonsArsenal/AugerHoldout.cs +++ b/Projectiles/DraedonsArsenal/AugerHoldout.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // Both checks to make sure sounds/hitboxes only happen once per swing public bool makeSound = true; public bool makeHitbox = true; - public int cooldownGiven => (int)(400 / Owner.GetAttackSpeed()); // Cooldown is effected by melee speed, lines up perfectly so you do 10 swings and end in time for a big swing + public int cooldownGiven => (int)(800 / Owner.GetAttackSpeed()); // Cooldown is effected by melee speed, lines up perfectly so you do 22 swings and end in time for a big swing public float pullFx = 1; // Scaling on the effects of the blade when it's buffed public bool pressedRight = false; // Spawns a hitbox to do damage, rather than dealing damage itself diff --git a/Projectiles/DraedonsArsenal/AugerPull.cs b/Projectiles/DraedonsArsenal/AugerPull.cs index 4362c1686c..ce365ce951 100644 --- a/Projectiles/DraedonsArsenal/AugerPull.cs +++ b/Projectiles/DraedonsArsenal/AugerPull.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (target != null && target.CanBeMoved(true) && Collision.CanHit(Projectile.Center, 1, 1, target.Center, 1, 1) && Vector2.Distance(target.Center, Projectile.Center) < 650) { Vector2 moveDir = target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX); - target.velocity = moveDir * 20; + target.velocity = moveDir; target.Center += moveDir * 3f; } } @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (Vector2.Distance(target.Center, Projectile.Center) > 15 && Vector2.Distance(target.Center, Projectile.Center) < 300) { Vector2 moveDir = target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX); - target.velocity = Vector2.Lerp(target.velocity, moveDir * 18, 0.12f); + target.velocity = Vector2.Lerp(target.velocity, moveDir * 5, 0.12f); target.Center += moveDir * 2f; } } diff --git a/Projectiles/DraedonsArsenal/AugerSlash.cs b/Projectiles/DraedonsArsenal/AugerSlash.cs index 6ead6c5d0c..ac72757579 100644 --- a/Projectiles/DraedonsArsenal/AugerSlash.cs +++ b/Projectiles/DraedonsArsenal/AugerSlash.cs @@ -117,6 +117,17 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } } } + + public override bool? CanHitNPC(NPC target) + { + Player owner = Main.player[Projectile.owner]; + + if (!Collision.CanHitLine( + owner.Center, 1, 1, + target.Center, 1, 1)) + return false; + return base.CanHitNPC(target); + } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { if (Projectile.timeLeft <= 10) diff --git a/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs index 8d47e17e69..36a3eebbcb 100644 --- a/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs +++ b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs @@ -72,11 +72,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // Update the damage of the holdout projectile constantly so that it decreases as charge decreases, even while in use. Projectile.damage = Owner.GetWeaponDamage(heldItem); - // Check if the player's held item still has sufficient charge. If so, and they're still using it, take a tiny bit of charge from it. CalamityGlobalItem modItem = heldItem.Calamity(); - if ((Owner.channel || Owner.Calamity().mouseRight) && modItem.Charge >= HydraulicVoltCrasher.HoldoutChargeUse) + if ((Owner.channel || Owner.Calamity().mouseRight)) { - modItem.Charge -= HydraulicVoltCrasher.HoldoutChargeUse; float speed = Owner.inventory[Owner.selectedItem].shootSpeed * Projectile.scale; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction diff --git a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs index 89ee94fd78..beec781400 100644 --- a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs +++ b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs @@ -37,14 +37,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal private const float MaximumMouseRange = 360f; private const float ProjCenterOffset = 36f; - public bool IsSmall - { - get - { - CalamityGlobalItem swordItem = Main.player[Projectile.owner].HeldItem.Calamity(); - return swordItem.ChargeRatio < Phaseslayer.SizeChargeThreshold; - } - } + public bool IsSmall => false; //Phaseslayer no longer uses charge so no longer gets small. I don't care to redo the code to remove this entirely so it's just being set to false. // ai[0] wrapper. Stores a rolling lerped average of angular momentum which is used as the swing speed damage multiplier. public float AngularDamageFactor @@ -116,12 +109,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal AdjustCurrentDamage(player, deltaAngle); ManipulateFrames(); HandleSwordBeams(player, modItem, deltaAngle); - - // Because sword beams (or just holding the sword while it's fizzling) can take energy even when the sword's at zero energy, - // this is here to ensure the sword item's charge never goes below zero. - if (modItem.Charge < 0f) - modItem.Charge = 0f; - HandleFadeout(); } @@ -131,7 +118,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { // In addition to typical channel cancellation criteria, the sword fizzles out if it runs out of charge. Item playerItem = player.HeldItem; - bool hasCharge = modItem.Charge > 0f; + bool hasCharge = true; // Phaseslayer no longer uses charge so always true. if (!player.CantUseHoldout() && playerItem.type == ModContent.ItemType() && hasCharge) { // 14NOV2024: Ozzatron: clamped mouse position unnecessary, the effect is capped separately @@ -251,9 +238,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { Vector2 velocity = Projectile.rotation.ToRotationVector2() * 20f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * SwordBeamDamageMultiplier), 0f, player.whoAmI); - - // Actually consume energy to fire the sword beam. - modItem.Charge -= Phaseslayer.SwordBeamChargeUse; } // The sound delay doubles as the sword beam's cooldown. diff --git a/Projectiles/Magic/AlphaDraconisStar.cs b/Projectiles/Magic/AlphaDraconisStar.cs index a54c132ee8..d209c22695 100644 --- a/Projectiles/Magic/AlphaDraconisStar.cs +++ b/Projectiles/Magic/AlphaDraconisStar.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.width = 22; Projectile.height = 24; Projectile.friendly = true; - Projectile.penetrate = -1; + Projectile.penetrate = 5; Projectile.DamageType = DamageClass.Magic; Projectile.extraUpdates = 4; Projectile.usesLocalNPCImmunity = true; @@ -32,6 +32,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.scale = 0.5f; Projectile.tileCollide = false; Projectile.timeLeft = Projectile.MaxUpdates * 300; + Projectile.stopsDealingDamageAfterPenetrateHits = true; } public override void AI() diff --git a/Projectiles/Magic/Shadowbolt.cs b/Projectiles/Magic/Shadowbolt.cs index 023e40225a..2cdc0e9dd2 100644 --- a/Projectiles/Magic/Shadowbolt.cs +++ b/Projectiles/Magic/Shadowbolt.cs @@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles.Magic } } - if (!hasReboundOffPlat && Projectile.numHits == 0 && !hasSetPlatSpawn && (Collision.SolidCollision(Projectile.Center, 20, 20) || time > 70)) + if (!hasReboundOffPlat && Projectile.numHits == 0 && !hasSetPlatSpawn && time > 70) { hasSetPlatSpawn = true; spawnPlat = true; diff --git a/Projectiles/Melee/CrescentMoonProj.cs b/Projectiles/Melee/CrescentMoonProj.cs index f3262e0e04..8b2486a67f 100644 --- a/Projectiles/Melee/CrescentMoonProj.cs +++ b/Projectiles/Melee/CrescentMoonProj.cs @@ -58,6 +58,13 @@ namespace CalamityMod.Projectiles.Melee CalamityUtils.HomeInOnNPC(Projectile, true, 600f, 12f, 20f, true); } + public override bool? CanHitNPC(NPC target) + { + if (target.CanBeChasedBy(Projectile, false) && target.Calamity().IsArmored()) + return false; + return base.CanHitNPC(target); + } + public override void OnKill(int timeLeft) { for (int i = 0; i < 5; i++) diff --git a/Projectiles/Melee/GelWave.cs b/Projectiles/Melee/GelWave.cs index 04c0470b26..e8e142abcb 100644 --- a/Projectiles/Melee/GelWave.cs +++ b/Projectiles/Melee/GelWave.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -10,7 +9,6 @@ namespace CalamityMod.Projectiles.Melee { public new string LocalizationCategory => "Projectiles.Melee"; - public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/GeliticBladeWave"); public override void SetStaticDefaults() { @@ -34,11 +32,6 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (Projectile.localAI[0] == 0f) - { - SoundEngine.PlaySound(UseSound with { Volume = 3f, PitchVariance = 0.25f }, Projectile.position); - Projectile.localAI[0] += 1f; - } Lighting.AddLight(Projectile.Center, Color.Blue.ToVector3()); Projectile.rotation = Projectile.velocity.ToRotation(); if (Main.rand.NextBool(10)) diff --git a/Projectiles/Melee/LucreciaHoldout.cs b/Projectiles/Melee/LucreciaHoldout.cs index 563156fa77..16623a3a65 100644 --- a/Projectiles/Melee/LucreciaHoldout.cs +++ b/Projectiles/Melee/LucreciaHoldout.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = Projectile.height = 54; } - public override void Spawn(IEntitySource source) + public override void Spawn() { var player = Main.player[Projectile.owner]; var modplayer = player.GetModPlayer(); @@ -179,12 +179,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.scale = baseScale * MathHelper.Lerp(0.9f, 1.4f, eased); // VFX vars - Vector2 mousePosition = Main.MouseWorld; + Vector2 mousePosition = player.Calamity().mouseWorld; Vector2 fireDirection = Vector2.Normalize(mousePosition - player.Center); if (!trailFXTriggered) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), player.Center, fireDirection * 5, ModContent.ProjectileType(), Projectile.damage * 8, Projectile.knockBack, Projectile.owner, 0f, 0f); + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), player.Center, fireDirection * 5, ModContent.ProjectileType(), Projectile.damage * 8, Projectile.knockBack, Projectile.owner, 0f, 0f); SoundStyle swish = new("CalamityMod/Sounds/Custom/MeatySlash"); SoundEngine.PlaySound(swish with { Volume = 0.3f, Pitch = Main.rand.NextFloat(0.1f, 0.2f) }, Projectile.Center); diff --git a/Projectiles/Melee/MawOfInfinityHoldout.cs b/Projectiles/Melee/MawOfInfinityHoldout.cs index 50c78908ce..cb0d2546cb 100644 --- a/Projectiles/Melee/MawOfInfinityHoldout.cs +++ b/Projectiles/Melee/MawOfInfinityHoldout.cs @@ -37,14 +37,16 @@ namespace CalamityMod.Projectiles.Melee Projectile.extraUpdates = 5; //ExtraUpdates help make collision more accurate Projectile.noEnchantmentVisuals = true; } - public override void Spawn(IEntitySource source) + public override void Spawn() { var player = Main.player[Projectile.owner]; var modplayer = player.GetModPlayer(); StartupTime = 10; CooldownTime = 10; swingTime -= StartupTime + CooldownTime; - modplayer.swingNum = modplayer.swingNum++ % 3; + + if (Main.myPlayer == Projectile.owner) + modplayer.swingNum = modplayer.swingNum++ % 3; OffsetDistance = 70; RotateInStartup = 0.2f; RotateInCooldown = 0f; @@ -91,6 +93,7 @@ namespace CalamityMod.Projectiles.Melee Main.projectile[p].friendly = true; Main.projectile[p].DamageType = DamageClass.Melee; Main.projectile[p].timeLeft = 120; + Main.projectile[p].netUpdate = true; } } } @@ -116,8 +119,8 @@ namespace CalamityMod.Projectiles.Melee case 0: if (Main.myPlayer == Projectile.owner) Projectile.NewProjectile(Projectile.GetSource_FromThis(), player.Center, -angle * 3, ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack, player.whoAmI); - player.itemAnimation = BaseItem.useAnimation; - player.itemTime = BaseItem.useTime; + player.itemAnimation = BaseItem.useAnimation; + player.itemTime = BaseItem.useTime; Projectile.Kill(); return; } diff --git a/Projectiles/Melee/MawOfInfinityJaws.cs b/Projectiles/Melee/MawOfInfinityJaws.cs index 69bad96387..3a910c3585 100644 --- a/Projectiles/Melee/MawOfInfinityJaws.cs +++ b/Projectiles/Melee/MawOfInfinityJaws.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -30,6 +31,18 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = 10; } + public override void SendExtraAI(BinaryWriter writer) + { + writer.WriteVector2(GoalPos); + writer.WriteVector2(StartPos); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + GoalPos = reader.ReadVector2(); + StartPos = reader.ReadVector2(); + } + Vector2 GoalPos = Vector2.Zero; Vector2 StartPos = Vector2.Zero; float offset = 0; @@ -41,6 +54,7 @@ namespace CalamityMod.Projectiles.Melee { GoalPos = player.Calamity().mouseWorld; StartPos = Projectile.Center; + Projectile.netUpdate = true; } Projectile.Center = Vector2.Lerp(StartPos, GoalPos, MathHelper.Min(1,MathF.Pow(1 - (Projectile.timeLeft - 5) / 30f,0.5f))); Projectile.rotation = StartPos.DirectionTo(GoalPos).ToRotation(); diff --git a/Projectiles/Melee/MirrorBladeProjectile.cs b/Projectiles/Melee/MirrorBladeProjectile.cs index d134a0b5f8..56cca4d246 100644 --- a/Projectiles/Melee/MirrorBladeProjectile.cs +++ b/Projectiles/Melee/MirrorBladeProjectile.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee public override bool drawSwordTrail => false; public override Color[] trailColors => new Color[] { Color.Red, Color.MediumPurple, Color.Purple }; public override int StartupTime { get; set; } public override int CooldownTime { get; set; } - public override bool AlternateSwings => true; + public override bool AlternateSwings => false; public bool SpawnShards = true; public override bool useMeleeSpeed => true; @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.extraUpdates = 3; } - public override void Spawn(IEntitySource source) + public override void Spawn() { var player = Main.player[Projectile.owner]; var modplayer = player.GetModPlayer(); diff --git a/Projectiles/Melee/MirrorBlast.cs b/Projectiles/Melee/MirrorBlast.cs index 20f70b3d07..276bc0972a 100644 --- a/Projectiles/Melee/MirrorBlast.cs +++ b/Projectiles/Melee/MirrorBlast.cs @@ -56,8 +56,8 @@ namespace CalamityMod.Projectiles.Melee { isShard = reader.ReadBoolean(); hasSpawned = reader.ReadBoolean(); - shardNum = reader.Read(); - shardShield = reader.Read(); + shardNum = reader.ReadInt32(); + shardShield = reader.ReadInt32(); } public override bool? CanDamage() { @@ -73,8 +73,24 @@ namespace CalamityMod.Projectiles.Melee } public override void AI() { + player.Calamity().mouseWorldListener = true; if (!hasSpawned) { + Projectile.netUpdate = true; + if (Projectile.ai[0] != 0) + { + //This is used when spawned by Evolution. + //Setting AP so high guarantees we get the full dmg of the projectile. + Projectile.ArmorPenetration = 1000; + hasSpawned = true; + shardShield = 0; + isShard = false; + Projectile.timeLeft = 1200; + Projectile.velocity = Projectile.DirectionTo(player.Center) * -20f; + Projectile.DamageType = DamageClass.Generic; + Projectile.CritChance = 0; + return; + } shardNum = player.ownedProjectileCounts[Projectile.type]; hasSpawned = true; shardNum = 0; @@ -83,6 +99,7 @@ namespace CalamityMod.Projectiles.Melee if (proj.active && proj.type == ModContent.ProjectileType() && proj.owner == Projectile.owner) { (proj.ModProjectile as MirrorBlast).shardNum++; + proj.netUpdate = true; } } } @@ -94,6 +111,7 @@ namespace CalamityMod.Projectiles.Melee isShard = false; Projectile.timeLeft = 1200; Projectile.velocity = Projectile.DirectionTo(player.Center) * -20f; + Projectile.netUpdate = true; return; } List positions = new List() //Hardcoded positions for the mirror shield shards so we can make it look nice diff --git a/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs b/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs index 6131ada730..4ef4e0f9b3 100644 --- a/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs +++ b/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords Projectile.extraUpdates = 3; } - public override void Spawn(IEntitySource source) + public override void Spawn() { angle = angle.RotatedByRandom(0.25f); } @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords using (Main.spriteBatch.Scope()) { Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Main.spriteBatch.Draw(tex, Projectile.Center + sparkAngle * -10 - Main.screenPosition, null, Color.SkyBlue * 0.75f, sparkAngle.ToRotation() + MathHelper.PiOver2, new Vector2(tex.Width * 0.5f,tex.Height), new Vector2(0.85f, MathHelper.Lerp(0.1f, 1.4f, SwingCompletion)) * Projectile.scale * 0.04f, SpriteEffects.None, 1); + Main.spriteBatch.Draw(tex, Projectile.Center + sparkAngle * -10 - Main.screenPosition, null, Color.SkyBlue * 0.75f, sparkAngle.ToRotation() + MathHelper.PiOver2, new Vector2(tex.Width * 0.5f,tex.Height), new Vector2(0.85f, MathHelper.Lerp(0.1f, 1.55f, SwingCompletion)) * Projectile.scale * 0.04f, SpriteEffects.None, 1); Main.spriteBatch.End(); } @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - var lineCollisionLength = 160; + var lineCollisionLength = 192; var player = Main.player[Projectile.owner]; var armcenter = player.Center - new Vector2(5 * player.direction, 2); var swordDir = armcenter.DirectionTo(Projectile.Center); diff --git a/Projectiles/Melee/Shortswords/GalileoGladiusThrown.cs b/Projectiles/Melee/Shortswords/GalileoGladiusThrown.cs index 1f660375a7..5e612c0346 100644 --- a/Projectiles/Melee/Shortswords/GalileoGladiusThrown.cs +++ b/Projectiles/Melee/Shortswords/GalileoGladiusThrown.cs @@ -21,9 +21,9 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Shortswords { - public class GalileoGladiusThrown : ModProjectile + public class GalileoGladiusThrown : ModProjectile, ILocalizedModType { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public new string LocalizationCategory => "Projectiles.Melee"; public Player Owner => Main.player[Projectile.owner]; public override string Texture => "CalamityMod/Items/Weapons/Melee/GalileoGladius"; @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords else { Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; - if (Projectile.Distance(Owner.Center) > 900) + if (Projectile.Distance(Owner.Center) > 1000) { Projectile.ai[1] = 1; } @@ -143,8 +143,21 @@ namespace CalamityMod.Projectiles.Melee.Shortswords Projectile.damage *= 20; Projectile.Damage(); Owner.Calamity().StratusStarburst -= 10; + for (int i = 0; i < 3; i++) + { + float moveDuration = Main.rand.Next(5, 15); + var proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.rotation + MathHelper.PiOver4*3).ToRotationVector2().RotatedByRandom(0.4f) * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), Projectile.originalDamage, Projectile.knockBack, Projectile.owner, 0f, moveDuration); + if (Main.projectile.IndexInRange(proj)) + { + Main.projectile[proj].DamageType = DamageClass.Melee; + Main.projectile[proj].usesIDStaticNPCImmunity = false; + Main.projectile[proj].usesLocalNPCImmunity = true; + Main.projectile[proj].localNPCHitCooldown = 20; + } + } Projectile.velocity = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * -15; SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact, Owner.Center); + } stabbedNPC = null; } @@ -219,7 +232,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords stabbedNPC = target; NPCOffset = Projectile.Center - target.Center; } - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 600); } List<(float, float)> offsets = new() diff --git a/Projectiles/Melee/Spears/GildedProboscisProj.cs b/Projectiles/Melee/Spears/GildedProboscisProj.cs index b1e15fc195..b4c31c6166 100644 --- a/Projectiles/Melee/Spears/GildedProboscisProj.cs +++ b/Projectiles/Melee/Spears/GildedProboscisProj.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Melee.Spears Projectile.extraUpdates = 5; //ExtraUpdates help make the VFX smoother Projectile.noEnchantmentVisuals = true; } - public override void Spawn(IEntitySource source) + public override void Spawn() { //This sets variables for the spear in general, as well as the secondary attack //The secondary attack is the "default" because it was coded first diff --git a/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs b/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs index 31d0477afd..843103b40d 100644 --- a/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs +++ b/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee public bool hasGivenBlood = false; - public override void Spawn(IEntitySource source) + public override void Spawn() { var player = Main.player[Projectile.owner]; var modplayer = player.GetModPlayer(); diff --git a/Projectiles/Ranged/BlightFlames.cs b/Projectiles/Ranged/BlightFlames.cs index 6e7cd5ea41..78afb7d58f 100644 --- a/Projectiles/Ranged/BlightFlames.cs +++ b/Projectiles/Ranged/BlightFlames.cs @@ -118,8 +118,11 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { //if (!postTileHit) - //Projectile.Center = Projectile.Center + Main.rand.NextVector2Circular(20, 20); - target.AddBuff(ModContent.BuffType(), 420); + //Projectile.Center = Projectile.Center + Main.rand.NextVector2Circular(20, 20); + + //Doze - Flamethrowers in vanilla are long debuff infliction tools (20 seconds of their debuff). + //I am applying this as the base for Cal flamethrowers, with shorter times being the exception instead of the rule + target.AddBuff(ModContent.BuffType(), 1200); for (int i = 0; i <= 3; i++) { diff --git a/Projectiles/Ranged/BloodBoilerFire.cs b/Projectiles/Ranged/BloodBoilerFire.cs index ccdedc8a8d..6f66d1d97f 100644 --- a/Projectiles/Ranged/BloodBoilerFire.cs +++ b/Projectiles/Ranged/BloodBoilerFire.cs @@ -208,8 +208,11 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 360); - target.AddBuff(ModContent.BuffType(), 360); + + //Doze - Flamethrowers in vanilla are long debuff infliction tools (20 seconds of their debuff). + //I am applying this as the base for Cal flamethrowers, with shorter times being the exception instead of the rule + target.AddBuff(ModContent.BuffType(), 1200); + target.AddBuff(ModContent.BuffType(), 1200); improvedHeal = true; } diff --git a/Projectiles/Ranged/BrimstoneFireFriendly.cs b/Projectiles/Ranged/BrimstoneFireFriendly.cs index 75f421c5e6..d10e45801b 100644 --- a/Projectiles/Ranged/BrimstoneFireFriendly.cs +++ b/Projectiles/Ranged/BrimstoneFireFriendly.cs @@ -82,7 +82,9 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 240); + //Doze - Flamethrowers in vanilla are long debuff infliction tools (20 seconds of their debuff). + //I am applying this as the base for Cal flamethrowers, with shorter times being the exception instead of the rule + target.AddBuff(ModContent.BuffType(), 1200); // Gas up the enemy int smokeCount = 3 + (int)MathHelper.Clamp(target.width * 0.1f, 0f, 20f); diff --git a/Projectiles/Ranged/ChromaticFire.cs b/Projectiles/Ranged/ChromaticFire.cs index f487e3028a..bd30a4ba89 100644 --- a/Projectiles/Ranged/ChromaticFire.cs +++ b/Projectiles/Ranged/ChromaticFire.cs @@ -96,6 +96,9 @@ namespace CalamityMod.Projectiles.Ranged // Circular hitbox adjusted for the size of the smoke particles (which is 52 here) public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 52 * Projectile.scale * 0.5f, targetHitbox); - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 540); + + //Doze - Flamethrowers in vanilla are long debuff infliction tools (20 seconds of their debuff). + //I am applying this as the base for Cal flamethrowers, with shorter times being the exception instead of the rule + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 1200); } } diff --git a/Projectiles/Ranged/ChromaticFlare.cs b/Projectiles/Ranged/ChromaticFlare.cs index 660fe9be9d..99a1d3fd7b 100644 --- a/Projectiles/Ranged/ChromaticFlare.cs +++ b/Projectiles/Ranged/ChromaticFlare.cs @@ -82,7 +82,9 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 540); + //Doze - Flamethrowers in vanilla are long debuff infliction tools (20 seconds of their debuff). + //I am applying this as the base for Cal flamethrowers, with shorter times being the exception instead of the rule + target.AddBuff(ModContent.BuffType(), 1200); // Lose a bit of damage from repeated hits if ((StickToEnemies || StickToTiles) && Projectile.damage > 1) diff --git a/Projectiles/Ranged/DragonsBreathFlames.cs b/Projectiles/Ranged/DragonsBreathFlames.cs index 16fe7ff92b..643df17066 100644 --- a/Projectiles/Ranged/DragonsBreathFlames.cs +++ b/Projectiles/Ranged/DragonsBreathFlames.cs @@ -226,7 +226,10 @@ namespace CalamityMod.Projectiles.Ranged } postHit = true; } - target.AddBuff(ModContent.BuffType(), 240); + + //Doze - Flamethrowers in vanilla are long debuff infliction tools (20 seconds of their debuff). + //I am applying this as the base for Cal flamethrowers, with shorter times being the exception instead of the rule + target.AddBuff(ModContent.BuffType(), 1200); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Ranged/DrizzlefishFire.cs b/Projectiles/Ranged/DrizzlefishFire.cs index 770f16344a..9d8f700405 100644 --- a/Projectiles/Ranged/DrizzlefishFire.cs +++ b/Projectiles/Ranged/DrizzlefishFire.cs @@ -163,6 +163,10 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + + //Doze - Flamethrowers in vanilla are long debuff infliction tools (20 seconds of their debuff). + //I am applying this as the base for Cal flamethrowers, with shorter times being the exception instead of the rule + //This is one of the exceptions, as Brimstone Flames is a very strong DoT debuff for this tier. if (Projectile.ai[1] == 1f) { target.AddBuff(BuffID.OnFire3, 120); diff --git a/Projectiles/Ranged/DrizzlefishFireSplit.cs b/Projectiles/Ranged/DrizzlefishFireSplit.cs index 439b011d56..390906dd83 100644 --- a/Projectiles/Ranged/DrizzlefishFireSplit.cs +++ b/Projectiles/Ranged/DrizzlefishFireSplit.cs @@ -92,6 +92,10 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + + //Doze - Flamethrowers in vanilla are long debuff infliction tools (20 seconds of their debuff). + //I am applying this as the base for Cal flamethrowers, with shorter times being the exception instead of the rule + //This is one of the exceptions, as Brimstone Flames is a very strong debuff for it's tier if (Projectile.ai[1] == 1f) { target.AddBuff(BuffID.OnFire3, 60); diff --git a/Projectiles/Ranged/DrizzlefishFireball.cs b/Projectiles/Ranged/DrizzlefishFireball.cs index d6de88439b..7d2f18766e 100644 --- a/Projectiles/Ranged/DrizzlefishFireball.cs +++ b/Projectiles/Ranged/DrizzlefishFireball.cs @@ -136,12 +136,17 @@ namespace CalamityMod.Projectiles.Ranged } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + + //Doze - Flamethrowers in vanilla are long debuff infliction tools (20 seconds of their debuff). + //I am applying this as the base for Cal flamethrowers, with shorter times being the exception instead of the rule + //This is one of the exceptions, as Brimstone Flames is a very strong debuff for it's tier if (Projectile.ai[1] == 1f) { target.AddBuff(BuffID.OnFire3, 40); } else { + target.AddBuff(ModContent.BuffType(), 20); } } diff --git a/Projectiles/Ranged/EssenceFire.cs b/Projectiles/Ranged/EssenceFire.cs index 36e947c47b..5807bc11dd 100644 --- a/Projectiles/Ranged/EssenceFire.cs +++ b/Projectiles/Ranged/EssenceFire.cs @@ -86,7 +86,9 @@ namespace CalamityMod.Projectiles.Ranged hitbox.Inflate(size, size); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 360); + //Doze - Flamethrowers in vanilla are long debuff infliction tools (20 seconds of their debuff). + //I am applying this as the base for Cal flamethrowers, with shorter times being the exception instead of the rule + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 1200); public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (Projectile.numHits > 0) diff --git a/Projectiles/Ranged/ExoFire.cs b/Projectiles/Ranged/ExoFire.cs index c37de35d6d..59fe2939aa 100644 --- a/Projectiles/Ranged/ExoFire.cs +++ b/Projectiles/Ranged/ExoFire.cs @@ -87,7 +87,10 @@ namespace CalamityMod.Projectiles.Ranged } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 300); + + //Doze - Flamethrowers in vanilla are long debuff infliction tools (20 seconds of their debuff). + //I am applying this as the base for Cal flamethrowers, with shorter times being the exception instead of the rule + target.AddBuff(ModContent.BuffType(), 1200); if (audioCooldown == 0) { SoundEngine.PlaySound(Photoviscerator.HitSound, target.Center); @@ -95,7 +98,7 @@ namespace CalamityMod.Projectiles.Ranged } } - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 300); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 1200); } } diff --git a/Projectiles/Ranged/ExoFlareCluster.cs b/Projectiles/Ranged/ExoFlareCluster.cs index f81f141294..9d49ba0ef0 100644 --- a/Projectiles/Ranged/ExoFlareCluster.cs +++ b/Projectiles/Ranged/ExoFlareCluster.cs @@ -75,7 +75,9 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 600); + //Doze - Flamethrowers in vanilla are long debuff infliction tools (20 seconds of their debuff). + //I am applying this as the base for Cal flamethrowers, with shorter times being the exception instead of the rule + target.AddBuff(ModContent.BuffType(), 1200); Projectile.tileCollide = false; float numberOflines = 5; @@ -146,7 +148,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(ModContent.BuffType(), 600); + target.AddBuff(ModContent.BuffType(), 1200); } } } diff --git a/Projectiles/Ranged/FreedomStarHoldout.cs b/Projectiles/Ranged/FreedomStarHoldout.cs index 2d54e518ad..e1d5479db2 100644 --- a/Projectiles/Ranged/FreedomStarHoldout.cs +++ b/Projectiles/Ranged/FreedomStarHoldout.cs @@ -147,26 +147,10 @@ namespace CalamityMod.Projectiles.Ranged // Checks if the Freedom Star has sufficient charge to fire. If this is false, it stops functioning. CalamityGlobalItem modItem = freedomStar.Calamity(); - float chargeConsumed = FreedomStar.HoldoutChargeUse_Orb; - switch (chargeAmt) - { - case 1: - chargeConsumed = FreedomStar.HoldoutChargeUse_OrbLarge; - break; - - case 2: - chargeConsumed = MathHelper.Lerp(FreedomStar.HoldoutChargeUse_Laser, FreedomStar.HoldoutChargeUse_LaserLarge, lerpAmtForCharge); - break; - - default: - break; - } - bool hasCharge = modItem.Charge >= chargeConsumed; + bool hasCharge = true; if (stillInUse && hasCharge) { - // Use charge when firing anything. - modItem.Charge -= chargeConsumed; if (Projectile.ai[0] == LaserGateValue) { diff --git a/Projectiles/Ranged/HalleysInfernoHoldout.cs b/Projectiles/Ranged/HalleysInfernoHoldout.cs index f609bcb2e5..166b8d838d 100644 --- a/Projectiles/Ranged/HalleysInfernoHoldout.cs +++ b/Projectiles/Ranged/HalleysInfernoHoldout.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Ranged ShotTimer += 35; } var spawnpos = Projectile.Center; - Projectile.NewProjectile(Owner.GetSource_ItemUse_WithPotentialAmmo(Halley,AmmoID.Gel),spawnpos,spawnpos.DirectionTo(Main.MouseWorld) * Halley.shootSpeed,ModContent.ProjectileType(), (int)Owner.GetDamage(DamageClass.Ranged).ApplyTo(Halley.damage),Halley.knockBack,Projectile.owner); + Projectile.NewProjectile(Owner.GetSource_ItemUse_WithPotentialAmmo(Halley,AmmoID.Gel),spawnpos,spawnpos.DirectionTo(Main.MouseWorld) * Halley.shootSpeed,ModContent.ProjectileType(), (int)Owner.GetDamage(DamageClass.Ranged).ApplyTo(Halley.damage),Halley.knockBack,Projectile.owner); RecoilAmount = 8; SoundEngine.PlaySound(HalleysInferno.ShootSound); //consume gel @@ -96,7 +96,8 @@ namespace CalamityMod.Projectiles.Ranged } for (var i = 0; i < 5; i++) GeneralParticleHandler.SpawnParticle(new GlowSparkParticle(spawnpos + dir * 36, (dir * Halley.shootSpeed).RotatedByRandom(0.75f) * Main.rand.NextFloat(0.5f, 1.5f), false, 7, 0.02f, drawColor, new Vector2(0.5f, 1f))); - Projectile.NewProjectile(Owner.GetSource_ItemUse_WithPotentialAmmo(Halley, AmmoID.Gel), spawnpos + dir * 16,dir * Halley.shootSpeed * 0.75f, ModContent.ProjectileType(), (int)Owner.GetDamage(DamageClass.Ranged).ApplyTo(Halley.damage), Halley.knockBack, Projectile.owner, color); + if (Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(Owner.GetSource_ItemUse_WithPotentialAmmo(Halley, AmmoID.Gel), spawnpos + dir * 16,dir * Halley.shootSpeed * 0.75f, ModContent.ProjectileType(), (int)Owner.GetDamage(DamageClass.Ranged).ApplyTo(Halley.damage), Halley.knockBack, Projectile.owner, color); Owner.Calamity().StratusStarburst--; SoundEngine.PlaySound(HalleysInferno.ShootSound); RecoilAmount = 4; diff --git a/Projectiles/Ranged/HalleysStarburst.cs b/Projectiles/Ranged/HalleysStarburst.cs index 6fe09d78be..653cd786c9 100644 --- a/Projectiles/Ranged/HalleysStarburst.cs +++ b/Projectiles/Ranged/HalleysStarburst.cs @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(ModContent.BuffType(), 75); SoundEngine.PlaySound(SoundID.DD2_CrystalCartImpact, Projectile.Center); // Dust emission on hit diff --git a/Projectiles/Ranged/PristineFire.cs b/Projectiles/Ranged/PristineFire.cs index 4522e97562..6d321b5b86 100644 --- a/Projectiles/Ranged/PristineFire.cs +++ b/Projectiles/Ranged/PristineFire.cs @@ -76,6 +76,10 @@ namespace CalamityMod.Projectiles.Ranged time--; } + + //Doze - Flamethrowers in vanilla are long debuff infliction tools (20 seconds of their debuff). + //I am applying this as the base for Cal flamethrowers, with shorter times being the exception instead of the rule + //On Pristine Fury, the full 20 seconds is limited to the ignition of the secondary. public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); public override void OnKill(int timeLeft) diff --git a/Projectiles/Ranged/PristineSecondary.cs b/Projectiles/Ranged/PristineSecondary.cs index e3dc9c3c78..876f0a59a8 100644 --- a/Projectiles/Ranged/PristineSecondary.cs +++ b/Projectiles/Ranged/PristineSecondary.cs @@ -124,7 +124,10 @@ namespace CalamityMod.Projectiles.Ranged { if (Ignited) { - target.AddBuff(ModContent.BuffType(), 420); + + //Doze - Flamethrowers in vanilla are long debuff infliction tools (20 seconds of their debuff). + //I am applying this as the base for Cal flamethrowers, with shorter times being the exception instead of the rule + target.AddBuff(ModContent.BuffType(), 1200); } } diff --git a/Projectiles/Ranged/ShadeFire.cs b/Projectiles/Ranged/ShadeFire.cs index b96378bcb6..cc6a29d94c 100644 --- a/Projectiles/Ranged/ShadeFire.cs +++ b/Projectiles/Ranged/ShadeFire.cs @@ -56,6 +56,9 @@ namespace CalamityMod.Projectiles.Ranged // Circular hitbox adjusted for the size of the smoke particles (which is 52 here) public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 52 * Projectile.scale * 0.5f, targetHitbox); - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); + + //Doze - Flamethrowers in vanilla are long debuff infliction tools (20 seconds of their debuff). + //I am applying this as the base for Cal flamethrowers, with shorter times being the exception instead of the rule + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 1200); } } diff --git a/Projectiles/Ranged/SparkSpreaderFire.cs b/Projectiles/Ranged/SparkSpreaderFire.cs index fa7385a9ee..8caf844073 100644 --- a/Projectiles/Ranged/SparkSpreaderFire.cs +++ b/Projectiles/Ranged/SparkSpreaderFire.cs @@ -61,15 +61,19 @@ namespace CalamityMod.Projectiles.Ranged return true; } + + //Doze - Flamethrowers in vanilla are long debuff infliction tools (20 seconds of their debuff). + //I am applying this as the base for Cal flamethrowers, with shorter times being the exception instead of the rule + //Due to Spark Spreader's tier, I am making this be random of 5-20 seconds public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(1, 4)); + target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(5, 20+1)); SpawnSparks(5); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(1, 4)); + target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(5, 20+1)); SpawnSparks(5); } diff --git a/Projectiles/Ranged/StarfleetHoldout.cs b/Projectiles/Ranged/StarfleetHoldout.cs index e8b51cbd0c..00243c45ff 100644 --- a/Projectiles/Ranged/StarfleetHoldout.cs +++ b/Projectiles/Ranged/StarfleetHoldout.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Ranged glowIntensity = MathHelper.Lerp(glowIntensity, (float)Math.Pow(Utils.GetLerpValue(recoilTimerMax, 0, shootingCooldown, true), 5), 0.2f); - if ((Owner.HeldItem.type != ItemType() && doingNothing) || Owner.dead) + if ((Owner.HeldItem.type != ItemType() && doingNothing) || (doingNothing && (Main.mapFullscreen || Owner.mouseInterface)) || Owner.dead) { Projectile.Kill(); return; diff --git a/Projectiles/Ranged/StarmadaHoldout.cs b/Projectiles/Ranged/StarmadaHoldout.cs index 7383465a48..4bbfc9ee1a 100644 --- a/Projectiles/Ranged/StarmadaHoldout.cs +++ b/Projectiles/Ranged/StarmadaHoldout.cs @@ -91,7 +91,7 @@ namespace CalamityMod.Projectiles.Ranged shake = MathHelper.Lerp(shake, 0, 0.05f); frontRecoil = MathHelper.Lerp(frontRecoil, 0, 0.11f); - if ((Owner.HeldItem.type != ItemType() && doingNothing) || Owner.dead) + if ((Owner.HeldItem.type != ItemType() && doingNothing) || (doingNothing && (Main.mapFullscreen || Owner.mouseInterface)) || Owner.dead) { Projectile.Kill(); return; diff --git a/Projectiles/Ranged/TauCannonHoldout.cs b/Projectiles/Ranged/TauCannonHoldout.cs index a4b677a4e0..754264c5ea 100644 --- a/Projectiles/Ranged/TauCannonHoldout.cs +++ b/Projectiles/Ranged/TauCannonHoldout.cs @@ -129,7 +129,6 @@ namespace CalamityMod.Projectiles.Ranged if (!HasShotBeam) { - modItem.Charge -= 0.2f; HasShotBeam = true; } @@ -149,7 +148,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.owner, ai1: Projectile.whoAmI); OffsetLengthFromArm -= 25f; - modItem.Charge -= 0.8f; HasShotBeam = true; SoundEngine.PlaySound(SmallBeamSound, GunTipPosition); } @@ -187,7 +185,6 @@ namespace CalamityMod.Projectiles.Ranged } } - modItem.Charge -= 2.5f; HasShotBeam = true; } diff --git a/Projectiles/Summon/BrittleStarMinion.cs b/Projectiles/Summon/BrittleStarMinion.cs index 5f5d145125..31eedec90e 100644 --- a/Projectiles/Summon/BrittleStarMinion.cs +++ b/Projectiles/Summon/BrittleStarMinion.cs @@ -120,7 +120,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.Center = Vector2.Lerp(Projectile.Center, idleDestination, 0.15f); AITimer++; - Owner.statDefense += 4; Projectile.rotation += MoveWidth * 0.2f; } if (!MinionBuffMode && !Reforming) // Minion when ramming diff --git a/Projectiles/Summon/EnchantedKnifeSummon.cs b/Projectiles/Summon/EnchantedKnifeSummon.cs index e6d1c2e8cf..3537ae9712 100644 --- a/Projectiles/Summon/EnchantedKnifeSummon.cs +++ b/Projectiles/Summon/EnchantedKnifeSummon.cs @@ -127,12 +127,23 @@ namespace CalamityMod.Projectiles.Summon return; } + if (float.IsNaN(SwingCenter.X) || float.IsNaN(SwingCenter.Y) || float.IsNaN(Projectile.velocity.X) || float.IsNaN(Projectile.velocity.Y)) + { + SwingCenter = Target.Center; + Projectile.velocity = Vector2.Zero; + } + SwingCenter += Projectile.velocity; Projectile.velocity *= 0.9f; var easing = new CalamityUtils.CurveSegment(CalamityUtils.PolyInOutEasing, 0f, 0f, 1f, 3); - float swingRotation = MathHelper.Lerp(-MathHelper.PiOver2, MathHelper.PiOver2, CalamityUtils.PiecewiseAnimation(Utils.GetLerpValue(SwingWait, SwingWait + SwingTime, SwingTimer, true), easing)) * MathF.Sign(Target.Center.X - SwingCenter.X); + float xDifference = Target.Center.X - SwingCenter.X; + int signDirection = float.IsNaN(xDifference) ? 1 : MathF.Sign(xDifference); + float swingRotation = MathHelper.Lerp(-MathHelper.PiOver2, MathHelper.PiOver2, CalamityUtils.PiecewiseAnimation(Utils.GetLerpValue(SwingWait, SwingWait + SwingTime, SwingTimer, true), easing)) * signDirection; Vector2 predictiveDirection = CalamityUtils.CalculatePredictiveAimToTarget(SwingCenter, Target, ProjectileSpeed); + + if (float.IsNaN(predictiveDirection.X) || float.IsNaN(predictiveDirection.Y)) + predictiveDirection = Projectile.DirectionTo(Target.Center); Projectile.Center = SwingCenter + (predictiveDirection.ToRotation() + swingRotation).ToRotationVector2() * 40f; Projectile.rotation = Projectile.DirectionFrom(SwingCenter).ToRotation(); @@ -152,7 +163,9 @@ namespace CalamityMod.Projectiles.Summon if (DashTimer >= DashCooldown) { - Projectile.velocity = CalamityUtils.CalculatePredictiveAimToTarget(SwingCenter, Target, DashSpeed); + Vector2 dashVelocity = CalamityUtils.CalculatePredictiveAimToTarget(SwingCenter, Target, DashSpeed); + if (!float.IsNaN(dashVelocity.X) && !float.IsNaN(dashVelocity.Y)) + Projectile.velocity = dashVelocity; DashTimer = 0f; } @@ -179,18 +192,24 @@ namespace CalamityMod.Projectiles.Summon if (newState == AttackState) { + if (Target is null) + return; + float targetSize = Target.Size.Length(); Vector2 previousCenter = Projectile.Center; Vector2 newCenter = Target.Center + Main.rand.NextVector2CircularEdge(targetSize * 0.5f + 160f, targetSize * 0.5f + 160f); int maxAttempts = 10; int attempts = 0; - while (Main.tile[newCenter.ToSafeTileCoordinates()].IsTileSolid() || attempts == maxAttempts) + while (Main.tile[newCenter.ToSafeTileCoordinates()].IsTileSolid() && attempts < maxAttempts) { newCenter = Target.Center + Main.rand.NextVector2CircularEdge(targetSize * 0.5f + 160f, targetSize * 0.5f + 160f); attempts++; } + if (float.IsNaN(newCenter.X) || float.IsNaN(newCenter.Y)) + newCenter = Target.Center; + Projectile.Center = newCenter; SwingCenter = Projectile.Center; diff --git a/Projectiles/Typeless/ArtifactOfResilienceShards.cs b/Projectiles/Typeless/ArtifactOfResilienceShards.cs index 7b14d880d3..7e07cc5f9a 100644 --- a/Projectiles/Typeless/ArtifactOfResilienceShards.cs +++ b/Projectiles/Typeless/ArtifactOfResilienceShards.cs @@ -176,6 +176,10 @@ namespace CalamityMod.Projectiles.Typeless } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + bool crit = Main.rand.Next(0, 100 + 1) < Owner.GetTotalCritChance(Owner.GetBestClass()); + if (crit) + modifiers.SetCrit(); + modifiers.SourceDamage *= (isAttacking ? 1 : 0.45f); if (isAttacking) target.AddBuff(ModContent.BuffType(), 520); diff --git a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs index c1554dbe85..ed19b92991 100644 --- a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs +++ b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs @@ -437,14 +437,29 @@ namespace CalamityMod.Projectiles.Typeless Owner.Center = respawnPoint; } killed = true; - Owner.fullRotationOrigin = Owner.Center - Owner.position; - Owner.fullRotation = 0; Owner.Calamity().rOfDelivarenceRam = false; Projectile.netUpdate = true; Projectile.Kill(); } + + public override void OnKill(int timeLeft) + { + if (Projectile.owner == Main.myPlayer && SoundEngine.TryGetActiveSound(digSoundSlot, out var sound)) + sound.Stop(); + + Owner.fullRotationOrigin = Owner.Center - Owner.position; + Owner.fullRotation = 0f; + + if (Main.netMode != NetmodeID.SinglePlayer) + NetMessage.SendData(MessageID.SyncPlayer, number: Owner.whoAmI); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + bool crit = Main.rand.Next(0, 100 + 1) < Owner.GetTotalCritChance(Owner.GetBestClass()); + if (crit) + modifiers.SetCrit(); + float minMult = 0.15f; int hitsToMinMult = 15; float damageMult = Utils.Remap(hitCountDamageSource, 0, hitsToMinMult, 1, minMult, true); diff --git a/Projectiles/Typeless/TransformerBlob.cs b/Projectiles/Typeless/TransformerBlob.cs index 67714d5db1..a3fc1c1c55 100644 --- a/Projectiles/Typeless/TransformerBlob.cs +++ b/Projectiles/Typeless/TransformerBlob.cs @@ -162,7 +162,7 @@ namespace CalamityMod.Projectiles.Typeless if (visuals) { SoundStyle fire = new("CalamityMod/Sounds/Item/OmicronBeam"); - SoundEngine.PlaySound(fire with { Volume = 0.3f, Pitch = Main.rand.NextFloat(0.3f, 0.5f) + Projectile.ai[1] * 0.015f, MaxInstances = -1 }, Projectile.Center); + SoundEngine.PlaySound(fire with { Volume = 0.3f, Pitch = Math.Clamp(Main.rand.NextFloat(0.1f, 0.2f) + Projectile.ai[1] * 0.02f, 0, 1), MaxInstances = 1 }, Projectile.Center); } } else if (poweredTimer == 0) diff --git a/Projectiles/Typeless/WarbannerDamage.cs b/Projectiles/Typeless/WarbannerDamage.cs index 43622a0356..ca12ba043e 100644 --- a/Projectiles/Typeless/WarbannerDamage.cs +++ b/Projectiles/Typeless/WarbannerDamage.cs @@ -9,11 +9,18 @@ namespace CalamityMod.Projectiles.Typeless public class WarbannerDamage : DirectStrike, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; + public Player Owner => Main.player[Projectile.owner]; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 30); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + bool crit = Main.rand.Next(0, 100 + 1) < Owner.GetTotalCritChance(Owner.GetBestClass()); + if (crit) + modifiers.SetCrit(); + } } } diff --git a/Projectiles/Typeless/WulfrumHook.cs b/Projectiles/Typeless/WulfrumHook.cs index 20d8259506..426e0432ec 100644 --- a/Projectiles/Typeless/WulfrumHook.cs +++ b/Projectiles/Typeless/WulfrumHook.cs @@ -54,6 +54,16 @@ namespace CalamityMod.Projectiles.Typeless Projectile.aiStyle = ProjAIStyleID.Hook; //The projectile uses entirely custom AI, but for some reason terraria's only way to distinguish what is and isnt a hook is its ai style. } + public override bool? CanUseGrapple(Player player) + { + if (player.TryGetModPlayer(out var mPlayer) && mPlayer.hookCooldown > 0) + { + return false; + } + + return base.CanUseGrapple(player); + } + public override bool? CanDamage() => false; public override bool PreAI() => false; @@ -156,8 +166,11 @@ namespace CalamityMod.Projectiles.Typeless if (!tile.HasUnactuatedTile || !tile.CanTileBeLatchedOnTo(EquippedHook == ItemID.SquirrelHook && Projectile.Distance(Owner.Center) > 96) || Owner.IsBlacklistedForGrappling(tilePos)) continue; + + /* if (Main.myPlayer != Owner.whoAmI) continue; + */ OnGrapple(worldPos, x, y); @@ -197,8 +210,12 @@ namespace CalamityMod.Projectiles.Typeless Owner.grappling[Owner.grapCount] = Projectile.whoAmI; Owner.grapCount++; } - if (EquippedHook == ItemID.QueenSlimeHook) + + if (EquippedHook == ItemID.QueenSlimeHook && Owner.whoAmI == Main.myPlayer) + { Owner.DoQueenSlimeHookTeleport(grapplePos + new Vector2(-(Owner.Center - Projectile.Center).Length() * 0.75f, 0).RotatedBy(Projectile.DirectionTo(Owner.Center).ToRotation())); + } + mp.SwingLength = (Owner.Center - Projectile.Center).Length(); mp.OldPosition = Owner.Center - Owner.velocity; mp.SetSegments(Projectile.Center); @@ -208,11 +225,14 @@ namespace CalamityMod.Projectiles.Typeless if (tileVisualHitbox.HasValue) Projectile.Center = tileVisualHitbox.Value.Center.ToVector2(); - Projectile.netUpdate = true; - NetMessage.SendData(MessageID.PlayerControls, -1, -1, null, Owner.whoAmI); + if (Owner.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) + { + Projectile.netUpdate = true; + NetMessage.SendData(MessageID.PlayerControls, -1, -1, null, Owner.whoAmI); + WulfrumAcrobaticsSync.Send(Owner, mp, Projectile); + } } - public override void OnKill(int timeLeft) { if (Owner.grappling[0] == Projectile.whoAmI) diff --git a/Schematics/Arsenal_Lab_Planetoid.csch b/Schematics/Arsenal_Lab_Planetoid.csch index 44ab386a8c..c83879ccaa 100644 Binary files a/Schematics/Arsenal_Lab_Planetoid.csch and b/Schematics/Arsenal_Lab_Planetoid.csch differ diff --git a/Sounds/Item/GeliticBladeSwing1.ogg b/Sounds/Item/GeliticBladeSwing1.ogg new file mode 100644 index 0000000000..b005163e8b Binary files /dev/null and b/Sounds/Item/GeliticBladeSwing1.ogg differ diff --git a/Sounds/Item/GeliticBladeSwing2.ogg b/Sounds/Item/GeliticBladeSwing2.ogg new file mode 100644 index 0000000000..ca2674232e Binary files /dev/null and b/Sounds/Item/GeliticBladeSwing2.ogg differ diff --git a/Sounds/Item/GeliticBladeWave.ogg b/Sounds/Item/GeliticBladeWave.ogg deleted file mode 100644 index a63365b97d..0000000000 Binary files a/Sounds/Item/GeliticBladeWave.ogg and /dev/null differ diff --git a/Systems/Collections/CalamityItemSets.cs b/Systems/Collections/CalamityItemSets.cs index a9a0c179a8..5c01ead45c 100644 --- a/Systems/Collections/CalamityItemSets.cs +++ b/Systems/Collections/CalamityItemSets.cs @@ -4,7 +4,11 @@ using CalamityMod.Items.Fishing.FishingRods; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Items.Placeables.Furniture.BossRelics; +using CalamityMod.Items.Placeables.Furniture.Monoliths; +using CalamityMod.Items.Placeables.Furniture.Paintings; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Items.Potions; using CalamityMod.Items.Tools; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.DraedonsArsenal; @@ -53,17 +57,16 @@ namespace CalamityMod.Systems.Collections /// Set this for items which are dropped by enemies or bosses which spawn on the edges of the world.
/// Defaults to . /// - public static bool[] ItemForcedInsideWorld = Factory.CreateBoolSet(ItemID.HotlineFishingHook, ItemID.BottomlessBucket, ItemID.SuperAbsorbantSponge, ItemID.FishingPotion, - ItemID.SonarPotion, ItemID.CratePotion, ItemID.AnglerTackleBag, ItemID.HighTestFishingLine, ItemID.TackleBox, ItemID.AnglerEarring, ItemID.FishermansGuide, ItemID.WeatherRadio, - ItemID.Sextant, ItemID.AnglerHat, ItemID.AnglerVest, ItemID.AnglerPants, ItemID.GoldenBugNet, ItemID.FishronWings, ItemID.Flairon, ItemID.Tsunami, ItemID.BubbleGun, - ItemID.RazorbladeTyphoon, ItemID.TempestStaff, ItemID.FishronBossBag, ItemID.Coral, ItemID.Seashell, ItemID.Starfish, ItemID.SoulofSight, ItemID.GreaterHealingPotion, - ItemID.SuperHealingPotion, ItemID.SoulofFlight, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType()); + public static bool[] ItemForcedInsideWorld = Factory.CreateBoolSet(ItemID.FishronWings, ItemID.Flairon, ItemID.Tsunami, ItemID.BubbleGun, ItemID.RazorbladeTyphoon, + ItemID.TempestStaff, ItemID.FishronBossBag, ItemID.GreaterHealingPotion, ItemID.SoulofFlight, ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); /// /// If for an item type, prevents this rogue weapon from triggering Venerated Locket's clone projectile effect when used.
diff --git a/Systems/Collections/CalamityTileSets.cs b/Systems/Collections/CalamityTileSets.cs index 32626dd35f..343582df06 100644 --- a/Systems/Collections/CalamityTileSets.cs +++ b/Systems/Collections/CalamityTileSets.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Systems.Collections public static bool[] CanBeReplacedByAbyssGeneration = Factory.CreateBoolSet(); /// - /// If for a tile type, It does not draw BlendMerge on PostDraw hook. Instead it will be drawn after every solid tiles has drawn to screen
+ /// If for a tile type, it will not perform its BlendMerge in the PostDraw hook, and instead will be drawn after every solid tile has been drawn to the screen.
/// Defaults to . ///
public static bool[] DrawBlendMergeAfterSolidTile = Factory.CreateBoolSet(TileType()); diff --git a/Systems/Mechanic/RecipeSystem.cs b/Systems/Mechanic/RecipeSystem.cs index 7c3ff6cd34..71e7665c26 100644 --- a/Systems/Mechanic/RecipeSystem.cs +++ b/Systems/Mechanic/RecipeSystem.cs @@ -14,6 +14,7 @@ using CalamityMod.Items.Placeables.FurnitureDriftwood; using CalamityMod.Items.Placeables.FurnitureAcidwood; using CalamityMod.Items.Placeables.Crags; using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Items.Potions.Food; using CalamityMod.Items.Tools; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -50,13 +51,27 @@ namespace CalamityMod.Systems RecipeGroup firefly = RecipeGroup.recipeGroups[RecipeGroupID.Fireflies]; firefly.ValidItems.Add(ItemType()); - // Astral, Sunken Sea and Sulphurous Sea Sand is Sand + RecipeGroup fruit = RecipeGroup.recipeGroups[RecipeGroupID.Fruit]; + fruit.ValidItems.Add(ItemType()); + fruit.ValidItems.Add(ItemType()); + fruit.ValidItems.Add(ItemType()); + fruit.ValidItems.Add(ItemType()); + fruit.ValidItems.Add(ItemType()); + fruit.ValidItems.Add(ItemType()); + + // Astral, Sunken Sea and Sulphurous Sea sand are Sand + // This recipe group also naturally includes Hardened Sand, but not Sandstone RecipeGroup sand = RecipeGroup.recipeGroups[RecipeGroupID.Sand]; sand.ValidItems.Add(ItemType()); + sand.ValidItems.Add(ItemType()); + sand.ValidItems.Add(ItemType()); sand.ValidItems.Add(ItemType()); + sand.ValidItems.Add(ItemType()); + sand.ValidItems.Add(ItemType()); + sand.ValidItems.Add(ItemType()); sand.ValidItems.Add(ItemType()); - // Acidwood is Wood + // Acidwood and Driftwood are Wood RecipeGroup wood = RecipeGroup.recipeGroups[RecipeGroupID.Wood]; wood.ValidItems.Add(ItemType()); wood.ValidItems.Add(ItemType()); @@ -656,7 +671,7 @@ namespace CalamityMod.Systems Register() .DisableDecraft(); - AddAstralClayRecipes(); + AddAstralRecipeVariants(); AddBloodOrbPotionRecipes(); AddCookedFood(); AddMiscItemRecipes(); @@ -938,13 +953,22 @@ namespace CalamityMod.Systems } #endregion - #region Astral Clay - private static void AddAstralClayRecipes() + #region Astral Recipe Variants + private static void AddAstralRecipeVariants() { + #region Astral Clay // Intentionally excluding Red Brick and Red Stucco recipes + // Argon Moss Brick + Recipe r = Recipe.Create(ItemID.ArgonMossBlock, 10); + r.AddIngredient(ItemID.ArgonMoss); + r.AddIngredient(10); + r.AddTile(TileID.Furnaces); + r.Register(); + r.SortAfterFirstRecipesOf(ItemID.ArgonMossBlock); + r.DisableDecraft(); // Bowl - Recipe r = Recipe.Create(ItemID.Bowl); + r = Recipe.Create(ItemID.Bowl); r.AddIngredient(2); r.AddTile(TileID.Furnaces); r.Register(); @@ -959,6 +983,42 @@ namespace CalamityMod.Systems r.SortAfterFirstRecipesOf(ItemID.ClayPot); r.DisableDecraft(); + // Helium Moss Brick + r = Recipe.Create(ItemID.RainbowMossBlock, 10); + r.AddIngredient(ItemID.RainbowMoss); + r.AddIngredient(10); + r.AddTile(TileID.Furnaces); + r.Register(); + r.SortAfterFirstRecipesOf(ItemID.RainbowMossBlock); + r.DisableDecraft(); + + // Krypton Moss Brick + r = Recipe.Create(ItemID.KryptonMossBlock, 10); + r.AddIngredient(ItemID.KryptonMoss); + r.AddIngredient(10); + r.AddTile(TileID.Furnaces); + r.Register(); + r.SortAfterFirstRecipesOf(ItemID.KryptonMossBlock); + r.DisableDecraft(); + + // Lava Moss Brick + r = Recipe.Create(ItemID.LavaMossBlock, 10); + r.AddIngredient(ItemID.LavaMoss); + r.AddIngredient(10); + r.AddTile(TileID.Furnaces); + r.Register(); + r.SortAfterFirstRecipesOf(ItemID.LavaMossBlock); + r.DisableDecraft(); + + // Neon Moss Brick + r = Recipe.Create(ItemID.VioletMossBlock, 10); + r.AddIngredient(ItemID.VioletMoss); + r.AddIngredient(10); + r.AddTile(TileID.Furnaces); + r.Register(); + r.SortAfterFirstRecipesOf(ItemID.VioletMossBlock); + r.DisableDecraft(); + // Pink Vase r = Recipe.Create(ItemID.PinkVase); r.AddIngredient(4); @@ -992,6 +1052,84 @@ namespace CalamityMod.Systems r.Register(); r.SortAfterFirstRecipesOf(ItemID.RoninHat); r.DisableDecraft(); + + // Xenon Moss Brick + r = Recipe.Create(ItemID.XenonMossBlock, 10); + r.AddIngredient(ItemID.XenonMoss); + r.AddIngredient(10); + r.AddTile(TileID.Furnaces); + r.Register(); + r.SortAfterFirstRecipesOf(ItemID.XenonMossBlock); + r.DisableDecraft(); + #endregion + + #region Astral Dirt + // Intentionally excluding a ton of pure dirt recipes ie. Dirt Bombs, Walls + // Floret Protector set + r = Recipe.Create(ItemID.FloretProtectorHelmet); + r.AddIngredient(ItemID.Glass, 20); + r.AddIngredient(10); + r.AddIngredient(ItemID.Daybloom); + r.AddTile(TileID.Loom); + r.Register(); + r.SortAfterFirstRecipesOf(ItemID.FloretProtectorHelmet); + r.DisableDecraft(); + + r = Recipe.Create(ItemID.FloretProtectorChestplate); + r.AddIngredient(ItemID.Silk, 20); + r.AddIngredient(15); + r.AddTile(TileID.Loom); + r.Register(); + r.SortAfterFirstRecipesOf(ItemID.FloretProtectorChestplate); + r.DisableDecraft(); + + r = Recipe.Create(ItemID.FloretProtectorLegs); + r.AddIngredient(ItemID.Silk, 20); + r.AddIngredient(15); + r.AddTile(TileID.Loom); + r.Register(); + r.SortAfterFirstRecipesOf(ItemID.FloretProtectorLegs); + r.DisableDecraft(); + #endregion + + #region Astral Ice + // Ice Torch + r = Recipe.Create(ItemID.IceTorch, 3); + r.AddIngredient(ItemID.Torch, 3); + r.AddIngredient(); + r.Register(); + r.SortAfterFirstRecipesOf(ItemID.IceTorch); + r.DisableDecraft(); + #endregion + + #region Astral Snow + // Frozen Banana Daiquiri + r = Recipe.Create(ItemID.BananaDaiquiri); + r.AddIngredient(ItemID.Banana); + r.AddIngredient(ItemID.Bottle); + r.AddIngredient(); + r.AddTile(TileID.CookingPots); + r.Register(); + r.SortAfterFirstRecipesOf(ItemID.BananaDaiquiri); + r.DisableDecraft(); + + // Snowball + r = Recipe.Create(ItemID.Snowball, 15); + r.AddIngredient(); + r.Register(); + r.SortAfterFirstRecipesOf(ItemID.Snowball); + r.DisableDecraft(); + #endregion + + #region Hardened Astral Sand + // Desert Torch + r = Recipe.Create(ItemID.DesertTorch, 3); + r.AddIngredient(ItemID.Torch, 3); + r.AddIngredient(); + r.Register(); + r.SortAfterFirstRecipesOf(ItemID.DesertTorch); + r.DisableDecraft(); + #endregion } #endregion diff --git a/UI/ModeIndicator/ModeIndicatorUI.cs b/UI/ModeIndicator/ModeIndicatorUI.cs index 139848fb68..9dacbef733 100644 --- a/UI/ModeIndicator/ModeIndicatorUI.cs +++ b/UI/ModeIndicator/ModeIndicatorUI.cs @@ -139,9 +139,10 @@ namespace CalamityMod.UI.ModeIndicator spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, Main.UIScaleMatrix); - + /* Texture2D outlineTexture = ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicatorOutline").Value; spriteBatch.Draw(outlineTexture, DrawCenter, null, Color.White * opacity, 0f, outlineTexture.Size() * 0.5f, MainIconScale, SpriteEffects.None, 0f); + */ } string extraDescText = string.Empty;