diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index f13faa6246..6e39e51774 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -2974,6 +2974,9 @@ namespace CalamityMod.CalPlayer #endregion #region Screen Position Movements + + float HalleyScopeLerp = 0; + bool HalleyToggle = false; public override void ModifyScreenPosition() { // CIT 08FEB2025: Photosensitivity config also disables screenshake @@ -2983,6 +2986,19 @@ namespace CalamityMod.CalPlayer Main.screenPosition += Main.rand.NextVector2Circular(GeneralScreenShakePower * CalamityClientConfig.Instance.ScreenshakePower, GeneralScreenShakePower * CalamityClientConfig.Instance.ScreenshakePower); GeneralScreenShakePower = MathHelper.Clamp(GeneralScreenShakePower - 0.185f, 0f, 20f * CalamityClientConfig.Instance.ScreenshakePower); + + if (Player.HeldItem.type != ModContent.ItemType()) + HalleyToggle = false; + else if (Player.HeldItem.JustPressedKeybind()) + HalleyToggle = !HalleyToggle; + + HalleyScopeLerp = MathHelper.Clamp(HalleyScopeLerp + (HalleyToggle ? 0.05f : -0.05f), 0, 1); + if (HalleyScopeLerp > 0) + { + var screenSize = new Vector2(Main.screenWidth, Main.screenHeight); + Vector2 center = Main.screenPosition + screenSize * 0.5f; + Main.screenPosition -= (Vector2.Clamp((center - Main.MouseWorld) / screenSize, new(-0.5f), new(0.5f)) / Main.GameZoomTarget * MathHelper.SmoothStep(0, 1, HalleyScopeLerp)) * new Vector2(1920, 1200) * 0.9f; + } } #endregion diff --git a/Items/Weapons/Melee/ArkoftheCosmos.cs b/Items/Weapons/Melee/ArkoftheCosmos.cs index c119913376..528419da7f 100644 --- a/Items/Weapons/Melee/ArkoftheCosmos.cs +++ b/Items/Weapons/Melee/ArkoftheCosmos.cs @@ -10,6 +10,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameInput; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -22,11 +23,6 @@ namespace CalamityMod.Items.Weapons.Melee public float Combo = 0f; public float Charge = 0f; - // Frame window for double right click to snip. - // The right click item activation takes 3 frames, so the frame window is frame 3 to frame 11. - public static int DoubleRightClickFrames = 11; - private int rmbFrames = 0; - public static float NeedleDamageMultiplier = 0.7f; //Damage on the non-homing needle projectile public static float MaxThrowReach = 760; public static float SnapDamageMultiplier = 1.2f; //Extra damage from making the scissors snap @@ -68,9 +64,14 @@ namespace CalamityMod.Items.Weapons.Melee var blastTooltip = tooltips.FirstOrDefault(x => x.Text.Contains("[BLAST]") && x.Mod == "Terraria"); if (blastTooltip != null) { - blastTooltip.Text = Lang.SupportGlyphs(this.GetLocalizedValue("BlastInfo")); + var key = Item.GetDynamicModHotkey().GetAssignedKeysOrEmpty(PlayerInput.CurrentInputMode); + if (key.Count > 0) + blastTooltip.Text = Lang.SupportGlyphs(this.GetLocalizedValue("BlastInfoKeybind")); + else + blastTooltip.Text = Lang.SupportGlyphs(this.GetLocalizedValue("BlastInfo")); blastTooltip.OverrideColor = Color.Lerp(Color.HotPink, Color.Crimson, 0.5f + (float)Math.Sin(Main.GlobalTimeWrappedHourly) * 0.625f); } + tooltips.IntegrateDynamicHotkey(Item); } public override void SetDefaults() @@ -100,14 +101,30 @@ namespace CalamityMod.Items.Weapons.Melee { player.Calamity().mouseWorldListener = true; - if (rmbFrames > 0) - --rmbFrames; - if (CanUseItem(player) && Combo != 4) Item.channel = false; if (Combo == 4) Item.channel = true; + + if (Main.myPlayer == player.whoAmI && Item.CurrentlyPressingKeybind() && Charge > 0) + { + Projectile blast = Main.projectile.FirstOrDefault(p => p.active && p.owner == player.whoAmI && p.type == ProjectileType(), null); + + if (blast == null) + { + float speed = Item.shootSpeed; + int dmg = (int)player.GetTotalDamage(Item.DamageType).ApplyTo(Item.damage); + Vector2 pos = player.Center; + int shoot = Item.shoot; + float kb = Item.knockBack; + var velocity = player.DirectionTo(Main.MouseWorld) * Item.shootSpeed; + PlayerLoader.ModifyShootStats(player, Item, ref pos, ref velocity, ref shoot, ref dmg, ref kb); + float angle = velocity.ToRotation(); + Projectile.NewProjectile(player.GetSource_ItemUse(Item), player.Center + angle.ToRotationVector2() * 90f, velocity, ProjectileType(), (int)(dmg * BlastDamageMultiplier), 0, player.whoAmI, Charge); + Charge = 0; + } + } } public override bool CanUseItem(Player player) @@ -122,15 +139,16 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2) { - // If it has been less than N frames since the last alt function use, this is a double right click. - bool rightMouseDoubleClick = rmbFrames > 0; // Check if a parry holdout or blast is already present. Projectile parrier = Main.projectile.FirstOrDefault(p => p.active && p.owner == player.whoAmI && p.type == ProjectileType(), null); Projectile blast = Main.projectile.FirstOrDefault(p => p.active && p.owner == player.whoAmI && p.type == ProjectileType(), null); - bool canExecuteBlast = rightMouseDoubleClick && Charge > 0 && blast is null; + bool canExecuteBlast = Charge > 0 && blast is null; bool canExecuteParry = parrier is null && !canExecuteBlast; + //Disable blast usage if hotkey is bound + if (Item.GetDynamicModHotkey().GetAssignedKeysOrEmpty(PlayerInput.CurrentInputMode).Count > 0) + canExecuteBlast = false; // The blast is checked first, so that it overrides the first right click triggering a parry. Blasts delete any active parry holdouts on use. if (canExecuteBlast) @@ -139,13 +157,6 @@ namespace CalamityMod.Items.Weapons.Melee float angle = velocity.ToRotation(); Projectile.NewProjectile(source, player.Center + angle.ToRotationVector2() * 90f, velocity, ProjectileType(), (int)(damage * BlastDamageMultiplier), 0, player.whoAmI, Charge); Charge = 0; - - // If the parry holdout has existed for very few frames, just delete it. - if (parrier is not null && parrier.timeLeft > ArkoftheCosmosParryHoldout.MaxTime - DoubleRightClickFrames) - { - parrier.active = false; - parrier.netUpdate = true; - } } // If the blast cannot be executed, then the parry is executed, assuming no existing holdout is present. @@ -162,9 +173,6 @@ namespace CalamityMod.Items.Weapons.Melee if (!anyArkParryExists) Projectile.NewProjectile(source, player.Center, velocity, ProjectileType(), damage, 0, player.whoAmI, 0, 0); } - - // Regardless of what transpires from the right click, set the double right click frames appropriately. - rmbFrames = DoubleRightClickFrames; return false; } diff --git a/Items/Weapons/Ranged/HalleysInferno.cs b/Items/Weapons/Ranged/HalleysInferno.cs index 791aaa307d..baf7cbfcfe 100644 --- a/Items/Weapons/Ranged/HalleysInferno.cs +++ b/Items/Weapons/Ranged/HalleysInferno.cs @@ -1,4 +1,5 @@ -using System.Linq; +using System.Collections.Generic; +using System.Linq; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Ranged; @@ -20,13 +21,13 @@ 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 MaxStarburstPerStar => 0.25f; public static float LostAccuracyPerMiss => 4; public static float MaxAccuracy => 50; - public static float StarburstDmgMult => 2.5f; + public static float StarburstDmgMult => 2f; - public static float StarburstVelMult => 0.75f; + public static float StarburstVelMult => 1f; public override void SetDefaults() { Item.width = 84; @@ -59,6 +60,8 @@ namespace CalamityMod.Items.Weapons.Ranged ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } + public override void ModifyTooltips(List tooltips) => tooltips.IntegrateDynamicHotkey(Item); + public override void HoldItem(Player player) { if (player.mount.Type == MountID.Drill) diff --git a/Items/Weapons/Summon/IgneousExaltation.cs b/Items/Weapons/Summon/IgneousExaltation.cs index 3b829ede05..eedd2bb6f4 100644 --- a/Items/Weapons/Summon/IgneousExaltation.cs +++ b/Items/Weapons/Summon/IgneousExaltation.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.Summon; +using System.Collections.Generic; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Materials; using CalamityMod.Packets; using CalamityMod.Projectiles.Summon; @@ -61,20 +62,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - public override bool CanRightClick() + public override void HoldItem(Player player) { - if (!Main.keyState.PressingShift()) - return false; - return true; + if (Main.myPlayer == player.whoAmI && Item.JustPressedKeybind()) + { + Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections = !Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections; + if (Main.netMode != NetmodeID.SinglePlayer) + ExaltationDirectionSyncPacket.Send(Main.LocalPlayer.Calamity()); + } } - public override void RightClick(Player player) - { - Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections = !Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections; - if (Main.netMode != NetmodeID.SinglePlayer) - ExaltationDirectionSyncPacket.Send(Main.LocalPlayer.Calamity()); - } - - public override bool ConsumeItem(Player player) => false; + public override void ModifyTooltips(List tooltips) => tooltips.IntegrateDynamicHotkey(Item); 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/Summon/ViridVanguard.cs b/Items/Weapons/Summon/ViridVanguard.cs index 82968c717c..6efbba9703 100644 --- a/Items/Weapons/Summon/ViridVanguard.cs +++ b/Items/Weapons/Summon/ViridVanguard.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.Summon; +using System.Collections.Generic; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Materials; using CalamityMod.Packets; using CalamityMod.Projectiles.Summon; @@ -92,21 +93,17 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.rare = ModContent.RarityType(); } - - public override bool CanRightClick() + public override void HoldItem(Player player) { - if (!Main.keyState.PressingShift()) - return false; - return true; - } - public override void RightClick(Player player) - { - Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections = !Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections; - if (Main.netMode != NetmodeID.SinglePlayer) - ExaltationDirectionSyncPacket.Send(Main.LocalPlayer.Calamity()); + if (Main.myPlayer == player.whoAmI && Item.JustPressedKeybind()) + { + Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections = !Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections; + if (Main.netMode != NetmodeID.SinglePlayer) + ExaltationDirectionSyncPacket.Send(Main.LocalPlayer.Calamity()); + } } - public override bool ConsumeItem(Player player) => false; + public override void ModifyTooltips(List tooltips) => tooltips.IntegrateDynamicHotkey(Item); public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { diff --git a/Items/Weapons/Summon/VoidEaterMarionette.cs b/Items/Weapons/Summon/VoidEaterMarionette.cs index f74c703f3c..e3266817a6 100644 --- a/Items/Weapons/Summon/VoidEaterMarionette.cs +++ b/Items/Weapons/Summon/VoidEaterMarionette.cs @@ -1,6 +1,8 @@ -using System.Linq; +using System.Collections.Generic; +using System.Linq; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Summon; +using CalamityMod.Packets; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Systems.Collections; @@ -41,22 +43,25 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; Item.shootSpeed = 8; } - public override bool CanRightClick() + + public override void HoldItem(Player player) { - if (!Main.keyState.PressingShift()) - return false; - return true; - } - public override void RightClick(Player player) - { - if (player.ownedProjectileCounts[Item.shoot] > 0) + if (Main.myPlayer == player.whoAmI && player.ownedProjectileCounts[Item.shoot] > 0 && Item.JustPressedKeybind()) { var p = Main.projectile.First(x => x.active && x.type == Item.shoot && x.owner == player.whoAmI); - p.ModProjectile().FocusOnFetching = !p.ModProjectile().FocusOnFetching; - p.netUpdate = true; + if (p.ModProjectile is VoidEaterMarionetteProjectile vem) + { + + vem.FocusOnFetching = !vem.FocusOnFetching; + p.netUpdate = true; + if (vem.FocusOnFetching) + CombatText.NewText(player.Hitbox, Color.White, this.GetLocalizedValue("FetchStart"),true); + else + CombatText.NewText(player.Hitbox, Color.White, this.GetLocalizedValue("FetchEnd"), true); + } } } - public override bool ConsumeItem(Player player) => false; + public override void ModifyTooltips(List tooltips) => tooltips.IntegrateDynamicHotkey(Item); public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.ownedProjectileCounts[type] > 0) diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 172e65e32b..d64aec2a46 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -86,7 +86,8 @@ ArkoftheCosmos: { You can also parry projectiles to make them deal 120 less damage for a short period Parrying will empower the next 16 swings of the sword ''' - BlastInfo: Double with charges available to cause a Big Rip in spacetime and consume all charges + BlastInfo: with charges available to cause a Big Rip in spacetime and consume all charges + BlastInfoKeybind: Press [KEY] with charges available to cause a Big Rip in spacetime and consume all charges } ArkoftheElements: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 6239730850..a90286b15b 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -547,6 +547,7 @@ HalleysInferno: { Fires a burst of intensely concentrated lunar fire jets to rapid-fire Starbursts that inflict [cbuff:CalamityMod/Voidfrost] Generates Starbursts when hitting enemies, depending on your accuracy + Press [KEY] to toggle long-range scope mode Uses gel for ammo 'Halley arrived sooner than expected' ''' diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index bab713548b..d48bb3c7f8 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -491,7 +491,7 @@ IgneousExaltation: { Summons an Igneous blade that orbits around you When your minion slots are full, again to launch all blades towards the cursor This ability has a two-second cooldown that requires holding this item - Shift- this item in your inventory to change the rotation direction + Press [KEY] while holding this item to change the rotation direction ''' } @@ -847,7 +847,7 @@ ViridVanguard: { All weapons inflict [cbuff:CalamityMod/SagePoison], which becomes more powerful the more weapons are summoned When all minion slots are full, again to spin up a flurry of slashes aimed at your cursor This ability has a five-second cooldown that requires holding this item - Shift- this item in your inventory to change the rotation direction + Press [KEY] while holding this item to change the rotation direction ''' } @@ -871,8 +871,10 @@ VoidEaterMarionette: { Repeated summons increase the length and power of the Devourer The Devourer attacks with [ceffect/dog:Divinity Devourer], [ceffect/dog:Faith Incinerator] and [ceffect/dog:Ultracosmic Maelstrom] Can play fetch with dropped items - Shift- this item in your inventory when the Devourer has been spawned to prioritize fetching + Press [KEY] while holding this item when the Devourer has been spawned to prioritize fetching ''' + FetchStart: Go fetch! + FetchEnd: Get 'em! } WarloksMoonFist: { diff --git a/Projectiles/Ranged/HalleysInfernoHoldout.cs b/Projectiles/Ranged/HalleysInfernoHoldout.cs index 9d09b629f1..c76f38e264 100644 --- a/Projectiles/Ranged/HalleysInfernoHoldout.cs +++ b/Projectiles/Ranged/HalleysInfernoHoldout.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Ranged { if (ShotTimer <= 0 && Owner.Calamity().AvaliableStarburst > 1) { - ShotTimer = 4; + ShotTimer = 3; var spawnpos = Projectile.Center; var dir = spawnpos.DirectionTo(Main.MouseWorld); var color = Main.rand.Next(1, 7); @@ -97,10 +97,10 @@ namespace CalamityMod.Projectiles.Ranged for (var i = 0; i < 5; i++) GeneralParticleHandler.SpawnParticle(new GlowSparkParticle(spawnpos + dir * 36, (dir * Halley.shootSpeed).RotatedByRandom(0.75f) * Main.rand.NextFloat(0.5f, 1.5f), false, 7, 0.02f, drawColor, new Vector2(0.5f, 1f))); if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Owner.GetSource_ItemUse_WithPotentialAmmo(Halley, AmmoID.Gel), spawnpos + dir * 16,dir * Halley.shootSpeed * HalleysInferno.StarburstVelMult, ModContent.ProjectileType(), (int)(Owner.GetDamage(DamageClass.Ranged).ApplyTo(Halley.damage) * HalleysInferno.StarburstDmgMult), Halley.knockBack, Projectile.owner, color); - Owner.Calamity().StratusStarburst -= 2; + Projectile.NewProjectile(Owner.GetSource_ItemUse_WithPotentialAmmo(Halley, AmmoID.Gel), spawnpos + dir * 8 + dir.RotatedByRandom(MathHelper.TwoPi)*4,dir * Halley.shootSpeed * HalleysInferno.StarburstVelMult, ModContent.ProjectileType(), (int)(Owner.GetDamage(DamageClass.Ranged).ApplyTo(Halley.damage) * HalleysInferno.StarburstDmgMult), Halley.knockBack, Projectile.owner, color); + Owner.Calamity().StratusStarburst -= 1; SoundEngine.PlaySound(HalleysInferno.ShootSound); - RecoilAmount = 4; + RecoilAmount = 16; } } RecoilAmount *= 0.75f; diff --git a/Projectiles/Ranged/HalleysStarburst.cs b/Projectiles/Ranged/HalleysStarburst.cs index 41e48151e3..afde077a30 100644 --- a/Projectiles/Ranged/HalleysStarburst.cs +++ b/Projectiles/Ranged/HalleysStarburst.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.MaxUpdates = 6; + Projectile.MaxUpdates = 9; Projectile.timeLeft = 60 * Projectile.MaxUpdates; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1;