diff --git a/Items/Weapons/Ranged/HeavenlyGale.cs b/Items/Weapons/Ranged/HeavenlyGale.cs index c03094962f..8fad30e270 100644 --- a/Items/Weapons/Ranged/HeavenlyGale.cs +++ b/Items/Weapons/Ranged/HeavenlyGale.cs @@ -2,6 +2,7 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -48,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.damage = 300; Item.DamageType = DamageClass.Ranged; Item.width = 138; - Item.height = 138; + Item.height = 176; Item.useAnimation = Item.useTime = ArrowShootTime; // 40 Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -68,6 +69,9 @@ namespace CalamityMod.Items.Weapons.Ranged // Shoot via the projectile only public override bool CanShoot(Player player) => false; + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + => Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Ranged/HeavenlyGaleGlow").Value); + public override void AddRecipes() { CreateRecipe(). @@ -80,4 +84,4 @@ namespace CalamityMod.Items.Weapons.Ranged Register(); } } -} +} \ No newline at end of file diff --git a/Items/Weapons/Ranged/HeavenlyGale.png b/Items/Weapons/Ranged/HeavenlyGale.png index 4b03c9a8ea..d57ee9e59f 100644 Binary files a/Items/Weapons/Ranged/HeavenlyGale.png and b/Items/Weapons/Ranged/HeavenlyGale.png differ diff --git a/Items/Weapons/Ranged/HeavenlyGaleGlow.png b/Items/Weapons/Ranged/HeavenlyGaleGlow.png new file mode 100644 index 0000000000..e5fbbc09ae Binary files /dev/null and b/Items/Weapons/Ranged/HeavenlyGaleGlow.png differ diff --git a/Projectiles/Ranged/HeavenlyGaleProj.cs b/Projectiles/Ranged/HeavenlyGaleProj.cs index 7f81efe0a9..a29fb982f7 100644 --- a/Projectiles/Ranged/HeavenlyGaleProj.cs +++ b/Projectiles/Ranged/HeavenlyGaleProj.cs @@ -27,29 +27,27 @@ namespace CalamityMod.Projectiles.Ranged return firstHalf + secondHalf; } } + public float StringReelbackDistance => Projectile.width * StringReelbackInterpolant * 0.3f; + + // Where the string should go, relative to the center of the projectile + public Vector2 topStringOffset => new Vector2(-40f, -56f); + public Vector2 bottomStringOffset => new Vector2(-40f, 46f); + public float StringHalfHeight => (Math.Abs(topStringOffset.Y) + Math.Abs(bottomStringOffset.Y)) * 0.5f; public float ChargeupInterpolant => Utils.GetLerpValue(HeavenlyGale.ShootDelay, HeavenlyGale.MaxChargeTime, ChargeTimer, true); - - public float StringHalfHeight => Projectile.height * 0.36f; - - public float StringReelbackDistance => Projectile.width * StringReelbackInterpolant * 0.25f; - public ref float CurrentChargingFrames => ref Projectile.ai[0]; - public ref float ChargeTimer => ref Projectile.ai[1]; public ref float ShootDelay => ref Projectile.localAI[0]; public override int AssociatedItemID => ModContent.ItemType(); - public override int IntendedProjectileType => ModContent.ProjectileType(); public override void SetStaticDefaults() => DisplayName.SetDefault("Heavenly Gale"); public override void SetDefaults() { - Projectile.width = 138; - Projectile.height = 138; + Projectile.width = Projectile.height = 176; Projectile.friendly = true; Projectile.penetrate = -1; Projectile.tileCollide = false; @@ -173,7 +171,7 @@ namespace CalamityMod.Projectiles.Ranged } } - Projectile.position = armPosition - Projectile.Size * 0.5f + Projectile.velocity.SafeNormalize(Vector2.UnitY) * 36f; + Projectile.position = armPosition - Projectile.Size * 0.5f + Projectile.velocity.SafeNormalize(Vector2.UnitY) * 44f; Projectile.rotation = Projectile.velocity.ToRotation(); Projectile.spriteDirection = Projectile.direction; Projectile.timeLeft = 2; @@ -200,16 +198,14 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { Texture2D texture = ModContent.Request(Texture).Value; + Texture2D textureGlow = ModContent.Request("CalamityMod/Projectiles/Ranged/HeavenlyGaleProjGlow").Value; Vector2 origin = texture.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; // Draw the string of the bow. It reels back in the initial frames. - float stringNeckOffset = 40f; - Vector2 aimDirection = Projectile.rotation.ToRotationVector2(); - Vector2 center = Projectile.Center - aimDirection * 12f; - Vector2 topOfBow = center + Vector2.UnitY.RotatedBy(Projectile.rotation) * StringHalfHeight; - Vector2 bottomOfBow = center - Vector2.UnitY.RotatedBy(Projectile.rotation) * StringHalfHeight; - Vector2 endOfString = center - aimDirection * (StringReelbackDistance + (1f - StringReelbackInterpolant) * stringNeckOffset * 0.5f); + Vector2 topOfBow = Projectile.Center + Vector2.UnitX.RotatedBy(Projectile.rotation + topStringOffset.ToRotation()) * topStringOffset.Length(); + Vector2 bottomOfBow = Projectile.Center + Vector2.UnitX.RotatedBy(Projectile.rotation + bottomStringOffset.ToRotation()) * bottomStringOffset.Length(); + Vector2 endOfString = Projectile.Center - Projectile.rotation.ToRotationVector2() * (StringReelbackDistance + (1f - StringReelbackInterpolant) * 25f); float chargeOffset = ChargeupInterpolant * Projectile.scale * 3f; Color chargeColor = Color.Lerp(Color.Lime, Color.Cyan, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 7.1f) * 0.5f + 0.5f) * ChargeupInterpolant * 0.6f; @@ -221,10 +217,7 @@ namespace CalamityMod.Projectiles.Ranged { direction = SpriteEffects.FlipHorizontally; rotation += MathHelper.Pi; - topOfBow -= aimDirection * stringNeckOffset; } - else - bottomOfBow -= aimDirection * stringNeckOffset; Color stringColor = new(105, 239, 145); Main.spriteBatch.DrawLineBetter(topOfBow, endOfString, stringColor, 2f); @@ -237,10 +230,11 @@ namespace CalamityMod.Projectiles.Ranged Main.spriteBatch.Draw(texture, drawPosition + drawOffset, null, chargeColor, rotation, origin, Projectile.scale, direction, 0f); } Main.spriteBatch.Draw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), rotation, origin, Projectile.scale, direction, 0f); + Main.spriteBatch.Draw(textureGlow, drawPosition, null, Color.White, rotation, origin, Projectile.scale, direction, 0f); return false; } // The bow itself should not do contact damage. public override bool? CanDamage() => false; } -} +} \ No newline at end of file diff --git a/Projectiles/Ranged/HeavenlyGaleProj.png b/Projectiles/Ranged/HeavenlyGaleProj.png index ba3ff0c8a2..cdf87233cb 100644 Binary files a/Projectiles/Ranged/HeavenlyGaleProj.png and b/Projectiles/Ranged/HeavenlyGaleProj.png differ diff --git a/Projectiles/Ranged/HeavenlyGaleProjGlow.png b/Projectiles/Ranged/HeavenlyGaleProjGlow.png new file mode 100644 index 0000000000..0e0a3b2e25 Binary files /dev/null and b/Projectiles/Ranged/HeavenlyGaleProjGlow.png differ