From 7ae7ace8d1fc0d8a2bd749cbd025a5c575103d9c Mon Sep 17 00:00:00 2001 From: Memes Date: Fri, 17 May 2024 22:23:27 +0200 Subject: [PATCH] Sorry Xyk, it was a holdout. --- Items/Weapons/Magic/Wingman.cs | 4 ++-- .../Magic/{WingmanGun.cs => WingmanHoldout.cs} | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) rename Projectiles/Magic/{WingmanGun.cs => WingmanHoldout.cs} (96%) diff --git a/Items/Weapons/Magic/Wingman.cs b/Items/Weapons/Magic/Wingman.cs index dd721ceff9..b4960be3d1 100644 --- a/Items/Weapons/Magic/Wingman.cs +++ b/Items/Weapons/Magic/Wingman.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.UseSound = null; Item.autoReuse = true; Item.shootSpeed = 25f; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.channel = true; } @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Magic { for (int i = 0; i < 2; i++) { - Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 0, i == 0 ? 1 : -1); + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 0, i == 0 ? 1 : -1); holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); } diff --git a/Projectiles/Magic/WingmanGun.cs b/Projectiles/Magic/WingmanHoldout.cs similarity index 96% rename from Projectiles/Magic/WingmanGun.cs rename to Projectiles/Magic/WingmanHoldout.cs index a5edea2490..7a7d41eec1 100644 --- a/Projectiles/Magic/WingmanGun.cs +++ b/Projectiles/Magic/WingmanHoldout.cs @@ -14,7 +14,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class WingmanGun : ModProjectile + public class WingmanHoldout : ModProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Magic/Wingman"; @@ -54,8 +54,9 @@ namespace CalamityMod.Projectiles.Magic Lighting.AddLight(Projectile.Center, StaticEffectsColor.ToVector3() * 0.2f); if (time == 0) - MovingUp = Projectile.ai[2] == 1; - + { + MovingUp = Projectile.ai[2] == 1 ? true : false; + } firingDelay--; Item heldItem = Owner.ActiveItem(); @@ -64,7 +65,9 @@ namespace CalamityMod.Projectiles.Magic Projectile.damage = heldItem is null ? 0 : Owner.GetWeaponDamage(heldItem); if (PostFireCooldown > 0) + { PostFiringCooldown(); + } Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(-0.05f * Projectile.direction) * 12f; // If there's no player, or the player is the server, or the owner's stunned, there'll be no holdout. @@ -78,7 +81,7 @@ namespace CalamityMod.Projectiles.Magic // If the player's pressing RMB, it'll shoot the grenade. if (Owner.Calamity().mouseRight) { - if (Owner.CheckMana(Owner.ActiveItem(), (int)(heldItem.mana * Owner.manaCost) * 5, true, false)) + if ((Owner.CheckMana(Owner.ActiveItem(), (int)(heldItem.mana * Owner.manaCost) * 5, true, false))) { Shoot(true); PostFireCooldown = 35 + 55 * Utils.GetLerpValue(10, 40, FiringTime, true); @@ -97,7 +100,7 @@ namespace CalamityMod.Projectiles.Magic } else if (ShootingTimer >= FiringTime) { - if (Owner.CheckMana(Owner.ActiveItem(), -1, true, false)) + if (Owner.CheckMana(Owner.ActiveItem(), (int)(heldItem.mana * Owner.manaCost), true, false)) { Shoot(false); ShootingTimer = 0; @@ -116,6 +119,7 @@ namespace CalamityMod.Projectiles.Magic } ShootingTimer = 0; } + } } @@ -164,6 +168,10 @@ namespace CalamityMod.Projectiles.Magic Projectile.spriteDirection = Projectile.direction = direction; Owner.ChangeDir(direction); + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = Owner.itemAnimation = 2; + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); + float armRotation = (Projectile.rotation - MathHelper.PiOver2); // -Pi/2 because the arms rotation starts with arms pointing down. if (Projectile.ai[2] == 1) Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, armRotation);