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 0000000000..32d9d0f4f3 Binary files /dev/null and b/Items/Weapons/Rogue/BouncingBetty.png differ diff --git a/NPCs/TownNPCs/THIEF.cs b/NPCs/TownNPCs/THIEF.cs index b2f56d7b86..109cfabdf1 100644 --- a/NPCs/TownNPCs/THIEF.cs +++ b/NPCs/TownNPCs/THIEF.cs @@ -3,9 +3,12 @@ using CalamityMod.Items.Pets; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Rogue; using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System.Collections.Generic; using Terraria; using Terraria.ID; +using Terraria.GameContent.Events; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.NPCs.TownNPCs @@ -183,7 +186,12 @@ namespace CalamityMod.NPCs.TownNPCs } return "Sorry, I got nothing."; } - + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/TownNPCs/THIEF" + (BirthdayParty.PartyIsUp ? "Alt" : "")), npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY) - new Vector2(0f, 6f), npc.frame, drawColor, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } public override void SetChatButtons(ref string button, ref string button2) { button = Language.GetTextValue("LegacyInterface.28"); @@ -235,13 +243,13 @@ namespace CalamityMod.NPCs.TownNPCs shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 60, 0, 0); nextSlot++; } - /*if (NPC.downedMechBoss1 || NPC.downedMechBoss2 || NPC.downedMechBoss3) + if (NPC.downedMechBoss1 || NPC.downedMechBoss2 || NPC.downedMechBoss3) { - shop.item[nextSlot].SetDefaults(ModContent.ItemType()); + 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 0000000000..32d9d0f4f3 Binary files /dev/null and b/Projectiles/Rogue/BouncingBettyProjectile.png differ diff --git a/Projectiles/Rogue/BouncingBettyShrapnel.cs b/Projectiles/Rogue/BouncingBettyShrapnel.cs new file mode 100644 index 0000000000..a191403d53 --- /dev/null +++ b/Projectiles/Rogue/BouncingBettyShrapnel.cs @@ -0,0 +1,37 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class BouncingBettyShrapnel : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shrapnel"); + Main.projFrames[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.tileCollide = true; + projectile.Calamity().rogue = true; + } + public override bool OnTileCollide(Vector2 oldVelocity) => 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 0000000000..84914f0531 Binary files /dev/null and b/Projectiles/Rogue/BouncingBettyShrapnel.png differ