diff --git a/Items/Weapons/Ranged/RCCAnihilator.cs b/Items/Weapons/Ranged/RCCAnihilator.cs index 3c813cd8a1..a57f4f1fe9 100644 --- a/Items/Weapons/Ranged/RCCAnihilator.cs +++ b/Items/Weapons/Ranged/RCCAnihilator.cs @@ -8,11 +8,14 @@ using System.Collections.Generic; using Terraria.Graphics.Shaders; using Microsoft.Xna.Framework.Graphics; using CalamityMod.Projectiles.Ranged; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Ranged { public class RCCAnihilator : ModItem - { + { + public override bool CloneNewInstances => true; + public bool RCChannel = false; public const int MaxBolts = 6; public override void SetStaticDefaults() { @@ -40,12 +43,24 @@ namespace CalamityMod.Items.Weapons.Ranged item.shootSpeed = 15f; item.useAmmo = AmmoID.Arrow; } + public override ModItem Clone(Item item) + { + var clone = base.Clone(item); - public override string Texture => "CalamityMod/Items/Weapons/Ranged/ClockworkBow"; + if (Main.mouseItem.type == ItemType()) + item.modItem.HoldItem(Main.player[Main.myPlayer]); + + (clone as RCCAnihilator).RCChannel = (item.modItem as RCCAnihilator).RCChannel; + + return clone; + } + + public override string Texture => "CalamityMod/Projectiles/Ranged/RCCHoldout"; //What. Huh. HUH? you got a problem with my file organization in my proof of concept HUH???? HUH???? public override bool AltFunctionUse(Player player) { return true; } + public override bool CanUseItem(Player player) { @@ -57,19 +72,25 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - if (player.altFunctionUse == 2) + + if (player.altFunctionUse == 2 && !RCChannel) { Vector2 shootVelocity = new Vector2(speedX, speedY); Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); // Charge-up. Done via a holdout projectile. Projectile.NewProjectile(position, shootDirection, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + RCChannel = true; return false; } else //This is just a test thing { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 1f, 0f); + Vector2 shootVelocity = new Vector2(speedX, speedY); + Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); + // Charge-up. Done via a holdout projectile. + Projectile.NewProjectile(position, shootDirection, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + RCChannel = false; return false; - } + } } } } diff --git a/Projectiles/Ranged/RCCHoldout.cs b/Projectiles/Ranged/RCCHoldout.cs index 4e9ae8c363..d00838a6e6 100644 --- a/Projectiles/Ranged/RCCHoldout.cs +++ b/Projectiles/Ranged/RCCHoldout.cs @@ -6,7 +6,7 @@ using Terraria.ModLoader; using Terraria.Graphics.Shaders; using Microsoft.Xna.Framework.Graphics; using CalamityMod.Items.Weapons.Ranged; - +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Ranged { @@ -15,13 +15,13 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - DisplayName.SetDefault("Rending Bolt"); + DisplayName.SetDefault("Rending Bow"); //Main.projFrames[projectile.type] = 9; might animate the bow's string getting drawn but not rn } private Player Owner => Main.player[projectile.owner]; - private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed; + private bool OwnerCanShoot => Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed && Owner.HeldItem.type == ItemType() && (Owner.HeldItem.modItem as RCCAnihilator).RCChannel; private ref float CurrentChargingFrames => ref projectile.ai[0]; private ref float LoadedBolts => ref projectile.ai[1]; private ref float FramesToLoadBolt => ref projectile.localAI[0]; @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Ranged private float angularSpread = MathHelper.ToRadians(16); //public override string Texture => "CalamityMod/Projectiles/Ranged/ClockworkBowHoldout"; - public override string Texture => "CalamityMod/Items/Weapons/Ranged/ClockworkBow"; + public override string Texture => "CalamityMod/Projectiles/Ranged/RCCHoldout"; public override void SetDefaults() { @@ -55,6 +55,7 @@ namespace CalamityMod.Projectiles.Ranged if (LoadedBolts <= 0f) //If theres no arrows to shoot { projectile.Kill(); + (Owner.HeldItem.modItem as RCCAnihilator).RCChannel = false; return; } // Fire the spread of arrows @@ -81,9 +82,9 @@ namespace CalamityMod.Projectiles.Ranged ++LoadedBolts; if (LoadedBolts % 2 == 0) - CombatText.NewText(Owner.Hitbox, new Color(155, 255, 255), "Tock", true); + CombatText.NewText(Owner.Hitbox, new Color(163, 90, 237), "H34Ds", true); else - CombatText.NewText(Owner.Hitbox, new Color(255, 200, 100), "Tick", true); + CombatText.NewText(Owner.Hitbox, new Color(255, 235, 155), "8R8K", true); FramesToLoadBolt *= 0.950f; @@ -100,6 +101,9 @@ namespace CalamityMod.Projectiles.Ranged UpdateProjectileHeldVariables(armPosition); ManipulatePlayerVariables(); + + if (!Main.mouseRight) + (Owner.HeldItem.modItem as RCCAnihilator).RCChannel = false; } public void UnloadBolts(Vector2 tipPosition) @@ -228,7 +232,7 @@ namespace CalamityMod.Projectiles.Ranged } Color Transparency = Color.White * (1 - Shift); - var BoltTexture = ModContent.GetTexture("CalamityMod/Projectiles/Ranged/PrecisionBolt"); + var BoltTexture = ModContent.GetTexture("CalamityMod/Projectiles/Ranged/RendingBolt"); Vector2 PointingTo = new Vector2((float)Math.Cos(projectile.rotation + BoltAngle), (float)Math.Sin(projectile.rotation + BoltAngle)); //It's called trigonometry we do a little trigonometry Vector2 ShiftDown = PointingTo.RotatedBy(-MathHelper.PiOver2); float FlipFactor = projectile.direction == -1 ? MathHelper.Pi : 0f; diff --git a/Projectiles/Ranged/RCCHoldout.png b/Projectiles/Ranged/RCCHoldout.png new file mode 100644 index 0000000000..7e87dcb941 Binary files /dev/null and b/Projectiles/Ranged/RCCHoldout.png differ diff --git a/Projectiles/Ranged/RendingBolt.png b/Projectiles/Ranged/RendingBolt.png new file mode 100644 index 0000000000..9fad478a0a Binary files /dev/null and b/Projectiles/Ranged/RendingBolt.png differ