From ca4971a57caee63cab46fd23fcc7b739d214aaa2 Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Sat, 2 Nov 2019 15:32:14 -0500 Subject: [PATCH] Bouncing Betty and Bandit sprite fix --- Items/Weapons/Rogue/BouncingBetty.cs | 51 ++++++++ Items/Weapons/Rogue/BouncingBetty.png | Bin 0 -> 357 bytes NPCs/TownNPCs/THIEF.cs | 20 +++- Projectiles/Rogue/BlastBarrelProjectile.cs | 2 +- Projectiles/Rogue/BouncingBettyProjectile.cs | 112 ++++++++++++++++++ Projectiles/Rogue/BouncingBettyProjectile.png | Bin 0 -> 357 bytes Projectiles/Rogue/BouncingBettyShrapnel.cs | 37 ++++++ Projectiles/Rogue/BouncingBettyShrapnel.png | Bin 0 -> 224 bytes 8 files changed, 215 insertions(+), 7 deletions(-) create mode 100644 Items/Weapons/Rogue/BouncingBetty.cs create mode 100644 Items/Weapons/Rogue/BouncingBetty.png create mode 100644 Projectiles/Rogue/BouncingBettyProjectile.cs create mode 100644 Projectiles/Rogue/BouncingBettyProjectile.png create mode 100644 Projectiles/Rogue/BouncingBettyShrapnel.cs create mode 100644 Projectiles/Rogue/BouncingBettyShrapnel.png diff --git a/Items/Weapons/Rogue/BouncingBetty.cs b/Items/Weapons/Rogue/BouncingBetty.cs new file mode 100644 index 0000000000..37f92918d6 --- /dev/null +++ b/Items/Weapons/Rogue/BouncingBetty.cs @@ -0,0 +1,51 @@ +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Weapons.Rogue +{ + public class BouncingBetty : RogueWeapon + { + public const int BaseDamage = 34; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bouncing Betty"); + Tooltip.SetDefault("Act like grenades, but bounce on explosion\n" + + "Stealth Strike Effect: Explodes into a violent blast of fire and shrapnel on bounce"); + } + + public override void SafeSetDefaults() + { + item.damage = BaseDamage; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 12; + item.useTime = 12; + item.useStyle = ItemUseStyleID.SwingThrow; + item.knockBack = 3f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.width = 16; + item.height = 22; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 4, 0); + item.rare = 5; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 15f; + item.Calamity().rogue = true; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 velocity = new Vector2(speedX, speedY); + float strikeValue = player.Calamity().StealthStrikeAvailable().ToInt(); //0 if false, 1 if true + int projectileIndex = Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, ai1: strikeValue); + if (player.Calamity().StealthStrikeAvailable()) + { + Main.projectile[projectileIndex].Calamity().stealthStrike = strikeValue == 1f; + } + return false; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Rogue/BouncingBetty.png b/Items/Weapons/Rogue/BouncingBetty.png new file mode 100644 index 0000000000000000000000000000000000000000..32d9d0f4f3ee9a5f23bce45f33900e770335fc0a GIT binary patch literal 357 zcmV-r0h<1aP)Px$A4x<(R5*>jlfO%XK^VtB7Ya2r1hr&nSTDRtfnn&}5~70=P2t>7vs;5hTYo?h zv^6&965--53PuisKS+p{+8Q0MAs_Hw-f(!&zSG_D9N*7QDbfNU`bz;&f;5C$et(MUoA^mdK` zSh+|7aDV#(z}YmC((1%ZVuv8)JrL)=wCkjdeQ<*G@|ps0hjk+hkvpsda8()); + shop.item[nextSlot].SetDefaults(ModContent.ItemType()); nextSlot++; - shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - nextSlot++; - }*/ + /*shop.item[nextSlot].SetDefaults(ModContent.ItemType()); + nextSlot++;*/ + } if (NPC.downedPlantBoss) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); diff --git a/Projectiles/Rogue/BlastBarrelProjectile.cs b/Projectiles/Rogue/BlastBarrelProjectile.cs index af359d54b7..33c79ff8d4 100644 --- a/Projectiles/Rogue/BlastBarrelProjectile.cs +++ b/Projectiles/Rogue/BlastBarrelProjectile.cs @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Rogue Main.rand.Next(ProjectileID.MolotovFire, ProjectileID.MolotovFire3 + 1), BlastBarrel.BaseDamage, 1f, projectile.owner); Main.projectile[fireIndex].thrown = false; - Main.projectile[fireIndex].Calamity().rogue = true; + Main.projectile[fireIndex].Calamity().forceRogue = true; Main.projectile[fireIndex].penetrate = -1; Main.projectile[fireIndex].usesLocalNPCImmunity = true; Main.projectile[fireIndex].localNPCHitCooldown = -1; diff --git a/Projectiles/Rogue/BouncingBettyProjectile.cs b/Projectiles/Rogue/BouncingBettyProjectile.cs new file mode 100644 index 0000000000..e654dc437d --- /dev/null +++ b/Projectiles/Rogue/BouncingBettyProjectile.cs @@ -0,0 +1,112 @@ +using CalamityMod.Items.Weapons.Rogue; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class BouncingBettyProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bouncing Betty"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 22; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 600; + projectile.penetrate = 3; + projectile.Calamity().rogue = true; + } + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Point tileCoords = projectile.Bottom.ToTileCoordinates(); + if (Main.tile[tileCoords.X, tileCoords.Y + 1].nactive() && + WorldGen.SolidTile(Main.tile[tileCoords.X, tileCoords.Y + 1]) && + projectile.timeLeft < 575) + { + Main.PlaySound(2, projectile.Center, 14); + //This is definitely not a near copy of the Blast Barrel nosiree :> + bool stealthS = projectile.Calamity().stealthStrike; + int projectileCount = 2; + if (stealthS) + { + projectileCount += 2; + } + for (int i = 0; i < projectileCount; i++) + { + if (Main.rand.NextBool(4)) + { + Vector2 shrapnelVelocity = (Vector2.UnitY * (-16f + Main.rand.NextFloat(-7, 4f))).RotatedByRandom((double)MathHelper.ToRadians(30f)); + Projectile.NewProjectile(projectile.Center, projectile.velocity + shrapnelVelocity, + ModContent.ProjectileType(), BlastBarrel.BaseDamage, 3f, projectile.owner); + } + else + { + Vector2 fireVelocity = (Vector2.UnitY * (-16f + Main.rand.NextFloat(-7, 4f))).RotatedByRandom((double)MathHelper.ToRadians(40f)); + int fireIndex = Projectile.NewProjectile(projectile.Center, projectile.velocity + fireVelocity, + Main.rand.Next(ProjectileID.MolotovFire, ProjectileID.MolotovFire3 + 1), + BlastBarrel.BaseDamage, 1f, projectile.owner); + Main.projectile[fireIndex].thrown = false; + Main.projectile[fireIndex].Calamity().forceRogue = true; + Main.projectile[fireIndex].penetrate = -1; + Main.projectile[fireIndex].usesLocalNPCImmunity = true; + Main.projectile[fireIndex].localNPCHitCooldown = 9; + Main.projectile[fireIndex].timeLeft = 120; + } + } + projectile.Kill(); + } + else + { + projectile.velocity.Y += 0.4f; + } + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.velocity *= -1f; + return false; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Main.PlaySound(2, projectile.Center, 14); + //This is definitely not a near copy of the Blast Barrel nosiree :> + bool stealthS = projectile.Calamity().stealthStrike; + int projectileCount = 2; + if (stealthS) + { + projectileCount += 2; + } + for (int i = 0; i < projectileCount; i++) + { + if (Main.rand.NextBool(4)) + { + Vector2 shrapnelVelocity = (Vector2.UnitY * (-16f + Main.rand.NextFloat(-3, 12f))).RotatedByRandom((double)MathHelper.ToRadians(30f)); + Projectile.NewProjectile(projectile.Center, projectile.velocity + shrapnelVelocity, + ModContent.ProjectileType(), BlastBarrel.BaseDamage, 3f, projectile.owner); + } + else + { + Vector2 fireVelocity = (Vector2.UnitY * (-16f + Main.rand.NextFloat(-3, 12f))).RotatedByRandom((double)MathHelper.ToRadians(40f)); + int fireIndex = Projectile.NewProjectile(projectile.Center, projectile.velocity + fireVelocity, + Main.rand.Next(ProjectileID.MolotovFire, ProjectileID.MolotovFire3 + 1), + BlastBarrel.BaseDamage, 1f, projectile.owner); + Main.projectile[fireIndex].thrown = false; + Main.projectile[fireIndex].Calamity().forceRogue = true; + Main.projectile[fireIndex].penetrate = -1; + Main.projectile[fireIndex].usesLocalNPCImmunity = true; + Main.projectile[fireIndex].localNPCHitCooldown = 9; + Main.projectile[fireIndex].timeLeft = 120; + } + } + projectile.velocity *= -1f; + } + } +} \ No newline at end of file diff --git a/Projectiles/Rogue/BouncingBettyProjectile.png b/Projectiles/Rogue/BouncingBettyProjectile.png new file mode 100644 index 0000000000000000000000000000000000000000..32d9d0f4f3ee9a5f23bce45f33900e770335fc0a GIT binary patch literal 357 zcmV-r0h<1aP)Px$A4x<(R5*>jlfO%XK^VtB7Ya2r1hr&nSTDRtfnn&}5~70=P2t>7vs;5hTYo?h zv^6&965--53PuisKS+p{+8Q0MAs_Hw-f(!&zSG_D9N*7QDbfNU`bz;&f;5C$et(MUoA^mdK` zSh+|7aDV#(z}YmC((1%ZVuv8)JrL)=wCkjdeQ<*G@|ps0hjk+hkvpsda8 false; + + public override void AI() + { + if (projectile.velocity != Vector2.Zero) + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + projectile.velocity.Y += 0.2f; + } + } +} diff --git a/Projectiles/Rogue/BouncingBettyShrapnel.png b/Projectiles/Rogue/BouncingBettyShrapnel.png new file mode 100644 index 0000000000000000000000000000000000000000..84914f0531b92fe8b9b88f6505b4be297c28ad60 GIT binary patch literal 224 zcmeAS@N?(olHy`uVBq!ia0vp^AT|#N8<337)>#0g7>k44ofy`glX(f`%<^<`43U^R z_2NdZ#zc{0AMa~BdClZGk}%P+>tNQzn1=2RyO^&lU2o7f3}EYwOk=xu=u7SSl5@qc z>gS!~Jp4~2X5I4T`o3OQ8D<~nO;HKi7NF7Sn9maST_!`mywKUh{mrT7&&M^+RliT# z$b2?QHTKwr6{Yhw