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/Alcohol/CinnamonRollBuff.cs b/Buffs/Alcohol/CinnamonRollBuff.cs index fb650b5fa2..bb724a3a52 100644 --- a/Buffs/Alcohol/CinnamonRollBuff.cs +++ b/Buffs/Alcohol/CinnamonRollBuff.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Buffs.Alcohol public override void Update(Player player, ref int buffIndex) { player.Calamity().cinnamonRoll = true; - player.Calamity().HeatDebuffMultiplier += 0.5f; } } } 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 a371bdef12..e6c7796255 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; @@ -3448,8 +3447,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) { @@ -3459,7 +3459,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; @@ -3557,7 +3557,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]; @@ -4100,7 +4100,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; @@ -4371,7 +4371,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); @@ -4956,7 +4956,7 @@ namespace CalamityMod.CalPlayer //Flashlight //Due to being in postUpdate we need to adjust the mousepos for the player's movement that will have happened var mouseworld = Main.MouseWorld + Player.position - Player.oldPosition; - EnhancedDarknessSystem.lights.Add(new(center: Player.Center + Player.DirectionTo(mouseworld) * 750f, rotation: Player.DirectionTo(mouseworld).ToRotation() - MathHelper.PiOver2, vectorScale: new Vector2(0.75f * abyssFlashlightWidthMultiplier, 0.75f), texture: Request("CalamityMod/Particles/BloomLineFade"))); + EnhancedDarknessSystem.lights.Add(new(center: Player.Center + Player.DirectionTo(mouseworld) * 750f, rotation: Player.DirectionTo(mouseworld).ToRotation() - MathHelper.PiOver2, vectorScale: new Vector2(0.85f * abyssFlashlightWidthMultiplier, 0.75f), texture: Request("CalamityMod/Particles/BloomLineFade").Value)); } if (lastDeerclopsPosition.HasValue) @@ -4969,7 +4969,7 @@ namespace CalamityMod.CalPlayer //Add the main light circle for the arena DeerclopsAI.ArenaTex ??= ModContent.Request(DeerclopsAI.ArenaTexPath); - EnhancedDarknessSystem.lights.Add(new(lastDeerclopsPosition.Value, scale: DeerclopsAI.borderScale, texture: DeerclopsAI.ArenaTex)); + EnhancedDarknessSystem.lights.Add(new(lastDeerclopsPosition.Value, scale: DeerclopsAI.borderScale, texture: DeerclopsAI.ArenaTex.Value)); //we draw light around the player when far away so they have some visibility, although very small. This is especially nice in multiplayer. we scale opacity with distance bc it looks better EnhancedDarknessSystem.lights.Add(new EnhancedDarknessSystem.LightSource(scale: 0.75f, opacity: MathHelper.Clamp(Main.LocalPlayer.DistanceSQ(lastDeerclopsPosition.Value) / (409600 /*640^2*/), 0, 1))); @@ -5357,7 +5357,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/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index ab25f12f25..88be2f9439 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -77,7 +77,7 @@ namespace CalamityMod.CalPlayer if (Starshield > 0 && drawInfo.shadow == 0) { var color = Color.Lerp(Color.DeepSkyBlue, Color.LightSkyBlue, (StratusStarburst / (float)MaxStratusStarburst)); - var opacity = MathHelper.Min(MathHelper.Min(Starshield / 30f, 1f), (3600 - Starshield) / 30f); + var opacity = MathHelper.Min(MathHelper.Min(Starshield / 30f, 1f), (CalamityUtils.MinutesToFrames(10) - Starshield) / 30f); float size = 80 + 32 * (StratusStarburst / (float)MaxStratusStarburst); Vector2 drawPosition = Player.Center + new Vector2(0, Player.gfxOffY) - Main.screenPosition; @@ -95,7 +95,7 @@ namespace CalamityMod.CalPlayer GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].UseSaturation(0.2f); GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/MeltyNoiseHighContrast"), 1); GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].Apply(); - Main.EntitySpriteDraw(telegraphBase, drawPosition, null, Color.DarkSlateBlue * opacity, 0, telegraphBase.Size() / 2f, size * 2f * opacity / telegraphBase.Width, 0, 0); + Main.EntitySpriteDraw(telegraphBase, drawPosition, null, Color.DarkSlateBlue * opacity, 0, telegraphBase.Size() / 2f, size * 1.5f * opacity / telegraphBase.Width, 0, 0); //Draw the outer particles Main.spriteBatch.EnterShaderRegion(matrix: matrix); @@ -120,27 +120,82 @@ namespace CalamityMod.CalPlayer } if (DoG != null && Main.mapStyle != 2) { - Rectangle screen = new((int)Main.screenPosition.X, (int)Main.screenPosition.Y, Main.screenWidth, Main.screenHeight); - var rift = DoG.GetRiftLocation(); - if (rift != Vector2.Zero && !Main.zenithWorld) + int drawCount = calamityPlayer.trippy ? 4 : 1; + + for (int i = 0; i < drawCount; i++) { - var dist = Player.Distance(rift); - var tex = ModContent.Request("Terraria/Images/Extra_173").Value; - float scale = 1f; - Main.spriteBatch.Draw(tex, Player.Center + Player.DirectionTo(rift) * 196 * Math.Min(dist / 2400f, 2) - Main.screenPosition, null, Color.White * 0.9f * Math.Clamp(MathHelper.Lerp(0, 1, (dist - 300) / 600), 0, 1), 0, tex.Size() / 2f, scale * 0.9f, SpriteEffects.FlipHorizontally, 0); - } - else - { - var dis = Player.Distance(DoG.NPC.Center); - if ((DoG.NPC.ai[3] < 3 || !DoG.Phase2Started) && DoG.NPC.Opacity > 0.5f && !DoG.Dying) + var rift = DoG.GetRiftLocation(); + bool drawingRift = rift != Vector2.Zero && !Main.zenithWorld; + + Vector2 targetCenter = drawingRift ? rift : DoG.NPC.Center; + float diffX = targetCenter.X - Player.Center.X; + float diffY = targetCenter.Y - Player.Center.Y; + + // Mirror the offset based on i's index + if (calamityPlayer.trippy) { - string phase1IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_Head_Boss"; - string phase2IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_P2_Head_Boss"; - var tex = ModContent.Request((DoG.Phase2Started && DoG.NPC.localAI[2] < 300) ? phase2IconPath : phase1IconPath).Value; - Main.spriteBatch.Draw(tex, Player.Center + Player.DirectionTo(DoG.NPC.Center) * 196 * Math.Min(dis / 2400f, 2) - Main.screenPosition, null, Color.White * 0.9f * Math.Clamp(MathHelper.Lerp(0, 1, (dis - 600) / 300), 0, 1), DoG.NPC.rotation, tex.Size() / 2f, 1, SpriteEffects.None, 0); + switch (i) + { + case 0: diffX = -Math.Abs(diffX); diffY = -Math.Abs(diffY); break; // Top Left + case 1: diffX = Math.Abs(diffX); diffY = -Math.Abs(diffY); break; // Top Right + case 2: diffX = Math.Abs(diffX); diffY = Math.Abs(diffY); break; // Bottom Right + case 3: diffX = -Math.Abs(diffX); diffY = Math.Abs(diffY); break; // Bottom Left + } + } + + Vector2 virtualTargetPos = Player.Center + new Vector2(diffX, diffY); + float dist = Player.Distance(virtualTargetPos); + Vector2 directionToTarget = Player.DirectionTo(virtualTargetPos); + + if (drawingRift) + { + var tex = ModContent.Request("Terraria/Images/Extra_173").Value; + float opacity = 0.9f * Math.Clamp(MathHelper.Lerp(0, 1, (dist - 300) / 600), 0, 1); + + Color drawColor = calamityPlayer.trippy ? Main.DiscoColor : Color.White * 0.9f; + + Main.spriteBatch.Draw(tex, Player.Center + directionToTarget * 196 * Math.Min(dist / 2400f, 2) - Main.screenPosition, + null, drawColor * opacity, 0, tex.Size() / 2f, 0.9f, SpriteEffects.FlipHorizontally, 0); + } + else + { + var dis = Player.Distance(virtualTargetPos); + if ((DoG.NPC.ai[3] < 3 || !DoG.Phase2Started) && DoG.NPC.Opacity > 0.5f && !DoG.Dying && !drawInfo.drawPlayer.isDisplayDollOrInanimate) + { + string phase1IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_Head_Boss"; + string phase2IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_P2_Head_Boss"; + var tex = ModContent.Request((DoG.Phase2Started && DoG.NPC.localAI[2] < 300) ? phase2IconPath : phase1IconPath).Value; + + float baseRotation = DoG.NPC.rotation; + + if (calamityPlayer.trippy) + { + Vector2 rotVec = baseRotation.ToRotationVector2(); + switch (i) + { + case 0: + rotVec.X *= -1; + rotVec.Y *= -1; + break; + case 1: + rotVec.Y *= -1; + break; + case 2: + break; + case 3: + rotVec.X *= -1; + break; + } + baseRotation = rotVec.ToRotation(); + } + + float opacity = 0.9f * Math.Clamp(MathHelper.Lerp(0, 1, (dis - 600) / 300), 0, 1); + Color drawColor = calamityPlayer.trippy ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, (int)(255 * 0.9f)) : Color.White * 0.9f; + + Main.spriteBatch.Draw(tex, Player.Center + directionToTarget * 196 * Math.Min(dis / 2400f, 2) - Main.screenPosition, null, drawColor * opacity, baseRotation, tex.Size() / 2f, 1, SpriteEffects.None, 0); + } } } - } //Charge animation for Thread of Eradication diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index 300556dbd1..655646c3e6 100644 --- a/CalPlayer/CalamityPlayerFishing.cs +++ b/CalPlayer/CalamityPlayerFishing.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using CalamityMod.Events; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Fishing; using CalamityMod.Items.Fishing.AstralCatches; using CalamityMod.Items.Fishing.BrimstoneCragCatches; @@ -28,6 +29,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.UI; namespace CalamityMod.CalPlayer { @@ -191,6 +193,23 @@ namespace CalamityMod.CalPlayer itemDrop = ModContent.ItemType(); return; } + + if (Main.rand.NextBool(50)) + { + switch (Main.rand.Next(3)) + { + case 0: + itemDrop = ModContent.ItemType(); + return; + case 1: + itemDrop = ModContent.ItemType(); + return; + case 2: + itemDrop = ModContent.ItemType(); + return; + } + return; + } } // Ignore catches if it's junk @@ -430,8 +449,8 @@ namespace CalamityMod.CalPlayer if (!canSulphurFish || item.fishingPole <= 0 || item.holdStyle != 1) fishingLevel = -1; - // If your bait is the Bloodworm, set the Fisherman's Pocket Guide to display Warning! - // This only happens when a fishing bobber projectile exists + // Set Fisherman's Pocket Guide to display "Warning!" with Bloodworm as bait + // This runs only while there is a fishing bobber; logic with no fishing bobber is handled in the ModifyDisplayParameters hook in the separate class below Player.displayedFishingInfo = Language.GetTextValue("GameUI.FishingWarning"); } } @@ -474,4 +493,24 @@ namespace CalamityMod.CalPlayer } #endregion } + + public class BloodwormFishPowerWarning : GlobalInfoDisplay + { + // Set Fisherman's Pocket Guide to display "Warning!" with Bloodworm as bait + // This runs only while there is no fishing bobber; logic with a fishing bobber is handled in the GetFishingLevel hook above + public override void ModifyDisplayParameters(InfoDisplay currentDisplay, ref string displayValue, ref string displayName, ref Color displayColor, ref Color displayShadowColor) + { + if (currentDisplay == InfoDisplay.FishFinder) + { + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.owner == Main.myPlayer && p.bobber) + return; + } + + if (Main.LocalPlayer.GetFishingConditions().BaitItemType == ModContent.ItemType()) + displayValue = Language.GetTextValue("GameUI.FishingWarning"); + } + } + } } diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index f8291c3f03..29eb0084cd 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -56,6 +56,7 @@ using Terraria.GameContent.Creative; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using CalamityMod.Projectiles.Melee; namespace CalamityMod.CalPlayer { @@ -142,7 +143,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)); @@ -165,7 +166,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); @@ -185,7 +186,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)); @@ -208,7 +209,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); @@ -882,7 +883,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); @@ -923,19 +924,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); @@ -943,7 +946,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; @@ -1131,7 +1134,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); @@ -1156,8 +1159,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); } @@ -1191,8 +1194,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); @@ -1392,7 +1395,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; @@ -1423,7 +1426,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; } @@ -1470,7 +1473,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. @@ -1576,12 +1579,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; } } @@ -2156,7 +2159,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)); @@ -2166,9 +2169,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) @@ -2374,7 +2377,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); } } @@ -2400,7 +2403,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); @@ -2455,7 +2458,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); @@ -2466,7 +2469,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++) { @@ -2507,7 +2510,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); @@ -2527,11 +2530,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; } @@ -2539,7 +2542,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); @@ -2557,7 +2560,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++) @@ -2572,7 +2575,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 2bc5d07102..1e88cd1731 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 @@ -567,12 +567,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 35f572c889..b42f750bd8 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 60fe2b408a..c735faff42 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); @@ -1321,7 +1323,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; } } @@ -1340,7 +1342,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()) { @@ -1378,7 +1380,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/CalPlayer/DrawLayers/WingsofRebirthLayer.cs b/CalPlayer/DrawLayers/WingsofRebirthLayer.cs index c3aac53bca..6eaeef33b6 100644 --- a/CalPlayer/DrawLayers/WingsofRebirthLayer.cs +++ b/CalPlayer/DrawLayers/WingsofRebirthLayer.cs @@ -28,7 +28,7 @@ namespace CalamityMod.CalPlayer.DrawLayers return; Texture2D texture = yharwingTexture.Value; Vector2 Position = drawInfo.Position; - Vector2 pos = new Vector2((int)(Position.X - Main.screenPosition.X + (drawPlayer.width / 2) - (2 * drawPlayer.direction)), (int)(Position.Y - Main.screenPosition.Y + (drawPlayer.height / 2) - 2f * drawPlayer.gravDir)); + Vector2 pos = new Vector2((int)(Position.X - Main.screenPosition.X + (drawPlayer.width / 2) - (2 * drawPlayer.direction)), (int)(Position.Y - Main.screenPosition.Y + (drawPlayer.height / 2 + drawPlayer.HeightOffsetVisual / 2f) - 2f * drawPlayer.gravDir)); Color lightColor = Lighting.GetColor((int)drawPlayer.Center.X / 16, (int)drawPlayer.Center.Y / 16, Color.White); Color color = lightColor * (1 - drawInfo.shadow); DrawData d = new DrawData(texture, pos, texture.Frame(1, 9, 0, drawInfo.drawPlayer.wingFrame), color, 0f, new Vector2(texture.Width / 2, texture.Height / 18), 1f, drawInfo.playerEffect, 0); @@ -36,4 +36,4 @@ namespace CalamityMod.CalPlayer.DrawLayers drawInfo.DrawDataCache.Add(d); } } -} \ No newline at end of file +} diff --git a/CalamityNetcode.cs b/CalamityNetcode.cs index 33c5e2f016..cb7eafed84 100644 --- a/CalamityNetcode.cs +++ b/CalamityNetcode.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using CalamityMod.Packets; using Microsoft.Xna.Framework; @@ -11,39 +12,45 @@ namespace CalamityMod { public class CalamityNetcode : ModSystem { - private static CalamityPacket[] _PacketRegistry = new CalamityPacket[256]; // This should allow to use 0-255 range (full byte range) + private static List _PacketHandlers = []; - internal static void RegisterHandler(CalamityPacket handler) + internal static ushort RegisterHandler(CalamityPacket handler) { - var msgType = handler.MessageType; - var existingHandler = _PacketRegistry[msgType]; + var id = (ushort)_PacketHandlers.Count; + _PacketHandlers.Add(handler); + return id; + } - if (existingHandler != null) - { - CalamityMod.Log.Error($"Packet instance has already registered by other type!" + - $" [Failed On: '{handler.GetType().FullName}'" + - $" Current Owner: '{existingHandler.GetType().FullName}'," + - $" msgTypeToRegister: '{msgType}']"); - return; - } + internal static void WriteHandlerNetID(BinaryWriter packet, ushort netID) + { + if (_PacketHandlers.Count > 256) + packet.Write(netID); + else + packet.Write((byte)netID); + } - _PacketRegistry[msgType] = handler; + internal static ushort ReadHandlerNetID(BinaryReader packet) + { + if (_PacketHandlers.Count > 256) + return packet.ReadUInt16(); + else + return packet.ReadByte(); } public override void OnModUnload() { - _PacketRegistry = null; + _PacketHandlers = null; } public static void HandlePacket(Mod mod, BinaryReader reader, int whoAmI) { try { - CalamityModMessageType msgType = (CalamityModMessageType)reader.ReadByte(); - var packetHandler = _PacketRegistry[(byte)msgType]; + var netID = ReadHandlerNetID(reader); + var packetHandler = _PacketHandlers[netID]; if (packetHandler is not null) { - packetHandler.HandlePacket(in reader, whoAmI); + packetHandler.HandlePacket(reader, whoAmI); } else { @@ -52,7 +59,7 @@ namespace CalamityMod // Throw an exception now instead of allowing the network stream to corrupt. // - CalamityMod.Log.Error($"Failed to parse Calamity packet: No Calamity packet exists with ID {msgType}."); + CalamityMod.Log.Error($"Failed to parse Calamity packet: No Calamity packet exists with ID {netID}."); throw new Exception("Failed to parse Calamity packet: Invalid Calamity packet ID."); } } @@ -132,85 +139,4 @@ namespace CalamityMod } } } - - public enum CalamityModMessageType : byte - { - // Player mechanic syncs - DefenseDamageSync, // TODO -- this can't be synced every 60 frames, it needs to be synced when the player gets hit, or every time it heals up - RageSync, // TODO -- this can't be synced every 60 frames, it needs to be synced every time the player is - AdrenalineSync, // TODO -- this can't be synced every 60 frames, it needs to be synced every time the player is - CooldownAddition, - CooldownRemoval, - SyncCooldownDictionary, - ExaltationDirection, - - // Syncs for specific bosses or entities - SyncCalamityNPCAIArray, - SyncVanillaNPCLocalAIArray, - SpawnSuperDummy, - DeleteAllSuperDummies, - SyncAndroombaSolution, - SyncAndroombaAI, - SyncSlabCrabAI, - PlaceAltCritter, - ProvidenceDyeConditionSync, // TODO -- this packetstorms if you hit Provi with spam weapons. It should ONLY send a packet if the status changes. - PSCChallengeSync, // TODO -- once you've failed the PSC challenge this packetstorms - - // General things for entities - SpawnNPCOnPlayer, - SpawnBossOnPosition, - SyncNPCMotionDataToServer, - SyncNPCPosAndRotOnly, - SyncNPCDemonicFlamesDamage, - SyncNPCDemonSwordImpales, - - // Tile Entities - PowerCellFactory, - ChargingStationStandard, - ChargingStationItemChange, - Turret, - LabHologramProjector, - UpdateCodebreakerConstituents, - UpdateCodebreakerContainedStuff, - UpdateCodebreakerDecryptCountdown, - UnlockAbyssChests, - UpdateCanvasPainting, - - // Draedon Summoner - CodebreakerSummonStuff, - ExoMechSelection, - - // Boss Rush - BossRushStage, - BossRushStartTimer, - BossRushEndTimer, - EndBossRush, - BRHostileProjKillSync, // TODO -- Simplify this. Only one packet needs be sent: "kill all hostile projectiles for N frames". - - // Acid Rain - AcidRainSync, - AcidRainOldDukeSummonSync, - EncounteredOldDukeSync, - - // Mouse Controls syncs - RightClickSync, - MouseRotationSync, - MousePositionSync, - - // World state sync - SwitchToDifficulty, - - // Music events - MusicEventSyncRequest, - MusicEventSyncResponse, - - // Bandit Reforge Refund - BanditStolenMoneySync, - WantToRefundReforges, - - // Player Draw Effect Parameters - SyncPlayerDrawParameter, - - DialogueDisplayStart, - } } 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/Effects/OtherworldBarrierDistortion.fx b/Effects/OtherworldBarrierDistortion.fx index ead46908fe..9f854ad59a 100644 --- a/Effects/OtherworldBarrierDistortion.fx +++ b/Effects/OtherworldBarrierDistortion.fx @@ -17,7 +17,7 @@ float4 uShaderSpecificData; float4 AdjustPixelPosition(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 { // Drift to offset the noisemap. X multiplier is a prime number to ensure the "loop time" of this is very high, it takes 100 uTime to return to the original state - float2 drift = float2(uTime * uRotation, uTime * uSaturation); + float2 drift = float2(0.23 * uTime * uSaturation, uTime * uSaturation); //This is the uv distance from the center of the texture float2 uvOffsetFromCenter = (coords - 0.5); @@ -38,16 +38,8 @@ float4 AdjustPixelPosition(float4 sampleColor : COLOR0, float2 coords : TEXCOORD // I would like to be able to draw directly additive, but I have been unable to make that work and this has worked well. float4 distortedColor = tex2D(uImage0, modifiedCoords); distortedColor.a = distortedColor.x; - distortedColor *= uDirection; - - float4 drawColor = sampleColor; - float4 borderColor = sampleColor; - borderColor.rgb = uSecondaryColor; - - if(dist > 0.4) - drawColor = lerp(sampleColor, borderColor, (dist - 0.4) / 0.1); - return distortedColor * drawColor * mask; + return distortedColor * sampleColor * mask; } diff --git a/Effects/OtherworldBarrierDistortion.xnb b/Effects/OtherworldBarrierDistortion.xnb index ad3fa23439..d933cce2e5 100644 Binary files a/Effects/OtherworldBarrierDistortion.xnb and b/Effects/OtherworldBarrierDistortion.xnb differ diff --git a/ExtraTextures/Bestiary/DesertNuisance_Bestiary.png b/ExtraTextures/Bestiary/DesertNuisance_Bestiary.png deleted file mode 100644 index c592bad6ce..0000000000 Binary files a/ExtraTextures/Bestiary/DesertNuisance_Bestiary.png and /dev/null differ diff --git a/ExtraTextures/Bestiary/DesertPest_Bestiary.png b/ExtraTextures/Bestiary/DesertPest_Bestiary.png deleted file mode 100644 index a2641ce82d..0000000000 Binary files a/ExtraTextures/Bestiary/DesertPest_Bestiary.png and /dev/null differ diff --git a/ExtraTextures/Bestiary/DesertScourge_Bestiary.png b/ExtraTextures/Bestiary/DesertScourge_Bestiary.png deleted file mode 100644 index 4b36bd6565..0000000000 Binary files a/ExtraTextures/Bestiary/DesertScourge_Bestiary.png and /dev/null differ diff --git a/Graphics/EnhancedDarknessSystem.cs b/Graphics/EnhancedDarknessSystem.cs index e6636e92b3..f300ee70fb 100644 --- a/Graphics/EnhancedDarknessSystem.cs +++ b/Graphics/EnhancedDarknessSystem.cs @@ -14,20 +14,26 @@ namespace CalamityMod.Graphics { public class EnhancedDarknessSystem : ModSystem { + + private static Asset _defaultTexture; public class LightSource { - public Asset texture; + + public Texture2D texture = _defaultTexture.Value; public float scale = 1; public Vector2 vectorScale = Vector2.One; public Vector2 center = Main.LocalPlayer.Center; public float rotation = 0; public float opacity = 1; - + public Color color = Color.White; + public int lifetime = 1; + public Rectangle? frame = null; public LightSource() { } - public LightSource(Vector2? center = null, Asset texture = null, float scale = 1, float rotation = 0, Vector2? vectorScale = null, float opacity = 1) + // This constructor only gives the most common arguments. Frame, Color, lifetime, etc. must be set in curly braces afterwards to prevent this constructor getting too unwieldy. + public LightSource(Vector2? center = null, Texture2D texture = null, float scale = 1, float rotation = 0, Vector2? vectorScale = null, float opacity = 1) { - this.texture = texture ?? ModContent.Request("CalamityMod/Particles/BloomCircle"); + this.texture = texture ?? ModContent.Request("CalamityMod/Particles/BloomCircle").Value; this.scale = scale; this.vectorScale = vectorScale ?? Vector2.One; this.center = center ?? Main.LocalPlayer.Center; @@ -37,10 +43,11 @@ namespace CalamityMod.Graphics } public static List lights = new(); - public override void OnModLoad() + public override void Load() { On_OverlayManager.Draw += DrawShadowOverlay; On_LightingEngine.UpdateLightDecay += AdjustTransmissiveness; + _defaultTexture = ModContent.Request("CalamityMod/Particles/BloomCircle"); } private void DrawShadowOverlay(On_OverlayManager.orig_Draw orig, OverlayManager self, SpriteBatch spriteBatch, RenderLayers layer, bool beginSpriteBatch) @@ -58,8 +65,8 @@ namespace CalamityMod.Graphics var device = Main.instance.GraphicsDevice; using var lease = RenderTargetPool.Shared.Rent( device, - Main.screenWidth / 2, - Main.screenHeight / 2, + Main.screenWidth, + Main.screenHeight, RenderTargetDescriptor.Default ); @@ -68,7 +75,7 @@ namespace CalamityMod.Graphics Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.Default, Main.Rasterizer, null, Matrix.Identity); foreach (var item in lights) { - Main.spriteBatch.Draw(item.texture.Value, (item.center - Main.screenPosition) * 0.5f, null, Color.White * item.opacity, item.rotation, item.texture.Size() * 0.5f, item.vectorScale * item.scale * 0.5f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(item.texture, (item.center - Main.screenPosition), item.frame, item.color * item.opacity, item.rotation, item.frame is null ? item.texture.Size() * 0.5f : item.frame.Value.Size(), item.vectorScale * item.scale, SpriteEffects.None, 0); } Main.spriteBatch.End(); } @@ -79,7 +86,7 @@ namespace CalamityMod.Graphics var shader = GameShaders.Misc["CalamityMod:DozeLightingShader"]; shader.UseOpacity(mp.darknessIntensity); shader.Apply(); - Main.spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White, 0, Vector2.Zero, 2, 0, 0); + Main.spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White, 0, Vector2.Zero, 1, 0, 0); spriteBatch.End(); } } @@ -109,7 +116,17 @@ namespace CalamityMod.Graphics public override void PreUpdateEntities() { //Every frame, the light sources are determined by what was added on that frame only. Therefore, we reset the light list every frame. - lights.Clear(); + //Lifetime is provided to smooth out things that don't run every frame consistently to prevent flickering, such as the abyss torches. + for (var i = 0; i < lights.Count; i++) + { + var item = lights[i]; + item.lifetime--; + if (item.lifetime <= 0) + { + lights.Remove(item); + i--; + } + } } } 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 49741c87c6..0e39b0ffa5 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -109,6 +109,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; @@ -145,7 +146,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 7b1b31010d..8b11dcb9e3 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/ArcFlashRing.cs b/Items/Accessories/ArcFlashRing.cs index c2e110cae8..32d8fbc0c0 100644 --- a/Items/Accessories/ArcFlashRing.cs +++ b/Items/Accessories/ArcFlashRing.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; - public static int LightningSpawnPercent = 6; - public static float LightningDamageMult = 4f; + public static int LightningSpawnPercent = 5; + public static float LightningDamageMult = 3f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(LightningSpawnPercent, LightningDamageMult); public override void SetDefaults() 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/OccultSkullCrown.cs b/Items/Accessories/OccultSkullCrown.cs index d5d4f8a7f0..989c1bde9e 100644 --- a/Items/Accessories/OccultSkullCrown.cs +++ b/Items/Accessories/OccultSkullCrown.cs @@ -32,8 +32,8 @@ namespace CalamityMod.Items.Accessories Item.width = 82; Item.height = 62; Item.defense = 5; - Item.rare = ModContent.RarityType(); - Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; + Item.rare = ModContent.RarityType(); + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.accessory = true; Item.SetRevExclusive(); } 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/WarbanneroftheRighteous.cs b/Items/Accessories/WarbanneroftheRighteous.cs index b14c0f227d..60899e5cd8 100644 --- a/Items/Accessories/WarbanneroftheRighteous.cs +++ b/Items/Accessories/WarbanneroftheRighteous.cs @@ -93,7 +93,7 @@ namespace CalamityMod.Items.Accessories { modNPC.warbannerBurnIntensity = intensity; modNPC.warbannerBurnDirection = Utils.DirectionTo(player.Center, nPC.Center); - int burnDamage = (int)player.GetBestClassDamage().ApplyTo(37 * damageMult); // There is up to a 3x multiplier on this damage depending on distance from the enemy + int burnDamage = (int)player.GetBestClassDamage().ApplyTo(15 * damageMult); // There is up to a 3x multiplier on this damage depending on distance from the enemy modNPC.warbannerBurnDamage = burnDamage; modNPC.warbannerBurnStacks++; modNPC.warbannerBurnTimer = 180; diff --git a/Items/Accessories/WulfrumAcrobaticsPack.cs b/Items/Accessories/WulfrumAcrobaticsPack.cs index e8723b67b3..b9f1911f34 100644 --- a/Items/Accessories/WulfrumAcrobaticsPack.cs +++ b/Items/Accessories/WulfrumAcrobaticsPack.cs @@ -1,13 +1,15 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using CalamityMod.DataStructures; using CalamityMod.Items.Materials; +using CalamityMod.Packets; using CalamityMod.Projectiles.Typeless; 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 +25,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 +34,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 +79,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 +87,7 @@ namespace CalamityMod.Items.Accessories { projectile.active = false; } - } + }*/ } public class WulfrumPackPlayer : ModPlayer @@ -226,6 +233,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; @@ -281,7 +386,7 @@ namespace CalamityMod.Items.Accessories } hookCache = -1; - if (!obeyGravity) + if (!obeyGravity) { Player.gravity = -1f; //Disable player gravity with Anti-Grav hook } @@ -355,7 +460,7 @@ namespace CalamityMod.Items.Accessories Player.velocity.X = Player.velocity.X == 0 ? 1.5f : 1.5f * Math.Sign(Player.velocity.X); } } - + else { if (Player.grappling[0] > -1) @@ -363,7 +468,7 @@ namespace CalamityMod.Items.Accessories var Hook = Main.projectile[Player.grappling[0]]; if (Hook != null) { - + if (Player.controlRight) Player.velocity.X += 0.3f; else if (Player.controlLeft) @@ -380,7 +485,7 @@ namespace CalamityMod.Items.Accessories var dis = Hook.Center.Distance(estimatedPos); if (dis > SwingLength && dis < 1000f) { - var dis2 = Math.Min(Player.Center.Distance(goalPos), SwingLength*3f); + var dis2 = Math.Min(Player.Center.Distance(goalPos), SwingLength * 3f); if (dis2 > 0) { Player.velocity = Player.Center.DirectionTo(goalPos) * dis2; @@ -529,7 +634,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 +666,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 +686,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 +700,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 +745,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 +783,179 @@ namespace CalamityMod.Items.Accessories } } } + + internal sealed class WulfrumAcrobaticsSync : CalamityPacket + { + public static WulfrumAcrobaticsSync Instance { get; private set; } + + 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(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 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(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 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(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 0b561a8924..0d0e8efdcf 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -483,76 +483,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 @@ -1056,7 +986,7 @@ namespace CalamityMod.Items player.endurance -= 0.12f; // Solar Flare armor dash overrides modded dashes by default - if (player.solarShields > 0 || player.wingsLogic == (int)VanillaWingID.WingsSolar) + if (player.solarShields > 0) modPlayer.DashID = string.Empty; } } diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 3aa7a43014..388bec75f7 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -28,6 +28,7 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.UI.Chat; +using static CalamityMod.CalamityUtils; namespace CalamityMod.Items { @@ -151,8 +152,8 @@ namespace CalamityMod.Items WhipAutomaticTooltips(item, tooltips, ref lastTooltipIndex); // In GFB, replace all instances of "rogue" with "rouge". - string[] rogueKey = new string[] { CalamityUtils.GetTextValue($"Misc.GFBRogueUppercase"), CalamityUtils.GetTextValue($"Misc.GFBRogueLowercase") }; - string[] rougeKey = new string[] { CalamityUtils.GetTextValue($"Misc.GFBRougeUppercase"), CalamityUtils.GetTextValue($"Misc.GFBRougeLowercase") }; + string[] rogueKey = [CalamityUtils.GetTextValue($"Misc.GFBRogueUppercase"), CalamityUtils.GetTextValue($"Misc.GFBRogueLowercase")]; + string[] rougeKey = [CalamityUtils.GetTextValue($"Misc.GFBRougeUppercase"), CalamityUtils.GetTextValue($"Misc.GFBRougeLowercase")]; for (int n = 0; n < rogueKey.Length; n++) { if (Main.zenithWorld && rogueKey[n] != "") @@ -1635,7 +1636,35 @@ namespace CalamityMod.Items return false; } + // IV Drip tooltip FX + if (line.Mod == "Terraria" && item.type == ModContent.ItemType() && line.Name == "Tooltip4") + { + Vector2 basePosition = new Vector2(line.X, line.Y); + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, null, Main.UIScaleMatrix); + + for (int i = 0; i < 3; i++) // Draw 3 lines of differing opacity, color, and displacement. + { + float timer = (float)Math.Sin(Main.GlobalTimeWrappedHourly + 1f) / 2f; + + float angle = (Main.GlobalTimeWrappedHourly * 2f) + (i * MathHelper.TwoPi / 3f); + float radius = timer * (3f + i * 6f); + Vector2 offset = new Vector2((float)Math.Cos(angle) * 1.7f, (float)Math.Sin(angle) * 1f) * radius; // Offset in an elliptical pattern + Vector2 pos = basePosition + offset; + + Color color = MulticolorLerp(Math.Abs(timer + (i * 0.2f)) % 1f, Color.LightBlue, Color.LightGreen, (i == 3) ? Color.Blue : (i == 2) ? Color.Red : Color.White); + float opacity = 1f - (i * 0.2f); + float rotation = line.Rotation + (timer * (Main.GlobalTimeWrappedHourly * 0.00001f)); // This precision is intended + + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, pos, color * opacity, rotation, line.Origin, line.BaseScale, line.MaxWidth, line.Spread); + } + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Main.UIScaleMatrix); + + return false; + } if (line.Mod == "Terraria" && item.type == ModContent.ItemType() && (line.Name == "Tooltip1" || line.Name == "Tooltip2" || line.Name == "Tooltip4" || line.Name == "Tooltip5" || line.Name == "Tooltip7")) { Color rarityColor = Color.Black; 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/Dyes/TarragonDye.cs b/Items/Dyes/TarragonDye.cs index 0522fd91bf..d6193e134f 100644 --- a/Items/Dyes/TarragonDye.cs +++ b/Items/Dyes/TarragonDye.cs @@ -13,6 +13,10 @@ namespace CalamityMod.Items.Dyes { public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/TarragonDyeShader"), "DyePass"). UseColor(new Color(20, 117, 70)).UseSecondaryColor(new Color(28, 255, 55)).UseImage(Request("CalamityMod/ExtraTextures/GreyscaleGradients/Bark")); + public override void SafeSetStaticDefaults() + { + Item.ResearchUnlockCount = 3; + } public override void SafeSetDefaults() { diff --git a/Items/Fishing/BaseQuestFish.cs b/Items/Fishing/BaseQuestFish.cs index e18d825cfa..7cf3ed426d 100644 --- a/Items/Fishing/BaseQuestFish.cs +++ b/Items/Fishing/BaseQuestFish.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Fishing public virtual LocalizedText Location => LocalizedText.Empty; public new string LocalizationCategory => "Items.Fishing"; - public override LocalizedText Tooltip => Location; + public override LocalizedText Tooltip => CalamityUtils.GetText($"Items.Fishing.LocationTooltip").WithFormatArgs(Location); public override void SetStaticDefaults() { @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Fishing public override void AnglerQuestChat(ref string description, ref string catchLocation) { description = this.GetLocalizedValue("QuestDescription"); - catchLocation = Location.ToString().Replace("'", string.Empty); + catchLocation = Location.ToString(); } } } diff --git a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs index 4ff45d393b..bbf1466626 100644 --- a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs +++ b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Tiles.Crags; using Terraria; using Terraria.ID; @@ -49,6 +50,9 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches // This is our equivalent to Souls of Light/Night itemLoot.Add(ModContent.ItemType(), 2, 2, 5); + // Slagfire Douser @ 10% + itemLoot.Add(ModContent.ItemType(), 10, 1, 1); + itemLoot.AddBiomeCrateLootRules(); } } diff --git a/Items/Fishing/BrimstoneCragCatches/SlagCrate.cs b/Items/Fishing/BrimstoneCragCatches/SlagCrate.cs index 3095e8fb7e..6d58c05f02 100644 --- a/Items/Fishing/BrimstoneCragCatches/SlagCrate.cs +++ b/Items/Fishing/BrimstoneCragCatches/SlagCrate.cs @@ -1,4 +1,6 @@ -using CalamityMod.Tiles.Crags; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Tiles.Crags; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,6 +36,9 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches // This is our equivalent to Bamboo itemLoot.Add(ModContent.ItemType(), 3, 20, 50); + // Slagfire Douser @ 10% + itemLoot.Add(ModContent.ItemType(), 10, 1, 1); + itemLoot.AddBiomeCrateLootRules(false); } } diff --git a/Items/Potions/Alcohol/GrapeBeer.cs b/Items/Potions/Alcohol/GrapeBeer.cs index 1370471392..934254c049 100644 --- a/Items/Potions/Alcohol/GrapeBeer.cs +++ b/Items/Potions/Alcohol/GrapeBeer.cs @@ -12,12 +12,12 @@ 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() { - Item.ResearchUnlockCount = 30; + Item.ResearchUnlockCount = 20; ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(36, 2, 41), new Color(56, 0, 64), diff --git a/Items/Potions/Alcohol/Margarita.cs b/Items/Potions/Alcohol/Margarita.cs index bfe464f655..540564af49 100644 --- a/Items/Potions/Alcohol/Margarita.cs +++ b/Items/Potions/Alcohol/Margarita.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 30; + Item.ResearchUnlockCount = 20; ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(219, 227, 191), new Color(186, 189, 147), diff --git a/Items/Potions/Alcohol/RedWine.cs b/Items/Potions/Alcohol/RedWine.cs index dd9a8c55f3..cfbb26c2e8 100644 --- a/Items/Potions/Alcohol/RedWine.cs +++ b/Items/Potions/Alcohol/RedWine.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 30; + Item.ResearchUnlockCount = 20; ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(54, 5, 21), new Color(82, 9, 36), diff --git a/Items/Potions/Alcohol/Vodka.cs b/Items/Potions/Alcohol/Vodka.cs index 625c737ae5..df6d812501 100644 --- a/Items/Potions/Alcohol/Vodka.cs +++ b/Items/Potions/Alcohol/Vodka.cs @@ -36,8 +36,8 @@ namespace CalamityMod.Items.Potions.Alcohol } public override void AddRecipes() { - CreateRecipe(6). - AddIngredient(ItemID.BottledWater, 6). + CreateRecipe(10). + AddIngredient(ItemID.Bottle, 10). AddIngredient(10). AddIngredient(10). AddTile(TileID.Kegs). diff --git a/Items/Potions/Alcohol/WhiteWine.cs b/Items/Potions/Alcohol/WhiteWine.cs index 9e0be6cb45..7c6c6a26eb 100644 --- a/Items/Potions/Alcohol/WhiteWine.cs +++ b/Items/Potions/Alcohol/WhiteWine.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 30; + Item.ResearchUnlockCount = 20; // Clear, yellow-green ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(242, 252, 177, 180), 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/HolofibreImmolator.cs b/Items/Weapons/DraedonsArsenal/HolofibreImmolator.cs index 4662772075..40bc830c79 100644 --- a/Items/Weapons/DraedonsArsenal/HolofibreImmolator.cs +++ b/Items/Weapons/DraedonsArsenal/HolofibreImmolator.cs @@ -46,9 +46,15 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; } - + public override bool AltFunctionUse(Player player) => true; public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; + public override void HoldItem(Player player) + { + if (Main.myPlayer == player.whoAmI) + player.Calamity().rightClickListener = true; + + player.Calamity().mouseWorldListener = true; + } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/HolofibreImmolatorGlow").Value); 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..b0557f6d3a 100644 --- a/Items/Weapons/Magic/AlphaDraconis.cs +++ b/Items/Weapons/Magic/AlphaDraconis.cs @@ -26,9 +26,9 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 52; Item.height = 74; - Item.damage = 270; + Item.damage = 125; Item.DamageType = DamageClass.Magic; - Item.mana = 6; + Item.mana = 12; Item.useTime = 12; Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Shoot; @@ -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(), (int)(damage * 3.5f), 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/Melee/Lightspeed.cs b/Items/Weapons/Melee/Lightspeed.cs index c8ae64ce38..97b6bc2f38 100644 --- a/Items/Weapons/Melee/Lightspeed.cs +++ b/Items/Weapons/Melee/Lightspeed.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 74; Item.height = 94; Item.useStyle = ItemUseStyleID.Shoot; - Item.damage = 196; + Item.damage = 234; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = Item.useTime = 20; Item.shootSpeed = 10f; @@ -36,10 +36,8 @@ namespace CalamityMod.Items.Weapons.Melee base.SetDefaults(); } - public override bool AltFunctionUse(Player player) - { - return true; - } + // You can only use the right-click if you have sufficient Elemental Mastery + public override bool AltFunctionUse(Player player) => player.Calamity().elementalMastery >= 100; public override void HoldItem(Player player) { 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..c6fbde9718 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; @@ -19,11 +20,11 @@ namespace CalamityMod.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/SlagfireDouser.cs b/Items/Weapons/Ranged/SlagfireDouser.cs new file mode 100644 index 0000000000..ffa8425ca4 --- /dev/null +++ b/Items/Weapons/Ranged/SlagfireDouser.cs @@ -0,0 +1,50 @@ +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class SlagfireDouser : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetDefaults() + { + Item.width = 104; + Item.height = 34; + Item.damage = 10; + Item.DamageType = DamageClass.Ranged; + Item.useTime = 30; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = .4f, Pitch = -.95f, PitchVariance = 0.1f }; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; + Item.autoReuse = false; // Because holdout + Item.shoot = ModContent.ProjectileType(); + Item.ArmorPenetration = 10; + Item.shootSpeed = 13f; + Item.reuseDelay = 0; // Because holdout + Item.channel = true; // Because holdout + Item.noUseGraphic = true; + } + + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; + public override Vector2? HoldoutOffset() => new Vector2(102, 0); + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ProjectileType(), damage, knockback, player.whoAmI); + + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); // Aim toward mouse + + return false; + } + } +} diff --git a/Items/Weapons/Ranged/SlagfireDouser.png b/Items/Weapons/Ranged/SlagfireDouser.png new file mode 100644 index 0000000000..cc4081bfd8 Binary files /dev/null and b/Items/Weapons/Ranged/SlagfireDouser.png differ 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/Items/Weapons/Rogue/KelvinCatalyst.cs b/Items/Weapons/Rogue/KelvinCatalyst.cs index cfcd7844f7..bdb23f1f1c 100644 --- a/Items/Weapons/Rogue/KelvinCatalyst.cs +++ b/Items/Weapons/Rogue/KelvinCatalyst.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 20; Item.height = 20; - Item.damage = 60; + Item.damage = 50; Item.noMelee = true; Item.noUseGraphic = true; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/DazzlingStabberStaff.cs b/Items/Weapons/Summon/DazzlingStabberStaff.cs index 86f2e16692..2eb6396a97 100644 --- a/Items/Weapons/Summon/DazzlingStabberStaff.cs +++ b/Items/Weapons/Summon/DazzlingStabberStaff.cs @@ -39,27 +39,43 @@ namespace CalamityMod.Items.Weapons.Summon } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + float usedMinionSlots = 0; + foreach (var minions in Main.ActiveProjectiles) + { + if (minions.owner == player.whoAmI) + usedMinionSlots += minions.minionSlots; + } + bool hasSlotsForSummon = true; + if (usedMinionSlots + 1 > player.maxMinions) + hasSlotsForSummon = false; + player.AddBuff(Item.buffType, 2); - for (int i = 0; i < 3; i++) + int projCount = player.ownedProjectileCounts[type] + (hasSlotsForSummon ? 3 : 0); + if (hasSlotsForSummon) { - var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, i + 1); - minion.originalDamage = Item.damage; + for (int i = 0; i < 3; i++) + { + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, i + 1); + minion.originalDamage = Item.damage; + } } float angleMax = MathHelper.ToRadians(360f); - if (player.ownedProjectileCounts[type] == 1) + if (projCount == 100) angleMax = 0f; float index = 1f; - if (player.ownedProjectileCounts[Item.shoot] > 30) + if (projCount > 30) { - angleMax += MathHelper.ToRadians((player.ownedProjectileCounts[Item.shoot] - 30) * 2.5f); + angleMax += MathHelper.ToRadians((projCount - 30) * 2.5f); } angleMax = angleMax > MathHelper.ToRadians(360f) ? MathHelper.ToRadians(360f) : angleMax; // More intuitive than using a min function foreach (Projectile p in Main.ActiveProjectiles) { if (p.type == type && p.owner == player.whoAmI) { - p.ai[1] = index / player.ownedProjectileCounts[type] * angleMax - angleMax / 2f; + int adjustedProjCount = (int)(projCount); + Main.NewText("index: " + index.ToString() + " | projCount: " + adjustedProjCount.ToString() + " | angleMax: " + angleMax.ToString()); + p.ai[1] = index / adjustedProjCount * angleMax - angleMax / 2f; p.netUpdate = true; index++; } diff --git a/Items/Weapons/Summon/SeashineHilt.cs b/Items/Weapons/Summon/SeashineHilt.cs index 347289457d..312100f28f 100644 --- a/Items/Weapons/Summon/SeashineHilt.cs +++ b/Items/Weapons/Summon/SeashineHilt.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Summon // There's a long cooldown on commanding blades // This is so you don't just hold down right click, since now it's optimal to only command blades when all are ready if (player.altFunctionUse == 2) - return 0.1f; + return 0.37f; else return 1f; } @@ -57,6 +57,17 @@ namespace CalamityMod.Items.Weapons.Summon } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + float usedMinionSlots = 0; + foreach (var minions in Main.ActiveProjectiles) + { + if (minions.owner == player.whoAmI) + usedMinionSlots += minions.minionSlots; + } + bool hasSlotsForSummon = true; + if (usedMinionSlots + 1 > player.maxMinions) + hasSlotsForSummon = false; + + // Call all active blades to attack if they are charged // The check to see if a blade is charged is done in the blade itself if (player.altFunctionUse == 2) @@ -89,7 +100,7 @@ namespace CalamityMod.Items.Weapons.Summon SoundEngine.PlaySound(SoundID.Item101 with { Volume = 0.9f, Pitch = Main.rand.NextFloat(0.3f, 0.5f) }, player.Center); } } - else // Toss out the summon + else if (hasSlotsForSummon) // Toss out the summon { player.AddBuff(Item.buffType, 2); SoundEngine.PlaySound(SoundID.Item1, player.Center); @@ -117,6 +128,8 @@ namespace CalamityMod.Items.Weapons.Summon } } } + + return false; } public override void UseItemFrame(Player player) // Player hand animation when you command the blades diff --git a/Items/Weapons/Typeless/StratusSphere.cs b/Items/Weapons/Typeless/StratusSphere.cs index 65b8e68846..3094b78dbd 100644 --- a/Items/Weapons/Typeless/StratusSphere.cs +++ b/Items/Weapons/Typeless/StratusSphere.cs @@ -11,6 +11,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.Graphics.Effects; @@ -23,11 +24,14 @@ namespace CalamityMod.Items.Weapons.Typeless public class StratusSphere : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Typeless"; + public static readonly SoundStyle CastSound = new("CalamityMod/Sounds/Item/StratusSphereCast"); + public static readonly SoundStyle LoopSound = new("CalamityMod/Sounds/Item/StratusSphereLoop"); + public override void SetDefaults() { Item.width = 48; Item.height = 30; - Item.damage = 500; + Item.damage = 400; Item.DamageType = AverageDamageClass.Instance; Item.useTime = 30; Item.useAnimation = 30; @@ -37,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Typeless Item.knockBack = 5.5f; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); - Item.UseSound = SoundID.Item40; + Item.UseSound = CastSound; Item.autoReuse = true; Item.shootSpeed = 20f; Item.shoot = ModContent.ProjectileType(); @@ -81,7 +85,7 @@ namespace CalamityMod.Items.Weapons.Typeless player.Calamity().Starshield = 30; } else - player.Calamity().Starshield = 3600; + player.Calamity().Starshield = CalamityUtils.MinutesToFrames(10); } else { diff --git a/Localization/en-US/Mods.CalamityMod.Bestiary.Vanilla.hjson b/Localization/en-US/Mods.CalamityMod.Bestiary.Vanilla.hjson index 8424669b66..1b8d3e82f5 100644 --- a/Localization/en-US/Mods.CalamityMod.Bestiary.Vanilla.hjson +++ b/Localization/en-US/Mods.CalamityMod.Bestiary.Vanilla.hjson @@ -1,6 +1,6 @@ // Put their internal name here NPCName: { - Guide: Once tasked with shepherding the Wall of Flesh, the Guide is a godlike figure in Demon folklore. However, the former warlock apprentice now savors a humble life, mentoring adventurers with his sharp intuition. + Guide: Once tasked with shepherding the Wall of Flesh, the Guide is a godlike figure in Demon folklore. However, the former warlock apprentice now savors a humble life, offering useful advice and crafting recipes. Dryad: The Dryad practices the art of Life Magic, pioneered by Silva. She is connected with nature and can analyze its purity worldwide. She sells seeds, too! Mechanic: The Mechanic was imprisoned for sticking her nose where she shouldn't. She sells wiring and tools for putting together anything imaginable. EmpressButterfly: These familiars conjured by the Empress draw power from their surroundings and later bring it to their master. They remind her of a lost loved one, and should one perish in the chaos of night, she shall unleash her full fury upon the attacker. @@ -62,7 +62,6 @@ NPCName: { RedDevil: Conjuring potent spears of dark magic, these elite demons hunt after the adventurer that destroyed their perceived deity. WyvernHead: Deeply in tune with the magic of the world, these serpentine dragons guard the skyward ruins of Chrysadia on behalf of the Storm Dragon. Now, their duty calls louder as divine essence surges through the land. Harpy: Winged, demi-human creatures from distant southward mountains who came to inhabit the sky archipelago after the ruin of its old civilization. They defend their new territory fiercely against invaders with their razor-sharp feathers. - Scutlix: One of the few creatures left in the Martian homeworld, these creatures function similarly to horses. That is, if horses could fire lasers from their eyes. MartianProbe: Sensing growing power on the planet, otherworldly beings send space-age technology to scan for valuable resources. SeekerHead: Godly magicks have unleashed the dark influences that gave birth to the Eater of Worlds, producing smaller, but just as deadly worms. DesertDjinn: Buried in these caves lie cryptic artifacts older than Ilmeris, their origins swept away by the sands of time. Corrupted by divine magicks, the once friendly djinns within them now reemerge, full of hostility. @@ -82,7 +81,7 @@ NPCName: { Spazmatism: A pair of mechanical eyes built by Draedon for reconnaissance and assassination, Spazmatism chases at high speed, exhaling cursed flames. TheDestroyer: Despite being made with repurposed mining equipment, the Destroyer was built for fighting other deities in single combat, decorated in laser-armed probes, which detach from its body when damaged. SkeletronPrime: Built with the express purpose of inciting fear into the hearts of any god worshiper, this machine has more arms than ever before, and a variety of fierce weapons. - Plantera: A creation of the Vernal Pass meant to replace Braelor in his absence. They harnessed dead animal souls to give it life, but the span of such magic was far larger than anticipated. It didn't take long for the Plantera to grow out of control and slaughter its masters. + Plantera: A dormant, yet powerful floral guardian grown by the elders of the Vernal Pass, using volatile animal souls as nourishment. Unshackled in a fit of herbage carnage, its reach now spans the entire jungle. HallowBoss: Despite their parentage, children of gods do not inherit a shred of their power. The Empress chose to claim power for herself by siphoning it from other places and beings. She found a perfect candidate in the Hallow due to its unstable nature, and is now transformed into a mighty fae. Golem: A remarkable display of ingenuity constructed by the Lihzahrd race. Seeking light after they hid away in their temple out of shame for driving their goddess away, they built this construct. Powered by solar energy cells, it is ready to guard the Temple. DukeFishron: An aquatic-evolved species which lives in isolation in the depths of the ocean. Despite their shortcomings, they still share blood with the dragons of old, claiming near complete dominion over the oceans. Legends claim it only surfaces in search of a rare, savory type of worm. diff --git a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson index b0868f354f..db28331712 100644 --- a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson +++ b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson @@ -79,7 +79,7 @@ CryoSlime: Slimes enchanted by the Archmage, as a host to crystallize the frozen Eidolist: Once members of the dragon cult, they now beg the favor of a new master. They are able to live in the abyss indefinitely thanks to their wyrm-like form, allowing them to serve a new purpose. FearlessGoldfishWarrior: Though Goldfish thrive in their ponds and lakes, many take to land during storms to feed on the worms that have also surfaced. There are even accounts of aquatic warriors who carry daggers of shimmering gold, though most consider these tales far too fishy to be credible. Frogfish: Well-camouflaged and prepared to strike at any moment, Frogfish show that the ocean is rarely as serene as it seems. There are few places where one can find true peace here in the heart of what once was an empire unrivaled. -Horse: After the Brimstone Elemental became dormant, the forgemasters of Azafure used clockwork and crystal to bind the powers of an elemental to a mechanical body. While formidable, it seems the dream of creating a true replacement for an elemental died unfulfilled with Azafure itself. +EarthElemental: After the Brimstone Elemental became dormant, the forgemasters of Azafure used clockwork and crystal to bind the powers of an elemental to a mechanical body. While formidable, it seems the dream of creating a true replacement for an elemental died unfulfilled with Azafure itself. IceClasper: Though their exact origins are an enigma, what is known is that these ethereal beings seek to stamp out any and all sources of warmth that exist in their home. Due to this fact, and taking into account the fossil record, many speculate that ice claspers may have played a vital role in the tundra's creation. ImpiousImmolator: An idol carved in the image of Her, it is lit ablaze with the crafter's lifeforce. After all, what weight does one's life hold when one wishes to see the world wreathed in Her holy flames? MantisShrimp: Though a variety of answers are given when one asks adventurers about dangerous creatures, few aside from sailors will mention the small yet mighty Mantis Shrimp. Their strikes are so swift that the energy generated from them heats the water to temperatures rivaling the magma of Azafure. diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index e462e0b291..0d7e66c88c 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: { @@ -830,7 +830,7 @@ GreenJellyRegen: { HallowedRuneDefense: { DisplayName: Hallowed Defense - Description: Increased defense by {0} and damage reduction by {1}% + Description: Increased defense by {0} } HallowedRunePower: { @@ -873,7 +873,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 f85719aee0..c4777f71e5 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}% @@ -429,14 +429,14 @@ CorrosiveSpine: { Tooltip: ''' 5% increased movement speed - Multiplies all sickness and water-related debuff damage by 1.25x + 25% increased Sickness and Water debuff damage All attacks irradiate enemies and reduces the severity of the sulphuric waters You burst into radioactive clouds when struck ''' } -CorruptFlask: { - DisplayName: Corrupt Flask +UnholyTonic: { + DisplayName: Unholy Tonic Tooltip: ''' Increases damage reduction by 4% and defense by 6 while in the corruption @@ -448,7 +448,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 ''' @@ -463,8 +462,8 @@ CrawCarapace: { ''' } -CrimsonFlask: { - DisplayName: Crimson Flask +ViciousTonic: { + DisplayName: Vicious Tonic Tooltip: ''' Increases damage reduction by 4% and defense by 6 while in the crimson @@ -485,7 +484,7 @@ CryoStone: { DisplayName: Cryo Stone Tooltip: ''' - Multiplies all cold-based debuff damage by 1.5x + 50% increased Cold debuff damage Creates a rotating ice shield around you that damages and slows down enemies on contact 'One of the ancient relics' ''' @@ -588,7 +587,7 @@ DiamondOfTheDeep: { DisplayName: Diamond of the Deep Tooltip: ''' - Multiplies all water debuff damage by 1.6x + 60% increased Water debuff damage Slowly accrue up to three different abyssal spirits Dash to disperse the spirits and have them attack enemies When dispersed [c/CB7AD7:below 50% life], the spirits support you instead @@ -756,9 +755,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 ''' } @@ -921,7 +920,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] ''' } @@ -1199,7 +1198,7 @@ Nucleogenesis: { DisplayName: Nucleogenesis Tooltip: ''' - Increases your max number of mininons by 4 + Increases your max number of minions by 4 Grants immunity to Shadowflame and Irradiated 15% increased summon damage, and increased minion knockback Minions inflict a variety of debuffs @@ -1305,7 +1304,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] ''' } @@ -1576,7 +1575,7 @@ SeaSpiritAmulet: { Slowly accumulate up to eight spirit orbs that follow you Spirits disperse when dashing If below 50% life, they will heal you, otherwise they will attack nearby enemies - Multiplies all water debuff damage by 1.35x + 35% increased Water debuff damage Spirit orbs are transparent and silent if visibility is disabled ''' } @@ -1688,7 +1687,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] ''' } @@ -1881,8 +1880,7 @@ TheAmalgam: { DisplayName: The Amalgam Tooltip: ''' - 10% increased damage - All attacks inflict a variety of debuffs and multiplies all elemental debuff damage by 3x + 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 The dank creeper flies above you, exploding into several shaderain clouds @@ -1938,9 +1936,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% ''' } @@ -1995,7 +1992,7 @@ ToxicHeart: { ''' Your heart beats with the plague, pulsing outside of your body Pulse frequency scale with regen, and pulses that kill enemies pulse again to heal you - Multiplies all sickness debuff damage by 1.5x + 50% increased Sickness debuff damage Effects are transparent and silent if visibility is disabled ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson index 01bff6009c..48756b94b9 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson @@ -1,9 +1,10 @@ -// Quest fish tooltips -CaughtInAstral: "'Caught in the Astral Infection'" -CaughtInBrimstoneCrag: "'Caught in the Brimstone Crag'" -CaughtInSnow: "'Caught in Tundra'" -CaughtInSpace: "'Caught in Sky Lakes'" -CaughtInSunkenSea: "'Caught in the Sunken Sea'" +// Quest fish tooltips +CaughtInAstral: Caught in the Astral Infection +CaughtInBrimstoneCrag: Caught in the Brimstone Crag +CaughtInSnow: Caught in Tundra +CaughtInSpace: Caught in Sky Lakes +CaughtInSunkenSea: Caught in the Sunken Sea +LocationTooltip: "'{0}'" // Astral Infection Catches AldebaranAlewife: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index 8748849c61..495946b816 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -992,7 +992,11 @@ ThaumaticChair: { ThermalTorch: { DisplayName: Thermal Torch - Tooltip: Can be placed in water + Tooltip: + ''' + Can be placed in water + Can dispell the magical darkness of the Abyss when placed + ''' } TranquilityCandle: { @@ -1002,7 +1006,11 @@ TranquilityCandle: { VoidTorch: { DisplayName: Void Torch - Tooltip: Can be placed in water + Tooltip: + ''' + Can be placed in water + Can dispell the magical darkness of the Abyss when placed + ''' } AnahitaTrophy: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index 76aec6fc70..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} ''' } @@ -166,7 +166,6 @@ ZergPotion: { Tooltip: Vastly increases enemy spawn rate } -// Very normal Keg crafts BloodyMary: { DisplayName: Bloody Mary Tooltip: @@ -242,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} ''' @@ -376,7 +374,7 @@ Vodka: { Tooltip: ''' {0}% increased Typeless debuff damage - {1}% decreased other debuff damage + {1}% decreased elemental debuff damage {$Common.AlcoholWarning} ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson index 3aa5e40fbb..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 @@ -415,6 +414,7 @@ WulfrumDiggingTurtle: { ''' Throws a rickety mining contraption to dig out a small tunnel In case of an emergency, press to instantly detonate all your digging turtles + The turtle scales with your pickaxe power ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson index dcead90351..154ba2a790 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson @@ -1,4 +1,4 @@ -AerialTracker: { +AerialTracker: { DisplayName: P-LSR: Aerial Tracker Tooltip: ''' @@ -57,15 +57,6 @@ GalvanizingGlaive: { ''' } -GaussDagger: { - DisplayName: Gauss Dagger - Tooltip: - ''' - Slices through foes with turbulent magnetic force - Striking foes envelops them in a damaging magnetic flux - ''' -} - HolofibreImmolator: { DisplayName: R-PMA: Holofibre Immolator Tooltip: @@ -73,7 +64,8 @@ HolofibreImmolator: { Fires three gravity-affected plasma drops which dissolve through foes Holding quickly charges the bow, firing a high-speed plasma arrow Plasma arrows will detonate after impact, creating stronger explosions if stuck into tiles - Holding while firing will repeatedly fire uncharged shots + Holding will repeatedly fire uncharged shots + Holding and will automatically fire charged arrows at a slightly slower rate [c/1FFBFF:'The elegance of holofibre is unmatched.] [c/1FFBFF:However, mechanical tension may have produced more consistent results.'] ''' @@ -128,7 +120,6 @@ Phaseslayer: { Projects a colossal laser blade which is controlled by the cursor Move the cursor to swing the blade and rip and tear through enemies Faster swings deal more damage and release additional sword beams - When at low charge, the blade becomes smaller and weaker ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index 3ef7721daf..d7fb1a1971 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -40,6 +40,8 @@ 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] + 'An imitation of insanity' ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index aac433761a..c75e16abee 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -313,7 +313,8 @@ 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] + 'Lunacy derived from genius' ''' } @@ -365,7 +366,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.] ''' } @@ -622,7 +623,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 95f3fc4b08..2a809f680d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -538,8 +538,8 @@ 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 Uses gel for ammo 'Halley arrived sooner than expected' ''' @@ -965,7 +965,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.' ''' @@ -1131,6 +1131,16 @@ Shroomer: { Tooltip: Fires bullets and an extremely powerful homing mushroom } +SlagfireDouser: { + DisplayName: Slagfire Douser + Tooltip: + ''' + Lobs armor-penetrating lava in bursts + Armor-penetrating lava ignores 10 points of enemy defense + [c/FF9900:Capable of dousing townsfolk in lava too...] + ''' +} + SlagMagnum: { DisplayName: Slag Magnum Tooltip: Converts musket balls into fossil shards that split into additional shards on impact @@ -1196,7 +1206,6 @@ Starfleet: { ''' fires a spread of starshots fires a concussive short range starburst - Holding down disables the recoil damper Starshots can be accelerated by firing when the starburst goes off Perfect timing reduces spread and increases damage Imperfect timing still increases damage, but heavily increases spread @@ -1211,7 +1220,6 @@ Starmada: { ''' fires a spread of starshots fires a concussive short range starburst - Holding down disables the recoil damper Starshots can be accelerated by firing when the starburst goes off Perfect timing reduces spread, increases damage, and adds a stacking weapon power buff Imperfect timing still increases damage, but heavily increases spread and reduces weapon power diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 8bbc0131be..089e633079 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -1332,7 +1332,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 e856580185..90b08e5662 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -715,8 +715,9 @@ 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] + 'A guide to a dream never realized' ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson index a3f107116d..08fb7476d2 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson @@ -83,5 +83,6 @@ StratusSphere: { Influenced players gain Starbursts over time, while enemies instead take damage to cause Starbursts to form a barrier, causing you to lose Starbursts instead of health Launching the singularity deactivates the barrier, and creating a barrier deactivates the singularity + 'Channeling souls into stars, an inane concept' ''' } diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index 814fa6d53a..22f3ea08cd 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -169,7 +169,7 @@ EbonianBlightSlime.DisplayName: Ebonian Blight Slime Eidolist.DisplayName: Eidolist FearlessGoldfishWarrior.DisplayName: Fearless Goldfish Warrior Frogfish.DisplayName: Frogfish -Horse.DisplayName: Earth Elemental +EarthElemental.DisplayName: Earth Elemental IceClasper.DisplayName: Ice Clasper ImpiousImmolator.DisplayName: Impious Immolator KingSlimeJewelRuby.DisplayName: Ruby Jewel diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index b77f498176..bb4a5def16 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/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 72c9edbf3f..7d68549da7 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -214,6 +214,7 @@ Sickness.DisplayName: Sickness SicknessRound.DisplayName: Round SicknessRound2.DisplayName: Round SlagRound.DisplayName: Slag Round +Slagfire.DisplayName: Slagfire SlimeBolt.DisplayName: Slime Bolt SparkSpreaderFire.DisplayName: Sparked Flames SpectralFlare.DisplayName: Spectral Flare diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index 72f7906a3d..150728ab41 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -1,4 +1,4 @@ -SmallWorldWarning: "[c/FF0000:SMALL WORLDS NOT SUPPORTED BY CALAMITY]" +SmallWorldWarning: "[c/FF0000:SMALL WORLDS NOT SUPPORTED BY CALAMITY]" // Main Menu Name MainMenu: Calamity Style MainMenuClassic: Calamity Style - Classic @@ -34,47 +34,52 @@ DifficultyClickText: "[c/919191:Click to select a difficulty mode]" ExpertDifficultyLock: "[c/919191:Higher difficulty modes can only be toggled in Expert Mode or above]" ChangingTheRules: "[c/919191:You cannot change the rules now!]" DifficultySwitch: Difficulty changed from [c/{0}:{1}] to [c/{2}:{3}]. -ClassicInfo: Your Adventure Begins... A far more relaxed Terraria experience -ExpertShortInfo: "[c/FFBA75:Fortune & Glory, Kid. For those looking for a more difficult vanilla experience]" +ClassicInfo: Your Adventure Begins... A relaxed, casual Terraria experience +ExpertShortInfo: "[c/FF9900:Fortune & Glory, Kid. For those looking for a more difficult vanilla experience]" ExpertExpandedInfo: ''' [c/A87A07:Most bosses gain new attacks and more difficult attack patterns] [c/A87A07:Most enemies have twice as much health, deal twice as much damage and receive 10% less knockback] [c/A87A07:Certain enemies have new attacks, can inflict new debuffs or have a higher chance of inflicting debuffs they already had] - [c/A87A07:Enemies drop more loot, as well as having higher chances] + [c/A87A07:Enemies drop more loot and have higher drop rates for their items] + [c/A87A07:Bosses have exclusive, signature "Expert drop" items] [c/A87A07:Players drop more of their coins on death] ''' -MasterShortInfo: "[c/1CFFAA:Game over man, game over! A tougher step up in stats from Expert Mode]" +MasterShortInfo: "[c/FF2619:Game over man, game over! A tough step up in stats from Expert Mode]" MasterExpandedInfo: ''' - [c/029C6D:Most enemies have even more health and knockback resistance added on from Expert Mode] - [c/029C6D:Bosses have new exclusive vanity rewards] - [c/029C6D:Players drop ALL their coins on death] - [c/029C6D:Players gain an additional accessory slot at the start of the game] + [c/bd5e6e:Most enemies have even more health and knockback resistance than in Expert Mode] + [c/bd5e6e:All foes deal even more damage than in Expert Mode] + [c/bd5e6e:Bosses have new exclusive vanity rewards] + [c/bd5e6e:Players drop ALL their coins on death] + [c/bd5e6e:Players gain an additional accessory slot at the start of the game] ''' +LegendaryShortInfo: "[c/32CD32:For those who are worthy... Even higher stats than Master Mode]" +LegendaryExpandedInfo: "[c/0b870b:Enemies have further increased health and contact damage from Master Mode]" Revengeance: Revengeance -RevengeanceShortInfo: "[c/F54254:The intended Calamity experience! Can only be enabled in Expert Mode!]" +RevengeanceShortInfo: "[c/F54254:The intended Calamity experience. Can only be enabled in Expert Mode]" RevengeanceExpandedInfo: ''' [c/B55362:Enables the] [c/85FFE9:Adrenaline] [c/B55362:mechanic. You gain Adrenaline while fighting bosses. Getting hit drops Adrenaline back to 0] [c/B55362: When Adrenaline is maxed, press] {1} [c/B55362:for a large damage boost] [c/B55362:Enables the] [c/FF8B54:Rage] [c/B55362:mechanic. You gain Rage when in proximity of enemies or by using certain items] [c/B55362: When Rage is maxed, press] {0} [c/B55362:for a temporary damage boost] - [c/B55362:Most foes have higher stats and more aggressive AIs] - [c/B55362:Bosses have new AI mechanics, new phases, and will drop Master Mode loot. Enemies spawn more frequently] - [c/F7342A:This mode is more difficult than Expert. Be sure to prepare for the challenge] + [c/B55362:Many enemies have new, more aggressive behavior patterns. Enemies spawn more frequently] + [c/B55362:All bosses have new attacks and patterns. Some are completely changed] + [c/B55362:Bosses will drop both "Expert drop" items and Master Mode's vanity rewards] ''' Death: Death -DeathShortInfo: "[c/E066F7:A far more difficult challenge than Revengeance Mode! Can only be enabled in Master Mode!]" +DeathShortInfo: "[c/E066F7:A far greater challenge than Revengeance! Can only be enabled in Master Mode]" DeathExpandedInfo: ''' - [c/B834E0:All foes will pose a much larger threat with highly aggressive AIs] - [c/B834E0:Bosses have substantially harder AI changes. Enemies are even more numerous and can easily overwhelm you] + [c/B834E0:Most basic enemies pose a much larger threat with highly aggressive behavior] + [c/B834E0:Blood Moons spawn unending waves of foes which can quickly overwhelm you] + [c/B834E0:Bosses are substantially faster and much more difficult than in Revengeance Mode] [c/B834E0:Debuffs are especially lethal and the Abyss is significantly more dangerous] - [c/E945FF:Vigilance and tenacity are crucial to survival] ''' -// Legendary (FTW + Master) + Death Mode Malice: Malice +MaliceShortInfo: "[c/f08080:For those who wish for suffering. Can only be enabled in Legendary Mode]" +MaliceExpandedInfo: "[c/a34e4e:Enemies have Death Mode and For The Worthy behavior with Legendary Mode stats]" // Calamity Health Bar ExoTwinsNameNormal: XS-01 Artemis and XS-03 Apollo ExoTwinsNameHekate: Eyes of XB-∞ Hekate diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson index edd4c8b9e2..4fe4d6f239 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson @@ -28,7 +28,7 @@ SetBonus: { ''' Eskimo: ''' - Multiplies all cold-based debuff damage by 1.25x + 25% increased Cold debuff damage Provides immunity to the Chilled, Frozen, and Frostburn debuffs ''' Rain: diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson index 4e9ae0f3f8..dabf9366a9 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson @@ -19,7 +19,7 @@ AddedTooltip: { ArcaneFlower: 5% increased magic damage HellfireTreads: ''' - Multiplies all fire-based debuff damage by 1.5x, does not stack with downgrades + 50% increased Heat debuff damage, does not stack with downgrades All attacks inflict Hellfire ''' FairyBoots: @@ -200,7 +200,7 @@ EditedTooltip: { ''' FlameWakerBoots: ''' - Multiplies all fire-based debuff damage by 1.25x + 25% increased Heat debuff damage All attacks light enemies on fire 'Never get cold feet again' ''' diff --git a/NPCs/Abyss/LuminousCorvina.cs b/NPCs/Abyss/LuminousCorvina.cs index 4ea185efc5..20218ea143 100644 --- a/NPCs/Abyss/LuminousCorvina.cs +++ b/NPCs/Abyss/LuminousCorvina.cs @@ -3,6 +3,7 @@ using System.IO; using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Graphics; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Items.Placeables.Banners; @@ -84,6 +85,9 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { + + EnhancedDarknessSystem.lights.Add(new(NPC.Center,scale: 1f)); + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; NPC.noGravity = true; if (NPC.direction == 0) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 32c967dc5f..cfa823e5c8 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -2935,9 +2935,6 @@ namespace CalamityMod.NPCs if (BossRushEvent.BossRushActive && !npc.friendly && !npc.townNPC && !DoesNotDisappearInBossRush) BossRushForceDespawnOtherNPCs(npc, Mod); - if (NPC.LunarApocalypseIsUp) - PillarEventProgressionEdit(npc); - #region Fairies Edit // Fairies don't run away and are immune to damage while wearing Fairy Boots. if (npc.type >= NPCID.FairyCritterPink && npc.type <= NPCID.FairyCritterBlue && (npc.ai[2] < 2f || npc.ai[2] == 7f)) @@ -3050,247 +3047,6 @@ namespace CalamityMod.NPCs } #endregion - #region Pillar Event Progression Edit - private void PillarEventProgressionEdit(NPC npc) - { - // Make pillars a bit more fun by forcing more difficult enemies based on progression. - int solarTowerShieldStrength = (int)Math.Ceiling(NPC.ShieldStrengthTowerSolar / 25D); - switch (solarTowerShieldStrength) - { - case 4: - // Possible spawns: Drakanian, Drakomire, Drakomire Rider, Sroller - switch (npc.type) - { - case NPCID.SolarCrawltipedeHead: - case NPCID.SolarCrawltipedeBody: - case NPCID.SolarCrawltipedeTail: - case NPCID.SolarSolenian: - case NPCID.SolarCorite: - npc.active = false; - npc.netUpdate = true; - break; - default: - break; - } - break; - case 3: - // Possible spawns: Drakanian, Drakomire Rider, Sroller - switch (npc.type) - { - case NPCID.SolarCrawltipedeHead: - case NPCID.SolarCrawltipedeBody: - case NPCID.SolarCrawltipedeTail: - case NPCID.SolarDrakomire: - case NPCID.SolarSolenian: - case NPCID.SolarCorite: - npc.active = false; - npc.netUpdate = true; - break; - default: - break; - } - break; - case 2: - // Possible spawns: Drakanian, Selenian, Sroller - switch (npc.type) - { - case NPCID.SolarDrakomire: - case NPCID.SolarCrawltipedeHead: - case NPCID.SolarCrawltipedeBody: - case NPCID.SolarCrawltipedeTail: - case NPCID.SolarCorite: - case NPCID.SolarDrakomireRider: - npc.active = false; - npc.netUpdate = true; - break; - default: - break; - } - break; - case 1: - // Possible spawns: Corite, Selenian, Sroller, Crawltipede - switch (npc.type) - { - case NPCID.SolarDrakomire: - case NPCID.SolarSpearman: - case NPCID.SolarDrakomireRider: - npc.active = false; - npc.netUpdate = true; - break; - default: - break; - } - break; - case 0: - // Possible spawns: Corite, Crawltipede, Selenian - switch (npc.type) - { - case NPCID.SolarDrakomire: - case NPCID.SolarSpearman: - case NPCID.SolarDrakomireRider: - case NPCID.SolarSroller: - npc.active = false; - npc.netUpdate = true; - break; - default: - break; - } - break; - } - - int vortexTowerShieldStrength = (int)Math.Ceiling(NPC.ShieldStrengthTowerVortex / 25D); - switch (vortexTowerShieldStrength) - { - case 4: - // Possible spawns: Alien Larva, Alien Hornet, Alien Queen - switch (npc.type) - { - case NPCID.VortexSoldier: - case NPCID.VortexRifleman: - npc.active = false; - npc.netUpdate = true; - break; - default: - break; - } - break; - case 3: - // Possible spawns: Alien Larva, Alien Hornet, Alien Queen, Vortexian - if (npc.type == NPCID.VortexRifleman) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 2: - // Possible spawns: Alien Larva, Alien Hornet, Alien Queen, Storm Diver - if (npc.type == NPCID.VortexSoldier) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 1: - case 0: - // Possible spawns: Alien Larva, Alien Hornet, Alien Queen, Vortexian, Storm Diver - break; - } - - int nebulaTowerShieldStrength = (int)Math.Ceiling(NPC.ShieldStrengthTowerNebula / 25D); - switch (nebulaTowerShieldStrength) - { - case 4: - // Possible spawns: Brain Suckler - switch (npc.type) - { - case NPCID.NebulaBeast: - case NPCID.NebulaBrain: - case NPCID.NebulaSoldier: - npc.active = false; - npc.netUpdate = true; - break; - default: - break; - } - break; - case 3: - // Possible spawns: Brain Suckler, Predictor - switch (npc.type) - { - case NPCID.NebulaBeast: - case NPCID.NebulaBrain: - npc.active = false; - npc.netUpdate = true; - break; - default: - break; - } - break; - case 2: - // Possible spawns: Brain Suckler, Predictor, Evolution Beast - if (npc.type == NPCID.NebulaBrain) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 1: - case 0: - // Possible spawns: Predictor, Evolution Beast, Nebula Floater - if (npc.type == NPCID.NebulaHeadcrab) - { - npc.active = false; - npc.netUpdate = true; - } - break; - } - - int stardustTowerShieldStrength = (int)Math.Ceiling(NPC.ShieldStrengthTowerStardust / 25D); - switch (stardustTowerShieldStrength) - { - case 4: - // Possible spawns: Milkyway Weaver, Star Cell - switch (npc.type) - { - case NPCID.StardustSpiderBig: - case NPCID.StardustSoldier: - case NPCID.StardustJellyfishBig: - npc.active = false; - npc.netUpdate = true; - break; - default: - break; - } - break; - case 3: - // Possible spawns: Milkyway Weaver, Stargazer, Twinkle Popper - switch (npc.type) - { - case NPCID.StardustCellBig: - case NPCID.StardustJellyfishBig: - npc.active = false; - npc.netUpdate = true; - break; - default: - break; - } - break; - case 2: - // Possible spawns: Stargazer, Twinkle Popper, Flow Invader - switch (npc.type) - { - case NPCID.StardustCellBig: - case NPCID.StardustWormHead: - case NPCID.StardustWormBody: - case NPCID.StardustWormTail: - npc.active = false; - npc.netUpdate = true; - break; - default: - break; - } - break; - case 1: - case 0: - // Possible spawns: Twinkle Popper, Flow Invader - switch (npc.type) - { - case NPCID.StardustCellBig: - case NPCID.StardustWormHead: - case NPCID.StardustWormBody: - case NPCID.StardustWormTail: - case NPCID.StardustSoldier: - npc.active = false; - npc.netUpdate = true; - break; - default: - break; - } - break; - } - } - #endregion - #region Post AI public override void PostAI(NPC npc) { @@ -6268,7 +6024,6 @@ namespace CalamityMod.NPCs case NPCID.GoblinSummoner: case NPCID.GoblinSorcerer: case NPCID.PirateCaptain: - case NPCID.Scutlix: case NPCID.MartianSaucerCore: case NPCID.TorchGod: case NPCID.EyeofCthulhu: 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/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index ac140bfe71..cb17aedea4 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -184,6 +184,7 @@ namespace CalamityMod.NPCs "Robin", // <@!654737510030639112> (altzeus) "Curly", // <@!673092101780668416> (curly4830) "Cobalt", // <@!132962828922388481> (cobalt_44) + "Dizzetriya", // <@!719818245665980517> (dizzykbity) ]; private static readonly string[] MerchantNames = [ @@ -206,6 +207,7 @@ namespace CalamityMod.NPCs [ "Arin", // <@!268169458302976012> (kiyotu) "Typhäne", // <@!222064016107896832> (typhane.) + "Charlotte Linlin", // <@!563406464522125323> (vixcalibur) ]; private static readonly string[] PirateNames = [ @@ -228,6 +230,7 @@ namespace CalamityMod.NPCs "Hael", // <@!641747280944431156> (kalebtull) "Yumesaki Mirrin", // <@!100235144744415232> (milinen) "Vela", // <@!208719047146209281> (nyxxynightstar) + "Misako Drevis", // <@!1103067115386323065> (threadsofmemory) ]; private static readonly string[] SantaClausNames = [ @@ -279,6 +282,7 @@ namespace CalamityMod.NPCs "Borgus", // <@!539127427482255376> (therealmeepman) "Postman Hiss", // <@!454638106122125312> (karinthefairy) "Cosmoec", // <@!793660591449309204> (cosmoecark) + "Junorism", // <@!740625002596008036> (hewhoshallnotbebaned) ]; private static readonly string[] TruffleNames = [ @@ -307,6 +311,7 @@ namespace CalamityMod.NPCs "Nextdoor Psycho", // <@!173261518572486656> (nextdoorpsycho) "Mike Cyclops", // <@!702327497475227741> (seichoseicho) "Derin", // <@!466703979695308820> (god_15) + "Umbara", // <@!450062421294579712> (umbaraeclipse) ]; private static readonly string[] ZoologistNames = [ @@ -1230,10 +1235,7 @@ namespace CalamityMod.NPCs shop.AddWithCustomValue(ItemType(), Item.buyPrice(gold: 20), Condition.DownedSkeletron) .Add(Condition.Hardmode) .AddWithCustomValue(ItemID.Boomstick, Item.buyPrice(gold: 25), Condition.DownedQueenBee) - .AddWithCustomValue(ItemID.Uzi, Item.buyPrice(gold: 50), Condition.DownedPlantera) - .AddWithCustomValue(ItemID.TacticalShotgun, Item.buyPrice(platinum: 1), Condition.DownedGolem) - .AddWithCustomValue(ItemID.SniperRifle, Item.buyPrice(platinum: 1), Condition.DownedGolem) - .AddWithCustomValue(ItemID.RifleScope, Item.buyPrice(platinum: 1), Condition.DownedGolem); + .AddWithCustomValue(ItemID.Uzi, Item.buyPrice(gold: 50), Condition.DownedPlantera); } if (type == NPCID.Stylist) @@ -1247,8 +1249,7 @@ namespace CalamityMod.NPCs if (type == NPCID.Cyborg) { - shop.AddWithCustomValue(ItemID.RocketLauncher, Item.buyPrice(platinum: 1), Condition.DownedGolem) - .Add(Condition.DownedGolem) + shop.Add(Condition.DownedGolem) .Add(CalamityConditions.DownedPolterghast); } @@ -1310,10 +1311,6 @@ namespace CalamityMod.NPCs { shop.Add() .AddWithCustomValue(ItemID.MagicMissile, Item.buyPrice(gold: 25)) - .AddWithCustomValue(ItemID.SpectreStaff, Item.buyPrice(platinum: 1), Condition.DownedGolem) - .AddWithCustomValue(ItemID.InfernoFork, Item.buyPrice(platinum: 1), Condition.DownedGolem) - .AddWithCustomValue(ItemID.ShadowbeamStaff, Item.buyPrice(platinum: 1), Condition.DownedGolem) - .AddWithCustomValue(ItemID.MagnetSphere, Item.buyPrice(platinum: 1), Condition.DownedGolem) .Add() .Add() .Add() @@ -1326,8 +1323,7 @@ namespace CalamityMod.NPCs .InsertAfter(ItemID.OasisFountain, ItemType()) .InsertAfter(ItemID.OasisFountain, ItemType()) .InsertAfter(ItemID.OasisFountain, ItemType()) - .InsertAfter(ItemID.OasisFountain, ItemType()) - .AddWithCustomValue(ItemID.ButterflyDust, Item.buyPrice(gold: 25), Condition.DownedGolem); + .InsertAfter(ItemID.OasisFountain, ItemType()); } if (type == NPCID.PartyGirl) 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/DesertScourge/DesertNuisanceHead.cs b/NPCs/DesertScourge/DesertNuisanceHead.cs index 71acc1e9b1..3eb9cecc4b 100644 --- a/NPCs/DesertScourge/DesertNuisanceHead.cs +++ b/NPCs/DesertScourge/DesertNuisanceHead.cs @@ -3,8 +3,10 @@ using System.IO; using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; @@ -36,14 +38,13 @@ namespace CalamityMod.NPCs.DesertScourge NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { - Scale = 0.6f, - PortraitScale = 0.6f, - CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/DesertNuisance_Bestiary", - PortraitPositionXOverride = 40, - PortraitPositionYOverride = 40 + Scale = 0.65f, + PortraitScale = 0.7f, + PortraitPositionXOverride = 0, + PortraitPositionYOverride = 0 }; - value.Position.X += 45; - value.Position.Y += 30; + value.Position.X += 0; + value.Position.Y -= 20; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; NPCID.Sets.CantTakeLunchMoney[Type] = true; @@ -574,6 +575,40 @@ namespace CalamityMod.NPCs.DesertScourge } } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + if (NPC.IsABestiaryIconDummy) + { + Texture2D texture = TextureAssets.Npc[NPC.type].Value; + NPC.Opacity = 1f; + // Reimplementation of CalamityUtils.DrawAnimatedBestiaryWorm but tweaked due to this entity' animations + NPC.frame = texture.Frame(); + // Buffers the segment position and rotations + float offset = -0.2f; + float startX = 60; + float startY = 70; + int segmentSpacing = 50; + int animationSpeed = 8; + float wormTimer = NPC.Calamity().bestiaryWormTimer; + int segCount = 3; + // Draw the body segments + for (int i = segCount; i > 0; i--) + { + // The first segment is slightly closer to keep up with the head + float bodyOffset = i * segmentSpacing - segmentSpacing * 0.5f; + + Texture2D toUse = i == 1 ? TextureAssets.Npc[ModContent.NPCType()].Value : DesertNuisanceBody.BodyTexture2.Value; + int frameCount = i == 1 ? 7 : 1; + spriteBatch.Draw(toUse, NPC.position + new Vector2(startX + bodyOffset, MathF.Sin((wormTimer + offset * i) * animationSpeed) * 2 + startY), toUse.Frame(1, frameCount, 0, 0), NPC.GetAlpha(drawColor), NPC.rotation - MathHelper.PiOver2 - MathF.Cos((wormTimer + offset * i) * animationSpeed) * MathHelper.PiOver4 * 0.075f, new Vector2(toUse.Width / 2, toUse.Height / (frameCount * 2)), NPC.scale, SpriteEffects.None, 0f); + } + // Draw the head + spriteBatch.Draw(texture, NPC.position + new Vector2(startX + 18, MathF.Sin(wormTimer * animationSpeed) * 2 + startY), texture.Frame(1, 7, 0, 0), NPC.GetAlpha(drawColor), NPC.rotation - MathHelper.PiOver2 - MathF.Cos(wormTimer * animationSpeed) * MathHelper.PiOver4 * 0.075f, new Vector2(texture.Width * 0.5f, texture.Height / 7), NPC.scale, SpriteEffects.None, 0f); + + return false; + } + return true; + } + public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.7f * balance); diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index d7f1499c1f..ae7a2ac6fb 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -16,12 +16,14 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; @@ -72,12 +74,11 @@ namespace CalamityMod.NPCs.DesertScourge { Scale = 0.65f, PortraitScale = 0.7f, - CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/DesertScourge_Bestiary", - PortraitPositionXOverride = 40, - PortraitPositionYOverride = 40 + PortraitPositionXOverride = 0, + PortraitPositionYOverride = 0 }; - value.Position.X += 65; - value.Position.Y += 35; + value.Position.X += 20; + value.Position.Y -= 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; } @@ -1033,8 +1034,34 @@ namespace CalamityMod.NPCs.DesertScourge public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { if (NPC.IsABestiaryIconDummy) + { + Texture2D texture = TextureAssets.Npc[NPC.type].Value; NPC.Opacity = 1f; + // Reimplementation of CalamityUtils.DrawAnimatedBestiaryWorm but tweaked due to this entity' animations + NPC.frame = texture.Frame(); + // Buffers the segment position and rotations + float offset = -0.2f; + float startX = 60; + float startY = 70; + int segmentSpacing = 50; + int animationSpeed = 4; + float wormTimer = NPC.Calamity().bestiaryWormTimer; + int segCount = 3; + // Draw the body segments + for (int i = segCount; i > 0; i--) + { + // The first segment is slightly closer to keep up with the head + float bodyOffset = i * segmentSpacing - segmentSpacing * 0.5f; + Texture2D toUse = i == 1 ? TextureAssets.Npc[ModContent.NPCType()].Value : DesertScourgeBody.BodyTexture2.Value; + int frameCount = i == 1 ? 7 : 1; + spriteBatch.Draw(toUse, NPC.position + new Vector2(startX + bodyOffset, MathF.Sin((wormTimer + offset * i) * animationSpeed) * 2 + startY), toUse.Frame(1, frameCount, 0, 0), NPC.GetAlpha(drawColor), NPC.rotation - MathHelper.PiOver2 - MathF.Cos((wormTimer + offset * i) * animationSpeed) * MathHelper.PiOver4 * 0.075f, new Vector2(toUse.Width / 2, toUse.Height / (frameCount * 2)), NPC.scale, SpriteEffects.None, 0f); + } + // Draw the head + spriteBatch.Draw(texture, NPC.position + new Vector2(startX + 18, MathF.Sin(wormTimer * animationSpeed) * 2 + startY), texture.Frame(1, 7, 0, 0), NPC.GetAlpha(drawColor), NPC.rotation - MathHelper.PiOver2 - MathF.Cos(wormTimer * animationSpeed) * MathHelper.PiOver4 * 0.075f, new Vector2(texture.Width * 0.5f, texture.Height / 7), NPC.scale, SpriteEffects.None, 0f); + + return false; + } return true; } diff --git a/NPCs/NormalNPCs/Horse.cs b/NPCs/NormalNPCs/EarthElemental.cs similarity index 99% rename from NPCs/NormalNPCs/Horse.cs rename to NPCs/NormalNPCs/EarthElemental.cs index 0f0f90ef32..d5c0c8b6f1 100644 --- a/NPCs/NormalNPCs/Horse.cs +++ b/NPCs/NormalNPCs/EarthElemental.cs @@ -15,7 +15,8 @@ using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.NormalNPCs { - public class Horse : ModNPC + [LegacyName("Horse")] + public class EarthElemental : ModNPC { public override void SetStaticDefaults() { @@ -60,7 +61,7 @@ namespace CalamityMod.NPCs.NormalNPCs bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Caverns, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Horse") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.EarthElemental") }); } diff --git a/NPCs/NormalNPCs/Horse.png b/NPCs/NormalNPCs/EarthElemental.png similarity index 100% rename from NPCs/NormalNPCs/Horse.png rename to NPCs/NormalNPCs/EarthElemental.png diff --git a/NPCs/TownNPCs/Bandit.cs b/NPCs/TownNPCs/Bandit.cs index 2c83ed448c..8f4766b4cc 100644 --- a/NPCs/TownNPCs/Bandit.cs +++ b/NPCs/TownNPCs/Bandit.cs @@ -120,6 +120,7 @@ namespace CalamityMod.NPCs.TownNPCs "Ishmael", // <@!840416568000381046> (vanillaoyster) "Ariallis", // <@!518231218806980609> (ariallis) "Shade", // <@!613133259563466755> (shade__storm) + "Orion", // <@!119164557657636865> (canacx) // Original names this.GetLocalizedValue("Name.Laura"), diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs index 9a3b183b73..f30880b7a5 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs @@ -100,9 +100,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float finalPhaseLifeRatio = death ? 0.4f : 0.25f; // Movement variables - float phase1MaxSpeedIncrease = death ? 2f : 4f; - float phase1MaxAccelerationIncrease = death ? 0.025f : 0.05f; - float phase1MaxChargeSpeedIncrease = death ? 3f : 6f; + float phase1MaxSpeedIncrease = 1f; + float phase1MaxChargeSpeedIncrease = 1.5f; // Phase duration variables float phase1MaxLaserPhaseDurationDecrease = death ? 120f : 300f; @@ -140,13 +139,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { if (NPC.ai[1] == 0f) { - float maxVelocity = (death ? 9.45f : 8.25f); - float acceleration = (death ? 0.13f : 0.115f); + float maxVelocity = death ? 9.25f : 8.25f; + float acceleration = death ? 0.13f : 0.115f; if (death) { - maxVelocity += phase1MaxSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)) / 2; - acceleration += phase1MaxAccelerationIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)) / 2; + maxVelocity += phase1MaxSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); } if (Main.getGoodWorld) @@ -213,7 +211,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { - float laserSpeed = death ? 11.4f : 10.5f; + float laserSpeed = death ? 11.25f : 10.5f; int type = ProjectileID.EyeLaser; int damage = LaserDamage.CalculateMechDamage(); @@ -228,9 +226,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { NPC.rotation = hoverRotation; - float chargeSpeed = death ? 18f : 15f; + float chargeSpeed = death ? 17.5f : 15f; if (death) - chargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)) / 2; + chargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); if (Main.getGoodWorld) chargeSpeed += 2f; @@ -241,7 +239,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (NPC.ai[1] == 2f) { NPC.ai[2] += 1f; - float decelerateGateValue = (death ? 36f : 32f) + (death ? 6f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + float decelerateGateValue = (death ? 36f : 32f) + (death ? 4f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); if (NPC.ai[2] >= decelerateGateValue) { float decelerationMultiplier = (death ? 0.84f : 0.92f) - (death ? 0.16f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); @@ -255,7 +253,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else NPC.rotation = NPC.velocity.ToRotation() - MathHelper.PiOver2; - float delayBeforeChargingAgain = (death ? 48f : 56f) - (death ? 1.5f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + float delayBeforeChargingAgain = death ? 48f : 56f; if (NPC.ai[2] >= delayBeforeChargingAgain) { NPC.ai[3] += 1f; @@ -391,8 +389,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (NPC.ai[1] == 0f) { - float maxVelocity = death ? 10.85f + 1.75f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 9.5f; - float acceleration = death ? 0.1975f + 0.025f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0.175f; + float maxVelocity = death ? 10.65f + (1.5f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio)) : 9.5f; + float acceleration = death ? 0.1975f : 0.175f; if (Main.getGoodWorld) { @@ -461,8 +459,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { if (NPC.ai[1] == 1f) { - float maxVelocity = death ? 10.85f + 1.75f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 9.5f; - float acceleration = death ? 0.295f + 0.075f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0.25f; + float maxVelocity = death ? 10.65f + (1.5f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio)) : 9.5f; + float acceleration = death ? 0.295f : 0.25f; if (Main.getGoodWorld) { @@ -518,7 +516,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set rotation and velocity NPC.rotation = hoverRotation; - float chargeSpeed = (death ? 25f : 22f) + (death ? 3.25f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float chargeSpeed = (death ? 25f : 22f) + (death ? 3f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); if (!spazAlive) chargeSpeed += 2f; if (Main.getGoodWorld) @@ -562,7 +560,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses SoundEngine.PlaySound(SoundID.Item33, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - float laserDartSpeed = (death ? 7.5f : 6f) * (spazAlive ? 1f : 1.5f); + float laserDartSpeed = (death ? 7.25f : 6f) * (spazAlive ? 1f : 1.5f); int type = ModContent.ProjectileType(); int damage = HomingDartDamage.CalculateMechDamage(); @@ -622,8 +620,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (NPC.ai[1] == 4f) { float chargeLineUpDistance = spazAlive ? 600f : 500f; - float chargeSpeed = (death ? 19.8f : 18f) + (death ? 2.5f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - float chargeAcceleration = (death ? 0.495f : 0.45f) + (death ? 0.1f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float chargeSpeed = (death ? 20f : 18f) + (death ? 1.5f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float chargeAcceleration = death ? 0.495f : 0.45f; if (spazAlive) { @@ -724,13 +722,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float finalPhaseLifeRatio = death ? 0.4f : 0.25f; // Movement variables - float phase1MaxSpeedIncrease = death ? 2.25f : 4.5f; - float phase1MaxAccelerationIncrease = death ? 0.075f : 0.15f; - float phase1MaxChargeSpeedIncrease = death ? 3f : 6f; + float phase1MaxSpeedIncrease = 1.125f; + float phase1MaxChargeSpeedIncrease = 1.4f; // Phase duration variables float phase1MaxCursedFlamePhaseDurationDecrease = death ? 80f : 200f; - float phase1MaxChargesDecrease = death ? 2f : 4f; + float phase1MaxChargesDecrease = 2f; // Phase checks bool phase2 = lifeRatio < phase2LifeRatio; @@ -768,13 +765,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (NPC.ai[1] == 0f) { // Velocity - float maxVelocity = death ? 13.8f : 12f; + float maxVelocity = death ? 13.5f : 12f; float acceleration = death ? 0.46f : 0.4f; if (death) { - maxVelocity += phase1MaxSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)) / 2; - acceleration += phase1MaxAccelerationIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)) / 2; + maxVelocity += phase1MaxSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); } if (Main.getGoodWorld) @@ -848,7 +844,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Rotation and velocity NPC.rotation = hoverRotation; - float chargeSpeed = death ? 20.4f + phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 18f; + float chargeSpeed = death ? 19.25f + (phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio))) : 18f; if (Main.getGoodWorld) chargeSpeed *= 1.2f; @@ -860,7 +856,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { NPC.ai[2] += 1f; - float timeBeforeSlowDown = death ? 18f : 10f; + float timeBeforeSlowDown = death ? 14f : 10f; if (NPC.ai[2] >= timeBeforeSlowDown) { // Slow down @@ -1019,8 +1015,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Shadowflamethrower phase if (NPC.ai[1] == 0f) { - float maxVelocity = 7.1f + (death ? 0.8f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - float acceleration = 0.118f + (death ? 0.02f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float maxVelocity = 7.1f + (death ? 0.7f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float acceleration = 0.118f + (death ? 0.0175f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); float distanceFromTarget = 180f; Vector2 destination = Main.player[NPC.target].Center + Vector2.UnitX * distanceFromTarget * direction; @@ -1121,7 +1117,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set rotation and velocity NPC.rotation = hoverRotation; - float chargeSpeed = (death ? 22.8f : 18f) + (death ? 1.5f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float chargeSpeed = death ? 19.25f + (phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio))) : 18f; if (Main.getGoodWorld) chargeSpeed *= 1.2f; @@ -1193,7 +1189,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (Main.netMode != NetmodeID.MultiplayerClient) { // Velocity - float spazmatismPhase3ChargeSpeed = (death ? 23f : 20f) + (death ? 3f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float spazmatismPhase3ChargeSpeed = (death ? 22.5f : 20f) + (death ? 3f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); if (NPC.ai[2] == -1f || (!retAlive && NPC.ai[3] == secondFastCharge)) spazmatismPhase3ChargeSpeed *= 1.3f; if (Main.getGoodWorld) 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/Packets/CalamityPacket.cs b/Packets/CalamityPacket.cs index b578fb4e50..74e667b086 100644 --- a/Packets/CalamityPacket.cs +++ b/Packets/CalamityPacket.cs @@ -8,14 +8,14 @@ namespace CalamityMod.Packets { internal abstract class CalamityPacket : ILoadable { - public abstract byte MessageType { get; } - public abstract void HandlePacket(in BinaryReader packet, int sender); + public abstract void HandlePacket(BinaryReader packet, int sender); + private ushort _NetID; private PropertyInfo _Prop_Static_Instance; public void Load(Mod mod) { - CalamityNetcode.RegisterHandler(this); + _NetID = CalamityNetcode.RegisterHandler(this); var type = GetType(); var instanceProperty = type.GetProperty("Instance", BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic); @@ -36,7 +36,7 @@ namespace CalamityMod.Packets _Prop_Static_Instance = null; } - public void CloneAndBroadcast(in BinaryReader packet, long startIndex, int length, int ignoreClient = -1) + public void CloneAndBroadcast(BinaryReader packet, long startIndex, int length, int ignoreClient = -1) { if (!Main.dedServ) return; @@ -58,7 +58,7 @@ namespace CalamityMod.Packets public ModPacket CreateBasePacket() { var packet = CalamityMod.Instance.GetPacket(); - packet.Write(MessageType); + CalamityNetcode.WriteHandlerNetID(packet, _NetID); return packet; } } diff --git a/Packets/Draedon/CodebreakerSummonStuffPacket.cs b/Packets/Draedon/CodebreakerSummonStuffPacket.cs index cfc99be8a3..a8898cbabf 100644 --- a/Packets/Draedon/CodebreakerSummonStuffPacket.cs +++ b/Packets/Draedon/CodebreakerSummonStuffPacket.cs @@ -8,8 +8,6 @@ namespace CalamityMod.Packets { public static CodebreakerSummonStuffPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.CodebreakerSummonStuff; - public static void Send(int toClient = -1, int ignoreClient = -1) { var packet = Instance.CreateBasePacket(); @@ -19,7 +17,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { CalamityWorld.DraedonSummonCountdown = packet.ReadInt32(); CalamityWorld.DraedonSummonPosition = packet.ReadVector2(); diff --git a/Packets/Draedon/ExoMechSelectionPacket.cs b/Packets/Draedon/ExoMechSelectionPacket.cs index f662dedfee..6d33146509 100644 --- a/Packets/Draedon/ExoMechSelectionPacket.cs +++ b/Packets/Draedon/ExoMechSelectionPacket.cs @@ -7,8 +7,6 @@ namespace CalamityMod.Packets { public static ExoMechSelectionPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.ExoMechSelection; - public static void Send(int toClient = -1, int ignoreClient = -1) { var packet = Instance.CreateBasePacket(); @@ -16,7 +14,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { CalamityWorld.DraedonMechToSummon = (ExoMech)packet.ReadInt32(); } diff --git a/Packets/Entities/Androomba/SyncAndroombaAIPacket.cs b/Packets/Entities/Androomba/SyncAndroombaAIPacket.cs index 7289db6bb7..ce17888ca5 100644 --- a/Packets/Entities/Androomba/SyncAndroombaAIPacket.cs +++ b/Packets/Entities/Androomba/SyncAndroombaAIPacket.cs @@ -8,8 +8,6 @@ namespace CalamityMod.Packets { public static SyncAndroombaAIPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.SyncAndroombaAI; - public static void Send(AndroombaFriendly roomba, int phase = -1, int toClient = -1, int ignoreClient = -1) { if (roomba is null) @@ -21,7 +19,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var roomba = packet.ReadModNPC(); var phase = packet.ReadInt32(); diff --git a/Packets/Entities/Androomba/SyncAndroombaSolutionPacket.cs b/Packets/Entities/Androomba/SyncAndroombaSolutionPacket.cs index a55e30551b..a0d5e925eb 100644 --- a/Packets/Entities/Androomba/SyncAndroombaSolutionPacket.cs +++ b/Packets/Entities/Androomba/SyncAndroombaSolutionPacket.cs @@ -8,8 +8,6 @@ namespace CalamityMod.Packets { public static SyncAndroombaSolutionPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.SyncAndroombaSolution; - public static void Send(AndroombaFriendly roomba, int solType = -1, int toClient = -1, int ignoreClient = -1) { if (roomba is null) @@ -21,7 +19,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var roomba = packet.ReadModNPC(); var solution = packet.ReadInt32(); diff --git a/Packets/Entities/DemonSwordImpalesSyncPacket.cs b/Packets/Entities/DemonSwordImpalesSyncPacket.cs index 36e3b3138f..6353513f79 100644 --- a/Packets/Entities/DemonSwordImpalesSyncPacket.cs +++ b/Packets/Entities/DemonSwordImpalesSyncPacket.cs @@ -6,7 +6,6 @@ namespace CalamityMod.Packets.Entities internal sealed class DemonSwordImpalesSyncPacket : CalamityPacket { public static DemonSwordImpalesSyncPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.SyncNPCDemonSwordImpales; public static void Send(NPC npc, int toClient = -1, int ignoreClient = -1) { @@ -19,7 +18,7 @@ namespace CalamityMod.Packets.Entities packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var npc = packet.ReadNPC(); var impales = packet.ReadInt32(); diff --git a/Packets/Entities/DemonicFlamesSyncPacket.cs b/Packets/Entities/DemonicFlamesSyncPacket.cs index 7cf11aff1f..a254962e80 100644 --- a/Packets/Entities/DemonicFlamesSyncPacket.cs +++ b/Packets/Entities/DemonicFlamesSyncPacket.cs @@ -6,7 +6,6 @@ namespace CalamityMod.Packets.Entities internal sealed class DemonicFlamesSyncPacket : CalamityPacket { public static DemonicFlamesSyncPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.SyncNPCDemonicFlamesDamage; public static void Send(NPC npc, int toClient = -1, int ignoreClient = -1) { @@ -19,7 +18,7 @@ namespace CalamityMod.Packets.Entities packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var npc = packet.ReadNPC(); var damage = packet.ReadInt32(); diff --git a/Packets/Entities/PlaceAltCritterPacket.cs b/Packets/Entities/PlaceAltCritterPacket.cs index b0b0eea0ee..c0b91a8fd0 100644 --- a/Packets/Entities/PlaceAltCritterPacket.cs +++ b/Packets/Entities/PlaceAltCritterPacket.cs @@ -7,8 +7,6 @@ namespace CalamityMod.Packets { public static PlaceAltCritterPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.PlaceAltCritter; - /// /// Same Method, but uses critterItem.makeNPC and critterItem.type for shorthanded call /// @@ -35,7 +33,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var placerplayer = packet.ReadPlayer(); int posX = packet.ReadInt32(); diff --git a/Packets/Entities/Providence/PSCChallengeSyncPacket.cs b/Packets/Entities/Providence/PSCChallengeSyncPacket.cs index be18ab4e4c..a5ee628386 100644 --- a/Packets/Entities/Providence/PSCChallengeSyncPacket.cs +++ b/Packets/Entities/Providence/PSCChallengeSyncPacket.cs @@ -7,8 +7,6 @@ namespace CalamityMod.Packets { public static PSCChallengeSyncPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.PSCChallengeSync; - public static void Send(Providence providence, int toClient = -1, int ignoreClient = -1) { if (providence is null) @@ -20,7 +18,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var providence = packet.ReadModNPC(); var challenge = packet.ReadBoolean(); diff --git a/Packets/Entities/Providence/ProvidenceDyeConditionSyncPacket.cs b/Packets/Entities/Providence/ProvidenceDyeConditionSyncPacket.cs index d9a7879e4c..fb0a58fce8 100644 --- a/Packets/Entities/Providence/ProvidenceDyeConditionSyncPacket.cs +++ b/Packets/Entities/Providence/ProvidenceDyeConditionSyncPacket.cs @@ -7,8 +7,6 @@ namespace CalamityMod.Packets { public static ProvidenceDyeConditionSyncPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.ProvidenceDyeConditionSync; - public static void Send(Providence providence, int toClient = -1, int ignoreClient = -1) { if (providence is null) @@ -20,7 +18,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var providence = packet.ReadModNPC(); var hasBeenEnraged = packet.ReadBoolean(); diff --git a/Packets/Entities/SlabCrab/SyncSlabCrabAIPacket.cs b/Packets/Entities/SlabCrab/SyncSlabCrabAIPacket.cs index a2d742e1dc..a146e50b6a 100644 --- a/Packets/Entities/SlabCrab/SyncSlabCrabAIPacket.cs +++ b/Packets/Entities/SlabCrab/SyncSlabCrabAIPacket.cs @@ -8,8 +8,6 @@ namespace CalamityMod.Packets { public static SyncSlabCrabAIPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.SyncSlabCrabAI; - public static void Send(SlabCrab crab, int phase = -1, int toClient = -1, int ignoreClient = -1) { if (crab is null) @@ -21,7 +19,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var crab = packet.ReadModNPC(); var phase = packet.ReadInt32(); diff --git a/Packets/Entities/SpawnBossOnPositionPacket.cs b/Packets/Entities/SpawnBossOnPositionPacket.cs index cb6c4bb53d..f23f347c6b 100644 --- a/Packets/Entities/SpawnBossOnPositionPacket.cs +++ b/Packets/Entities/SpawnBossOnPositionPacket.cs @@ -7,8 +7,6 @@ namespace CalamityMod.Packets { public static SpawnBossOnPositionPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.SpawnBossOnPosition; - public static void Send(int x, int y, int npcType, Player target = null, int toClient = -1, int ignoreClient = -1) { var packet = Instance.CreateBasePacket(); @@ -19,7 +17,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var x = packet.ReadInt32(); var y = packet.ReadInt32(); @@ -30,6 +28,11 @@ namespace CalamityMod.Packets if (!Main.dedServ) return; + if (npcType == Terraria.ID.NPCID.WallofFlesh) // Divert to using SpawnWOF instead. Used by Slagfire Douser. + { + NPC.SpawnWOF(new (x, y)); + return; + } int spawnedNPCIdx = NPC.NewNPC(NPC.GetBossSpawnSource(targetIndex), x, y, npcType, Start: 1); if (spawnedNPCIdx >= Main.maxNPCs) return; diff --git a/Packets/Entities/SpawnNPCOnPlayerPacket.cs b/Packets/Entities/SpawnNPCOnPlayerPacket.cs index e634a237fb..d58c0698b1 100644 --- a/Packets/Entities/SpawnNPCOnPlayerPacket.cs +++ b/Packets/Entities/SpawnNPCOnPlayerPacket.cs @@ -8,8 +8,6 @@ namespace CalamityMod.Packets { public static SpawnNPCOnPlayerPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.SpawnNPCOnPlayer; - public static void Send(Player player, int x, int y, int npcType, int toClient = -1, int ignoreClient = -1) { if (player is null) @@ -23,7 +21,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var player = packet.ReadPlayer(); var x = packet.ReadInt32(); diff --git a/Packets/Entities/SuperDummy/DeleteAllSuperDummiesPacket.cs b/Packets/Entities/SuperDummy/DeleteAllSuperDummiesPacket.cs index 121ce493e4..6d242152b2 100644 --- a/Packets/Entities/SuperDummy/DeleteAllSuperDummiesPacket.cs +++ b/Packets/Entities/SuperDummy/DeleteAllSuperDummiesPacket.cs @@ -8,15 +8,13 @@ namespace CalamityMod.Packets { public static DeleteAllSuperDummiesPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.DeleteAllSuperDummies; - public static void Send(int toClient = -1, int ignoreClient = -1) { var packet = Instance.CreateBasePacket(); packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { // There is nothing in the packet! We only need to call delete method on Server if (Main.dedServ) diff --git a/Packets/Entities/SuperDummy/SpawnSuperDummyPacket.cs b/Packets/Entities/SuperDummy/SpawnSuperDummyPacket.cs index 5af6d75164..5e907a2792 100644 --- a/Packets/Entities/SuperDummy/SpawnSuperDummyPacket.cs +++ b/Packets/Entities/SuperDummy/SpawnSuperDummyPacket.cs @@ -10,8 +10,6 @@ namespace CalamityMod.Packets { public static SpawnSuperDummyPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.SpawnSuperDummy; - public static void Send(int x, int y, int toClient = -1, int ignoreClient = -1) { var packet = Instance.CreateBasePacket(); @@ -20,7 +18,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var x = packet.ReadInt32(); var y = packet.ReadInt32(); diff --git a/Packets/Entities/SyncCalamityNPCAIArrayPacket.cs b/Packets/Entities/SyncCalamityNPCAIArrayPacket.cs index 5fef417523..2e3848c1b7 100644 --- a/Packets/Entities/SyncCalamityNPCAIArrayPacket.cs +++ b/Packets/Entities/SyncCalamityNPCAIArrayPacket.cs @@ -10,8 +10,6 @@ namespace CalamityMod.Packets public static SyncCalamityNPCAIArrayPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.SyncCalamityNPCAIArray; - public static void Send(NPC npc, int toClient = -1, int ignoreClient = -1) { if (npc is null) @@ -28,7 +26,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var npc = packet.ReadNPC(); var ai0 = packet.ReadSingle(); diff --git a/Packets/Entities/SyncNPCMotionDataToServerPacket.cs b/Packets/Entities/SyncNPCMotionDataToServerPacket.cs index 0d55f05b7e..9dce22fa4b 100644 --- a/Packets/Entities/SyncNPCMotionDataToServerPacket.cs +++ b/Packets/Entities/SyncNPCMotionDataToServerPacket.cs @@ -8,8 +8,6 @@ namespace CalamityMod.Packets { public static SyncNPCMotionDataToServerPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.SyncNPCMotionDataToServer; - public static void Send(NPC npc, int toClient = -1, int ignoreClient = -1) { if (npc is null) @@ -22,7 +20,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var npc = packet.ReadNPC(); var center = packet.ReadVector2(); diff --git a/Packets/Entities/SyncNPCPosAndRotOnlyPacket.cs b/Packets/Entities/SyncNPCPosAndRotOnlyPacket.cs index 7ef95276c0..a4f125e596 100644 --- a/Packets/Entities/SyncNPCPosAndRotOnlyPacket.cs +++ b/Packets/Entities/SyncNPCPosAndRotOnlyPacket.cs @@ -8,8 +8,6 @@ namespace CalamityMod.Packets { public static SyncNPCPosAndRotOnlyPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.SyncNPCPosAndRotOnly; - public static void Send(NPC npc, int toClient = -1, int ignoreClient = -1) { if (npc is null) @@ -22,7 +20,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var npc = packet.ReadNPC(); var position = packet.ReadVector2(); diff --git a/Packets/Entities/SyncVanillaNPCLocalAIArrayPacket.cs b/Packets/Entities/SyncVanillaNPCLocalAIArrayPacket.cs index 627c1fd89e..da5936aa15 100644 --- a/Packets/Entities/SyncVanillaNPCLocalAIArrayPacket.cs +++ b/Packets/Entities/SyncVanillaNPCLocalAIArrayPacket.cs @@ -7,8 +7,6 @@ namespace CalamityMod.Packets { public static SyncVanillaNPCLocalAIArrayPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.SyncVanillaNPCLocalAIArray; - public static void Send(NPC npc, int toClient = -1, int ignoreClient = -1) { if (npc is null) @@ -23,7 +21,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var npc = packet.ReadNPC(); var ai0 = packet.ReadSingle(); diff --git a/Packets/Events/AcidRain/AcidRainOldDukeSummonSyncPacket.cs b/Packets/Events/AcidRain/AcidRainOldDukeSummonSyncPacket.cs index 42f03c7417..8eec0880c4 100644 --- a/Packets/Events/AcidRain/AcidRainOldDukeSummonSyncPacket.cs +++ b/Packets/Events/AcidRain/AcidRainOldDukeSummonSyncPacket.cs @@ -7,8 +7,6 @@ namespace CalamityMod.Packets { public static AcidRainOldDukeSummonSyncPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.AcidRainOldDukeSummonSync; - public static void Send(int toClient = -1, int ignoreClient = -1) { var packet = Instance.CreateBasePacket(); @@ -16,7 +14,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { AcidRainEvent.HasTriedToSummonOldDuke = packet.ReadBoolean(); } diff --git a/Packets/Events/AcidRain/AcidRainSyncPacket.cs b/Packets/Events/AcidRain/AcidRainSyncPacket.cs index c6cda5e8fc..e216f62ebc 100644 --- a/Packets/Events/AcidRain/AcidRainSyncPacket.cs +++ b/Packets/Events/AcidRain/AcidRainSyncPacket.cs @@ -7,8 +7,6 @@ namespace CalamityMod.Packets { public static AcidRainSyncPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.AcidRainSync; - public static void Send(int toClient = -1, int ignoreClient = -1) { var packet = Instance.CreateBasePacket(); @@ -18,7 +16,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { AcidRainEvent.AcidRainEventIsOngoing = packet.ReadBoolean(); AcidRainEvent.AccumulatedKillPoints = packet.ReadInt32(); diff --git a/Packets/Events/AcidRain/EncounteredOldDukeSyncPacket.cs b/Packets/Events/AcidRain/EncounteredOldDukeSyncPacket.cs index 49b80c98e6..2c9384d41e 100644 --- a/Packets/Events/AcidRain/EncounteredOldDukeSyncPacket.cs +++ b/Packets/Events/AcidRain/EncounteredOldDukeSyncPacket.cs @@ -7,8 +7,6 @@ namespace CalamityMod.Packets { public static EncounteredOldDukeSyncPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.EncounteredOldDukeSync; - public static void Send(int toClient = -1, int ignoreClient = -1) { var packet = Instance.CreateBasePacket(); @@ -16,7 +14,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { AcidRainEvent.OldDukeHasBeenEncountered = packet.ReadBoolean(); } diff --git a/Packets/Events/BossRush/BRHostileProjKillSyncPacket.cs b/Packets/Events/BossRush/BRHostileProjKillSyncPacket.cs index e6d017302b..b54dfb388e 100644 --- a/Packets/Events/BossRush/BRHostileProjKillSyncPacket.cs +++ b/Packets/Events/BossRush/BRHostileProjKillSyncPacket.cs @@ -7,8 +7,6 @@ namespace CalamityMod.Packets { public static BRHostileProjKillSyncPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.BRHostileProjKillSync; - public static void Send(int toClient = -1, int ignoreClient = -1) { var packet = Instance.CreateBasePacket(); @@ -16,7 +14,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { BossRushEvent.HostileProjectileKillCounter = packet.ReadInt32(); } diff --git a/Packets/Events/BossRush/BossRushEndTimerPacket.cs b/Packets/Events/BossRush/BossRushEndTimerPacket.cs index 0f458f5615..3b7f33314f 100644 --- a/Packets/Events/BossRush/BossRushEndTimerPacket.cs +++ b/Packets/Events/BossRush/BossRushEndTimerPacket.cs @@ -7,8 +7,6 @@ namespace CalamityMod.Packets { public static BossRushEndTimerPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.BossRushEndTimer; - public static void Send(int toClient = -1, int ignoreClient = -1) { var packet = Instance.CreateBasePacket(); @@ -16,7 +14,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { BossRushEvent.EndTimer = packet.ReadInt32(); } diff --git a/Packets/Events/BossRush/BossRushStagePacket.cs b/Packets/Events/BossRush/BossRushStagePacket.cs index da5f848053..675fc6b164 100644 --- a/Packets/Events/BossRush/BossRushStagePacket.cs +++ b/Packets/Events/BossRush/BossRushStagePacket.cs @@ -7,8 +7,6 @@ namespace CalamityMod.Packets { public static BossRushStagePacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.BossRushStage; - public static void Send(int toClient = -1, int ignoreClient = -1) { var packet = Instance.CreateBasePacket(); @@ -16,7 +14,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { BossRushEvent.BossRushStage = packet.ReadInt32(); } diff --git a/Packets/Events/BossRush/BossRushStartTimerPacket.cs b/Packets/Events/BossRush/BossRushStartTimerPacket.cs index ef800b10e4..6abe50c28a 100644 --- a/Packets/Events/BossRush/BossRushStartTimerPacket.cs +++ b/Packets/Events/BossRush/BossRushStartTimerPacket.cs @@ -7,8 +7,6 @@ namespace CalamityMod.Packets { public static BossRushStartTimerPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.BossRushStartTimer; - public static void Send(int toClient = -1, int ignoreClient = -1) { var packet = Instance.CreateBasePacket(); @@ -16,7 +14,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { BossRushEvent.StartTimer = packet.ReadInt32(); } diff --git a/Packets/Events/BossRush/EndBossRushPacket.cs b/Packets/Events/BossRush/EndBossRushPacket.cs index 2defa057d4..1ae42822fa 100644 --- a/Packets/Events/BossRush/EndBossRushPacket.cs +++ b/Packets/Events/BossRush/EndBossRushPacket.cs @@ -7,15 +7,13 @@ namespace CalamityMod.Packets { public static EndBossRushPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.EndBossRush; - public static void Send(int toClient = -1, int ignoreClient = -1) { var packet = Instance.CreateBasePacket(); packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { BossRushEvent.EndEffects(); } diff --git a/Packets/MusicSystems/MusicEventSyncRequestPacket.cs b/Packets/MusicSystems/MusicEventSyncRequestPacket.cs index f40e04cd5b..ef2e6dc1fa 100644 --- a/Packets/MusicSystems/MusicEventSyncRequestPacket.cs +++ b/Packets/MusicSystems/MusicEventSyncRequestPacket.cs @@ -8,8 +8,6 @@ namespace CalamityMod.Packets { public static MusicEventSyncRequestPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.MusicEventSyncRequest; - public static void Send(int toClient = -1, int ignoreClient = -1) { // Only MP Client should send request! @@ -20,7 +18,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { // Only fulfill requests as the server host if (!Main.dedServ) diff --git a/Packets/MusicSystems/MusicEventSyncResponsePacket.cs b/Packets/MusicSystems/MusicEventSyncResponsePacket.cs index 7507064753..703760e453 100644 --- a/Packets/MusicSystems/MusicEventSyncResponsePacket.cs +++ b/Packets/MusicSystems/MusicEventSyncResponsePacket.cs @@ -9,8 +9,6 @@ namespace CalamityMod.Packets { public static MusicEventSyncResponsePacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.MusicEventSyncResponse; - public static void Send(int toClient = -1, int ignoreClient = -1) { // Only Server should send Reponse to Clients @@ -27,7 +25,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { // Only receive info as clients if (Main.netMode != NetmodeID.MultiplayerClient) diff --git a/Packets/Players/AdrenalineSyncPacket.cs b/Packets/Players/AdrenalineSyncPacket.cs index 2e429ecfa5..d623f8bf26 100644 --- a/Packets/Players/AdrenalineSyncPacket.cs +++ b/Packets/Players/AdrenalineSyncPacket.cs @@ -8,8 +8,6 @@ namespace CalamityMod.Packets { public static AdrenalineSyncPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.AdrenalineSync; - public static void Send(CalamityPlayer playerToSync, int toClient = -1, int ignoreClient = -1) { if (playerToSync is null) @@ -21,7 +19,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var player = packet.ReadCalamityPlayer(); var adrenaline = packet.ReadSingle(); diff --git a/Packets/Players/CooldownAdditionPacket.cs b/Packets/Players/CooldownAdditionPacket.cs index db42f7dd61..67b9119c26 100644 --- a/Packets/Players/CooldownAdditionPacket.cs +++ b/Packets/Players/CooldownAdditionPacket.cs @@ -10,8 +10,6 @@ namespace CalamityMod.Packets { public static CooldownAdditionPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.CooldownAddition; - public static void Send(CalamityPlayer player, CooldownInstance cd, int toClient = -1, int ignoreClient = -1) { Send(player, cd.netID, cd.duration, cd.timeLeft, toClient, ignoreClient); @@ -30,7 +28,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var player = packet.ReadCalamityPlayer(); var netID = packet.ReadUInt16(); diff --git a/Packets/Players/CooldownRemovalPacket.cs b/Packets/Players/CooldownRemovalPacket.cs index b1d44bc85f..63a63781e8 100644 --- a/Packets/Players/CooldownRemovalPacket.cs +++ b/Packets/Players/CooldownRemovalPacket.cs @@ -10,8 +10,6 @@ namespace CalamityMod.Packets { public static CooldownRemovalPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.CooldownRemoval; - public static void Send(CalamityPlayer player, ushort[] netIDsToRemove, int toClient = -1, int ignoreClient = -1) { if (player is null) @@ -27,7 +25,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var player = packet.ReadCalamityPlayer(); var count = packet.ReadInt32(); diff --git a/Packets/Players/DefenseDamageSyncPacket.cs b/Packets/Players/DefenseDamageSyncPacket.cs index b89c46cd3c..ed7e964951 100644 --- a/Packets/Players/DefenseDamageSyncPacket.cs +++ b/Packets/Players/DefenseDamageSyncPacket.cs @@ -8,8 +8,6 @@ namespace CalamityMod.Packets { public static DefenseDamageSyncPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.DefenseDamageSync; - public static void Send(CalamityPlayer playerToSync, int toClient = -1, int ignoreClient = -1) { if (playerToSync is null) @@ -24,7 +22,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var player = packet.ReadCalamityPlayer(); var totalDefDamage = packet.ReadInt32(); diff --git a/Packets/Players/ExaltationDirectionSyncPacket.cs b/Packets/Players/ExaltationDirectionSyncPacket.cs index 38c392c65e..8419069413 100644 --- a/Packets/Players/ExaltationDirectionSyncPacket.cs +++ b/Packets/Players/ExaltationDirectionSyncPacket.cs @@ -8,8 +8,6 @@ namespace CalamityMod.Packets { public static ExaltationDirectionSyncPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.ExaltationDirection; - public static void Send(CalamityPlayer playerToSync, int toClient = -1, int ignoreClient = -1) { if (playerToSync is null) @@ -21,7 +19,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var player = packet.ReadCalamityPlayer(); var invertDir = packet.ReadBoolean(); diff --git a/Packets/Players/MousePositionSyncPacket.cs b/Packets/Players/MousePositionSyncPacket.cs index 6ff457e760..7970227c00 100644 --- a/Packets/Players/MousePositionSyncPacket.cs +++ b/Packets/Players/MousePositionSyncPacket.cs @@ -9,8 +9,6 @@ namespace CalamityMod.Packets { public static MousePositionSyncPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.MousePositionSync; - public static void Send(CalamityPlayer player, int toClient = -1, int ignoreClient = -1) { if (player is null) @@ -23,7 +21,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var player = packet.ReadCalamityPlayer(); var deltaX = packet.ReadInt16(); diff --git a/Packets/Players/MouseRotationSyncPacket.cs b/Packets/Players/MouseRotationSyncPacket.cs index 82ab4e0bfd..213649d15b 100644 --- a/Packets/Players/MouseRotationSyncPacket.cs +++ b/Packets/Players/MouseRotationSyncPacket.cs @@ -9,8 +9,6 @@ namespace CalamityMod.Packets { public static MouseRotationSyncPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.MouseRotationSync; - public static void Send(CalamityPlayer player, int toClient = -1, int ignoreClient = -1) { if (player is null) @@ -22,7 +20,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var player = packet.ReadCalamityPlayer(); var rotation = (float)packet.ReadHalf(); diff --git a/Packets/Players/RageSyncPacket.cs b/Packets/Players/RageSyncPacket.cs index 97a8690081..7143bf1699 100644 --- a/Packets/Players/RageSyncPacket.cs +++ b/Packets/Players/RageSyncPacket.cs @@ -8,8 +8,6 @@ namespace CalamityMod.Packets { public static RageSyncPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.RageSync; - public static void Send(CalamityPlayer playerToSync, int toClient = -1, int ignoreClient = -1) { if (playerToSync is null) @@ -22,7 +20,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var player = packet.ReadCalamityPlayer(); var rage = packet.ReadSingle(); diff --git a/Packets/Players/RightClickSyncPacket.cs b/Packets/Players/RightClickSyncPacket.cs index 0dc5dfa405..9d03d404e2 100644 --- a/Packets/Players/RightClickSyncPacket.cs +++ b/Packets/Players/RightClickSyncPacket.cs @@ -8,8 +8,6 @@ namespace CalamityMod.Packets { public static RightClickSyncPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.RightClickSync; - public static void Send(CalamityPlayer player, int toClient = -1, int ignoreClient = -1) { if (player is null) @@ -21,7 +19,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var player = packet.ReadCalamityPlayer(); var rightClick = packet.ReadBoolean(); diff --git a/Packets/Players/SyncCooldownDictionaryPacket.cs b/Packets/Players/SyncCooldownDictionaryPacket.cs index d55523494e..cd70d6d41d 100644 --- a/Packets/Players/SyncCooldownDictionaryPacket.cs +++ b/Packets/Players/SyncCooldownDictionaryPacket.cs @@ -14,8 +14,6 @@ namespace CalamityMod.Packets { public static SyncCooldownDictionaryPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.SyncCooldownDictionary; - public static void Send(CalamityPlayer player, int toClient = -1, int ignoreClient = -1) { if (player is null) @@ -45,7 +43,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var player = packet.ReadCalamityPlayer(); int count = packet.ReadInt32(); diff --git a/Packets/Players/SyncPlayerDrawParameterPacket.cs b/Packets/Players/SyncPlayerDrawParameterPacket.cs index c24ac76945..8b2324af6d 100644 --- a/Packets/Players/SyncPlayerDrawParameterPacket.cs +++ b/Packets/Players/SyncPlayerDrawParameterPacket.cs @@ -9,8 +9,6 @@ namespace CalamityMod.Packets { public static SyncPlayerDrawParameterPacket Instance { get; set; } - public override byte MessageType => (byte)CalamityModMessageType.SyncPlayerDrawParameter; - public static void Send(CalamityPlayer player, int toClient = -1, int ignoreClient = -1) { if (player is null) @@ -26,7 +24,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var player = packet.ReadCalamityPlayer(); var roverCharge = (float)packet.ReadHalf(); diff --git a/Packets/StartDialogueDisplayPacket.cs b/Packets/StartDialogueDisplayPacket.cs index a96cbdd738..fbf821b80a 100644 --- a/Packets/StartDialogueDisplayPacket.cs +++ b/Packets/StartDialogueDisplayPacket.cs @@ -1,18 +1,10 @@ -using System; -using System.Collections.Generic; -using System.IO; +using System.IO; using System.Linq; -using System.Text; -using System.Threading.Tasks; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Systems; using CalamityMod.UI.DialogueDisplay.DisplayEffects; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader.IO; -using Terraria.Net; using static CalamityMod.UI.DialogueDisplay.DialogueDisplaySystem; namespace CalamityMod.Packets @@ -21,8 +13,6 @@ namespace CalamityMod.Packets { public static StartDialogueDisplayPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.DialogueDisplayStart; - public static void Send(string name, bool progressDialogue, Vector2 position, int index, int uptime, DisplayEffectID effect, float wrapWidth, int toClient = -1, int ignoreClient = -1) { // Only Server should send Reponse to Clients @@ -69,7 +59,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { // Only receive info as clients diff --git a/Packets/TileEntities/TECanvasPaintingPacket.cs b/Packets/TileEntities/TECanvasPaintingPacket.cs index c2d57ebfc7..99cc38a513 100644 --- a/Packets/TileEntities/TECanvasPaintingPacket.cs +++ b/Packets/TileEntities/TECanvasPaintingPacket.cs @@ -8,8 +8,6 @@ namespace CalamityMod.Packets { public static TECanvasPaintingPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.UpdateCanvasPainting; - public static void Send(TECanvasPainting painting, float posX, float posY, float scale, int toClient = -1, int ignoreClient = -1) { if (painting is null) @@ -23,7 +21,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var painting = packet.ReadTileEntity(); float posX = packet.ReadSingle(); diff --git a/Packets/TileEntities/TEChargingStationItemChangePacket.cs b/Packets/TileEntities/TEChargingStationItemChangePacket.cs index b6dac896fb..c25886c3a6 100644 --- a/Packets/TileEntities/TEChargingStationItemChangePacket.cs +++ b/Packets/TileEntities/TEChargingStationItemChangePacket.cs @@ -9,8 +9,6 @@ namespace CalamityMod.Packets { public static TEChargingStationItemChangePacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.ChargingStationItemChange; - public static void Send(TEChargingStation chargingStn, Item pluggedItem, int toClient = -1, int ignoreClient = -1) { if (chargingStn is null) @@ -22,7 +20,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var chargingStn = packet.ReadTileEntity(); Item thePlug = ItemIO.Receive(packet, readStack: true, readFavorite: true); diff --git a/Packets/TileEntities/TEChargingStationStandardPacket.cs b/Packets/TileEntities/TEChargingStationStandardPacket.cs index 344af55b7b..8e7b5962ea 100644 --- a/Packets/TileEntities/TEChargingStationStandardPacket.cs +++ b/Packets/TileEntities/TEChargingStationStandardPacket.cs @@ -10,8 +10,6 @@ namespace CalamityMod.Packets { public static TEChargingStationStandardPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.ChargingStationStandard; - public static void Send(TEChargingStation chargingStn, short timer, short cellStack, float chargeOrNaN, int toClient = -1, int ignoreClient = -1) { if (chargingStn is null) @@ -25,7 +23,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var chargingStn = packet.ReadTileEntity(); short timer = packet.ReadInt16(); diff --git a/Packets/TileEntities/TELabHologramProjectorPacket.cs b/Packets/TileEntities/TELabHologramProjectorPacket.cs index a09687259d..7e8e03f5a6 100644 --- a/Packets/TileEntities/TELabHologramProjectorPacket.cs +++ b/Packets/TileEntities/TELabHologramProjectorPacket.cs @@ -7,8 +7,6 @@ namespace CalamityMod.Packets { public static TELabHologramProjectorPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.LabHologramProjector; - public static void Send(TELabHologramProjector projector, bool poppingUp, int toClient = -1, int ignoreClient = -1) { if (projector is null) @@ -20,7 +18,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var projector = packet.ReadTileEntity(); bool pop = packet.ReadBoolean(); diff --git a/Packets/TileEntities/TEPowerCellFactoryPacket.cs b/Packets/TileEntities/TEPowerCellFactoryPacket.cs index e469982c4a..0c5b92eca6 100644 --- a/Packets/TileEntities/TEPowerCellFactoryPacket.cs +++ b/Packets/TileEntities/TEPowerCellFactoryPacket.cs @@ -9,8 +9,6 @@ namespace CalamityMod.Packets { public static TEPowerCellFactoryPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.PowerCellFactory; - public static void Send(TEPowerCellFactory cellFactory, long time, int stack, int toClient = -1, int ignoreClient = -1) { if (cellFactory is null) @@ -23,7 +21,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var cellFactory = packet.ReadTileEntity(); long time = packet.ReadInt64(); diff --git a/Packets/TileEntities/TETurretPacket.cs b/Packets/TileEntities/TETurretPacket.cs index 8539df9103..1d61b09962 100644 --- a/Packets/TileEntities/TETurretPacket.cs +++ b/Packets/TileEntities/TETurretPacket.cs @@ -9,8 +9,6 @@ namespace CalamityMod.Packets { public static TETurretPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.Turret; - public static void Send(TEBaseTurret turret, int toClient = -1, int ignoreClient = -1) { if (turret is null) @@ -25,7 +23,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var turret = packet.ReadTileEntity(); int firingTime = packet.ReadInt32(); diff --git a/Packets/TileEntities/TEUpdateCodebreakerConstituentsPacket.cs b/Packets/TileEntities/TEUpdateCodebreakerConstituentsPacket.cs index ca1c95ab61..c61a1e012d 100644 --- a/Packets/TileEntities/TEUpdateCodebreakerConstituentsPacket.cs +++ b/Packets/TileEntities/TEUpdateCodebreakerConstituentsPacket.cs @@ -8,8 +8,6 @@ namespace CalamityMod.Packets { public static TEUpdateCodebreakerConstituentsPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.UpdateCodebreakerConstituents; - public static void Send(TECodebreaker codeBreaker, int toClient = -1, int ignoreClient = -1) { if (codeBreaker is null) @@ -28,7 +26,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var codeBreaker = packet.ReadTileEntity(); BitsByte containmentFlagWrapper = packet.ReadByte(); diff --git a/Packets/TileEntities/TEUpdateCodebreakerContainedStuffPacket.cs b/Packets/TileEntities/TEUpdateCodebreakerContainedStuffPacket.cs index fe4b6abad8..8385b9ecb3 100644 --- a/Packets/TileEntities/TEUpdateCodebreakerContainedStuffPacket.cs +++ b/Packets/TileEntities/TEUpdateCodebreakerContainedStuffPacket.cs @@ -7,8 +7,6 @@ namespace CalamityMod.Packets { public static TEUpdateCodebreakerContainedStuffPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.UpdateCodebreakerContainedStuff; - public static void Send(TECodebreaker codeBreaker, int toClient = -1, int ignoreClient = -1) { if (codeBreaker is null) @@ -23,7 +21,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var codeBreaker = packet.ReadTileEntity(); int cellCount = packet.ReadInt32(); diff --git a/Packets/TileEntities/TEUpdateCodebreakerDecryptCountdownPacket.cs b/Packets/TileEntities/TEUpdateCodebreakerDecryptCountdownPacket.cs index 198bb552fb..6fc2b6499d 100644 --- a/Packets/TileEntities/TEUpdateCodebreakerDecryptCountdownPacket.cs +++ b/Packets/TileEntities/TEUpdateCodebreakerDecryptCountdownPacket.cs @@ -7,8 +7,6 @@ namespace CalamityMod.Packets { public static TEUpdateCodebreakerDecryptCountdownPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.UpdateCodebreakerDecryptCountdown; - public static void Send(TECodebreaker codeBreaker, int toClient = -1, int ignoreClient = -1) { if (codeBreaker is null) @@ -20,7 +18,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var codeBreaker = packet.ReadTileEntity(); int countdown = packet.ReadInt32(); diff --git a/Packets/Worlds/BanditStolenMoneySyncPacket.cs b/Packets/Worlds/BanditStolenMoneySyncPacket.cs index cf9cd1d688..0a04fcf7c6 100644 --- a/Packets/Worlds/BanditStolenMoneySyncPacket.cs +++ b/Packets/Worlds/BanditStolenMoneySyncPacket.cs @@ -8,8 +8,6 @@ namespace CalamityMod.Packets { public static BanditStolenMoneySyncPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.BanditStolenMoneySync; - public static void Send(int amountStolenByBandit, int toClient = -1, int ignoreClient = -1) { var packet = Instance.CreateBasePacket(); @@ -17,7 +15,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var amountStolenByBandit = packet.Read7BitEncodedInt(); diff --git a/Packets/Worlds/SwitchToDifficultyPacket.cs b/Packets/Worlds/SwitchToDifficultyPacket.cs index c32f33b7fe..0ea247d70d 100644 --- a/Packets/Worlds/SwitchToDifficultyPacket.cs +++ b/Packets/Worlds/SwitchToDifficultyPacket.cs @@ -10,8 +10,6 @@ namespace CalamityMod.Packets { public static SwitchToDifficultyPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.SwitchToDifficulty; - public static void Send(DifficultyMode modeToSwitch, int toClient = -1, int ignoreClient = -1) { var packet = Instance.CreateBasePacket(); @@ -21,7 +19,7 @@ namespace CalamityMod.Packets packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { var modeName = packet.ReadString(); var difficulty = DifficultyModeSystem.Difficulties.SingleOrDefault(diff => diff.FullName.Equals(modeName)); diff --git a/Packets/Worlds/UnlockAbyssChestsPacket.cs b/Packets/Worlds/UnlockAbyssChestsPacket.cs index 509fdc6113..88d7705d2d 100644 --- a/Packets/Worlds/UnlockAbyssChestsPacket.cs +++ b/Packets/Worlds/UnlockAbyssChestsPacket.cs @@ -7,15 +7,13 @@ namespace CalamityMod.Packets { public static UnlockAbyssChestsPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.UnlockAbyssChests; - public static void Send(int toClient = -1, int ignoreClient = -1) { var packet = Instance.CreateBasePacket(); packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { Abyss.DoUnlockAllAbyssChests(); } diff --git a/Packets/Worlds/WantToRefundReforgesPacket.cs b/Packets/Worlds/WantToRefundReforgesPacket.cs index 634aacb8bd..980805ffb2 100644 --- a/Packets/Worlds/WantToRefundReforgesPacket.cs +++ b/Packets/Worlds/WantToRefundReforgesPacket.cs @@ -9,15 +9,13 @@ namespace CalamityMod.Packets { public static WantToRefundReforgesPacket Instance { get; private set; } - public override byte MessageType => (byte)CalamityModMessageType.WantToRefundReforges; - public static void Send(int toClient = -1, int ignoreClient = -1) { var packet = Instance.CreateBasePacket(); packet.Send(toClient, ignoreClient); } - public override void HandlePacket(in BinaryReader packet, int sender) + public override void HandlePacket(BinaryReader packet, int sender) { // Only Server should handle this action! if (!Main.dedServ) diff --git a/Projectiles/BaseProjectiles/BaseSwordHoldoutProjectile.cs b/Projectiles/BaseProjectiles/BaseSwordHoldoutProjectile.cs index 4d6cab5a10..13125da4a5 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.MountedCenter - 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.MountedCenter - 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.MountedCenter - player.Calamity().mouseWorld).SafeNormalize(Vector2.One), RotateInCooldown); if (angle.X < 0) { player.direction = 1; @@ -398,7 +403,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles { adust = MathHelper.ToRadians(-45); } - var armCenter = player.Center - new Vector2(5 * player.direction, 2); + var armCenter = player.MountedCenter - new Vector2(5 * player.direction, 2); if (AfterImageLength > 0) { oldProjectileRot.Add(Projectile.rotation); @@ -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); @@ -419,7 +424,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles AdditionalAI(); if (!Projectile.active) return; - oldPlayerOffset = Projectile.Center - player.Center; + oldPlayerOffset = Projectile.Center - player.MountedCenter; player.itemTime = ExistsTime + 2 - timer; player.itemAnimation = ExistsTime + 2 - timer; if (timer > ExistsTime) @@ -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; @@ -506,9 +511,9 @@ namespace CalamityMod.Projectiles.BaseProjectiles if (lineCollisionLength > 0) { var player = Main.player[Projectile.owner]; - var armcenter = player.Center - new Vector2(5 * player.direction, 2); + var armcenter = player.MountedCenter - 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/BaseProjectiles/BaseWormProjectile.cs b/Projectiles/BaseProjectiles/BaseWormProjectile.cs index 93f3c034ae..b7c1765bb6 100644 --- a/Projectiles/BaseProjectiles/BaseWormProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseWormProjectile.cs @@ -294,7 +294,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles } var tex = SegmentTextureAssets[segment.segmentType].Value; Main.spriteBatch.Draw(tex, segment.Center - Main.screenPosition, null, color *segment.Opacity, segment.rotation, tex.Size() / 2 + (SegmentTypeDrawOffsets[segment.segmentType]), Projectile.scale, SpriteEffects.None, 1); - if (!GlowTextures.IndexInRange(segment.segmentType + 1) || GlowTextures[segment.segmentType + 1] is null) + if (GlowTextures is null || !GlowTextures.IndexInRange(segment.segmentType + 1) || GlowTextures[segment.segmentType + 1] is null) { return; } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 6dee0c35ee..3612ebc549 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -191,11 +191,6 @@ namespace CalamityMod.Projectiles /// public float conditionalHomingRange = 0f; - /// - /// Causes a projectile to use both Static and Local iframes when set - /// - public bool hybridIframes = false; - /// /// Whether or not this proj was spawned with grape beer on /// this does NOT mean it has grape beer homing! @@ -327,14 +322,12 @@ namespace CalamityMod.Projectiles void ApplyGrapeBeer() { - conditionalHomingRange = 600; if (projectile.timeLeft > 300 * projectile.MaxUpdates) projectile.timeLeft = 300 * projectile.MaxUpdates; - hybridIframes = true; - projectile.localNPCHitCooldown = -1; + //Calamity adds a hybrid iframe system when both local and static are set to true, so this works fine for both global and static projectiles. projectile.usesLocalNPCImmunity = true; - Main.player[projectile.owner].Calamity().grapeBeerTimer++; + projectile.localNPCHitCooldown = -1; } if (source is EntitySource_ItemUse_WithAmmo {Item: Item item}) { @@ -430,16 +423,9 @@ namespace CalamityMod.Projectiles //Light Pets will add light to the abyss darkness. //This uses local player on purpose, as the abyss darkness system is entirely client side. if (ProjectileID.Sets.LightPet[projectile.type] && Main.LocalPlayer.Calamity().ZoneAbyss) - EnhancedDarknessSystem.lights.Add(new() { center = projectile.Center, texture = ModContent.Request("CalamityMod/Particles/BloomCircle"), scale = 1 }); + EnhancedDarknessSystem.lights.Add(new() { center = projectile.Center, scale = 1 }); - ///Apply Hybrid iframes - if (hybridIframes) - { - projectile.usesIDStaticNPCImmunity = true; - projectile.usesLocalNPCImmunity = true; - } - - if (projectile.bobber && projectile.type != ModContent.ProjectileType() && RunFishingMinigames(projectile)) + if (projectile.bobber && projectile.type != ProjectileType() && RunFishingMinigames(projectile)) return false; //Reset the Homing Target immediately before AI can re-set it on applicable projectiles HomingTarget = -1; @@ -2933,7 +2919,7 @@ namespace CalamityMod.Projectiles //Make sure Victide Snail actually fishes when using a minigame rod foreach (var item in Main.ActiveProjectiles) { - if (item.type == ModContent.ProjectileType() && item.owner == projectile.owner) + if (item.type == ProjectileType() && item.owner == projectile.owner) item.ModProjectile().PlayerFishingTimer = 600; } #region Utilities @@ -3073,9 +3059,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) @@ -3091,10 +3080,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) { @@ -3121,16 +3116,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; @@ -3152,8 +3149,6 @@ namespace CalamityMod.Projectiles } if (projectile.ai[0] == 0) { - - projectile.ai[1] = CatchTime; projectile.localAI[1] = TimerToCatch; if (CaughtItemID != -1 && isReelingIn == 0) @@ -3184,13 +3179,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; @@ -3202,32 +3212,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)) @@ -3239,7 +3252,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); @@ -3366,10 +3379,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) { @@ -3382,7 +3398,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); @@ -3406,16 +3422,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; @@ -3529,7 +3547,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); @@ -3538,15 +3556,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) @@ -3579,7 +3617,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); @@ -4647,7 +4685,7 @@ namespace CalamityMod.Projectiles public override void OnHitNPC(Projectile projectile, NPC target, NPC.HitInfo hit, int damageDone) { //Manage Hybrid iframes - if (hybridIframes && (projectile.penetrate != 1 || projectile.appliesImmunityTimeOnSingleHits)) + if ((projectile.usesLocalNPCImmunity && projectile.usesIDStaticNPCImmunity) && (projectile.penetrate != 1 || projectile.appliesImmunityTimeOnSingleHits)) { projectile.localNPCImmunity[target.whoAmI] = projectile.localNPCHitCooldown; Projectile.perIDStaticNPCImmunity[projectile.type][target.whoAmI] = Main.GameUpdateCount + (uint)projectile.idStaticNPCHitCooldown; @@ -4783,7 +4821,7 @@ namespace CalamityMod.Projectiles public override bool? CanHitNPC(Projectile projectile, NPC target) { - if (hybridIframes && (projectile.localNPCImmunity[target.whoAmI] != 0 || Projectile.perIDStaticNPCImmunity[projectile.type][target.whoAmI] > Main.GameUpdateCount)) + if ((projectile.usesLocalNPCImmunity && projectile.usesIDStaticNPCImmunity) && (projectile.localNPCImmunity[target.whoAmI] != 0 || Projectile.perIDStaticNPCImmunity[projectile.type][target.whoAmI] > Main.GameUpdateCount)) return false; if (target.Calamity().IsArmored() && HomingTarget > -1 && HomingTarget != target.whoAmI) return false; 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/CountermeasureMittHoldout.cs b/Projectiles/DraedonsArsenal/CountermeasureMittHoldout.cs index b3ff0df337..6ab5de6adc 100644 --- a/Projectiles/DraedonsArsenal/CountermeasureMittHoldout.cs +++ b/Projectiles/DraedonsArsenal/CountermeasureMittHoldout.cs @@ -396,21 +396,39 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { for (int i = 0; i < 25; i++) { - Dust dust = Dust.NewDustPerfect(pos, Effects.ArsenalEffects.ArsenalLaserDust, vel.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.4f) * Main.rand.NextFloat(10f, 35f), 0, default, Main.rand.NextFloat(1f, 1.8f)); + float size = Main.rand.NextFloat(0.4f, 1f); + Dust dust = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Circular(10, 10), ModContent.DustType(), -vel.SafeNormalize(Vector2.UnitX).RotatedBy(0.95f * (Main.rand.NextBool() ? 1 : -1)) * Main.rand.NextFloat(4f, 18f) * size, 0, default, Main.rand.NextFloat(1.1f, 1.9f) + (1 - size)); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalLaserColor; + dust.fadeIn = 0.7f; + } + for (int i = 0; i < 25; i++) + { + Dust dust = Dust.NewDustPerfect(pos + Main.rand.NextVector2Circular(20, 20), Effects.ArsenalEffects.ArsenalLaserDust, vel.SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(10f, 45f), 0, default, Main.rand.NextFloat(1f, 1.8f)); dust.noGravity = true; dust.color = Effects.ArsenalEffects.ArsenalLaserColor; dust.alpha = 100; dust.fadeIn = 20; + if (i % 2 == 0) + { + Dust dust2 = Dust.NewDustPerfect(pos + Main.rand.NextVector2Circular(20, 20), Effects.ArsenalEffects.ArsenalLaserDust, vel.SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(40f, 65f), 0, default, Main.rand.NextFloat(0.6f, 1.1f)); + dust2.noGravity = true; + dust2.color = Effects.ArsenalEffects.ArsenalLaserColor; + dust2.alpha = 100; + dust2.fadeIn = 10; + } } for (int i = 0; i < 2; i++) { - Particle pulse = new CustomSpark(pos, vel.SafeNormalize(Vector2.UnitX) * 1, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 20, 0.08f, Effects.ArsenalEffects.ArsenalLaserColor, new Vector2(2f, 0.7f), shrinkSpeed: -0.1f); + Particle pulse = new CustomSpark(pos, vel.SafeNormalize(Vector2.UnitX) * 2, "CalamityMod/Particles/BloomRing", false, 20, 1f, Effects.ArsenalEffects.ArsenalLaserColor, new Vector2(2f, 0.7f), shrinkSpeed: -0.2f); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse1 = new CustomSpark(pos, vel.SafeNormalize(Vector2.UnitX) * 15, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 18, 0.06f, Effects.ArsenalEffects.ArsenalLaserColor, new Vector2(2f, 0.7f), shrinkSpeed: -0.1f); + Particle pulse1 = new CustomSpark(pos, vel.SafeNormalize(Vector2.UnitX) * 18, "CalamityMod/Particles/BloomRing", false, 18, 0.8f, Effects.ArsenalEffects.ArsenalLaserColor, new Vector2(2f, 0.7f), shrinkSpeed: -0.2f); GeneralParticleHandler.SpawnParticle(pulse1); - Particle pulse2 = new CustomSpark(pos, vel.SafeNormalize(Vector2.UnitX) * 25, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 16, 0.04f, Effects.ArsenalEffects.ArsenalLaserColor, new Vector2(2f, 0.7f), shrinkSpeed: -0.1f); + Particle pulse2 = new CustomSpark(pos, vel.SafeNormalize(Vector2.UnitX) * 34, "CalamityMod/Particles/BloomRing", false, 16, 0.6f, Effects.ArsenalEffects.ArsenalLaserColor, new Vector2(2f, 0.7f), shrinkSpeed: -0.2f); GeneralParticleHandler.SpawnParticle(pulse2); } + Particle bloom = new CustomSpark(pos, vel.SafeNormalize(Vector2.UnitX) * 8, "CalamityMod/Particles/BloomCircle", false, 22, 0.7f, Effects.ArsenalEffects.ArsenalLaserColor, new Vector2(1f, 8f), true, true, shrinkSpeed: -0.5f, extraRotation: MathHelper.PiOver2); + GeneralParticleHandler.SpawnParticle(bloom); oneFx = false; } damageMult -= 6; @@ -546,7 +564,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (forcePalm) { for (int y = 0; y < 8; y++) - Main.EntitySpriteDraw(bloom, palmBlastPos - Main.screenPosition + thrustAddition, null, Color.Lerp(Effects.ArsenalEffects.ArsenalLaserColor, Color.White, y * 0.1f) with { A = 0 } * fadeIn * 0.25f, alteredRotation, bloom.Size() / 2, new Vector2(1f, 1f) * Projectile.scale * (0.3f - 0.02f * y) * randSize, SpriteEffects.FlipVertically); + Main.EntitySpriteDraw(bloom, palmBlastPos - Main.screenPosition + thrustAddition, null, Color.Lerp(Effects.ArsenalEffects.ArsenalLaserColor, Color.White, y * 0.1f) with { A = 0 } * fadeIn * 0.25f, alteredRotation + Main.rand.NextFloat(-4, 4), bloom.Size() / 2, new Vector2(0.4f, 1.8f) * Projectile.scale * (0.3f - 0.02f * y) * randSize, SpriteEffects.FlipVertically); + Main.EntitySpriteDraw(diamond, palmBlastPos - Main.screenPosition + thrustAddition, null, Color.White with { A = 0 } * fadeIn, 0, diamond.Size() / 2, new Vector2(1.7f * Main.rand.NextFloat(1, 1.6f) * (float)Math.Pow(fadeIn, 3), 0.06f) * Projectile.scale * 0.3f, SpriteEffects.FlipVertically); + Main.EntitySpriteDraw(bloom, palmBlastPos - Main.screenPosition + thrustAddition, null, Effects.ArsenalEffects.ArsenalLaserColor with { A = 0 } * fadeIn * 0.35f, 0, bloom.Size() / 2, new Vector2(1.8f, 0.5f) * Projectile.scale * 0.4f * randSize, SpriteEffects.FlipVertically); } return false; } diff --git a/Projectiles/DraedonsArsenal/CountermeasurePalmBlast.cs b/Projectiles/DraedonsArsenal/CountermeasurePalmBlast.cs index c2c01bbd8b..295d12422c 100644 --- a/Projectiles/DraedonsArsenal/CountermeasurePalmBlast.cs +++ b/Projectiles/DraedonsArsenal/CountermeasurePalmBlast.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public float fade => (float)Math.Pow(Utils.GetLerpValue(0, 13, Projectile.timeLeft, true), 4); public bool onSpawn = true; private NPC targeted = null; + public int lifetime = 18; public override void SetDefaults() { Projectile.width = 150; @@ -22,7 +23,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = -1; - Projectile.timeLeft = 15; + Projectile.timeLeft = lifetime; Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; @@ -45,9 +46,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Vector2 launchVel = Projectile.velocity.SafeNormalize(Vector2.UnitX); float launchPower = 25; targeted.MoveNPC(launchVel, launchPower, true); - - Particle bloom = new CustomSpark(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, "CalamityMod/Particles/BloomCircle", false, 12, 0.7f, Effects.ArsenalEffects.ArsenalLaserColor, new Vector2(1f, 3f), true, true, shrinkSpeed: -0.5f, extraRotation: MathHelper.PiOver2); - GeneralParticleHandler.SpawnParticle(bloom); } time++; } @@ -73,13 +71,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Texture2D beam = ModContent.Request("CalamityMod/Particles/BloomLineFade").Value; Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; - float completion = Utils.GetLerpValue(15, 0, time); + float completion = Utils.GetLerpValue(lifetime, 0, time); for (int i = 0; i < 6; i++) { Color orbColor = Color.Lerp(Effects.ArsenalEffects.ArsenalLaserColor, Color.White, i * 0.04f) with { A = 0 } * 0.8f; float scale = Projectile.scale * (0.05f + i * 0.01f) * 3; - Main.EntitySpriteDraw(beam, Projectile.Center - Main.screenPosition, null, orbColor, Projectile.rotation, new Vector2(beam.Width / 2, beam.Height), new Vector2(0.3f * fade, 2 * completion) * scale, SpriteEffects.None); + Main.EntitySpriteDraw(beam, Projectile.Center - Main.screenPosition, null, orbColor, Projectile.rotation, new Vector2(beam.Width / 2, beam.Height), new Vector2(0.3f * fade, 2) * scale, SpriteEffects.None); Main.EntitySpriteDraw(bloom, Projectile.Center - Main.screenPosition, null, orbColor, Projectile.rotation + MathHelper.PiOver2, bloom.Size() * 0.5f, new Vector2(0.5f, 1 + 2 * completion) * scale * 3 * fade, SpriteEffects.None); } diff --git a/Projectiles/DraedonsArsenal/HolofibreImmolatorHoldout.cs b/Projectiles/DraedonsArsenal/HolofibreImmolatorHoldout.cs index aae2452af4..67492398f7 100644 --- a/Projectiles/DraedonsArsenal/HolofibreImmolatorHoldout.cs +++ b/Projectiles/DraedonsArsenal/HolofibreImmolatorHoldout.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items; +using CalamityMod.Dusts; +using CalamityMod.Items; using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -29,11 +30,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public ref float ShotsLoaded => ref Projectile.ai[1]; public int chargeMax = 0; public int downtime = 0; + public static int spamDelayMax = 8; + public int spamDelay = spamDelayMax; public bool ChargeLV1 => CurrentChargingFrames >= chargeMax; public override void KillHoldoutLogic() { - if (Owner.CantUseHoldout(false) || HeldItem.type != Owner.HeldItem.type) + if (HeldItem.type != Owner.HeldItem.type) Projectile.Kill(); } public override void OnSpawn(IEntitySource source) @@ -41,29 +44,34 @@ namespace CalamityMod.Projectiles.DraedonsArsenal OffsetLengthFromArm = 15; Player Owner = Main.player[Projectile.owner]; chargeMax = (int)(Owner.itemAnimationMax * 1.5f); - - SoundStyle sound = new("CalamityMod/Sounds/Item/ImmolatorCharge"); - ChargeSlot = SoundEngine.PlaySound(sound with { Volume = 0.7f, IsLooped = true }, Projectile.Center); } public override void HoldoutAI() { + if (CurrentChargingFrames == 0) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/ImmolatorCharge"); + ChargeSlot = SoundEngine.PlaySound(sound with { Volume = 0.7f, IsLooped = true }, Projectile.Center); + } CalamityGlobalItem modItem = Owner.HeldItem.Calamity(); Vector2 mountedCenter = Owner.MountedCenter; Vector2 ownerToMouse = Owner.Calamity().mouseWorld - mountedCenter; if (SoundEngine.TryGetActiveSound(ChargeSlot, out var ChargeSound) && ChargeSound.IsPlaying) ChargeSound.Position = Projectile.Center; - + if (ChargeLV1 && spamDelay > 0) + spamDelay--; // Fire if the owner stops channeling or otherwise cannot use the weapon. - if ((Owner.CantUseHoldout() || Owner.Calamity().mouseRight) && downtime == 0 && time >= 1) + bool autoSpam = (Owner.Calamity().mouseRight && !Main.mouseLeft); + bool chargeSpam = (Owner.Calamity().mouseRight && Main.mouseLeft && ChargeLV1 && spamDelay == 0); + if ((!Main.mouseLeft || autoSpam || chargeSpam) && downtime == 0 && time >= 1) { KeepRefreshingLifetime = false; Projectile.timeLeft = Owner.Calamity().mouseRight ? Owner.itemAnimationMax * 2 : Owner.itemAnimationMax; downtime = Owner.itemAnimationMax; - if (Owner.Calamity().mouseRight) + if (Owner.Calamity().mouseRight && !Main.mouseLeft) CurrentChargingFrames = 0; - + spamDelay = spamDelayMax; // Big Shot mode if (ChargeLV1) { @@ -116,6 +124,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal else if (downtime == 0) { CurrentChargingFrames++; + Projectile.timeLeft = Owner.itemAnimationMax; + // Charge-up visuals if (CurrentChargingFrames >= 10) { @@ -131,7 +141,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal ChargeSound?.Stop(); for (int i = 0; i < 20; i++) { - Dust chargefull = Dust.NewDustPerfect(GunTipPosition, Effects.ArsenalEffects.ArsenalDust); + Dust chargefull = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType()); chargefull.velocity = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 4f + Owner.velocity * 0.5f; chargefull.scale = Main.rand.NextFloat(0.6f, 0.8f); chargefull.noGravity = false; @@ -143,16 +153,20 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (CurrentChargingFrames > chargeMax && Main.rand.NextBool()) { - Dust chargefull = Dust.NewDustPerfect(GunTipPosition, Effects.ArsenalEffects.ArsenalDust); + Dust chargefull = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType()); chargefull.velocity = Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(5, 9); - chargefull.scale = Main.rand.NextFloat(0.2f, 0.4f); + chargefull.scale = Main.rand.NextFloat(0.7f, 0.85f); chargefull.noGravity = true; chargefull.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + chargefull.fadeIn = 0.5f; } } - if (downtime == 1 && !Owner.Calamity().mouseRight) + if ((downtime == 1 && !Owner.Calamity().mouseRight) || Owner.dead) + { + ChargeSound?.Stop(); Projectile.Kill(); + } if (downtime > 0) downtime--; @@ -193,7 +207,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Main.EntitySpriteDraw(rechargeTexture, tipPosition - Main.screenPosition, null, Effects.ArsenalEffects.ArsenalPlasmaColor with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.25f * Utils.GetLerpValue(0, chargeMax, CurrentChargingFrames, true) * randSize, SpriteEffects.None, 0); Main.EntitySpriteDraw(rechargeTexture, tipPosition - Main.screenPosition, null, Color.White with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.15f * Utils.GetLerpValue(0, chargeMax, CurrentChargingFrames, true) * randSize, SpriteEffects.None, 0); - Main.EntitySpriteDraw(pointTexture, tipPosition - Main.screenPosition + (Projectile.velocity * 15 * fade), null, Effects.ArsenalEffects.ArsenalPlasmaColor with { A = 0 } * fade, Projectile.velocity.RotatedBy(MathHelper.ToRadians(90f)).ToRotation(), pointTexture.Size() * 0.5f, new Vector2(0.5f, 0.9f) * 0.035f * fade * randSize * (CurrentChargingFrames == chargeMax ? 1.5f : 1), flipSprite); + for (int i = 0; i < 3; i++) + Main.EntitySpriteDraw(pointTexture, tipPosition - Main.screenPosition + (Projectile.velocity * 15 * fade), null, Color.Lerp(Color.White, Effects.ArsenalEffects.ArsenalPlasmaColor, i * 0.5f) with { A = 0 } * fade * 0.7f, Projectile.velocity.RotatedBy(MathHelper.ToRadians(90f)).ToRotation(), pointTexture.Size() * 0.5f, new Vector2(0.7f - 0.2f * i, 0.7f + 0.3f * i) * 0.035f * fade * randSize * (CurrentChargingFrames == chargeMax ? 1.5f : 1) * (0.6f + 0.2f * i), flipSprite); } return false; } 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/ImmolationArrow.cs b/Projectiles/DraedonsArsenal/ImmolationArrow.cs index ec64b427de..a08dcb5229 100644 --- a/Projectiles/DraedonsArsenal/ImmolationArrow.cs +++ b/Projectiles/DraedonsArsenal/ImmolationArrow.cs @@ -1,4 +1,5 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -87,8 +88,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { if (Main.rand.NextBool(3) && canStick) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? Effects.ArsenalEffects.ArsenalDust : Effects.ArsenalEffects.ArsenalPlasmaDust, -Projectile.velocity); - dust.scale = dust.type == Effects.ArsenalEffects.ArsenalDust ? Main.rand.NextFloat(0.3f, 0.6f) : Main.rand.NextFloat(0.6f, 1.4f); + Dust dust = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalPlasmaDust, -Projectile.velocity); + dust.scale = Main.rand.NextFloat(0.6f, 1.4f); dust.velocity = -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.7f); dust.noGravity = true; dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; @@ -138,8 +139,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } if (Main.rand.NextBool()) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? Effects.ArsenalEffects.ArsenalDust : ModContent.DustType(), -Projectile.velocity); - dust.scale = dust.type == Effects.ArsenalEffects.ArsenalDust ? Main.rand.NextFloat(0.3f, 0.6f) : Main.rand.NextFloat(0.6f, 1.4f); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), -Projectile.velocity); + dust.scale = Main.rand.NextFloat(0.6f, 1.4f); dust.velocity = (new Vector2(35, 35).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.7f)) * Utils.GetLerpValue(90, 0, stuckTimer); dust.noGravity = true; dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; @@ -212,8 +213,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int i = 0; i < (int)(15 * bonus); i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? Effects.ArsenalEffects.ArsenalDust : stuckInGround ? ModContent.DustType() : Effects.ArsenalEffects.ArsenalPlasmaDust, -Projectile.velocity); - dust.scale = dust.type == Effects.ArsenalEffects.ArsenalDust ? Main.rand.NextFloat(0.3f, 0.6f) : Main.rand.NextFloat(0.9f, 1.8f); + Dust dust = Dust.NewDustPerfect(Projectile.Center, stuckInGround ? ModContent.DustType() : Effects.ArsenalEffects.ArsenalPlasmaDust, -Projectile.velocity); + dust.scale = Main.rand.NextFloat(0.9f, 1.8f); dust.velocity = (new Vector2(35, 35).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.7f)) * Utils.GetLerpValue(90, 0, stuckTimer); dust.noGravity = false; dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; @@ -231,24 +232,17 @@ namespace CalamityMod.Projectiles.DraedonsArsenal return false; Asset tex = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/ImmolationArrow"); + Asset bloom = ModContent.Request("CalamityMod/Particles/BloomCircle"); - if (!stuckInGround && !stuckInTarget && false) - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Effects.ArsenalEffects.ArsenalPlasmaColor with { A = 0 }, 1, tex.Value); + float randSize = Main.rand.NextFloat(0.9f, 1f); + float fadeIn = (float)Math.Pow(Utils.GetLerpValue(90, 5, stuckTimer, true), 3); + for (int i = 0; i < 6; i++) + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 6 * i, null, Color.Lerp(Color.White, Effects.ArsenalEffects.ArsenalPlasmaColor, i * 0.35f) with { A = 0 } * 0.5f, Projectile.rotation, tex.Size() * 0.5f, new Vector2(0.7f - 0.15f * i, 0.7f + 0.15f * i) * randSize * (0.6f + 0.25f * i) * 2, SpriteEffects.None); + + for (int i = 0; i < 3; i++) + Main.EntitySpriteDraw(bloom.Value, Projectile.Center - Main.screenPosition + (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 3, null, Color.Lerp(Color.White, Effects.ArsenalEffects.ArsenalPlasmaColor, 0.5f * i) with { A = 0 } * fadeIn * 0.3f, Projectile.rotation, bloom.Size() * 0.5f, new Vector2(1f - 0.2f * i, 1f + 0.35f * i) * randSize * (0.5f + 0.15f * i), SpriteEffects.None); - float randSize = Main.rand.NextFloat(0.8f, 1.1f); - for (int i = 0; i < 20; i++) - { - Vector2 scale = Projectile.scale * new Vector2(0.5f, 1) * 1.5f * randSize; - Vector2 drawOffset = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 3; - Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, Effects.ArsenalEffects.ArsenalPlasmaColor with { A = 0 } * 0.2f, Projectile.rotation, tex.Size() * 0.5f, scale, SpriteEffects.None); - } Vector2 scale2 = 1.1f * new Vector2(0.5f, 1) * 1.5f * randSize; - Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Effects.ArsenalEffects.ArsenalPlasmaColor with { A = 0 } * 0.5f, Projectile.rotation, tex.Size() * 0.5f, scale2, SpriteEffects.None); - if (stuckInTarget || stuckInGround) - { - Vector2 scale = 1.1f * new Vector2(0.5f, 1) * 1.5f * randSize; - Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Color.White with { A = 0 } * Utils.GetLerpValue(90, 30, stuckTimer, true), Projectile.rotation, tex.Size() * 0.5f, scale, SpriteEffects.None); - } return false; } } diff --git a/Projectiles/DraedonsArsenal/ImmolationSpray.cs b/Projectiles/DraedonsArsenal/ImmolationSpray.cs index 91349cf6b1..56aa2e95fe 100644 --- a/Projectiles/DraedonsArsenal/ImmolationSpray.cs +++ b/Projectiles/DraedonsArsenal/ImmolationSpray.cs @@ -49,8 +49,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Particle spark = new GlowOrbParticle(placement, -Projectile.velocity * speed, false, 7, Main.rand.NextFloat(0.4f, 0.7f), Effects.ArsenalEffects.ArsenalPlasmaColor); GeneralParticleHandler.SpawnParticle(spark); - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? Effects.ArsenalEffects.ArsenalDust : Effects.ArsenalEffects.ArsenalPlasmaDust, -Projectile.velocity); - dust.scale = dust.type == Effects.ArsenalEffects.ArsenalDust ? Main.rand.NextFloat(0.2f, 0.5f) : Main.rand.NextFloat(0.4f, 1.1f); + Dust dust = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalPlasmaDust, -Projectile.velocity); + dust.scale = Main.rand.NextFloat(0.4f, 1.1f); dust.velocity = (new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.7f)); dust.noGravity = true; dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; 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/DraedonsArsenal/PulseDragonProjectile.cs b/Projectiles/DraedonsArsenal/PulseDragonProjectile.cs index 5e115036fa..f8b2db1ce6 100644 --- a/Projectiles/DraedonsArsenal/PulseDragonProjectile.cs +++ b/Projectiles/DraedonsArsenal/PulseDragonProjectile.cs @@ -125,6 +125,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (field.whoAmI.WithinBounds(Main.maxProjectiles)) { field.DamageType = DamageClass.MeleeNoSpeed; + field.usesIDStaticNPCImmunity = false; field.usesLocalNPCImmunity = true; field.localNPCHitCooldown = 3; field.timeLeft = 12; diff --git a/Projectiles/Magic/AlphaDraconisStar.cs b/Projectiles/Magic/AlphaDraconisStar.cs index a54c132ee8..22c4fb5947 100644 --- a/Projectiles/Magic/AlphaDraconisStar.cs +++ b/Projectiles/Magic/AlphaDraconisStar.cs @@ -1,10 +1,17 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Graphics.Primitives; using CalamityMod.Particles; using CalamityMod.Utilities.Daybreak; +using CalamityMod.Utilities.Daybreak.Buffers; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -24,7 +31,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 +39,12 @@ namespace CalamityMod.Projectiles.Magic Projectile.scale = 0.5f; Projectile.tileCollide = false; Projectile.timeLeft = Projectile.MaxUpdates * 300; + Projectile.stopsDealingDamageAfterPenetrateHits = true; + } + + public override void OnSpawn(IEntitySource source) + { + ProjectileID.Sets.TrailCacheLength[Type] = 8; } public override void AI() @@ -103,13 +116,23 @@ namespace CalamityMod.Projectiles.Magic } } } + + // Emit a small amount of dust while traveling + if (Main.rand.NextBool(10)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalPlasmaDust, -Projectile.velocity); + dust.scale = Main.rand.NextFloat(0.4f, 1f); + dust.velocity = -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.7f); + dust.noGravity = true; + dust.color = Color.CadetBlue; + } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { if (Projectile.ai[2] == 0) { - if (Main.rand.NextFloat() <= 0.5f) //50% chance to become pick-up-able stars + if (Main.rand.NextFloat() <= 0.33f) //33% chance to become pick-up-able stars { Projectile.ai[2] = 2; Projectile.timeLeft = 600 * Projectile.MaxUpdates; @@ -121,15 +144,127 @@ namespace CalamityMod.Projectiles.Magic } } + public override void OnKill(int timeLeft) + { + if (Projectile.ai[2] == 2) + return; + for (int i = 0; i < 4; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), -Projectile.velocity); + dust.scale = Main.rand.NextFloat(0.4f, 0.6f); + dust.velocity = (new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f)); + dust.color = Color.CadetBlue; + } + } + + + + public override bool PreDraw(ref Color lightColor) { - using (Main.spriteBatch.Scope()) + // Glow FX + Texture2D mainTexture = ModContent.Request(Texture).Value; + SpriteEffects spriteEffects = SpriteEffects.None; + + Vector2 drawOrigin = mainTexture.Size() / 2f; + float drawScale = Projectile.scale; + float drawRotation = Projectile.rotation; + Vector2 drawPosition; + + float glowSine = ((float)Math.Sin(Main.GlobalTimeWrappedHourly * 14f) + 1f) / 2f; + float pulse = MathHelper.Lerp(0.25f, 0.8f, glowSine); // Least protruding to most protruding + drawPosition = Projectile.Center - Main.screenPosition; + + for (int i = 0; i < 12; i++) { - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - CalamityUtils.DrawAfterimagesCentered(Projectile, 1, Color.White, shrink: true); - Main.spriteBatch.End(); + Vector2 unitVector = (MathHelper.TwoPi * i / 12f).ToRotationVector2(); + + Vector2 innerOffset = unitVector * (1.4f * pulse); + Main.spriteBatch.Draw(mainTexture, drawPosition + innerOffset, null, Color.SkyBlue with { A = 0 } * 0.225f, drawRotation, drawOrigin, drawScale, spriteEffects, 0f); + + Vector2 outerOffset = unitVector * (1.75f * pulse); + Main.spriteBatch.Draw(mainTexture, drawPosition + outerOffset, null, Color.DeepSkyBlue with { A = 0 } * 0.1f, drawRotation, drawOrigin, drawScale, spriteEffects, 0f); } + + // Trail rendering + Main.spriteBatch.End(out var ss); + + var device = Main.instance.GraphicsDevice; + using var lease = RenderTargetPool.Shared.Rent( + device, + Main.screenWidth / 2, + Main.screenHeight / 2, + RenderTargetDescriptor.Default + ); + + using (lease.Scope(clearColor: Color.Transparent)) + { + if (Projectile.velocity.Length() > 1) // Will otherwise cause noticeable frame drops + { + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(FireWidthFunction, FireColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), Projectile.oldPos.Length + 32); + + Vector2[] fireCoreLength = Projectile.oldPos.Take(8).ToArray(); + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); + PrimitiveRenderer.RenderTrail(fireCoreLength, new(FireCoreWidthFunction, FireCoreColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), fireCoreLength.Length + 24); + } + } + + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f); + Main.spriteBatch.End(); + + Main.spriteBatch.Begin(ss); return false; } + + public float FireWidthFunction(float completion, Vector2 pos) + { + float width; + float maxBodyWidth = 32f * Projectile.scale; + float curveRatio = 0.05f; + var positions = Projectile.oldPos.ToList(); + positions.RemoveAll(x => x == Vector2.Zero); + // Crop the tip of the trail into a conic shape. + if (completion < curveRatio) + width = MathF.Pow(completion / curveRatio, 0.5f) * maxBodyWidth; + else + width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f); + + // Pulse inwards and outwards over time. + float pulseInterpolant = MathF.Cos(MathHelper.Pi * completion - Main.GlobalTimeWrappedHourly * 20f) * 0.5f + 0.5f; + float additionalPulseWidth = MathHelper.Lerp(0f, 12f, pulseInterpolant); + return (width + additionalPulseWidth) * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type]; + } + + public Color FireColorFunction(float completion, Vector2 pos) + { + Color mainColor = Color.CadetBlue * 1.1f; + Color endColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true)); + return Color.Lerp(mainColor, endColor, completion) * Projectile.Opacity; + } + + public float FireCoreWidthFunction(float completion, Vector2 pos) + { + float width; + float maxBodyWidth = Projectile.scale * 8; + float curveRatio = 0.1f; + var positions = Projectile.oldPos.ToList(); + positions.RemoveAll(x => x == Vector2.Zero); + + if (completion < curveRatio) + width = MathF.Sin(completion / curveRatio * MathHelper.PiOver2) * maxBodyWidth + curveRatio; + else + width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f); + return width * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type]; + } + + public Color FireCoreColorFunction(float completion, Vector2 pos) + { + Color mainColor = Color.CadetBlue; + Color tipColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.2f, 1f, completion, true)); + Color fullBodyColor = Color.Lerp(mainColor, tipColor, completion); + return Color.Lerp(fullBodyColor, Color.White, 0.175f) * Projectile.Opacity; + } } } diff --git a/Projectiles/Magic/AquaSigilWaterdroplet.cs b/Projectiles/Magic/AquaSigilWaterdroplet.cs index ff26a9dfbc..041b600a89 100644 --- a/Projectiles/Magic/AquaSigilWaterdroplet.cs +++ b/Projectiles/Magic/AquaSigilWaterdroplet.cs @@ -1,17 +1,18 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Enums; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Particles; -using CalamityMod.Graphics.Primitives; -using System; using Terraria.GameContent; using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class AquaSigilWaterdroplet : ModProjectile, ILocalizedModType + public class AquaSigilWaterdroplet : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer { public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; @@ -50,13 +51,20 @@ namespace CalamityMod.Projectiles.Magic return; } - GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, Projectile.velocity, false, 2, Projectile.scale * 1.525f, Color.LightSkyBlue)); - // Gravity! Projectile.velocity.Y = Projectile.velocity.Y + 0.35f; } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + int frameHeight = texture.Height / Main.projFrames[Type]; + Rectangle sourceRect = new Rectangle(0, frameHeight * Projectile.frame, texture.Width, frameHeight); - // Standard trail drawing logic + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, sourceRect, Color.White, Projectile.rotation, sourceRect.Size() * 0.5f, 1f, 0); + return false; + } + + // Handle the projectile's trail from here private float WidthFunction(float completionRatio, Vector2 vertexPos) => MathHelper.Lerp(0f, MathHelper.Lerp(Projectile.scale * 48f, 0f, completionRatio), MathF.Pow(completionRatio, 1f / 2.5f)); private Color ColorFunction(float completionRatio, Vector2 vertexPos) { @@ -65,19 +73,11 @@ namespace CalamityMod.Projectiles.Magic Color endColor = Color.LightSkyBlue; return Color.Lerp(endColor, Color.White, completionRatio) * fadeOpacity; } - public override bool PreDraw(ref Color lightColor) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer) { GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); - PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, (_,_) => Projectile.Size * 0.5f, pixelate: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 32); - - - Texture2D texture = TextureAssets.Projectile[Type].Value; - int frameHeight = texture.Height / Main.projFrames[Type]; - Rectangle sourceRect = new Rectangle(0, frameHeight * Projectile.frame, texture.Width, frameHeight); - - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, sourceRect, Color.White, Projectile.rotation, sourceRect.Size() * 0.5f, 1f, 0); - - return false; + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, (_,_) => Projectile.Size * 0.5f, pixelate: true, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 32); + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, Projectile.velocity, false, 2, Projectile.scale * 1.525f, Color.LightSkyBlue), pixelate: true); } } } diff --git a/Projectiles/Magic/AuroraAustralis.cs b/Projectiles/Magic/AuroraAustralis.cs index ae1b9ec827..9381f68bf7 100644 --- a/Projectiles/Magic/AuroraAustralis.cs +++ b/Projectiles/Magic/AuroraAustralis.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 1; Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.timeLeft = 300; + Projectile.timeLeft = 180; Projectile.DamageType = DamageClass.Magic; Projectile.alpha = 255; diff --git a/Projectiles/Magic/DracoConstellation.cs b/Projectiles/Magic/DracoConstellation.cs index c71ee5fa60..90e20daa46 100644 --- a/Projectiles/Magic/DracoConstellation.cs +++ b/Projectiles/Magic/DracoConstellation.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Utilities.Daybreak; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -206,41 +207,46 @@ namespace CalamityMod.Projectiles.Magic } public override bool PreDraw(ref Color lightColor) { - var tex = TextureAssets.Projectile[Type].Value; - var connectioncolor = Color.SkyBlue * ((MathF.Sin(Main.GlobalTimeWrappedHourly) + 1) * 0.125f + 0.75f); - for (var i = 0; i < Segments.Count; i++) + using (Main.spriteBatch.Scope()) { - if (i == 0) + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive,SamplerState.PointClamp,DepthStencilState.None,Main.Rasterizer,null,Main.Transform); + var tex = TextureAssets.Projectile[Type].Value; + var connectioncolor = Color.SkyBlue * ((MathF.Sin(Main.GlobalTimeWrappedHourly) + 1) * 0.125f + 0.75f); + for (var i = 0; i < Segments.Count; i++) { - CalamityUtils.DrawLineBetter(Main.spriteBatch, Projectile.Center, Segments[i].Center, connectioncolor, 2 * Projectile.scale); + if (i == 0) + { + CalamityUtils.DrawLineBetter(Main.spriteBatch, Projectile.Center, Segments[i].Center, connectioncolor, 2 * Projectile.scale); + } + if (Segments.IndexInRange(i + 1)) + { + var nextSegment = Segments[i + 1]; + CalamityUtils.DrawLineBetter(Main.spriteBatch, Segments[i].Center, nextSegment.Center, connectioncolor, 2 * Projectile.scale); + } + Main.spriteBatch.Draw(GetGlowTex(), Segments[i].Center - Main.screenPosition, null, Color.SkyBlue, 0, GetGlowTex().Size() * 0.5f, 0.2f * Projectile.scale, SpriteEffects.None, 0); + + Main.spriteBatch.Draw(tex, Segments[i].Center - Main.screenPosition, null, Color.White, 0 * Segments[i].followDistance * 5f * Main.GlobalTimeWrappedHourly, tex.Size() * 0.5f, 0.75f * Projectile.scale, SpriteEffects.None, 0); } - if (Segments.IndexInRange(i + 1)) + void DrawHeadStar(Vector2 offsetPercentage) { - var nextSegment = Segments[i + 1]; - CalamityUtils.DrawLineBetter(Main.spriteBatch, Segments[i].Center, nextSegment.Center, connectioncolor, 2 * Projectile.scale); + Main.spriteBatch.Draw(GetGlowTex(), Projectile.Center + offsetPercentage.RotatedBy(Projectile.rotation - MathHelper.PiOver2) * TailLength - Main.screenPosition, null, Color.SkyBlue, 0, GetGlowTex().Size() * 0.5f, 0.2f * Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(tex, Projectile.Center + offsetPercentage.RotatedBy(Projectile.rotation - MathHelper.PiOver2) * TailLength - Main.screenPosition, null, Color.White, 0 * Math.Abs(offsetPercentage.X) * 5f * Main.GlobalTimeWrappedHourly, tex.Size() * 0.5f, 0.75f * Projectile.scale, SpriteEffects.None, 0); } - Main.spriteBatch.Draw(GetGlowTex(), Segments[i].Center - Main.screenPosition, null, Color.SkyBlue, 0, GetGlowTex().Size() * 0.5f, 0.2f * Projectile.scale, SpriteEffects.None, 0); + void connectOffsets(Vector2 offset1, Vector2 offset2) + { + CalamityUtils.DrawLineBetter(Main.spriteBatch, Projectile.Center + offset1.RotatedBy(Projectile.rotation - MathHelper.PiOver2) * TailLength, Projectile.Center + offset2.RotatedBy(Projectile.rotation - MathHelper.PiOver2) * TailLength, connectioncolor, 2 * Projectile.scale); - Main.spriteBatch.Draw(tex, Segments[i].Center - Main.screenPosition, null, Color.White, 0 * Segments[i].followDistance * 5f * Main.GlobalTimeWrappedHourly, tex.Size() * 0.5f, 0.75f * Projectile.scale, SpriteEffects.None, 0); + } + connectOffsets(new(), new(-0.0425f, 0.0637f)); + connectOffsets(new(), new(0.0307f, 0.0418f)); + connectOffsets(new(-0.0425f, 0.0637f), new(0.0168f, 0.0791f)); + connectOffsets(new(0.0307f, 0.0418f), new(0.0168f, 0.0791f)); + DrawHeadStar(new()); + DrawHeadStar(new(-0.0425f, 0.0637f)); + DrawHeadStar(new(0.0307f, 0.0418f)); + DrawHeadStar(new(0.0168f, 0.0791f)); + Main.spriteBatch.End(); } - void DrawHeadStar(Vector2 offsetPercentage) - { - Main.spriteBatch.Draw(GetGlowTex(), Projectile.Center + offsetPercentage.RotatedBy(Projectile.rotation - MathHelper.PiOver2) * TailLength - Main.screenPosition, null, Color.SkyBlue, 0, GetGlowTex().Size() * 0.5f, 0.2f * Projectile.scale, SpriteEffects.None, 0); - Main.spriteBatch.Draw(tex, Projectile.Center + offsetPercentage.RotatedBy(Projectile.rotation - MathHelper.PiOver2) * TailLength - Main.screenPosition, null, Color.White, 0 * Math.Abs(offsetPercentage.X) * 5f * Main.GlobalTimeWrappedHourly, tex.Size() * 0.5f, 0.75f * Projectile.scale, SpriteEffects.None, 0); - } - void connectOffsets(Vector2 offset1, Vector2 offset2) - { - CalamityUtils.DrawLineBetter(Main.spriteBatch, Projectile.Center + offset1.RotatedBy(Projectile.rotation - MathHelper.PiOver2) * TailLength, Projectile.Center + offset2.RotatedBy(Projectile.rotation - MathHelper.PiOver2) * TailLength, connectioncolor, 2 * Projectile.scale); - - } - connectOffsets(new(), new(-0.0425f, 0.0637f)); - connectOffsets(new(), new(0.0307f, 0.0418f)); - connectOffsets(new(-0.0425f, 0.0637f), new(0.0168f, 0.0791f)); - connectOffsets(new(0.0307f, 0.0418f), new(0.0168f, 0.0791f)); - DrawHeadStar(new()); - DrawHeadStar(new(-0.0425f, 0.0637f)); - DrawHeadStar(new(0.0307f, 0.0418f)); - DrawHeadStar(new(0.0168f, 0.0791f)); return false; } diff --git a/Projectiles/Magic/IgnisSigilEmbers.cs b/Projectiles/Magic/IgnisSigilEmbers.cs index 254701113f..48bc309196 100644 --- a/Projectiles/Magic/IgnisSigilEmbers.cs +++ b/Projectiles/Magic/IgnisSigilEmbers.cs @@ -1,17 +1,18 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Enums; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Particles; -using CalamityMod.Graphics.Primitives; -using System; using Terraria.GameContent; using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class IgnisSigilEmbers : ModProjectile, ILocalizedModType + public class IgnisSigilEmbers : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer { public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; @@ -49,12 +50,21 @@ namespace CalamityMod.Projectiles.Magic return; } - GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, Projectile.velocity, false, 2, Projectile.scale * 1.45f, Color.Salmon)); - // Gravity! Projectile.velocity.Y = Projectile.velocity.Y + 0.35f; } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + int frameHeight = texture.Height / Main.projFrames[Type]; + Rectangle sourceRect = new Rectangle(0, frameHeight * Projectile.frame, texture.Width, frameHeight); + + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, sourceRect, Color.White, Projectile.rotation, sourceRect.Size() * 0.5f, 1f, 0); + return false; + } + + // Handle the projectile's trail from here private float WidthFunction(float completionRatio, Vector2 vertexPos) => MathHelper.Lerp(0f, MathHelper.Lerp(Projectile.scale * 48f, 0f, completionRatio), MathF.Pow(completionRatio, 1f / 2.5f)); private Color ColorFunction(float completionRatio, Vector2 vertexPos) { @@ -63,19 +73,11 @@ namespace CalamityMod.Projectiles.Magic Color endColor = Color.DarkOrange; return Color.Lerp(endColor, Color.DarkSalmon, completionRatio) * fadeOpacity; } - public override bool PreDraw(ref Color lightColor) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer) { GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); - PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, (_, _) => Projectile.Size * 0.5f, pixelate: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 32); - - - Texture2D texture = TextureAssets.Projectile[Type].Value; - int frameHeight = texture.Height / Main.projFrames[Type]; - Rectangle sourceRect = new Rectangle(0, frameHeight * Projectile.frame, texture.Width, frameHeight); - - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, sourceRect, Color.White, Projectile.rotation, sourceRect.Size() * 0.5f, 1f, 0); - - return false; + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, (_, _) => Projectile.Size * 0.5f, pixelate: true, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 32); + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, Projectile.velocity, false, 2, Projectile.scale * 1.45f, Color.Salmon), pixelate: true); } } } 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/Magic/VehemenceBolt.cs b/Projectiles/Magic/VehemenceBolt.cs index 1d247c1c38..88c5d24e18 100644 --- a/Projectiles/Magic/VehemenceBolt.cs +++ b/Projectiles/Magic/VehemenceBolt.cs @@ -3,6 +3,7 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -30,9 +31,12 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; } - public override void AI() + public override void OnSpawn(IEntitySource source) { Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + public override void AI() + { Lighting.AddLight(Projectile.Center, Color.DarkRed.ToVector3()); if (Time == 0f) diff --git a/Projectiles/Magic/VehemenceHoldout.cs b/Projectiles/Magic/VehemenceHoldout.cs index 66c6aca0ca..d37556252e 100644 --- a/Projectiles/Magic/VehemenceHoldout.cs +++ b/Projectiles/Magic/VehemenceHoldout.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.friendly = false; Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.timeLeft = 91; + Projectile.timeLeft = 300; } public override void AI() diff --git a/Projectiles/Magic/VisNeedle.cs b/Projectiles/Magic/VisNeedle.cs index 2421a6c5a9..452592e9f1 100644 --- a/Projectiles/Magic/VisNeedle.cs +++ b/Projectiles/Magic/VisNeedle.cs @@ -1,17 +1,18 @@ using System; +using CalamityMod.Enums; using CalamityMod.Graphics.Primitives; -using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; using Terraria.GameContent; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria; -using CalamityMod.Particles; namespace CalamityMod.Projectiles.Magic { - public class VisNeedle : ModProjectile, ILocalizedModType + public class VisNeedle : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer { public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() @@ -47,6 +48,16 @@ namespace CalamityMod.Projectiles.Magic } } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + int frameHeight = texture.Height / Main.projFrames[Type]; + Rectangle sourceRect = new Rectangle(0, frameHeight * Projectile.frame, texture.Width, frameHeight); + + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, sourceRect, Color.White, Projectile.rotation, sourceRect.Size() * 0.5f, 1f, 0); + + return false; + } // Handle the projectile's trail from here private float WidthFunction(float completionRatio, Vector2 vertexPos) => MathHelper.Lerp(0f, MathHelper.Lerp(10f, 0f, completionRatio), MathF.Pow(completionRatio, 1f / 2.5f)); @@ -57,19 +68,10 @@ namespace CalamityMod.Projectiles.Magic Color endColor = Color.Lerp(Color.Magenta, Color.Violet, (float)Math.Sin(completionRatio * MathHelper.Pi * 2f - offsetTime * 4f) * 0.5f + 0.5f); return Color.Lerp(endColor, Color.White, completionRatio) * fadeOpacity; } - public override bool PreDraw(ref Color lightColor) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer) { GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); - PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, (_,_) => Projectile.Size * 0.5f, pixelate: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); - - - Texture2D texture = TextureAssets.Projectile[Type].Value; - int frameHeight = texture.Height / Main.projFrames[Type]; - Rectangle sourceRect = new Rectangle(0, frameHeight * Projectile.frame, texture.Width, frameHeight); - - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, sourceRect, Color.White, Projectile.rotation, sourceRect.Size() * 0.5f, 1f, 0); - - return false; + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, (_, _) => Projectile.Size* 0.5f, pixelate: true, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); } } } diff --git a/Projectiles/Magic/WarpSigilShot.cs b/Projectiles/Magic/WarpSigilShot.cs index 0c05f2f82c..88b1a56aac 100644 --- a/Projectiles/Magic/WarpSigilShot.cs +++ b/Projectiles/Magic/WarpSigilShot.cs @@ -1,19 +1,20 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Dusts; +using CalamityMod.Enums; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; -using CalamityMod.Graphics.Primitives; using Terraria.GameContent; using Terraria.Graphics.Shaders; -using CalamityMod.Particles; -using System; -using CalamityMod.Dusts; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class WarpSigilShot : ModProjectile, ILocalizedModType + public class WarpSigilShot : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer { public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; @@ -79,9 +80,6 @@ namespace CalamityMod.Projectiles.Magic } Projectile.friendly = DamageStatus == 1 ? true : false; - // Main orb/center of the projectile - GeneralParticleHandler.SpawnParticle(new SquishyLightParticle(Projectile.Center, Projectile.velocity, Projectile.scale * 0.425f, Color.Magenta, 2, 1f, 0f, 1f)); - float sine = (float)Math.Sin(Projectile.timeLeft * 0.575f / MathHelper.Pi); Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 16f; if (Main.rand.NextBool(5)) @@ -93,32 +91,6 @@ namespace CalamityMod.Projectiles.Magic } } - - // Standard trail drawing logic - private float WidthFunction(float completionRatio, Vector2 vertexPos) => MathHelper.Lerp(0f, MathHelper.Lerp(32f, 0f, completionRatio), MathF.Pow(completionRatio, 1f / 2.5f)); - - private Color ColorFunction(float completionRatio, Vector2 vertexPos) - { - float offsetTime = Main.GlobalTimeWrappedHourly; - float fadeOpacity = Utils.GetLerpValue(0.5f, 0f, completionRatio, true) * Projectile.Opacity; - Color endColor = Color.Lerp(Color.Magenta, Color.DarkMagenta, (float)Math.Sin(completionRatio * MathHelper.Pi * 1.6f - offsetTime * 4f) * 0.5f + 0.5f); - return Color.Lerp(endColor, Color.White, completionRatio) * fadeOpacity; - } - - public override bool PreDraw(ref Color lightColor) - { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); - PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, (_,_) => Projectile.Size * 0.5f, pixelate: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 32); - - Texture2D texture = TextureAssets.Projectile[Type].Value; - int frameHeight = texture.Height / Main.projFrames[Type]; - Rectangle sourceRect = new Rectangle(0, frameHeight * Projectile.frame, texture.Width, frameHeight); - - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, sourceRect, Color.White, Projectile.rotation, sourceRect.Size() * 0.5f, 1f, SpriteEffects.None, 0); - - return false; - } - public override void OnKill(int timeLeft) { SoundStyle w = new("CalamityMod/Sounds/Custom/PlagueSounds/PlagueBoom4"); @@ -134,5 +106,32 @@ namespace CalamityMod.Projectiles.Magic dust.scale = 0.5f; } } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + int frameHeight = texture.Height / Main.projFrames[Type]; + Rectangle sourceRect = new Rectangle(0, frameHeight * Projectile.frame, texture.Width, frameHeight); + + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, sourceRect, Color.White, Projectile.rotation, sourceRect.Size() * 0.5f, 1f, SpriteEffects.None, 0); + return false; + } + + // Handle the projectile's trail from here + private float WidthFunction(float completionRatio, Vector2 vertexPos) => MathHelper.Lerp(0f, MathHelper.Lerp(32f, 0f, completionRatio), MathF.Pow(completionRatio, 1f / 2.5f)); + private Color ColorFunction(float completionRatio, Vector2 vertexPos) + { + float offsetTime = Main.GlobalTimeWrappedHourly; + float fadeOpacity = Utils.GetLerpValue(0.5f, 0f, completionRatio, true) * Projectile.Opacity; + Color endColor = Color.Lerp(Color.Magenta, Color.DarkMagenta, (float)Math.Sin(completionRatio * MathHelper.Pi * 1.6f - offsetTime * 4f) * 0.5f + 0.5f); + return Color.Lerp(endColor, Color.White, completionRatio) * fadeOpacity; + } + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer) + { + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, (_,_) => Projectile.Size * 0.5f, pixelate: true, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 32); + + GeneralParticleHandler.SpawnParticle(new SquishyLightParticle(Projectile.Center, Projectile.velocity, Projectile.scale * 0.4f, Color.Magenta, 2, 1f, 0.5f, 1f), pixelate: 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/LightspeedHoldout.cs b/Projectiles/Melee/LightspeedHoldout.cs index b8e972feb2..e517fe64b4 100644 --- a/Projectiles/Melee/LightspeedHoldout.cs +++ b/Projectiles/Melee/LightspeedHoldout.cs @@ -178,7 +178,7 @@ namespace CalamityMod.Projectiles.Melee return; } - Vector2 toMouse = Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld()); + Vector2 toMouse = Utils.DirectionTo(Owner.MountedCenter, Owner.ClampedMouseWorld()); Positioning(toMouse); if (DashState == 0) @@ -201,7 +201,7 @@ namespace CalamityMod.Projectiles.Melee if (Owner.altFunctionUse == 0 && DashState == 0) { - Projectile.Center += (Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld()) * Main.rand.NextFloat(-5f, 8f)); + Projectile.Center += (Utils.DirectionTo(Owner.MountedCenter, Owner.ClampedMouseWorld()) * Main.rand.NextFloat(-5f, 8f)); UsePrimary(toMouse); } @@ -256,7 +256,7 @@ namespace CalamityMod.Projectiles.Melee } // Spawn the hitbox - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center + toMouse * 20 * (float)Math.Pow(Projectile.scale, 4), toMouse * 25, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.MountedCenter + toMouse * 20 * (float)Math.Pow(Projectile.scale, 4), toMouse * 25, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); } private void UseSecondary() @@ -294,12 +294,12 @@ namespace CalamityMod.Projectiles.Melee float orbitalAngle = AltSpinRotation * initialDirectionForThisAnim + (initialDirectionForThisAnim == -1 ? MathHelper.Pi : 0); float orbitRadius = 40f; - Projectile.Center = Owner.Center + orbitalAngle.ToRotationVector2() * orbitRadius; + Projectile.Center = Owner.MountedCenter + orbitalAngle.ToRotationVector2() * orbitRadius; float tangentAngle = orbitalAngle + (initialDirectionForThisAnim == 1 ? MathHelper.PiOver4 : -MathHelper.PiOver4 + MathHelper.Pi); Projectile.rotation = tangentAngle; // Proper arm positioning - Vector2 armDirection = Projectile.Center - Owner.Center; + Vector2 armDirection = Projectile.Center - Owner.MountedCenter; float baseArmRotation = armDirection.ToRotation(); float compositeArmRotation = baseArmRotation + (initialDirectionForThisAnim == 1 ? MathHelper.TwoPi * 0.75f : -MathHelper.PiOver2); @@ -318,7 +318,7 @@ namespace CalamityMod.Projectiles.Melee { if (DashTimer % 4 == 0) { - Vector2 pos = Owner.Center + Projectile.rotation.ToRotationVector2() * 60f; + Vector2 pos = Owner.MountedCenter + Projectile.rotation.ToRotationVector2() * 60f; Particle sparkle = new CritSpark(pos, new Vector2(7f, 0).RotatedBy(Projectile.rotation), Color.Lerp(Color.Aqua, Color.MediumPurple, Main.rand.NextFloat(1f)), Color.White * 0.33f, 1.2f, 12, 0.3f, 1.2f, hueShift: 0.06f); GeneralParticleHandler.SpawnParticle(sparkle); } @@ -333,13 +333,13 @@ namespace CalamityMod.Projectiles.Melee DashState = 2; DashTimer = DashDuration; - Vector2 toMouse = Owner.Center.DirectionTo(Owner.ClampedMouseWorld()); + Vector2 toMouse = Owner.MountedCenter.DirectionTo(Owner.ClampedMouseWorld()); Projectile.velocity = toMouse * DashSpeed; Owner.mount?.Dismount(Owner); Owner.RemoveAllGrapplingHooks(); - SoundEngine.PlaySound(Exoblade.DashSound, Owner.Center); + SoundEngine.PlaySound(Exoblade.DashSound, Owner.MountedCenter); SoundStyle otherSound = new("CalamityMod/Sounds/Item/OmicronBeam"); SoundEngine.PlaySound(otherSound with { Volume = 0.6f, Pitch = Main.rand.NextFloat(0.2f, 0.25f) }, Projectile.Center); @@ -350,7 +350,7 @@ namespace CalamityMod.Projectiles.Melee for (int k = 0; k < Owner.hurtCooldowns.Length; k++) Owner.hurtCooldowns[k] = Owner.immuneTime; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage * 24, Projectile.knockBack * 4, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.MountedCenter, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage * 24, Projectile.knockBack * 4, Projectile.owner); } } diff --git a/Projectiles/Melee/LucreciaHoldout.cs b/Projectiles/Melee/LucreciaHoldout.cs index 563156fa77..f46365a661 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(); @@ -127,11 +127,11 @@ namespace CalamityMod.Projectiles.Melee { if (timer % 8 == 0) { - Vector2 pos = player.Center + Projectile.rotation.ToRotationVector2() * 60f; + Vector2 pos = player.MountedCenter + Projectile.rotation.ToRotationVector2() * 60f; Particle sparkle = new CritSpark(pos, new Vector2(7f, 0).RotatedBy(Projectile.rotation), Color.Lerp(Color.CornflowerBlue, Color.MediumPurple, Main.rand.NextFloat(1f)), Color.White * 0.33f, 1.2f, 12, 0.3f, 1.2f); GeneralParticleHandler.SpawnParticle(sparkle); } - Particle smear = new CircularSmearVFX(player.Center, Color.CornflowerBlue * 0.35f, Projectile.rotation, Projectile.scale * 1.25f); + Particle smear = new CircularSmearVFX(player.MountedCenter, Color.CornflowerBlue * 0.35f, Projectile.rotation, Projectile.scale * 1.25f); GeneralParticleHandler.SpawnParticle(smear); } @@ -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); @@ -236,15 +237,15 @@ namespace CalamityMod.Projectiles.Melee var mousePosition = Main.MouseWorld; // Smear fx on swing - Vector2 shootDir = player.Center.DirectionTo(mousePosition) * 10f; + Vector2 shootDir = player.MountedCenter.DirectionTo(mousePosition) * 10f; int dir = -Math.Sign(mousePosition.X); - Particle swipe = new CustomSpark(player.Center - shootDir * 4, shootDir.RotatedBy(0.075f * (dir * (modplayer.swingNum % 2 == 0 ? 1 : -1))) * 1.22f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), 0.3f, modplayer.swingNum % 2 == 0 ? Color.CornflowerBlue * 0.85f : Color.MediumPurple * 0.8f, new Vector2(1.1f, 1.3f), true, false, 0, false, false); + Particle swipe = new CustomSpark(player.MountedCenter - shootDir * 4, shootDir.RotatedBy(0.075f * (dir * (modplayer.swingNum % 2 == 0 ? 1 : -1))) * 1.22f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), 0.3f, modplayer.swingNum % 2 == 0 ? Color.CornflowerBlue * 0.85f : Color.MediumPurple * 0.8f, new Vector2(1.1f, 1.3f), true, false, 0, false, false); GeneralParticleHandler.SpawnParticle(swipe); - var fireDirection = Vector2.Normalize(mousePosition - player.Center); + var fireDirection = Vector2.Normalize(mousePosition - player.MountedCenter); var helixSpeed = 12f; var helixVelocity = fireDirection * helixSpeed; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), player.Center + fireDirection * 3, helixVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), player.MountedCenter + fireDirection * 3, helixVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); SoundStyle projectile = new("CalamityMod/Sounds/Item/LucreciaBoltFire"); SoundEngine.PlaySound(projectile with { Volume = 0.8f, Pitch = Main.rand.NextFloat(-0.06f, 0.1f) }, Projectile.Center); 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/Melee/Yoyos/LaceratorYoyo.cs b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs index 8e5be19829..fb0fb6b52a 100644 --- a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs @@ -11,6 +11,7 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using CalamityMod.Particles; +using System.IO; namespace CalamityMod.Projectiles.Melee.Yoyos { @@ -50,6 +51,15 @@ namespace CalamityMod.Projectiles.Melee.Yoyos } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(chargeProgress); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + chargeProgress = reader.ReadInt32(); + } public override void AI() { if (sawDir == 0) @@ -114,6 +124,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos } var baseYoyo = Main.projectile.First(x => x.active && x.type == ModContent.ProjectileType() && x.owner == Projectile.owner); baseYoyo.ModProjectile().chargeProgress += (Main.player[Projectile.owner].yoyoGlove ? 0.05f : 0.1f); + Projectile.netUpdate = true; target.AddBuff(ModContent.BuffType(), 180); } diff --git a/Projectiles/Pets/BabyGhostBell.cs b/Projectiles/Pets/BabyGhostBell.cs index 00ba8afe34..1b3c1ec0fc 100644 --- a/Projectiles/Pets/BabyGhostBell.cs +++ b/Projectiles/Pets/BabyGhostBell.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Pets if (underwater) { if (Main.LocalPlayer.Calamity().ZoneAbyss) - EnhancedDarknessSystem.lights.Add(new() { center = Projectile.Center, rotation = 0, scale = 3, texture = ModContent.Request("CalamityMod/Particles/BloomCircle") }); + EnhancedDarknessSystem.lights.Add(new() { center = Projectile.Center, rotation = 0, scale = 3, texture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value }); Lighting.AddLight(Projectile.Center, 0.3f, 0.9f, 1.5f); } else diff --git a/Projectiles/Pets/OceanSpirit.cs b/Projectiles/Pets/OceanSpirit.cs index e67d58d68d..393b00f5ce 100644 --- a/Projectiles/Pets/OceanSpirit.cs +++ b/Projectiles/Pets/OceanSpirit.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Pets if (underwater) { if (Main.LocalPlayer.Calamity().ZoneAbyss) - EnhancedDarknessSystem.lights.Add(new() { center = Projectile.Center, rotation = 0, scale = 6, texture = ModContent.Request("CalamityMod/Particles/BloomCircle") }); + EnhancedDarknessSystem.lights.Add(new() { center = Projectile.Center, rotation = 0, scale = 6, texture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value }); if (Projectile.frame == 16) Projectile.frame = 0; if (sleepyTimer > 0) 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 8789dca7e2..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 @@ -74,7 +74,30 @@ namespace CalamityMod.Projectiles.Ranged ShotTimer = 4; var spawnpos = Projectile.Center; var dir = spawnpos.DirectionTo(Main.MouseWorld); - 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); + var color = Main.rand.Next(1, 7); + Color drawColor = Color.White; + switch (color) + { + case 1: + drawColor = Color.HotPink; + break; + case 2: + drawColor = Color.Yellow; + break; + case 3: + drawColor = Color.LimeGreen; + break; + case 4: + drawColor = Color.SkyBlue; + break; + case 5: + drawColor = Color.Lavender; + break; + } + 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))); + 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 d86551b2e9..41e48151e3 100644 --- a/Projectiles/Ranged/HalleysStarburst.cs +++ b/Projectiles/Ranged/HalleysStarburst.cs @@ -1,11 +1,16 @@ using System; using System.Linq; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; +using CalamityMod.Utilities.Daybreak; +using CalamityMod.Utilities.Daybreak.Buffers; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -19,6 +24,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { Main.projFrames[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 20; } public override void SetDefaults() @@ -29,42 +36,18 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.MaxUpdates = 4; + Projectile.MaxUpdates = 6; Projectile.timeLeft = 60 * Projectile.MaxUpdates; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; Projectile.frame = Main.rand.Next(0, 6); Projectile.scale = 0.75f; Projectile.rotation += Main.rand.NextFloat(0, 3); + Projectile.stopsDealingDamageAfterPenetrateHits = true; } public override void AI() { - if (drawColor == Color.Black) - { - switch (Main.rand.Next(1, 7)) - { - case 1: - drawColor = Color.HotPink; - break; - case 2: - drawColor = Color.Yellow; - break; - case 3: - drawColor = Color.LimeGreen; - break; - case 4: - drawColor = Color.SkyBlue; - break; - case 5: - drawColor = Color.Lavender; - break; - case 6: - - drawColor = Color.White; - break; - } - } Projectile.rotation += Projectile.direction * 0.05f; if (Projectile.FinalExtraUpdate()) { @@ -83,14 +66,18 @@ namespace CalamityMod.Projectiles.Ranged Projectile.frame = 0; if (Projectile.timeLeft == 1) { - Main.player[Projectile.owner].Calamity().HalleyAccuracyCounter -= HalleysInferno.LostAccuracyPerMiss; + + for (var i = 0; i < 5; i++) + GeneralParticleHandler.SpawnParticle(new GlowSparkParticle(Projectile.Center, Main.rand.NextVector2CircularEdge(10,10), false, 10, 0.02f, drawColor, new Vector2(0.5f, 1f))); + if (Projectile.damage != 0) + Main.player[Projectile.owner].Calamity().HalleyAccuracyCounter -= HalleysInferno.LostAccuracyPerMiss; } } public override bool PreDraw(ref Color lightColor) { if (drawColor == Color.Black) { - switch (Main.rand.Next(1, 7)) + switch (Projectile.ai[0]) { case 1: drawColor = Color.HotPink; @@ -112,13 +99,39 @@ namespace CalamityMod.Projectiles.Ranged break; } } + + Main.spriteBatch.End(out var ss); + + var device = Main.instance.GraphicsDevice; + using var lease = RenderTargetPool.Shared.Rent( + device, + Main.screenWidth / 2, + Main.screenHeight / 2, + RenderTargetDescriptor.Default + ); + + using (lease.Scope(clearColor: Color.Transparent)) + { + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(FireWidthFunction, FireColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), Projectile.oldPos.Length + 32); + + Vector2[] fireCoreLength = Projectile.oldPos.Take(8).ToArray(); + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); + PrimitiveRenderer.RenderTrail(fireCoreLength, new(FireCoreWidthFunction, FireCoreColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), fireCoreLength.Length + 24); + } + + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f); + Main.spriteBatch.End(); + + Main.spriteBatch.Begin(ss); lightColor = drawColor; return false; } 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 @@ -133,6 +146,8 @@ namespace CalamityMod.Projectiles.Ranged cplay.HalleyAccuracyCounter++; cplay.HalleyAccuracyCounter = MathF.Min(HalleysInferno.MaxAccuracy, cplay.HalleyAccuracyCounter); Main.player[Projectile.owner].Calamity().StarburstSpawnFrameCounter += cplay.HalleyAccuracyCounter / HalleysInferno.MaxAccuracy * HalleysInferno.MaxStarburstPerStar; + Projectile.velocity *= 0.25f; + Projectile.timeLeft = Projectile.MaxUpdates; } public override void OnHitPlayer(Player target, Player.HurtInfo info) @@ -149,5 +164,54 @@ namespace CalamityMod.Projectiles.Ranged dust.noGravity = true; } } + + public float FireWidthFunction(float completion, Vector2 pos) + { + float width; + float maxBodyWidth = 38f * Projectile.scale; + float curveRatio = 0.2f; + var positions = Projectile.oldPos.ToList(); + positions.RemoveAll(x => x == Vector2.Zero); + // Crop the tip of the trail into a conic shape. + if (completion < curveRatio) + width = MathF.Pow(completion / curveRatio, 0.5f) * maxBodyWidth; + else + width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f); + + // Pulse inwards and outwards over time. + float pulseInterpolant = MathF.Cos(MathHelper.Pi * completion - Main.GlobalTimeWrappedHourly * 20f) * 0.5f + 0.5f; + float additionalPulseWidth = MathHelper.Lerp(0f, 12f, pulseInterpolant); + return (width + additionalPulseWidth) * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type]; + } + + public Color FireColorFunction(float completion, Vector2 pos) + { + Color mainColor = drawColor * 1.3f; + Color endColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true)); + return Color.Lerp(mainColor, endColor, completion) * Projectile.Opacity; + } + + public float FireCoreWidthFunction(float completion, Vector2 pos) + { + float width; + float maxBodyWidth = Projectile.scale * 16; + float curveRatio = 0.25f; + var positions = Projectile.oldPos.ToList(); + positions.RemoveAll(x => x == Vector2.Zero); + + if (completion < curveRatio) + width = MathF.Sin(completion / curveRatio * MathHelper.PiOver2) * maxBodyWidth + curveRatio; + else + width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f); + return width * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type]; + } + + public Color FireCoreColorFunction(float completion, Vector2 pos) + { + Color mainColor = drawColor; + Color tipColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true)); + Color fullBodyColor = Color.Lerp(mainColor, tipColor, completion); + return Color.Lerp(fullBodyColor, Color.White, 0.175f) * Projectile.Opacity; + } } } 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/Slagfire.cs b/Projectiles/Ranged/Slagfire.cs new file mode 100644 index 0000000000..96af915003 --- /dev/null +++ b/Projectiles/Ranged/Slagfire.cs @@ -0,0 +1,157 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Packets; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class Slagfire : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override bool CanHitPlayer(Player target) => false; + public override void SetDefaults() + { + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.hostile = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.extraUpdates = 1; + Projectile.tileCollide = true; +            Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; + } + + public override void AI() + { + Projectile.localAI[1]++; + if (Projectile.localAI[1] >= 4f) + { + Projectile.tileCollide = true; + } + Projectile.scale -= 0.001f; + if (Projectile.scale <= 0f) + { + Projectile.Kill(); + } + if (Projectile.localAI[0] <= 3f) + { + Projectile.localAI[0] += 1f; + return; + } + + Color color = new(254, 63, 63); + + for (int i = 0; i < 3; i++) + { + Vector2 sparkPosition = Projectile.Center - (Projectile.velocity / 3f * i); + + Vector2 sparkVelocity = -Projectile.velocity * 0.01f * Main.rand.NextFloat(0.5f, 1.5f); + + Particle spark = new CustomSpark(sparkPosition, sparkVelocity, "CalamityMod/Particles/BloomLineFade", false, 6, 0.04f, color * 0.85f, new Vector2(0.45f, 0.9f), shrinkSpeed: 0.4f); + GeneralParticleHandler.SpawnParticle(spark); + } + + if (Main.rand.NextBool(8)) + { + Vector2 sparkPosition = Projectile.Center + Main.rand.NextVector2Circular(15, 15); + Vector2 sparkVelocity = -Projectile.velocity * Main.rand.NextFloat(0.01f, 0.045f); // Backward velocity + +                Particle subtleSpark = new CustomSpark(sparkPosition, sparkVelocity, "CalamityMod/Particles/BloomLineFade", false, 8, 0.02f, color * 0.5f, new Vector2(0.5f, 0.8f), shrinkSpeed: 0.3f); + GeneralParticleHandler.SpawnParticle(subtleSpark); + } + + // Falling particles to appear as lava droplets, similar to speed blaster's falling dust + if (Main.rand.NextBool(50)) + { + Vector2 spawnHere = Projectile.position; + spawnHere.Y = Projectile.Bottom.Y + 3f; // A little down + + Vector2 particleVelocity = new Vector2(Main.rand.Next(-1, 1), 3); + + GeneralParticleHandler.SpawnParticle(new WaterFlavoredParticle(spawnHere, particleVelocity, true, // Affected by gravity + Main.rand.Next(30, 50), Main.rand.NextFloat(0.4f, 0.65f), new(220, 138, 138))); + } + + if (Projectile.localAI[1] >= 10f) + Projectile.velocity.Y += 0.2f; + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (target.type == NPCID.Guide) + modifiers.FinalDamage *= 10f; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Color innerColor = new(230, 198, 198); + Color outterColor = new(248, 63, 63); + + Vector2 baseParticleDirection = new Vector2(Projectile.direction, 0).SafeNormalize(Vector2.UnitX * Projectile.direction); + + for (int i = 0; i < 4; i++) + { + // This rotation makes it look like it's bursting out from a set point + Vector2 particleVelocity = baseParticleDirection.RotatedByRandom(MathHelper.ToRadians(50f)) * Main.rand.NextFloat(10f, 13f); + + bool affectedByGravity = true; + int lifetime = Main.rand.Next(20, 45); + float scale = Main.rand.NextFloat(.3f, .7f); + + GeneralParticleHandler.SpawnParticle(new WaterFlavoredParticle(Projectile.Center, particleVelocity, affectedByGravity, lifetime, scale * 1.15f, outterColor)); + GeneralParticleHandler.SpawnParticle(new WaterFlavoredParticle(Projectile.Center, particleVelocity, affectedByGravity, lifetime, scale * 0.75f, innerColor)); + } + Projectile.Kill(); + return true; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damage) + { + Color innerColor = new(230, 198, 198); + Color outterColor = new(248, 63, 63); + + Vector2 baseParticleDirection = new Vector2(Projectile.direction, 0).SafeNormalize(Vector2.UnitX * Projectile.direction); + Vector2 initialSpawnPosition = target.Center + new Vector2(target.width / 2f * Projectile.direction + 4f * Projectile.direction, Main.rand.NextFloat(-target.height / 2f, target.height / 2f)); + + for (int i = 0; i < 4; i++) + { + Vector2 finalSpawnPosition = initialSpawnPosition + Main.rand.NextVector2Circular(1f, 1f); + + // This rotation makes it look like it's bursting out from a set point + Vector2 particleVelocity = baseParticleDirection.RotatedByRandom(MathHelper.ToRadians(50f)) * Main.rand.NextFloat(10f, 13f); + + bool affectedByGravity = true; + int lifetime = Main.rand.Next(20, 45); + float scale = Main.rand.NextFloat(.3f, .7f); + + GeneralParticleHandler.SpawnParticle(new WaterFlavoredParticle(finalSpawnPosition, particleVelocity, affectedByGravity, lifetime, scale * 1.15f, outterColor)); + GeneralParticleHandler.SpawnParticle(new WaterFlavoredParticle(finalSpawnPosition, particleVelocity, affectedByGravity, lifetime, scale * 0.75f, innerColor)); + } + + //WoF Spawning + if (target.type == NPCID.Guide) + { + if (target.life <= 0) + { + if (Projectile.owner == Main.myPlayer) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + SpawnBossOnPositionPacket.Send((int)Main.player[Projectile.owner].Center.X, (int)Main.player[Projectile.owner].Center.Y, NPCID.WallofFlesh, Main.player[Projectile.owner]); + + else + NPC.SpawnWOF(Main.player[Projectile.owner].Center); + } + } + } + } + } +} diff --git a/Projectiles/Ranged/SlagfireDouserHoldout.cs b/Projectiles/Ranged/SlagfireDouserHoldout.cs new file mode 100644 index 0000000000..267b3b2fdf --- /dev/null +++ b/Projectiles/Ranged/SlagfireDouserHoldout.cs @@ -0,0 +1,153 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Dusts.WaterSplash; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SlagfireDouserHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ItemType(); + + private static readonly Vector2 CustomHoldoutOffset = new Vector2(25f, -5f); + + public static Asset pistilTexture; + + public override string Texture => "CalamityMod/Projectiles/Ranged/SlagfireDouserHoldout"; + public static string TexturePathPistil => "CalamityMod/Projectiles/Ranged/SlagfireDouserPistil"; + private float pistilJigglePhysicsTimer = 0; + + // Positioning overrides + public override Vector2 GunTipPosition + { + get + { + Vector2 baseTip = base.GunTipPosition; + + baseTip.X += CustomHoldoutOffset.X * Owner.direction; + baseTip.Y += CustomHoldoutOffset.Y; + + baseTip -= Vector2.UnitX.RotatedBy(Projectile.rotation) * 24f * Owner.gravDir; + + return baseTip; + } + } + public override float MaxOffsetLengthFromArm => 12f; + public override float OffsetXUpwards => -25f; + public override float OffsetXDownwards => -25f; + public override float OffsetYUpwards => -24f; + public override float OffsetYDownwards => 24f; + public override float BaseOffsetY => -2f; + + public override float RecoilResolveSpeed => 0.12f; + private float frontArmRotation = 0.14f; + public ref float ShootingTimer => ref Projectile.ai[0]; + + private const int BurstProjectiles = 4; // 4 Slagfire shots per burst +        private const int DelayBetweenShotsInBurst = 4; + + public static Color EffectsColor { get; set; } = Color.MediumVioletRed * 1.3f; + public static Color StaticEffectsColor { get; set; } = Color.MediumVioletRed * 1.3f; + + public override void HoldoutAI() + { + if (!Owner.channel) + { + Projectile.Kill(); + return; + } + if (ShootingTimer % (HeldItem.useAnimation + BurstProjectiles * DelayBetweenShotsInBurst) == 0 && ShootingTimer > 0) + { + ShootingTimer = 0; + } + +            // Calc current shot index +            int currentShotInBurst = (int)((ShootingTimer % (HeldItem.useAnimation + BurstProjectiles * DelayBetweenShotsInBurst) - HeldItem.useAnimation) / DelayBetweenShotsInBurst); + + if (ShootingTimer >= HeldItem.useAnimation && currentShotInBurst >= 0 && currentShotInBurst < BurstProjectiles) + { + if ((ShootingTimer - HeldItem.useAnimation) % DelayBetweenShotsInBurst == 0) + { + Shoot(HeldItem); + } + } + + ShootingTimer++; // Once per tick + + pistilJigglePhysicsTimer = MathHelper.Clamp(pistilJigglePhysicsTimer - 0.04f, 0, 1); + + // Set front arm to be angled slightly up toward the trigger + ExtraFrontArmRotation = frontArmRotation; + } + + public void Shoot(Item item) + { + // Create random spread + Vector2 projectileDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); +            Vector2 finalProjectileVelocity = projectileDirection.RotatedByRandom(MathHelper.ToRadians(11f)) * item.shootSpeed; + +            // Spawn the main projectile +            Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, finalProjectileVelocity, ModContent.ProjectileType(), Owner.GetWeaponDamage(item), Owner.GetWeaponKnockback(item, item.knockBack), Projectile.owner); + +            if (Main.dedServ) + return; + + SoundEngine.PlaySound(SoundID.Item61 with { Volume = 0.9f, Pitch = 0.125f }, Projectile.Center); + +            // Translates arm back and upward to simulate recoil +            OffsetLengthFromArm -= 1f; + + pistilJigglePhysicsTimer += 1; + + + int dustAmount = Main.rand.Next(3, 6); + for (int i = 0; i < dustAmount; i++) + { + Dust shootDust = Dust.NewDustPerfect( + GunTipPosition, + ModContent.DustType(), + projectileDirection.RotatedByRandom(MathHelper.PiOver4 * 1.2f) * Main.rand.NextFloat(2.5f, 9f), + newColor: Color.Red); + shootDust.noGravity = false; + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + pistilTexture ??= Request(TexturePathPistil); + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + + float pistilPow = MathF.Pow(pistilJigglePhysicsTimer, 2); + Vector2 pistilJiggleScale = new Vector2(1 - 0.25f * pistilPow, 1 + 0.5f * pistilPow); + + drawPosition.X += 25 * Owner.direction; + drawPosition.Y += -5f; + + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + float pistilJiggleRotOffset = (MathF.Sin(MathF.Pow(pistilJigglePhysicsTimer * 3.4f, 2)) * 0.2f + MathF.Sin(Main.LocalPlayer.miscCounter * MathHelper.Pi) * 0.1f) * Projectile.spriteDirection; + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + Main.EntitySpriteDraw(pistilTexture.Value, drawPosition, null, drawColor, drawRotation + pistilJiggleRotOffset, pistilTexture.Size() * 0.5f, Projectile.scale * Owner.gravDir * pistilJiggleScale, flipSprite); + + return false; + } + } +} diff --git a/Projectiles/Ranged/SlagfireDouserHoldout.png b/Projectiles/Ranged/SlagfireDouserHoldout.png new file mode 100644 index 0000000000..ebd8568100 Binary files /dev/null and b/Projectiles/Ranged/SlagfireDouserHoldout.png differ diff --git a/Projectiles/Ranged/SlagfireDouserPistil.png b/Projectiles/Ranged/SlagfireDouserPistil.png new file mode 100644 index 0000000000..b760f61be8 Binary files /dev/null and b/Projectiles/Ranged/SlagfireDouserPistil.png differ 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..c3b09dc367 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; @@ -128,7 +128,8 @@ namespace CalamityMod.Projectiles.Ranged { float slowdown = (float)Math.Pow(Utils.GetLerpValue(recoilTimerMax / 2, recoilTimerMax, Math.Max(shootingCooldown, starburstCooldown), true), 4); Vector2 movement = recoilDirection * (recoilIntensity) * slowdown; - if (Collision.SolidCollision(Owner.Center + movement, (int)(Owner.width * 1.1f), (int)(Owner.height * 1.1f)) || !Owner.Calamity().mouseRight) + bool enableRecoil = false; + if (!enableRecoil || Collision.SolidCollision(Owner.Center + movement, (int)(Owner.width * 1.1f), (int)(Owner.height * 1.1f)) || !Owner.Calamity().mouseRight) { recoilIntensity = 0; return; diff --git a/Projectiles/Ranged/StarmadaHoldout.cs b/Projectiles/Ranged/StarmadaHoldout.cs index 7383465a48..41fc43d182 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; @@ -171,7 +171,8 @@ namespace CalamityMod.Projectiles.Ranged { float slowdown = (float)Math.Pow(Utils.GetLerpValue(recoilTimerMax / 2, recoilTimerMax, Math.Max(shootingCooldown, starburstCooldown), true), 4); Vector2 movement = recoilDirection * (recoilIntensity) * slowdown; - if (Collision.SolidCollision(Owner.Center + movement, (int)(Owner.width * 1.1f), (int)(Owner.height * 1.1f)) || !Owner.Calamity().mouseRight) + bool enableRecoil = false; + if (!enableRecoil || Collision.SolidCollision(Owner.Center + movement, (int)(Owner.width * 1.1f), (int)(Owner.height * 1.1f)) || !Owner.Calamity().mouseRight) { recoilIntensity = 0; 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/Rogue/BlazingStarProj.cs b/Projectiles/Rogue/BlazingStarProj.cs index abee87ca43..b368b086b9 100644 --- a/Projectiles/Rogue/BlazingStarProj.cs +++ b/Projectiles/Rogue/BlazingStarProj.cs @@ -82,6 +82,7 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.ai[1] = index; Projectile.velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(Projectile.Center, Main.npc[index], Projectile.velocity.Length(), Projectile.MaxUpdates); + Projectile.netUpdate = true; } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Rogue/GlaiveProj.cs b/Projectiles/Rogue/GlaiveProj.cs index b571cc12c5..42fa4b2e2e 100644 --- a/Projectiles/Rogue/GlaiveProj.cs +++ b/Projectiles/Rogue/GlaiveProj.cs @@ -80,6 +80,7 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.ai[1] = index; Projectile.velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(Projectile.Center, Main.npc[index], Projectile.velocity.Length(), Projectile.MaxUpdates); + Projectile.netUpdate = true; } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) 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/Summon/SarosAura.cs b/Projectiles/Summon/SarosAura.cs index cfc37df369..fc6f87a998 100644 --- a/Projectiles/Summon/SarosAura.cs +++ b/Projectiles/Summon/SarosAura.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.Summon; +using System.IO; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Utilities.Daybreak; using Microsoft.Xna.Framework; @@ -62,6 +63,7 @@ namespace CalamityMod.Projectiles.Summon minionSlotsAvaliable--; MinionSlotsToAdd--; player.channel = false; + Projectile.netUpdate = true; } if (MinionSlotsToAdd > 0) { @@ -125,6 +127,15 @@ namespace CalamityMod.Projectiles.Summon } } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Projectile.minionSlots); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + Projectile.minionSlots = reader.ReadSingle(); + } NPC GetTargetInRange(float range) { var player = Main.player[Projectile.owner]; diff --git a/Projectiles/Summon/SiriusMinion.cs b/Projectiles/Summon/SiriusMinion.cs index 17621d6251..2a73ff0429 100644 --- a/Projectiles/Summon/SiriusMinion.cs +++ b/Projectiles/Summon/SiriusMinion.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.DataStructures; @@ -52,22 +53,35 @@ namespace CalamityMod.Projectiles.Summon Projectile.DamageType = DamageClass.Summon; } + public int MinionSlotsToAdd + { + get { return (int)Projectile.ai[1]; } + set { Projectile.ai[1] = value; } + } + public override void AI() { NPC target = Projectile.Center.MinionHoming(5000f, Owner); // Constantly tries to find a target. - if (Projectile.ai[1] > 0) { - float consumedSlots = 0; + #region Add Minion Slots + if (MinionSlotsToAdd > 0) + { + float minionSlotsAvaliable = Owner.maxMinions; foreach (var item in Main.ActiveProjectiles) { - if (item.type == Projectile.type && item.owner == Owner.whoAmI) - { - consumedSlots += item.minionSlots; - } + if (item.owner == Projectile.owner) + minionSlotsAvaliable -= item.minionSlots; } - if (Owner.maxMinions >= consumedSlots + 1) + while (minionSlotsAvaliable >= 1 && MinionSlotsToAdd > 0) + { + Projectile.minionSlots++; - Projectile.ai[1]--; + minionSlotsAvaliable--; + MinionSlotsToAdd--; + Projectile.netUpdate = true; + } + MinionSlotsToAdd = 0; } + #endregion CheckMinionExistince(); // Checks if the minion can still exist. SpawnEffect(); // Does a dust spawn effect. ShootTarget(target); // If there's a target, shoot at the target. @@ -118,6 +132,16 @@ namespace CalamityMod.Projectiles.Summon SpawnStar(10,new Vector2(-49f, 166f), 0.5f,60); // belly } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Projectile.minionSlots); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + Projectile.minionSlots = reader.ReadSingle(); + } + #region Methods public void CheckMinionExistince() diff --git a/Projectiles/Summon/SunSpiritMinion.cs b/Projectiles/Summon/SunSpiritMinion.cs index 39bec75e41..b00258f2c4 100644 --- a/Projectiles/Summon/SunSpiritMinion.cs +++ b/Projectiles/Summon/SunSpiritMinion.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.Summon; +using System.IO; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Utilities.Daybreak; using Microsoft.Xna.Framework; @@ -61,6 +62,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.minionSlots++; minionSlotsAvaliable--; MinionSlotsToAdd--; + Projectile.netUpdate = true; } MinionSlotsToAdd = 0; } @@ -112,6 +114,16 @@ namespace CalamityMod.Projectiles.Summon } } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Projectile.minionSlots); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + Projectile.minionSlots = reader.ReadSingle(); + } + public override bool? CanDamage() => false; public static Asset circle; diff --git a/Projectiles/Summon/VengefulSunSpiritMinion.cs b/Projectiles/Summon/VengefulSunSpiritMinion.cs index 18d01a2249..61676b14c0 100644 --- a/Projectiles/Summon/VengefulSunSpiritMinion.cs +++ b/Projectiles/Summon/VengefulSunSpiritMinion.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.Summon; +using System.IO; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Utilities.Daybreak; using Microsoft.Xna.Framework; @@ -61,6 +62,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.minionSlots++; minionSlotsAvaliable--; MinionSlotsToAdd--; + Projectile.netUpdate = true; } MinionSlotsToAdd = 0; } @@ -111,6 +113,15 @@ namespace CalamityMod.Projectiles.Summon Projectile.ai[1] += 60f / (0.75f + Projectile.minionSlots * 0.25f); } } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Projectile.minionSlots); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + Projectile.minionSlots = reader.ReadSingle(); + } public override bool? CanDamage() => false; 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/StratusBlackHole.cs b/Projectiles/Typeless/StratusBlackHole.cs index 7e35411ecb..faf207f8a7 100644 --- a/Projectiles/Typeless/StratusBlackHole.cs +++ b/Projectiles/Typeless/StratusBlackHole.cs @@ -1,10 +1,13 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Weapons.Typeless; using CalamityMod.Systems.Graphic.PixelationSystem; using CalamityMod.Systems.Mechanic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; using Terraria; +using Terraria.Audio; using Terraria.Graphics.Shaders; using Terraria.ModLoader; @@ -13,6 +16,9 @@ namespace CalamityMod.Projectiles.Typeless public class StratusBlackHole : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; + + public SlotId LoopSoundSlot = SlotId.Invalid; + public override void SetStaticDefaults() { Main.projFrames[Type] = 6; @@ -27,7 +33,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.usesLocalNPCImmunity = true; Projectile.DamageType = AverageDamageClass.Instance; Projectile.MaxUpdates = 1; - Projectile.timeLeft = 3600 * Projectile.MaxUpdates; + Projectile.timeLeft = CalamityUtils.MinutesToFrames(10) * Projectile.MaxUpdates; Projectile.localNPCHitCooldown = 30 * Projectile.MaxUpdates; Projectile.aiStyle = 0; Projectile.tileCollide = false; @@ -66,7 +72,26 @@ namespace CalamityMod.Projectiles.Typeless player.Calamity().StratusStarburstResetTimer = (int)MathHelper.Max(player.Calamity().StratusStarburstResetTimer, 180); } } + + if (!SoundEngine.TryGetActiveSound(LoopSoundSlot, out var sound)) + LoopSoundSlot = SoundEngine.PlaySound(StratusSphere.LoopSound with { Volume = 1f }, Projectile.Center); + else + sound.Position = Projectile.Center; // Keep the sound consistently on the projectile } + + + private void StopLoop() + { + if (SoundEngine.TryGetActiveSound(LoopSoundSlot, out var sound)) + sound.Stop(); + + LoopSoundSlot = SlotId.Invalid; + } + public override void OnKill(int timeLeft) + { + StopLoop(); + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { return targetHitbox.IntersectsConeFastInaccurate(Projectile.Center, 600, 0, MathHelper.TwoPi); @@ -158,7 +183,13 @@ namespace CalamityMod.Projectiles.Typeless #region Singularity var telegraphBase = ModContent.Request("CalamityMod/ExtraTextures/BasicCircle").Value; - Main.EntitySpriteDraw(telegraphBase, drawPosition, null, Color.DarkSlateBlue, 0, telegraphBase.Size() / 2f, 84f * mproj.Projectile.Opacity / telegraphBase.Width, 0, 0); + + Main.spriteBatch.EnterShaderRegion(matrix: matrix); + GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].UseOpacity(0.5f); + GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].UseSaturation(0.2f); + GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/VoidGashes"), 1); + GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].Apply(); + Main.EntitySpriteDraw(telegraphBase, drawPosition, null, Color.Lerp(Color.DarkSlateBlue, Color.SkyBlue, 0.75f), 0.5f, telegraphBase.Size() / 2f, 84f * mproj.Projectile.Opacity / telegraphBase.Width, 0, 0); Main.spriteBatch.EnterShaderRegion(matrix: matrix); GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].UseOpacity(0.5f); @@ -166,7 +197,7 @@ namespace CalamityMod.Projectiles.Typeless GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/VoidGashes"), 1); GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].Apply(); telegraphBase = ModContent.Request("CalamityMod/ExtraTextures/BasicCircle").Value; - Main.EntitySpriteDraw(telegraphBase, drawPosition, null, Color.Lerp(Color.DarkSlateBlue, Color.MediumPurple, 1f), 0, telegraphBase.Size() / 2f, 84f * mproj.Projectile.Opacity / telegraphBase.Width, 0, 0); + Main.EntitySpriteDraw(telegraphBase, drawPosition, null, Color.Lerp(Color.DarkSlateBlue, Color.SkyBlue, 1f), 0, telegraphBase.Size() / 2f, 84f * mproj.Projectile.Opacity / telegraphBase.Width, 0, 0); Main.spriteBatch.EnterShaderRegion(matrix: matrix); GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].UseOpacity(0.25f); GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].UseSaturation(0.1f); 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/WulfrumDiggingTurtleProjectile.cs b/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs index ac0f53a210..a4679e0163 100644 --- a/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs +++ b/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - Lighting.AddLight(Projectile.Center, Color.GreenYellow.ToVector3()); + Lighting.AddLight(Projectile.Center, Color.GreenYellow.ToVector3()*0.75f); //Idle chainsaw sounds if ((!SoundEngine.TryGetActiveSound(IdlingSoundSlot, out var idleSoundOut))) 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/Skies/DoGSky.cs b/Skies/DoGSky.cs index 34f3f33673..74600d010d 100644 --- a/Skies/DoGSky.cs +++ b/Skies/DoGSky.cs @@ -3,6 +3,7 @@ using CalamityMod.Effects; using CalamityMod.Graphics.Primitives; using CalamityMod.NPCs.DevourerofGods; using CalamityMod.Systems.Graphic; +using CalamityMod.Utilities.Daybreak; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -413,23 +414,30 @@ namespace CalamityMod.Skies private void DrawDistortionRift(SpriteBatch spriteBatch) { - // Impose the distortion rift contents onto the primitives via shader. - var metaballShader = CalamityShaders.MetaballEdgeShader; - Texture2D distortionRiftContents = DoGVisualsManager.DistortionRiftBackgroundContentsTarget.Target; - Texture2D distortionRift = DoGVisualsManager.DistortionRiftPrimitivesTarget.Target; + using (spriteBatch.Scope()) + { + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, null, CalamityShaders.MetaballEdgeShader.Value, Main.BackgroundViewMatrix.TransformationMatrix); + // Impose the distortion rift contents onto the primitives via shader. + var metaballShader = CalamityShaders.MetaballEdgeShader; + Texture2D distortionRiftContents = DoGVisualsManager.DistortionRiftBackgroundContentsTarget.Target; + Texture2D distortionRift = DoGVisualsManager.DistortionRiftPrimitivesTarget.Target; - Vector2 screenSize = new(Main.screenWidth, Main.screenHeight); + Vector2 screenSize = new(Main.graphics.graphicsDevice.Viewport.Width, Main.graphics.graphicsDevice.Viewport.Height); - metaballShader.Value.Parameters["layerSize"]?.SetValue(distortionRiftContents.Size()); - metaballShader.Value.Parameters["screenSize"]?.SetValue(screenSize); - metaballShader.Value.Parameters["layerOffset"]?.SetValue(Vector2.Zero); - metaballShader.Value.Parameters["edgeColor"]?.SetValue(Color.Lerp(Color.Lerp(DoGSkyColor, Color.White, 0.6f), Color.Black, 0.15f).ToVector4()); + metaballShader.Value.Parameters["layerSize"]?.SetValue(distortionRiftContents.Size()); + metaballShader.Value.Parameters["screenSize"]?.SetValue(screenSize); + metaballShader.Value.Parameters["layerOffset"]?.SetValue(Vector2.Zero); + metaballShader.Value.Parameters["singleFrameScreenOffset"]?.SetValue(Vector2.Zero); + metaballShader.Value.Parameters["edgeColor"]?.SetValue(Color.Lerp(Color.Lerp(DoGSkyColor, Color.White, 0.6f), Color.Black, 0.15f).ToVector4()); + metaballShader.Value.Parameters["layerColor"]?.SetValue(DoGSkyColor.ToVector4()); - Main.instance.GraphicsDevice.Textures[1] = distortionRiftContents; - Main.instance.GraphicsDevice.SamplerStates[1] = SamplerState.LinearWrap; + Main.instance.GraphicsDevice.Textures[1] = distortionRiftContents; + Main.instance.GraphicsDevice.SamplerStates[1] = SamplerState.LinearWrap; - metaballShader.Value.CurrentTechnique.Passes[0].Apply(); - spriteBatch.Draw(distortionRift, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White); + metaballShader.Value.CurrentTechnique.Passes[0].Apply(); + spriteBatch.Draw(distortionRift, new Rectangle(0, 0, (int)screenSize.X, (int)screenSize.Y), Color.White); + Main.spriteBatch.End(); + } } private void GetCorrectDoGColor() diff --git a/Sounds/Custom/DoGFireball.ogg b/Sounds/Custom/DoGFireball.ogg index 54b891b040..a52798a895 100644 Binary files a/Sounds/Custom/DoGFireball.ogg and b/Sounds/Custom/DoGFireball.ogg 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/Sounds/Item/StratusSphereCast.ogg b/Sounds/Item/StratusSphereCast.ogg new file mode 100644 index 0000000000..d517c18890 Binary files /dev/null and b/Sounds/Item/StratusSphereCast.ogg differ diff --git a/Sounds/Item/StratusSphereLoop.ogg b/Sounds/Item/StratusSphereLoop.ogg new file mode 100644 index 0000000000..6497b8ced8 Binary files /dev/null and b/Sounds/Item/StratusSphereLoop.ogg 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/CalamityNPCSets.cs b/Systems/Collections/CalamityNPCSets.cs index e16ef7e0aa..5a234bd2a8 100644 --- a/Systems/Collections/CalamityNPCSets.cs +++ b/Systems/Collections/CalamityNPCSets.cs @@ -195,7 +195,7 @@ namespace CalamityMod.Systems.Collections NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), 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/DifficultyModeSystem.cs b/Systems/Mechanic/DifficultyModeSystem.cs index 72ddc7fa36..db1c5345bd 100644 --- a/Systems/Mechanic/DifficultyModeSystem.cs +++ b/Systems/Mechanic/DifficultyModeSystem.cs @@ -35,15 +35,19 @@ namespace CalamityMod.Systems MostAlternateDifficulties = 1; //Initialize base mod difficulties Difficulties = new List() { ModContent.GetInstance(), - ModContent.GetInstance(), - ModContent.GetInstance(), ModContent.GetInstance(), - ModContent.GetInstance() }; + ModContent.GetInstance(),ModContent.GetInstance(), + ModContent.GetInstance(), ModContent.GetInstance(), + ModContent.GetInstance(), ModContent.GetInstance() }; journeyDifficultyUpdateMethod = typeof(CreativePowers.DifficultySliderPower).GetMethod("UpdateInfoFromSliderValueCache", BindingFlags.Instance | BindingFlags.NonPublic); CalculateDifficultyData(); } + public override void PostWorldLoad() + { + CalculateDifficultyData(); //Reload difficulties upon loading a world to adjust for FTW. + } public override void OnModUnload() { Difficulties = null; @@ -58,6 +62,16 @@ namespace CalamityMod.Systems { case GameModeID.Normal: { + if (Main.getGoodWorld) + { + // if death was activated, change it to revengence + if (GetCurrentDifficulty.CountAs()) + { + ModeIndicatorUI.SwitchToDifficulty(ModContent.GetInstance(), broadcast: true); + } + break; + } + // vanilla game mode in classic, but cal difficulty >= expert if (GetCurrentDifficulty.CountAs() || GetCurrentDifficulty.CountAs()) { @@ -67,6 +81,15 @@ namespace CalamityMod.Systems } case GameModeID.Expert: { + if (Main.getGoodWorld) + { + if (GetCurrentDifficulty.CountAs()) + { + ModeIndicatorUI.SwitchToDifficulty(ModContent.GetInstance(), broadcast: true); + } + break; + } + // if death was activated, change it to revengence if (GetCurrentDifficulty.CountAs()) { @@ -76,6 +99,14 @@ namespace CalamityMod.Systems } case GameModeID.Master: { + if (Main.getGoodWorld) + { + if (!GetCurrentDifficulty.CountAs() && CalamityWorld.revenge) + { + ModeIndicatorUI.SwitchToDifficulty(ModContent.GetInstance(), broadcast: true); + } + break; + } // if revengence and master both activated, change it to death if (!GetCurrentDifficulty.CountAs() && CalamityWorld.revenge) { @@ -143,6 +174,10 @@ namespace CalamityMod.Systems for (int i = 0; i < Difficulties.Count; i++) { + //Only add difficulties that are allowed in the current world type; + if ((Main.getGoodWorld && Difficulties[i].GetForTheWorthyDisplay == DifficultyMode.FTWDisplayMode.NotForTheWorthy) + || (!Main.getGoodWorld && Difficulties[i].GetForTheWorthyDisplay == DifficultyMode.FTWDisplayMode.OnlyForTheWorthy)) + continue; //if we are at a new tier, create a new list of difficulties at that tier. if (currentTier != Difficulties[i].DifficultyScale) { @@ -235,6 +270,12 @@ namespace CalamityMod.Systems public abstract class DifficultyMode : ModType { + public enum FTWDisplayMode + { + Always, + OnlyForTheWorthy, + NotForTheWorthy, + } protected sealed override void Register() { ModTypeLookup.Register(this); @@ -251,6 +292,11 @@ namespace CalamityMod.Systems public abstract Asset Texture { get; } protected Asset _textureDisabled; public abstract Asset TextureDisabled { get; } + + protected Asset _outlineTexture; + public abstract Asset OutlineTexture { get; } + public virtual FTWDisplayMode GetForTheWorthyDisplay { get; } = FTWDisplayMode.Always; + protected SoundStyle? _activationSound; public abstract SoundStyle ActivationSound { get; } public abstract int BackBoneGameModeID { get; } @@ -262,8 +308,8 @@ namespace CalamityMod.Systems public abstract LocalizedText ShortDescription { get; } public virtual LocalizedText ExpandedDescription => LocalizedText.Empty; - public abstract LocalizedText FTWName { get; } - public abstract Color FTWTextColor { get; } + public virtual LocalizedText FTWName { get; } = null; + public virtual Color? FTWTextColor { get; } = null; /// @@ -304,6 +350,8 @@ namespace CalamityMod.Systems public override Asset Texture => _texture ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Classic"); + public override Asset OutlineTexture => _outlineTexture ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Classic_Border"); + public override Asset TextureDisabled => _textureDisabled ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Classic_Off"); public override SoundStyle ActivationSound => _activationSound ??= SoundID.MenuTick with { Volume = 1f }; @@ -317,17 +365,14 @@ namespace CalamityMod.Systems public override Color ChatTextColor => Color.White; public override LocalizedText ShortDescription => GetText("UI.ClassicInfo"); - - public override LocalizedText FTWName => Language.GetText("UI.Expert"); - - public override Color FTWTextColor => new Color(255, 186, 117); // World display: Main.mcColor + public override FTWDisplayMode GetForTheWorthyDisplay => FTWDisplayMode.NotForTheWorthy; } public class ExpertDifficulty : DifficultyMode { public override bool Enabled { - get => Main.getGoodWorld ? Main.masterMode : Main.expertMode; + get => Main.expertMode; set { if (!Main.GameModeInfo.IsJourneyMode) @@ -342,32 +387,29 @@ namespace CalamityMod.Systems } public override Asset Texture => _texture ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Expert"); + public override Asset OutlineTexture => _outlineTexture ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Expert_Border"); public override Asset TextureDisabled => _textureDisabled ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Expert_Off"); public override SoundStyle ActivationSound => _activationSound ??= SoundID.ForceRoarPitched; - public override int BackBoneGameModeID => GameModeID.Expert; + public override int BackBoneGameModeID => Main.getGoodWorld ? GameModeID.Normal : GameModeID.Expert; public override float DifficultyScale => 0.1f; public override LocalizedText Name => Language.GetText("UI.Expert"); - public override Color ChatTextColor => new Color(255, 186, 117); // World display: Main.mcColor + public override Color ChatTextColor => Main.mcColor; public override LocalizedText ShortDescription => GetText("UI.ExpertShortInfo"); public override LocalizedText ExpandedDescription => GetText("UI.ExpertExpandedInfo"); - - public override LocalizedText FTWName => Language.GetText("UI.Master"); - - public override Color FTWTextColor => new Color(28, 255, 170); // World display: Main.hcColor } public class MasterDifficulty : DifficultyMode { public override bool Enabled { - get => Main.getGoodWorld ? CalamityWorld.LegendaryMode : Main.masterMode; + get => Main.masterMode; set { if (!Main.GameModeInfo.IsJourneyMode) @@ -382,26 +424,63 @@ namespace CalamityMod.Systems } public override Asset Texture => _texture ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Master"); + public override Asset OutlineTexture => _outlineTexture ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Master_Border"); public override Asset TextureDisabled => _textureDisabled ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Master_Off"); public override SoundStyle ActivationSound => _activationSound ??= SoundID.NPCDeath10; - public override int BackBoneGameModeID => GameModeID.Master; + public override int BackBoneGameModeID => Main.getGoodWorld ? GameModeID.Expert : GameModeID.Master; public override float DifficultyScale => 0.25f; public override LocalizedText Name => Language.GetText("UI.Master"); - public override Color ChatTextColor => new Color(28, 255, 170); // World display: Main.hcColor + public override Color ChatTextColor => Main.hcColor; public override LocalizedText ShortDescription => GetText("UI.MasterShortInfo"); public override LocalizedText ExpandedDescription => GetText("UI.MasterExpandedInfo"); - public override LocalizedText FTWName => Language.GetText("UI.Legendary"); + } - public override Color FTWTextColor => Main.legendaryModeColor; + public class LegendaryDifficulty : DifficultyMode + { + public override bool Enabled + { + get => CalamityWorld.LegendaryMode; + set + { + if (!Main.GameModeInfo.IsJourneyMode) + { + Main.GameMode = value == true ? GameModeID.Master : GameModeID.Expert; + } + else + { + DifficultyModeSystem.AlignJourneyDifficultySlider(); + } + } + } + + public override Asset Texture => _texture ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Legendary"); + public override Asset OutlineTexture => _outlineTexture ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Legendary_Border"); + + public override Asset TextureDisabled => _textureDisabled ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Legendary_Off"); + + public override SoundStyle ActivationSound => _activationSound ??= SoundID.NPCDeath10; + + public override int BackBoneGameModeID => GameModeID.Master; + + public override float DifficultyScale => 0.5f; + + public override LocalizedText Name => Language.GetText("UI.Legendary"); + + public override Color ChatTextColor => Main.legendaryModeColor; + + public override LocalizedText ShortDescription => GetText("UI.LegendaryShortInfo"); + + public override LocalizedText ExpandedDescription => GetText("UI.LegendaryExpandedInfo"); + public override FTWDisplayMode GetForTheWorthyDisplay => FTWDisplayMode.OnlyForTheWorthy; } @@ -412,25 +491,22 @@ namespace CalamityMod.Systems get => CalamityWorld.revenge; set { - if (Main.getGoodWorld) - { - CalamityWorld.revenge = value; - CalamityWorld.death = value; - } - else - CalamityWorld.revenge = value; + CalamityWorld.revenge = value; + if (value && !Main.GameModeInfo.IsJourneyMode) + Main.GameMode = BackBoneGameModeID; } } public override Asset Texture => _texture ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Rev"); + public override Asset OutlineTexture => _outlineTexture ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Rev_Border"); public override Asset TextureDisabled => _textureDisabled ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Rev_Off"); public override SoundStyle ActivationSound => _activationSound ??= SoundID.Item119; - public override int BackBoneGameModeID => GameModeID.Expert; + public override int BackBoneGameModeID => Main.getGoodWorld ? GameModeID.Normal : GameModeID.Expert; - public override float DifficultyScale => 0.25f; + public override float DifficultyScale => 0.1f; public override LocalizedText Name => GetText("UI.Revengeance"); @@ -447,24 +523,20 @@ namespace CalamityMod.Systems return GetText("UI.RevengeanceExpandedInfo").WithFormatArgs(rageKey, adrenKey); } } - - public override LocalizedText FTWName => GetText("UI.Death"); - - public override Color FTWTextColor => new Color(192, 64, 219); } public class DeathDifficulty : DifficultyMode { public override bool Enabled { - get => Main.getGoodWorld ? CalamityWorld.death && CalamityWorld.LegendaryMode : CalamityWorld.death; + get => CalamityWorld.death; set { if (Main.getGoodWorld) { if (!Main.GameModeInfo.IsJourneyMode) { - Main.GameMode = value == true ? GameModeID.Master : GameModeID.Expert; + Main.GameMode = value == true ? GameModeID.Expert : GameModeID.Normal; } else { @@ -473,19 +545,24 @@ namespace CalamityMod.Systems CalamityWorld.death = value; } else + { CalamityWorld.death = value; + if (value && !Main.GameModeInfo.IsJourneyMode) + Main.GameMode = BackBoneGameModeID; + } } } public override Asset Texture => _texture ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Death"); + public override Asset OutlineTexture => _outlineTexture ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Death_Border"); public override Asset TextureDisabled => _textureDisabled ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Death_Off"); public override SoundStyle ActivationSound => _activationSound ??= DemonshadeHelm.ActivationSound; - public override int BackBoneGameModeID => GameModeID.Master; + public override int BackBoneGameModeID => Main.getGoodWorld ? GameModeID.Expert : GameModeID.Master; - public override float DifficultyScale => 0.5f; + public override float DifficultyScale => 0.25f; public override LocalizedText Name => GetText("UI.Death"); @@ -495,11 +572,6 @@ namespace CalamityMod.Systems public override LocalizedText ExpandedDescription => GetText("UI.DeathExpandedInfo"); - - public override LocalizedText FTWName => GetText("UI.Malice"); - - public override Color FTWTextColor => new Color(240, 128, 128); - public override int[] FavoredDifficultyAtTier(int tier) { DifficultyMode[] tierList = DifficultyModeSystem.DifficultyTiers[tier]; @@ -518,4 +590,66 @@ namespace CalamityMod.Systems return difficulties.ToArray(); } } + + public class MaliceDifficulty : DifficultyMode + { + public override bool Enabled + { + get => Main.getGoodWorld ? CalamityWorld.death && CalamityWorld.LegendaryMode : false; + set + { + if (Main.getGoodWorld) + { + if (!Main.GameModeInfo.IsJourneyMode) + { + Main.GameMode = value == true ? GameModeID.Master : GameModeID.Expert; + } + else + { + DifficultyModeSystem.AlignJourneyDifficultySlider(); + } + CalamityWorld.revenge = value; + CalamityWorld.death = value; + } + } + } + + public override Asset Texture => _texture ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Malice"); + public override Asset OutlineTexture => _outlineTexture ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Malice_Border"); + + public override Asset TextureDisabled => _textureDisabled ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Malice_Off"); + + public override SoundStyle ActivationSound => _activationSound ??= DemonshadeHelm.ActivationSound; + + public override int BackBoneGameModeID => GameModeID.Master; + + public override float DifficultyScale => 0.5f; + + public override LocalizedText Name => GetText("UI.Malice"); + + public override Color ChatTextColor => new Color(240, 128, 128); + + public override LocalizedText ShortDescription => GetText("UI.MaliceShortInfo"); + + public override LocalizedText ExpandedDescription => GetText("UI.MaliceExpandedInfo"); + public override FTWDisplayMode GetForTheWorthyDisplay => FTWDisplayMode.OnlyForTheWorthy; + + public override int[] FavoredDifficultyAtTier(int tier) + { + DifficultyMode[] tierList = DifficultyModeSystem.DifficultyTiers[tier]; + + List difficulties = new List(); + + for (int i = 0; i < tierList.Length; i++) + { + if (tierList[i] is MasterDifficulty || tierList[i] is DeathDifficulty) + difficulties.Add(i); + } + + if (difficulties.Count <= 0) + difficulties.Add(0); + + return difficulties.ToArray(); + } + } } diff --git a/Systems/Mechanic/RecipeSystem.cs b/Systems/Mechanic/RecipeSystem.cs index a368f7f7a7..22135486fa 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/Systems/World/WorldgenManagementSystem.cs b/Systems/World/WorldgenManagementSystem.cs index 2d58e8b58d..5399d037a4 100644 --- a/Systems/World/WorldgenManagementSystem.cs +++ b/Systems/World/WorldgenManagementSystem.cs @@ -45,17 +45,6 @@ namespace CalamityMod.Systems }); } - // Replace the shimmer gen to make it place sanely - int shimmerIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Shimmer")); - if (shimmerIndex != -1) - { - tasks[shimmerIndex] = new PassLegacy("Shimmer", (progress, config) => - { - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterShimmer").Value; - CustomShimmer.NewShimmer(); - }); - } - // Better Underworld structures after the world has been smoothed int underworldStructuresIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Smooth World")); if (underworldStructuresIndex != -1) @@ -544,111 +533,6 @@ namespace CalamityMod.Systems } } - // Give Dead Man's Chests better loot. - if (isDeadManChest) - { - for (int inventoryIndex = 0; inventoryIndex < 40; inventoryIndex++) - { - // Cavern Dead Man's Chests - if (chest.y > GenVars.lavaLine || (chest.y <= GenVars.lavaLine && Main.remixWorld)) - { - if (chest.item[inventoryIndex].type == ItemID.Dynamite) - chest.item[inventoryIndex].SetDefaults(ItemID.StickyDynamite); - - if (chest.item[inventoryIndex].type == ItemID.JestersArrow) - { - chest.item[inventoryIndex].SetDefaults(ItemID.HolyArrow); - chest.item[inventoryIndex].stack = WorldGen.genRand.Next(25, 51); - } - - if (chest.item[inventoryIndex].type == ItemID.SilverBar || - chest.item[inventoryIndex].type == ItemID.TungstenBar || - chest.item[inventoryIndex].type == ItemID.GoldBar || - chest.item[inventoryIndex].type == ItemID.PlatinumBar) - chest.item[inventoryIndex].stack = WorldGen.genRand.Next(6, 16); - - if (chest.item[inventoryIndex].type == ItemID.FlamingArrow) - { - chest.item[inventoryIndex].SetDefaults(ItemID.HellfireArrow); - chest.item[inventoryIndex].stack = WorldGen.genRand.Next(25, 51); - } - - if (chest.item[inventoryIndex].type == ItemID.ThrowingKnife) - { - chest.item[inventoryIndex].SetDefaults(ItemID.PoisonedKnife); - chest.item[inventoryIndex].stack = WorldGen.genRand.Next(25, 51); - } - - if (chest.item[inventoryIndex].type == ItemID.HealingPotion) - { - chest.item[inventoryIndex].SetDefaults(ItemID.RestorationPotion); - chest.item[inventoryIndex].stack = WorldGen.genRand.Next(3, 6); - } - - if (chest.item[inventoryIndex].type == ItemID.RecallPotion) - chest.item[inventoryIndex].SetDefaults(ItemID.PotionOfReturn); - - if (chest.item[inventoryIndex].type == ItemID.Torch) - { - chest.item[inventoryIndex].SetDefaults(ItemID.UltrabrightTorch); - chest.item[inventoryIndex].stack = WorldGen.genRand.Next(15, 30); - } - - if (chest.item[inventoryIndex].type == ItemID.Glowstick) - { - chest.item[inventoryIndex].SetDefaults(ItemID.SpelunkerGlowstick); - chest.item[inventoryIndex].stack = WorldGen.genRand.Next(15, 30); - } - - if (chest.item[inventoryIndex].type == ItemID.GoldCoin) - chest.item[inventoryIndex].stack = WorldGen.genRand.Next(2, 4); - } - - // Underground Dead Man's Chests - else - { - if (chest.item[inventoryIndex].type == ItemID.Bomb) - { - chest.item[inventoryIndex].SetDefaults(ItemID.StickyBomb); - chest.item[inventoryIndex].stack = WorldGen.genRand.Next(10, 20); - } - - if (chest.item[inventoryIndex].type == ItemID.Rope) - chest.item[inventoryIndex].stack = WorldGen.genRand.Next(100, 201); - - if (chest.item[inventoryIndex].type == ItemID.IronBar || - chest.item[inventoryIndex].type == ItemID.LeadBar || - chest.item[inventoryIndex].type == ItemID.SilverBar || - chest.item[inventoryIndex].type == ItemID.TungstenBar) - chest.item[inventoryIndex].stack = WorldGen.genRand.Next(10, 20); - - if (chest.item[inventoryIndex].type == ItemID.WoodenArrow) - { - chest.item[inventoryIndex].SetDefaults(ItemID.FlamingArrow); - chest.item[inventoryIndex].stack = WorldGen.genRand.Next(25, 50); - } - - if (chest.item[inventoryIndex].type == ItemID.Shuriken) - { - chest.item[inventoryIndex].SetDefaults(ItemID.ThrowingKnife); - chest.item[inventoryIndex].stack = WorldGen.genRand.Next(25, 50); - } - - if (chest.item[inventoryIndex].type == ItemID.LesserHealingPotion) - { - chest.item[inventoryIndex].SetDefaults(ItemID.HealingPotion); - chest.item[inventoryIndex].stack = WorldGen.genRand.Next(3, 6); - } - - if (chest.item[inventoryIndex].type == ItemID.SilverCoin) - { - chest.item[inventoryIndex].SetDefaults(ItemID.GoldCoin); - chest.item[inventoryIndex].stack = WorldGen.genRand.Next(1, 3); - } - } - } - } - // Adds Desert Medallion and The Comb to Sandstone Chests, each at a 20% chance if (isSandstoneChest) { diff --git a/Tiles/Abyss/ThermalTorch.cs b/Tiles/Abyss/ThermalTorch.cs index cb85c60abf..e0511695d6 100644 --- a/Tiles/Abyss/ThermalTorch.cs +++ b/Tiles/Abyss/ThermalTorch.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using System.Linq; +using CalamityMod.Graphics; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; @@ -57,6 +59,22 @@ namespace CalamityMod.Tiles.Abyss } } + public override void NearbyEffects(int i, int j, bool closer) + { + //This makes the placed torch cut through the abyss darkness. + var pos = new Point(i, j).ToWorldCoordinates(); + if (!closer && Main.LocalPlayer.Calamity().ZoneAbyss && !Main.gamePaused) + { + if (EnhancedDarknessSystem.lights.Any(x => x.center == pos)) + { + var e = EnhancedDarknessSystem.lights.First(x => x.center == pos); + e.lifetime = 5; + } + else + EnhancedDarknessSystem.lights.Add(new EnhancedDarknessSystem.LightSource(pos, scale: 2f) { lifetime = 5 }); + } + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { FlameTexture ??= ModContent.Request("CalamityMod/Tiles/Abyss/ThermalTorchFlame"); diff --git a/Tiles/Abyss/VoidTorch.cs b/Tiles/Abyss/VoidTorch.cs index d64e53ae73..83c12b9248 100644 --- a/Tiles/Abyss/VoidTorch.cs +++ b/Tiles/Abyss/VoidTorch.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using System.Linq; +using CalamityMod.Graphics; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; @@ -58,6 +60,22 @@ namespace CalamityMod.Tiles.Abyss } } + public override void NearbyEffects(int i, int j, bool closer) + { + //This makes the placed torch cut through the abyss darkness. + var pos = new Point(i, j).ToWorldCoordinates(); + if (!closer && Main.LocalPlayer.Calamity().ZoneAbyss && !Main.gamePaused) + { + if (EnhancedDarknessSystem.lights.Any(x => x.center == pos)) + { + var e = EnhancedDarknessSystem.lights.First(x => x.center == pos); + e.lifetime = 5; + } + else + EnhancedDarknessSystem.lights.Add(new EnhancedDarknessSystem.LightSource(pos, scale: 2f) { lifetime = 5 }); + } + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { FlameTexture ??= ModContent.Request("CalamityMod/Tiles/Abyss/VoidTorchFlame"); diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index e9e59b4094..0260b82767 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -304,7 +304,7 @@ namespace CalamityMod.Tiles AchievementsHelper.NotifyProgressionEvent(6); // Gives the Begone, Evil! achievement } - // Drop Evil Smasher on every 12 alter smashed + // Drop Evil Smasher on every 12 altar smashed if (WorldGen.altarCount > 1 && WorldGen.altarCount % 12 == 0) DropItem(i, j, ItemType(), quantity: 1, asStack: true, prefix: true); } @@ -315,46 +315,6 @@ namespace CalamityMod.Tiles if (Main.rand.NextBool(300)) DropItem(i, j, ItemType(), quantity: 1, asStack: true); } - - // Mature herbs always drop 1 seed (Blooming herbs drop between 1 and 3 seeds, more with Regrowth items) - if (type == TileID.MatureHerbs) - { - int herbType = Main.tile[i, j].TileFrameX / 18; - int seedQuantity = Main.rand.Next(2) + 1; - switch (herbType) - { - default: - break; - - case (int)HerbType.Daybloom: - DropItem(i, j, ItemID.DaybloomSeeds, quantity: seedQuantity, asStack: true); - break; - - case (int)HerbType.Moonglow: - DropItem(i, j, ItemID.MoonglowSeeds, quantity: seedQuantity, asStack: true); - break; - - case (int)HerbType.Blinkroot: - DropItem(i, j, ItemID.BlinkrootSeeds, quantity: seedQuantity, asStack: true); - break; - - case (int)HerbType.Deathweed: - DropItem(i, j, ItemID.DeathweedSeeds, quantity: seedQuantity, asStack: true); - break; - - case (int)HerbType.Waterleaf: - DropItem(i, j, ItemID.WaterleafSeeds, quantity: seedQuantity, asStack: true); - break; - - case (int)HerbType.Fireblossom: - DropItem(i, j, ItemID.FireblossomSeeds, quantity: seedQuantity, asStack: true); - break; - - case (int)HerbType.Shiverthorn: - DropItem(i, j, ItemID.ShiverthornSeeds, quantity: seedQuantity, asStack: true); - break; - } - } } private static void DropItem(int i, int j, int itemType, int quantity, bool asStack, Vector2 spreadMinMax = default, bool prefix = false) diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index 5abd9daead..12cd3e56cb 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -301,7 +301,7 @@ namespace CalamityMod.Tiles npc = NPCType(); - Formerly Cosmic Elemental break*/ case 76: - npc = NPCType(); + npc = NPCType(); break; case 77: npc = NPCType(); diff --git a/Tiles/SunkenSea/SeaPrism.cs b/Tiles/SunkenSea/SeaPrism.cs index d2ba903193..0539abd2f6 100644 --- a/Tiles/SunkenSea/SeaPrism.cs +++ b/Tiles/SunkenSea/SeaPrism.cs @@ -400,6 +400,13 @@ namespace CalamityMod.Tiles.SunkenSea Main.tileBatch.End(); Main.spriteBatch.End(); + var oldTex1 = Main.instance.GraphicsDevice.Textures[1]; + var oldSampler1 = Main.instance.GraphicsDevice.SamplerStates[1]; + var oldTex2 = Main.instance.GraphicsDevice.Textures[2]; + var oldSampler2 = Main.instance.GraphicsDevice.SamplerStates[2]; + var oldTex3 = Main.instance.GraphicsDevice.Textures[3]; + var oldSampler3 = Main.instance.GraphicsDevice.SamplerStates[3]; + Effect shader = CalamityShaders.SeaPrismColorBlendingShader.Value; shader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly); shader.Parameters["screenOffset"].SetValue(Main.screenPosition); @@ -526,6 +533,13 @@ namespace CalamityMod.Tiles.SunkenSea Main.spriteBatch.End(); + Main.instance.GraphicsDevice.Textures[1] = oldTex1; + Main.instance.GraphicsDevice.SamplerStates[1] = oldSampler1; + Main.instance.GraphicsDevice.Textures[2] = oldTex2; + Main.instance.GraphicsDevice.SamplerStates[2] = oldSampler2; + Main.instance.GraphicsDevice.Textures[3] = oldTex3; + Main.instance.GraphicsDevice.SamplerStates[3] = oldSampler3; + Main.spriteBatch.Begin(); Main.tileBatch.Begin(); @@ -539,6 +553,12 @@ namespace CalamityMod.Tiles.SunkenSea Main.tileBatch.End(); Main.spriteBatch.End(); + var oldTex1 = Main.instance.GraphicsDevice.Textures[1]; + var oldSampler1 = Main.instance.GraphicsDevice.SamplerStates[1]; + var oldTex2 = Main.instance.GraphicsDevice.Textures[2]; + var oldSampler2 = Main.instance.GraphicsDevice.SamplerStates[2]; + var oldTex3 = Main.instance.GraphicsDevice.Textures[3]; + Main.instance.GraphicsDevice.Textures[1] = SeaPrismWall.GlowMaskGreen.Texture; Main.instance.GraphicsDevice.SamplerStates[1] = SamplerState.LinearClamp; Main.instance.GraphicsDevice.Textures[2] = SeaPrismWall.GlowMaskPurple.Texture; @@ -552,7 +572,7 @@ namespace CalamityMod.Tiles.SunkenSea shader.Parameters["diagonalScreenLength"].SetValue((Main.screenWidth / 2f) - (Main.screenHeight / 2f)); shader.Parameters["doGlint"].SetValue(false); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shader, Matrix.Identity); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); Vector2 unscaledPosition = Main.Camera.UnscaledPosition; @@ -592,6 +612,12 @@ namespace CalamityMod.Tiles.SunkenSea Main.spriteBatch.End(); + Main.instance.GraphicsDevice.Textures[1] = oldTex1; + Main.instance.GraphicsDevice.SamplerStates[1] = oldSampler1; + Main.instance.GraphicsDevice.Textures[2] = oldTex2; + Main.instance.GraphicsDevice.SamplerStates[2] = oldSampler2; + Main.instance.GraphicsDevice.Textures[3] = oldTex3; + Main.spriteBatch.Begin(); Main.tileBatch.Begin(); diff --git a/UI/BossHealthBarManager.cs b/UI/BossHealthBarManager.cs index f43b565da1..583c3621d9 100644 --- a/UI/BossHealthBarManager.cs +++ b/UI/BossHealthBarManager.cs @@ -271,7 +271,7 @@ namespace CalamityMod.UI // Hardmode Modded. NPCType(), - NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), //Clone's brothers diff --git a/UI/ModeIndicator/ModeIndicatorOutline.png b/UI/ModeIndicator/ModeIndicatorOutline.png deleted file mode 100644 index 8cfff31c70..0000000000 Binary files a/UI/ModeIndicator/ModeIndicatorOutline.png and /dev/null differ diff --git a/UI/ModeIndicator/ModeIndicatorUI.cs b/UI/ModeIndicator/ModeIndicatorUI.cs index f18f516d30..9dacbef733 100644 --- a/UI/ModeIndicator/ModeIndicatorUI.cs +++ b/UI/ModeIndicator/ModeIndicatorUI.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using CalamityMod.CalPlayer; @@ -7,6 +8,7 @@ using CalamityMod.Packets; using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -23,15 +25,15 @@ namespace CalamityMod.UI.ModeIndicator { public static Rectangle MouseScreenArea => Utils.CenteredRectangle(Main.MouseScreen, Vector2.One * 2f); - public static Vector2 FrameSize => new Vector2(30f, 38f); + public static Vector2 FrameSize => new Vector2(74f, 74f); public static Rectangle MainClickArea => Utils.CenteredRectangle(DrawCenter, FrameSize * MainIconScale); public static bool ClickingMouse => Main.mouseLeft && Main.mouseLeftRelease; public static Vector2 DrawCenter => new Vector2(Main.screenWidth - 400f - WidthForTier(MostAlternateDifficulties) * 0.5f, 82f) + FrameSize * 0.5f; - private static int GlowFadeAnimLength = 40; + private static int GlowFadeAnimLength = 20; public static int GlowFadeTime = 0; //Lock icon - internal const int LockAnimLength = 30; + internal const int LockAnimLength = 15; private static int lockClickTime = 0; private static bool previousLockStatus = false; //Expand and shrink on hover @@ -43,10 +45,10 @@ namespace CalamityMod.UI.ModeIndicator public static float MainIconScale => 1f + iconHoverScaleBoost; //Menu state private static bool menuOpen = false; - internal static int MenuAnimLength => MostAlternateDifficulties > 1 ? 60 : 40; + internal static int MenuAnimLength => MostAlternateDifficulties > 1 ? 30 : 20; private static int menuOpenTransitionTime = 0; private static DifficultyMode previouslyHoveredMode = null; - public static float WidthForTier(int alts) => (alts - 1) * 44f; + public static float WidthForTier(int alts) => (alts - 1) * 76f; private static void ClearVariables() { @@ -137,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; @@ -204,14 +207,14 @@ namespace CalamityMod.UI.ModeIndicator if (MouseScreenArea.Intersects(MainClickArea)) { //Display the first non-none difficulty by default - string modeToDisplay = Main.getGoodWorld ? Difficulties[0].FTWName.ToString() : Difficulties[1].Name.ToString(); + string modeToDisplay = Main.getGoodWorld && Difficulties[0].FTWName is not null ? Difficulties[0].FTWName.ToString() : Difficulties[1].Name.ToString(); bool anyActiveMode = Main.getGoodWorld ? true : false; for (int i = 1; i < Difficulties.Count; i++) { if (GetCurrentDifficulty == Difficulties[i]) { - modeToDisplay = Main.getGoodWorld ? Difficulties[i].FTWName.ToString() : Difficulties[i].Name.ToString(); + modeToDisplay = Main.getGoodWorld && Difficulties[i].FTWName is not null ? Difficulties[i].FTWName.ToString() : Difficulties[i].Name.ToString(); anyActiveMode = true; } } @@ -295,12 +298,10 @@ namespace CalamityMod.UI.ModeIndicator public static void ManageHexIcons(SpriteBatch spriteBatch, out string text) { int tiers = DifficultyTiers.Count(); - float barLength = 68 * tiers * BarExpansionProgress; + float barLength = 90 * tiers * BarExpansionProgress; float progress = menuOpen ? 1 - menuOpenTransitionTime / (float)MenuAnimLength : menuOpenTransitionTime / (float)MenuAnimLength; Vector2 basePosition = DrawCenter + (barLength / (float)(tiers + 1f)) * Vector2.UnitY; - Texture2D outlineTexture = ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicatorOutline").Value; - text = string.Empty; bool modeHovered = false; Vector2 positionOffset = (barLength / (float)(tiers + 1f)) * Vector2.UnitY; @@ -332,6 +333,7 @@ namespace CalamityMod.UI.ModeIndicator if (mode == GetCurrentDifficulty) { usedOpacity = 1f; + Texture2D outlineTexture = mode.OutlineTexture.Value; spriteBatch.Draw(outlineTexture, iconPosition, null, mode.ChatTextColor * progressMult, 0f, outlineTexture.Size() * 0.5f, 1f, SpriteEffects.None, 0f); } @@ -368,9 +370,10 @@ namespace CalamityMod.UI.ModeIndicator #region Difficulty toggling public static string GetDifficultyText(DifficultyMode mode) { - LocalizedText preface = Main.getGoodWorld ? mode.FTWName : mode.Name; + bool useFTWName = mode.FTWName is not null && Main.getGoodWorld; + LocalizedText preface = useFTWName ? mode.FTWName : mode.Name; if (mode == GetCurrentDifficulty) - preface = CalamityUtils.GetText("UI.CurrentlySelected").WithFormatArgs(Main.getGoodWorld ? mode.FTWName.ToString() : mode.Name.ToString()); + preface = CalamityUtils.GetText("UI.CurrentlySelected").WithFormatArgs(useFTWName ? mode.FTWName.ToString() : mode.Name.ToString()); string text = "\n" + mode.ShortDescription.ToString(); @@ -396,8 +399,8 @@ namespace CalamityMod.UI.ModeIndicator return; // This has to be put before difficulties change as to not disrupt GetCurrentDifficulty - BroadcastFormattedText("Mods.CalamityMod.UI.DifficultySwitch", Color.White, Main.getGoodWorld ? GetCurrentDifficulty.FTWTextColor.Hex3() : GetCurrentDifficulty.ChatTextColor.Hex3(), Main.getGoodWorld ? GetCurrentDifficulty.FTWName : GetCurrentDifficulty.Name - , Main.getGoodWorld ? mode.FTWTextColor.Hex3() : mode.ChatTextColor.Hex3(), Main.getGoodWorld ? mode.FTWName : mode.Name); + BroadcastFormattedText("Mods.CalamityMod.UI.DifficultySwitch", Color.White, Main.getGoodWorld && GetCurrentDifficulty.FTWTextColor is not null ? GetCurrentDifficulty.FTWTextColor.Value.Hex3() : GetCurrentDifficulty.ChatTextColor.Hex3(), Main.getGoodWorld && GetCurrentDifficulty.FTWName is not null ? GetCurrentDifficulty.FTWName : GetCurrentDifficulty.Name + , Main.getGoodWorld && GetCurrentDifficulty.FTWTextColor is not null ? mode.FTWTextColor.Value.Hex3() : mode.ChatTextColor.Hex3(), Main.getGoodWorld && GetCurrentDifficulty.FTWName is not null ? mode.FTWName : mode.Name); // Todo, maybe in the future having a way to have multiple difficulty options on the same tier that can coexist, and it works in branching pathes? Not very necessary for cal & addons. // But would be super useful so other mods can let their own difficulties go there. diff --git a/UI/ModeIndicator/ModeIndicator_Classic.png b/UI/ModeIndicator/ModeIndicator_Classic.png index cec6bfee9b..311087fb85 100644 Binary files a/UI/ModeIndicator/ModeIndicator_Classic.png and b/UI/ModeIndicator/ModeIndicator_Classic.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Classic_Border.png b/UI/ModeIndicator/ModeIndicator_Classic_Border.png new file mode 100644 index 0000000000..4b7745f447 Binary files /dev/null and b/UI/ModeIndicator/ModeIndicator_Classic_Border.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Classic_Off.png b/UI/ModeIndicator/ModeIndicator_Classic_Off.png index ccf4bfccbc..1ce7e3aef4 100644 Binary files a/UI/ModeIndicator/ModeIndicator_Classic_Off.png and b/UI/ModeIndicator/ModeIndicator_Classic_Off.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Death.png b/UI/ModeIndicator/ModeIndicator_Death.png index 3407bf8f8d..0604833c59 100644 Binary files a/UI/ModeIndicator/ModeIndicator_Death.png and b/UI/ModeIndicator/ModeIndicator_Death.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Death_Border.png b/UI/ModeIndicator/ModeIndicator_Death_Border.png new file mode 100644 index 0000000000..6c3f3df9c1 Binary files /dev/null and b/UI/ModeIndicator/ModeIndicator_Death_Border.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Death_Off.png b/UI/ModeIndicator/ModeIndicator_Death_Off.png index 2a3f7cc3d5..d5cacd72c8 100644 Binary files a/UI/ModeIndicator/ModeIndicator_Death_Off.png and b/UI/ModeIndicator/ModeIndicator_Death_Off.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Expert.png b/UI/ModeIndicator/ModeIndicator_Expert.png index 7f16d0f576..893cbd39d6 100644 Binary files a/UI/ModeIndicator/ModeIndicator_Expert.png and b/UI/ModeIndicator/ModeIndicator_Expert.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Expert_Border.png b/UI/ModeIndicator/ModeIndicator_Expert_Border.png new file mode 100644 index 0000000000..a795897508 Binary files /dev/null and b/UI/ModeIndicator/ModeIndicator_Expert_Border.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Expert_Off.png b/UI/ModeIndicator/ModeIndicator_Expert_Off.png index 1ade0d9fd6..6aeff8c0d7 100644 Binary files a/UI/ModeIndicator/ModeIndicator_Expert_Off.png and b/UI/ModeIndicator/ModeIndicator_Expert_Off.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Legendary.png b/UI/ModeIndicator/ModeIndicator_Legendary.png new file mode 100644 index 0000000000..5a8789f90a Binary files /dev/null and b/UI/ModeIndicator/ModeIndicator_Legendary.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Legendary_Border.png b/UI/ModeIndicator/ModeIndicator_Legendary_Border.png new file mode 100644 index 0000000000..3dc61a1448 Binary files /dev/null and b/UI/ModeIndicator/ModeIndicator_Legendary_Border.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Legendary_Off.png b/UI/ModeIndicator/ModeIndicator_Legendary_Off.png new file mode 100644 index 0000000000..5261ecc7c4 Binary files /dev/null and b/UI/ModeIndicator/ModeIndicator_Legendary_Off.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Malice.png b/UI/ModeIndicator/ModeIndicator_Malice.png new file mode 100644 index 0000000000..f6ad0a7a8a Binary files /dev/null and b/UI/ModeIndicator/ModeIndicator_Malice.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Malice_Border.png b/UI/ModeIndicator/ModeIndicator_Malice_Border.png new file mode 100644 index 0000000000..7ddffeae4c Binary files /dev/null and b/UI/ModeIndicator/ModeIndicator_Malice_Border.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Malice_Off.png b/UI/ModeIndicator/ModeIndicator_Malice_Off.png new file mode 100644 index 0000000000..e74ba288b9 Binary files /dev/null and b/UI/ModeIndicator/ModeIndicator_Malice_Off.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Master.png b/UI/ModeIndicator/ModeIndicator_Master.png index c69fcfaa6e..655f9c13d0 100644 Binary files a/UI/ModeIndicator/ModeIndicator_Master.png and b/UI/ModeIndicator/ModeIndicator_Master.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Master_Border.png b/UI/ModeIndicator/ModeIndicator_Master_Border.png new file mode 100644 index 0000000000..65ee802bcb Binary files /dev/null and b/UI/ModeIndicator/ModeIndicator_Master_Border.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Master_Off.png b/UI/ModeIndicator/ModeIndicator_Master_Off.png index 91817fbfd1..cfb119a7ea 100644 Binary files a/UI/ModeIndicator/ModeIndicator_Master_Off.png and b/UI/ModeIndicator/ModeIndicator_Master_Off.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Rev.png b/UI/ModeIndicator/ModeIndicator_Rev.png index 5b21cfd0fa..9c29e362e0 100644 Binary files a/UI/ModeIndicator/ModeIndicator_Rev.png and b/UI/ModeIndicator/ModeIndicator_Rev.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Rev_Border.png b/UI/ModeIndicator/ModeIndicator_Rev_Border.png new file mode 100644 index 0000000000..3f59e2ad7d Binary files /dev/null and b/UI/ModeIndicator/ModeIndicator_Rev_Border.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Rev_Off.png b/UI/ModeIndicator/ModeIndicator_Rev_Off.png index 3f8cc887fa..1aba896d33 100644 Binary files a/UI/ModeIndicator/ModeIndicator_Rev_Off.png and b/UI/ModeIndicator/ModeIndicator_Rev_Off.png differ diff --git a/World/BrimstoneCrag.cs b/World/BrimstoneCrag.cs index cbb937e56f..611b17cbc0 100644 --- a/World/BrimstoneCrag.cs +++ b/World/BrimstoneCrag.cs @@ -527,6 +527,7 @@ namespace CalamityMod.World else { contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); } for (int i = 0; i < contents.Count; i++) diff --git a/World/CustomShimmer.cs b/World/CustomShimmer.cs deleted file mode 100644 index 7130e05878..0000000000 --- a/World/CustomShimmer.cs +++ /dev/null @@ -1,73 +0,0 @@ -using Microsoft.Xna.Framework; -using ReLogic.Utilities; -using Terraria; -using Terraria.WorldBuilding; - -namespace CalamityMod.World -{ - public class CustomShimmer - { - public static void NewShimmer() - { - // Large = 4, Medium = 3, Small = 2 - int worldSize = (int)(Main.maxTilesX / 4200f * 2f); - int minOffsetX = 240; - int maxOffsetX; - switch (worldSize) - { - default: - case 2: - maxOffsetX = 300; - break; - - case 3: - maxOffsetX = 360; - break; - - case 4: - maxOffsetX = 420; - break; - } - - int offset = 50; - int shimmerMinDepth = (int)((Main.worldSurface + Main.rockLayer) * 0.5) + offset; - int shimmerMaxDepth = (int)(((double)((Main.maxTilesY - 250) * 2) + Main.rockLayer) * 0.33); - shimmerMaxDepth = (int)MathHelper.Clamp(shimmerMaxDepth, shimmerMinDepth + 50, Main.maxTilesY - 460); - - int shimmerPositionY = WorldGen.genRand.Next(shimmerMinDepth, shimmerMaxDepth); - int shimmerPositionX = ((GenVars.dungeonSide < 0) ? WorldGen.genRand.Next(Main.maxTilesX - maxOffsetX, Main.maxTilesX - minOffsetX) : WorldGen.genRand.Next(minOffsetX, maxOffsetX)); - int remixSeedShimmerMinDepth = (int)Main.worldSurface + 150; - int remixSeedShimmerMaxDepth = (int)((Main.rockLayer + Main.worldSurface + 200D) * 0.5); - if (remixSeedShimmerMaxDepth <= remixSeedShimmerMinDepth) - remixSeedShimmerMaxDepth = remixSeedShimmerMinDepth + 50; - - if (WorldGen.tenthAnniversaryWorldGen) - shimmerPositionY = WorldGen.genRand.Next(remixSeedShimmerMinDepth, remixSeedShimmerMaxDepth); - - int attempts = 0; - while (!WorldGen.ShimmerMakeBiome(shimmerPositionX, shimmerPositionY)) - { - attempts++; - if (WorldGen.tenthAnniversaryWorldGen && attempts < 10000) - { - shimmerPositionY = WorldGen.genRand.Next(remixSeedShimmerMinDepth, remixSeedShimmerMaxDepth); - shimmerPositionX = ((GenVars.dungeonSide < 0) ? WorldGen.genRand.Next(Main.maxTilesX - maxOffsetX, Main.maxTilesX - minOffsetX) : WorldGen.genRand.Next(minOffsetX, maxOffsetX)); - } - else if (attempts > 20000) - { - shimmerPositionY = WorldGen.genRand.Next((int)Main.worldSurface + 120, shimmerMaxDepth); - shimmerPositionX = ((GenVars.dungeonSide < 0) ? WorldGen.genRand.Next(Main.maxTilesX - maxOffsetX * 2, Main.maxTilesX - minOffsetX) : WorldGen.genRand.Next(minOffsetX, maxOffsetX * 2)); - } - else - { - shimmerPositionY = WorldGen.genRand.Next((int)((Main.worldSurface + Main.rockLayer) * 0.5) + 20, shimmerMaxDepth); - shimmerPositionX = ((GenVars.dungeonSide < 0) ? WorldGen.genRand.Next(Main.maxTilesX - maxOffsetX, Main.maxTilesX - minOffsetX) : WorldGen.genRand.Next(minOffsetX, maxOffsetX)); - } - } - - GenVars.shimmerPosition = new Vector2D(shimmerPositionX, shimmerPositionY); - int genArea = 200; - GenVars.structures.AddProtectedStructure(new Rectangle(shimmerPositionX - (int)(genArea * 0.5f), shimmerPositionY - (int)(genArea * 0.5f), genArea, genArea)); - } - } -} diff --git a/World/ShimmerShrine.cs b/World/ShimmerShrine.cs index b499d5f361..7beb14fd6c 100644 --- a/World/ShimmerShrine.cs +++ b/World/ShimmerShrine.cs @@ -17,7 +17,7 @@ namespace CalamityMod.World var schematic = TileMaps[mapKey]; int placementPositionX = (int)GenVars.shimmerPosition.X; - int placementPositionY = (int)Main.worldSurface - 250; + int placementPositionY = (int)Main.worldSurface - 300; int offset = 28; while (!Main.tile[placementPositionX, placementPositionY].HasTile) @@ -39,7 +39,7 @@ namespace CalamityMod.World { new ChestItem(ItemID.AngelStatue, 1), new ChestItem(WorldGen.genRand.NextBool() ? ItemID.LifeCrystal : ItemID.ManaCrystal, 1), - new ChestItem(GenVars.goldBar == TileID.Gold ? ItemID.GoldBar : ItemID.PlatinumBar, WorldGen.genRand.Next(5, 16)), + new ChestItem(GenVars.gold == TileID.Gold ? ItemID.GoldBar : ItemID.PlatinumBar, WorldGen.genRand.Next(5, 16)), new ChestItem(ItemID.CanOfWorms, WorldGen.genRand.Next(3, 5)), new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(5, 11)), new ChestItem(ItemID.LuckPotionGreater, WorldGen.genRand.Next(1, 3)), diff --git a/build.txt b/build.txt index f89177c05d..5d37989673 100644 --- a/build.txt +++ b/build.txt @@ -2,7 +2,7 @@ author = The Calamity Dev Team version = 2.1 displayName = Calamity Mod modReferences = CalamityModMusic -homepage = https://discord.gg/calamity +homepage = https://calamitymod.com buildIgnore = .vs\*, Properties\*, *.csproj, *.user, obj\*, bin\*, *.config, .git\*, .github\*, LICENSE, README.md, .editorconfig, .gitignore, .gitattributes, Effects\Compiler\* hideCode = false hideResources = true