Sorry Xyk, it was a holdout.

This commit is contained in:
Memes committed 2024-05-17 22:23:27 +02:00
1 parent c8274f4a97
commit 7ae7ace8d1
2 files changed
+15 -7

No files matched your search

+2 -2
View File
@@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic
Item.UseSound = null;
Item.autoReuse = true;
Item.shootSpeed = 25f;
Item.shoot = ModContent.ProjectileType<WingmanGun>();
Item.shoot = ModContent.ProjectileType<WingmanHoldout>();
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<WingmanGun>(), damage, knockback, player.whoAmI, 0, 0, i == 0 ? 1 : -1);
Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType<WingmanHoldout>(), damage, knockback, player.whoAmI, 0, 0, i == 0 ? 1 : -1);
holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero);
}
@@ -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<Wingman>();
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);