diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index df6c24e6df..1d6aa74b99 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -1693,6 +1693,10 @@ namespace CalamityMod.CalPlayer private void ModifyHurtInfo_Calamity(ref Player.HurtInfo info) { + // Don't run any of this code if the hit was cancelled. + if (info.Cancelled) + return; + // Boss Rush's damage floor is implemented as a dirty modifier // TODO -- implementing this correctly would require fully reimplementing all of DR and ADR if (BossRushEvent.BossRushActive) diff --git a/Items/SummonItems/BloodwormItem.cs b/Items/SummonItems/BloodwormItem.cs index be23362d9c..5bd5f6c758 100644 --- a/Items/SummonItems/BloodwormItem.cs +++ b/Items/SummonItems/BloodwormItem.cs @@ -1,7 +1,10 @@ -using CalamityMod.NPCs.AcidRain; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.NPCs.AcidRain; using CalamityMod.Rarities; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.SummonItems @@ -9,6 +12,8 @@ namespace CalamityMod.Items.SummonItems public class BloodwormItem : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.SummonItems"; + + private const int SpoofBaitNumber = 4444; public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; @@ -20,7 +25,10 @@ namespace CalamityMod.Items.SummonItems Item.width = 28; Item.height = 28; Item.maxStack = Item.CommonMaxStack; - Item.bait = 4444; + // Why spoof this in the tooltip? + // To fix bugs related to how bait power affects hooking fish. + // Vanilla gets around this for Truffle Worm with a hundred hardcoded checks but we don't have the full luxury to do that. + Item.bait = 50; Item.useStyle = ItemUseStyleID.Swing; Item.autoReuse = true; Item.useTurn = true; @@ -38,5 +46,11 @@ namespace CalamityMod.Items.SummonItems { itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; } + + public override void ModifyTooltips(List tooltips) + { + TooltipLine bait = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "BaitPower"); + bait?.Text = Language.GetTextValue("GameUI.BaitPower", SpoofBaitNumber); + } } } diff --git a/Items/SummonItems/Terminus.cs b/Items/SummonItems/Terminus.cs index 71f0b167e4..c1432c9c8b 100644 --- a/Items/SummonItems/Terminus.cs +++ b/Items/SummonItems/Terminus.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Items.SummonItems public new string LocalizationCategory => "Items.SummonItems"; public override void SetDefaults() { - Item.width = Main.zenithWorld ? 54 : 28; - Item.height = Main.zenithWorld ? 78 : 28; + Item.width = Main.zenithWorld ? 54 : 70; + Item.height = Main.zenithWorld ? 78 : 80; Item.rare = ItemRarityID.Blue; Item.useAnimation = 45; Item.useTime = 45; @@ -31,17 +31,67 @@ namespace CalamityMod.Items.SummonItems Item.SetNameOverride(this.GetLocalizedValue("GFBName")); } - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) { + // The wiki classifies Boss Rush as an event + itemGroup = ContentSamples.CreativeHelper.ItemGroup.EventItem; + } + + #region Sprite Drawing + public static void DrawTerminusGlow(SpriteBatch spriteBatch, Vector2 baseDrawPosition, Rectangle frame, float rotation, float baseScale) + { + Texture2D glowTexture = ModContent.Request("CalamityMod/Items/SummonItems/TerminusGlow").Value; + Vector2 origin = frame.Size() * 0.5f; + + float pulseRate = Main.GlobalTimeWrappedHourly % 5f; + float slowingRate = Main.GlobalTimeWrappedHourly * 0.4f; + float orbitRadius = baseScale != 1f ? 4f : 7f; + float glowCount = 3f; + + pulseRate /= 2.5f; + if (pulseRate >= 1f) + pulseRate = 2f - pulseRate; + pulseRate *= 0.6f; + + for (int i = 0; i < glowCount; i++) + { + float progress = i / glowCount; + float pulseRotation = (progress + slowingRate) * MathHelper.TwoPi; + + Vector2 offset = Vector2.UnitY * orbitRadius; + offset = offset.RotatedBy(pulseRotation) * pulseRate; + + spriteBatch.Draw(glowTexture, baseDrawPosition + offset, frame, new Color(56, 12, 115, 33), rotation, origin, baseScale, 0, 0); + } + + spriteBatch.Draw(glowTexture, baseDrawPosition, frame, Color.White, rotation, origin, baseScale, 0, 0); + } + + public static void DrawGlowInWorld(SpriteBatch spriteBatch, Vector2 baseDrawPosition, float rotation, float baseScale) + { + Texture2D glowTexture = ModContent.Request("CalamityMod/Items/SummonItems/TerminusGlow").Value; + Rectangle frame = glowTexture.Bounds; + DrawTerminusGlow(spriteBatch, baseDrawPosition + new Vector2(0, -1), frame, rotation, baseScale); + } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture; + float invScale = scale * 1.4f; + if (Main.zenithWorld) { - Texture2D texture = ModContent.Request("CalamityMod/Items/SummonItems/Terminus_GFB").Value; - Color overlay = Color.White; - spriteBatch.Draw(texture, position, null, overlay, 0f, origin, scale, 0, 0); - return false; + texture = ModContent.Request("CalamityMod/Items/SummonItems/Terminus_GFB").Value; + spriteBatch.Draw(texture, position - new Vector2(-4, -1), null, Color.White, 0f, origin, invScale - 0.04f, 0, 0); } else - return true; + { + texture = ModContent.Request("CalamityMod/Items/SummonItems/Terminus").Value; + spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, invScale, 0, 0); + DrawTerminusGlow(spriteBatch, position, frame, 0f, invScale); + } + + return false; } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) @@ -49,17 +99,20 @@ namespace CalamityMod.Items.SummonItems if (Main.zenithWorld) { Texture2D texture = ModContent.Request("CalamityMod/Items/SummonItems/Terminus_GFB").Value; - spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, 0, 0); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, rotation, Vector2.Zero, scale, 0, 0); return false; } else return true; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - // The wiki classifies Boss Rush as an event - itemGroup = ContentSamples.CreativeHelper.ItemGroup.EventItem; + if (!Main.zenithWorld) + { + DrawGlowInWorld(spriteBatch, Item.Center - Main.screenPosition, rotation, scale); + } } + #endregion } } diff --git a/Items/SummonItems/Terminus.png b/Items/SummonItems/Terminus.png index 9693d24bb8..b94449e1dd 100644 Binary files a/Items/SummonItems/Terminus.png and b/Items/SummonItems/Terminus.png differ diff --git a/Items/SummonItems/TerminusGlow.png b/Items/SummonItems/TerminusGlow.png new file mode 100644 index 0000000000..67ce074418 Binary files /dev/null and b/Items/SummonItems/TerminusGlow.png differ diff --git a/Items/Weapons/Melee/TheBurningSky.cs b/Items/Weapons/Melee/TheBurningSky.cs index 161909dfc0..4147065fcb 100644 --- a/Items/Weapons/Melee/TheBurningSky.cs +++ b/Items/Weapons/Melee/TheBurningSky.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent.Prefixes; using Terraria.ID; using Terraria.ModLoader; @@ -44,6 +45,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); } + public override bool RangedPrefix() => true; //class identity is fake + public override bool MeleePrefix() => false; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson b/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson index 7b5ef7a2e5..52b51c52c4 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson @@ -286,7 +286,7 @@ Teratoma: { Terminus: { DisplayName: Terminus GFBName: Ogscule - Tooltip: Activates Boss Rush Mode, using it again will deactivate Boss Rush Mode + Tooltip: Hold to start or end the Boss Rush } YharonEgg: { diff --git a/Prefixes/ReforgeChange.cs b/Prefixes/ReforgeChange.cs index 7334129f63..5a42927f66 100644 --- a/Prefixes/ReforgeChange.cs +++ b/Prefixes/ReforgeChange.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Packets; using CalamityMod.World; @@ -193,7 +194,7 @@ namespace CalamityMod.Prefixes // MELEE (includes tools and whips) // Melee-ranged hybrid weapons prioritize Legendary if available, otherwise go for Unreal - if ((item.CountsAsClass() || item.CountsAsClass()) && !(item.CountsAsClass() && !supportsLegendary)) + if ((item.CountsAsClass() || item.CountsAsClass()) && !(item.CountsAsClass() && !supportsLegendary) && !(item.type == ItemType())) { // Terrarian (has its own special "Legendary" for marketing reasons) // Other items that want to use Legendary2 are also compatible @@ -218,8 +219,8 @@ namespace CalamityMod.Prefixes } } - // RANGED - else if (item.CountsAsClass()) + // RANGED (and also Burning Sky) + else if (item.CountsAsClass() || item.type == ItemType()) { prefix = IteratePrefix(rand, RangedPrefixTiers, currentPrefix); } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index adab757b67..ee5a3cbc01 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -3333,6 +3333,7 @@ namespace CalamityMod.Projectiles { projectile.ai[0] = 1; projectile.localAI[1] = NPCType() * -1; + baitPower = 4444; // Manually set the power to the displayed value ReelTheBobberChecks(); } else if (baitPower > 75) diff --git a/Projectiles/Typeless/TerminusHoldout.cs b/Projectiles/Typeless/TerminusHoldout.cs index c444e4d74e..52a48fc9ba 100644 --- a/Projectiles/Typeless/TerminusHoldout.cs +++ b/Projectiles/Typeless/TerminusHoldout.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - Projectile.width = 50; - Projectile.height = 50; + Projectile.width = 70; + Projectile.height = 80; Projectile.aiStyle = -1; Projectile.ignoreWater = true; Projectile.tileCollide = false; @@ -130,6 +130,8 @@ namespace CalamityMod.Projectiles.Typeless int dustCount = (int)Math.Round(MathHelper.SmoothStep(1f, 5f, Time / Lifetime)); float outwardness = MathHelper.SmoothStep(40f, 150f, Time / Lifetime); float dustScale = MathHelper.Lerp(1.15f, 1.725f, Time / Lifetime); + float colorTime = Time / Lifetime * Main.rand.NextFloat(0.65f, 1f); + for (int i = 0; i < dustCount; i++) { Vector2 spawnPosition = Projectile.Center + Main.rand.NextVector2Unit() * outwardness * Main.rand.NextFloat(0.75f, 1.1f); @@ -138,7 +140,7 @@ namespace CalamityMod.Projectiles.Typeless Dust paleMagic = Dust.NewDustPerfect(spawnPosition, DustID.PortalBoltTrail); paleMagic.velocity = dustVelocity; paleMagic.scale = dustScale * Main.rand.NextFloat(0.75f, 1.15f); - paleMagic.color = Color.Lerp(Color.LightCoral, Color.White, Time / Lifetime * Main.rand.NextFloat(0.65f, 1f)); + paleMagic.color = Main.zenithWorld ? Color.Lerp(Color.LightCoral, Color.White, colorTime) : Color.Lerp(Color.Violet, Color.Goldenrod, colorTime); paleMagic.noGravity = true; paleMagic.noLight = true; } @@ -169,8 +171,8 @@ namespace CalamityMod.Projectiles.Typeless SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; if (Time >= 150f) { - float outwardness = MathHelper.SmoothStep(1f, 15f, Utils.GetLerpValue(150f, Lifetime - 30f, Time, true)); - Color afterimageColor = Color.Lerp(baseColor, Color.LightCoral, Utils.GetLerpValue(150f, 195f, Time, true)) * 0.225f; + float outwardness = MathHelper.SmoothStep(0f, 12f, Utils.GetLerpValue(150f, Lifetime - 30f, Time, true)); + Color afterimageColor = Color.Lerp(baseColor, Color.PaleGoldenrod, Utils.GetLerpValue(150f, 195f, Time, true)) * 0.225f; afterimageColor.A = 0; for (int i = 0; i < 10; i++) @@ -179,9 +181,34 @@ namespace CalamityMod.Projectiles.Typeless Main.EntitySpriteDraw(texture, baseDrawPosition + drawOffset, null, afterimageColor, 0f, origin, Projectile.scale, direction, 0); } } - Main.EntitySpriteDraw(texture, baseDrawPosition, null, baseColor, 0f, origin, Projectile.scale, direction, 0); + Main.EntitySpriteDraw(texture, baseDrawPosition, null, baseColor, 0f, origin, Projectile.scale, direction, 0); return false; } + + public override void PostDraw(Color lightColor) + { + if (Main.zenithWorld) + return; + + Texture2D texture = ModContent.Request("CalamityMod/Items/SummonItems/TerminusGlow").Value; + Vector2 baseDrawPosition = Projectile.Center - Main.screenPosition; + Vector2 origin = texture.Size() * 0.5f; + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + + if (Time >= 75f) + { + float outwardness = MathHelper.SmoothStep(0f, 4f, Utils.GetLerpValue(75f, Lifetime - 30f, Time, true)); + + for (int i = 0; i < 3; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 4f + Main.GlobalTimeWrappedHourly * 4.4f).ToRotationVector2() * outwardness; + + Main.EntitySpriteDraw(texture, baseDrawPosition + drawOffset, null, new Color(56, 12, 115, 0), 0f, origin, Projectile.scale, direction, 0); + } + } + + Main.EntitySpriteDraw(texture, baseDrawPosition, null, Color.White, 0f, origin, Projectile.scale, direction, 0); + } } }