From e8002648c830569b21fbe01d5cb5a4aafa04538d Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <142704082+CongratsIsTrash@users.noreply.github.com> Date: Mon, 28 Aug 2023 20:23:58 -0400 Subject: [PATCH] Flarewing Bow balance, including the bat functionality I swear to god if this breaks the mod for the 20th time today --- Items/Weapons/Ranged/FlarewingBow.cs | 8 ++--- Projectiles/Ranged/FlareBat.cs | 48 ++++++++++++++++++---------- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/Items/Weapons/Ranged/FlarewingBow.cs b/Items/Weapons/Ranged/FlarewingBow.cs index 9e88e86d1b..98acdea737 100644 --- a/Items/Weapons/Ranged/FlarewingBow.cs +++ b/Items/Weapons/Ranged/FlarewingBow.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 17; + Item.damage = 28; Item.DamageType = DamageClass.Ranged; Item.width = 40; Item.height = 72; @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.UseSound = SoundID.Item5; Item.autoReuse = true; Item.shoot = ProjectileID.WoodenArrowFriendly; - Item.shootSpeed = 16f; + Item.shootSpeed = 20f; Item.useAmmo = AmmoID.Arrow; Item.Calamity().canFirePointBlankShots = true; } @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num117 = 0.314159274f; - int num118 = 4; + int num118 = 3; Vector2 vector7 = velocity; vector7.Normalize(); vector7 *= 50f; @@ -70,7 +70,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(5). AddIngredient(ItemID.LivingFireBlock, 50). AddIngredient(ItemID.Obsidian, 10). - AddTile(TileID.MythrilAnvil). + AddTile(TileID.Anvils). Register(); } } diff --git a/Projectiles/Ranged/FlareBat.cs b/Projectiles/Ranged/FlareBat.cs index cb08fbbdb3..69a385bc9b 100644 --- a/Projectiles/Ranged/FlareBat.cs +++ b/Projectiles/Ranged/FlareBat.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.height = 24; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = 3; + Projectile.penetrate = 2; Projectile.timeLeft = 300; Projectile.light = 0.25f; Projectile.usesLocalNPCImmunity = true; @@ -64,34 +64,48 @@ namespace CalamityMod.Projectiles.Ranged } Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) * Projectile.direction; - } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.penetrate--; - if (Projectile.penetrate <= 0) + if (Projectile.localAI[0] > 0f) + Projectile.localAI[0]--; + + // Makes the bat home onto enemies after piercing once; this is just the HomeInOnNPC util without the extra update shenanigans + if (Projectile.penetrate == 1 && Projectile.localAI[0] <= 0f) { - Projectile.Kill(); - } - else - { - if (Projectile.velocity.X != oldVelocity.X) + if (!Projectile.friendly) + return; + + Vector2 destination = Projectile.Center; + float maxDistance = 300; + bool locatedTarget = false; + + // Find a target + for (int i = 0; i < Main.maxNPCs; i++) { - Projectile.velocity.X = -oldVelocity.X; + float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2); + if (!Main.npc[i].CanBeChasedBy(Projectile, false) || !Projectile.WithinRange(Main.npc[i].Center, maxDistance + extraDistance)) + continue; + + if (Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + { + destination = Main.npc[i].Center; + locatedTarget = true; + break; + } } - if (Projectile.velocity.Y != oldVelocity.Y) + + if (locatedTarget) { - Projectile.velocity.Y = -oldVelocity.Y; + Vector2 homeDirection = (destination - Projectile.Center).SafeNormalize(Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * 20f + homeDirection * 12f) / (20f + 1f); } } - return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.OnFire3, 480); - - Projectile.Kill(); + Projectile.localAI[0] = 10f; + Projectile.damage /= 2; } public override void OnHitPlayer(Player target, Player.HurtInfo info)