Bouncing Betty and Bandit sprite fix

This commit is contained in:
DominicKarma42 committed 2019-11-02 15:32:14 -05:00
1 parent 268eee7c6a
commit ca4971a57c
8 files changed
+215 -7

No files matched your search

+51
View File
@@ -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<BouncingBettyProjectile>();
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<BouncingBettyProjectile>(), damage, knockBack, player.whoAmI, ai1: strikeValue);
if (player.Calamity().StealthStrikeAvailable())
{
Main.projectile[projectileIndex].Calamity().stealthStrike = strikeValue == 1f;
}
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

+14 -6
View File
@@ -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<Items.BouncingBetty>());
shop.item[nextSlot].SetDefaults(ModContent.ItemType<BouncingBetty>());
nextSlot++;
shop.item[nextSlot].SetDefaults(ModContent.ItemType<Items.LatcherMines>());
nextSlot++;
}*/
/*shop.item[nextSlot].SetDefaults(ModContent.ItemType<Items.LatcherMines>());
nextSlot++;*/
}
if (NPC.downedPlantBoss)
{
shop.item[nextSlot].SetDefaults(ModContent.ItemType<MonkeyDarts>());
+1 -1
View File
@@ -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;
@@ -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<BarrelShrapnel>(), 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<BarrelShrapnel>(), 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;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

@@ -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;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B