Buzzkill start

This commit is contained in:
CongratsIsTrash committed 2024-04-15 23:41:33 -04:00
1 parent 627b28877e
commit 3d0c1711ac
16 files changed
+266 -184

No files matched your search

+1 -1
View File
@@ -849,7 +849,7 @@ namespace CalamityMod
ProjectileType<DaemonsFlameBow>(),
ProjectileType<DrataliornusBow>(),
ProjectileType<FlakKrakenHoldout>(),
ProjectileType<ButcherGun>(),
ProjectileType<BuzzkillHoldout>(),
ProjectileType<StarfleetMK2Gun>(),
ProjectileType<NorfleetCannon>(),
ProjectileType<FlurrystormCannonShooting>(),
Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 998 B

@@ -8,40 +8,38 @@ using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Ranged
{
public class Butcher : ModItem, ILocalizedModType
[LegacyName("Butcher")]
public class Buzzkill : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
public const float ShootSpeed = 18f;
public override void SetDefaults()
{
Item.width = 20;
Item.height = 12;
Item.damage = 15;
Item.useTime = 40;
Item.useAnimation = 40;
Item.useTime = 20;
Item.useAnimation = 20;
Item.useStyle = ItemUseStyleID.Shoot;
Item.knockBack = 1f;
Item.value = CalamityGlobalItem.Rarity4BuyPrice;
Item.rare = ItemRarityID.LightRed;
Item.UseSound = SoundID.Item38;
Item.noMelee = true;
Item.noUseGraphic = true;
Item.DamageType = DamageClass.Ranged;
Item.channel = true;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<ButcherGun>();
Item.shootSpeed = 12f;
Item.useAmmo = AmmoID.Bullet;
Item.shoot = ModContent.ProjectileType<BuzzkillHoldout>();
Item.shootSpeed = ShootSpeed;
Item.Calamity().canFirePointBlankShots = true;
}
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
// Spawning the holdout cannot consume ammo
public override bool CanConsumeAmmo(Item ammo, Player player) => !Main.rand.NextBool(4) && player.ownedProjectileCounts[Item.shoot] > 0;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType<ButcherGun>(), damage, knockback, player.whoAmI, 0f, 0f);
Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType<BuzzkillHoldout>(), damage, knockback, player.whoAmI, 0f, 0f);
return false;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

@@ -200,13 +200,9 @@ BulletFilledShotgun: {
'''
}
Butcher: {
DisplayName: Butcher
Tooltip:
'''
Fires bullets faster and more accurately the longer you hold the trigger
25% chance to save ammo
'''
Buzzkill: {
DisplayName: Buzzkill
Tooltip: Rapidly fires sawblades that slice through enemies and bounce off tiles
}
ChickenCannon: {
@@ -35,6 +35,7 @@ BouncingShotgunPellet.DisplayName: Shotgun Pellet
BrimstoneBolt.DisplayName: Brimstone Bolt
BrimstoneFireFriendly.DisplayName: Brimstone Fire
BubonicRoundProj.DisplayName: Bubonic Round
BuzzkillSaw.DisplayName: Buzzsaw
CardClub.DisplayName: Club
CardClubSplit.DisplayName: Club
CardDiamond.DisplayName: Diamond
-1
View File
@@ -231,7 +231,6 @@ namespace CalamityMod
ItemRedirect(ItemType<Elderberry>(), "Elderberry (calamity)");
ItemRedirect(ItemType<PineapplePet>(), "Pineapple (calamity)");
ItemRedirect(ItemType<TrashmanTrashcan>(), "Trash Can (pet)");
ItemRedirect(ItemType<Butcher>(), "Butcher (weapon)");
ItemRedirect(ItemType<Purity>(), "Purity (accessory)");
ItemRedirect(ItemType<SandstormGun>(), "Sandstorm (weapon)");
ItemRedirect(ItemType<Thunderstorm>(), "Thunderstorm (weapon)");
-164
View File
@@ -1,164 +0,0 @@
using System;
using CalamityMod.Items.Weapons.Ranged;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class ButcherGun : ModProjectile
{
public override LocalizedText DisplayName => CalamityUtils.GetItemName<Butcher>();
public override string Texture => "CalamityMod/Items/Weapons/Ranged/Butcher";
public override void SetDefaults()
{
Projectile.width = 66;
Projectile.height = 32;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.DamageType = DamageClass.Ranged;
Projectile.ignoreWater = true;
}
public override void AI()
{
Player player = Main.player[Projectile.owner];
Projectile.ai[0] += 1f;
int incrementAmt = 0;
float spreadMult = 0.15f;
if (Projectile.ai[0] >= 80f)
{
incrementAmt++;
spreadMult = 0.13f;
}
if (Projectile.ai[0] >= 160f)
{
incrementAmt++;
spreadMult = 0.11f;
}
if (Projectile.ai[0] >= 240f)
{
incrementAmt++;
spreadMult = 0.09f;
}
if (Projectile.ai[0] >= 320f)
{
incrementAmt++;
spreadMult = 0.07f;
}
if (Projectile.ai[0] >= 400f)
{
incrementAmt++;
spreadMult = 0.05f;
}
if (Projectile.ai[0] >= 480f)
{
incrementAmt++;
spreadMult = 0.04f;
}
if (Projectile.ai[0] >= 560f)
{
incrementAmt++;
spreadMult = 0.03f;
}
if (Projectile.ai[0] >= 640f) //8
{
incrementAmt++;
spreadMult = 0.02f;
}
int shootDelayBase = 40;
int incrementMult = 3;
Projectile.ai[1] -= 1f;
bool willShoot = false;
if (Projectile.ai[1] <= 0f)
{
Projectile.ai[1] = (float)(shootDelayBase - incrementMult * incrementAmt);
willShoot = true;
}
bool canShoot = !player.CantUseHoldout() && player.HasAmmo(player.ActiveItem());
if (Projectile.localAI[0] > 0f)
{
Projectile.localAI[0] -= 1f;
}
if (Projectile.soundDelay <= 0 && canShoot)
{
Projectile.soundDelay = shootDelayBase - incrementMult * incrementAmt;
if (Projectile.ai[0] != 1f)
{
SoundEngine.PlaySound(SoundID.Item38, Projectile.position);
}
Projectile.localAI[0] = 12f;
}
Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true);
if (willShoot && Main.myPlayer == Projectile.owner)
{
int projType = ProjectileID.Bullet;
float speedMult = 14f;
int damage = player.GetWeaponDamage(player.ActiveItem());
float kback = player.ActiveItem().knockBack;
if (canShoot)
{
player.PickAmmo(player.ActiveItem(), out projType, out speedMult, out damage, out kback, out _);
kback = player.GetWeaponKnockback(player.ActiveItem(), kback);
float speed = player.ActiveItem().shootSpeed * Projectile.scale;
Vector2 targetPos = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - source;
if (player.gravDir == -1f)
{
targetPos.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - source.Y;
}
Vector2 velMult = Vector2.Normalize(targetPos);
if (float.IsNaN(velMult.X) || float.IsNaN(velMult.Y))
{
velMult = -Vector2.UnitY;
}
velMult *= speed;
if (velMult.X != Projectile.velocity.X || velMult.Y != Projectile.velocity.Y)
{
Projectile.netUpdate = true;
}
Projectile.velocity = velMult * 0.55f;
int randomBulletCount = Main.rand.Next(3, 5); //3 to 4 bullets
for (int projIndex = 0; projIndex < randomBulletCount; projIndex++)
{
Vector2 bulletVel = Vector2.Normalize(Projectile.velocity) * speedMult * (0.6f + Main.rand.NextFloat() * spreadMult);
if (float.IsNaN(bulletVel.X) || float.IsNaN(bulletVel.Y))
{
bulletVel = -Vector2.UnitY;
}
source += Utils.RandomVector2(Main.rand, -5f, 5f);
bulletVel.X += (float)Main.rand.Next(-15, 16) * spreadMult;
bulletVel.Y += (float)Main.rand.Next(-15, 16) * spreadMult;
int bullet = Projectile.NewProjectile(Projectile.GetSource_FromThis(), source, bulletVel, projType, damage, kback, Projectile.owner, 0f, 0f);
Main.projectile[bullet].noDropItem = true;
Main.projectile[bullet].extraUpdates += incrementAmt / 2; //0 to 4
}
}
else
{
Projectile.Kill();
}
}
Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f;
float rotationAmt = 0f;
if (Projectile.spriteDirection == -1)
{
rotationAmt = MathHelper.Pi;
}
Projectile.rotation = Projectile.velocity.ToRotation() + rotationAmt;
Projectile.spriteDirection = Projectile.direction;
Projectile.timeLeft = 2;
player.ChangeDir(Projectile.direction);
player.heldProj = Projectile.whoAmI;
player.itemTime = 2;
player.itemAnimation = 2;
player.itemRotation = (float)Math.Atan2((double)(Projectile.velocity.Y * (float)Projectile.direction), (double)(Projectile.velocity.X * (float)Projectile.direction));
}
public override bool? CanDamage() => false;
}
}
+111
View File
@@ -0,0 +1,111 @@
using System;
using CalamityMod.Items.Weapons.Ranged;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class BuzzkillHoldout : ModProjectile
{
public override LocalizedText DisplayName => CalamityUtils.GetItemName<Buzzkill>();
public ref float Time => ref Projectile.ai[0];
public const float ChargeupTime = 90f;
Player player => Main.player[Projectile.owner];
public override void SetStaticDefaults()
{
Main.projFrames[Projectile.type] = 4;
}
public override void SetDefaults()
{
Projectile.width = 76;
Projectile.height = 44;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.DamageType = DamageClass.Ranged;
Projectile.ignoreWater = true;
}
public override void AI()
{
Vector2 armPos = player.RotatedRelativePoint(player.MountedCenter, true);
Vector2 weaponTipPos = armPos + Projectile.velocity * Projectile.width * 0.5f;
Time++;
if (player.CantUseHoldout())
Projectile.Kill();
else
Projectile.timeLeft = 2;
if (Projectile.frame > 0)
{
Projectile.frameCounter++;
if (Projectile.frameCounter >= 3)
{
Projectile.frameCounter = 0;
Projectile.frame++;
if (Projectile.frame > 3)
Projectile.frame = 1;
}
}
if (Time < ChargeupTime)
{
if (Time == 1f)
{
// Insert charge-up sound
Main.NewText("Insert charge-up sound");
}
if (Time > 30f && Projectile.frame == 0)
Projectile.frame = 1;
}
else
{
if (Time % player.ActiveItem().useTime == 0)
{
SoundEngine.PlaySound(SoundID.DD2_BallistaTowerShot, weaponTipPos);
Projectile.NewProjectile(Projectile.GetSource_FromThis(), weaponTipPos, Projectile.velocity.SafeNormalize(Vector2.UnitY) * Buzzkill.ShootSpeed, ModContent.ProjectileType<BuzzkillSaw>(), Projectile.damage, Projectile.knockBack, Main.myPlayer);
}
}
UpdateProjectileHeldValues(armPos);
player.ChangeDir(Projectile.direction);
player.heldProj = Projectile.whoAmI;
player.itemTime = 2;
player.itemAnimation = 2;
player.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation();
}
private void UpdateProjectileHeldValues(Vector2 armPosition)
{
if (Main.myPlayer == Projectile.owner)
{
float interpolant = Utils.GetLerpValue(5f, 40f, Projectile.Distance(Main.MouseWorld), true);
Vector2 oldVel = Projectile.velocity;
Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), interpolant);
if (Projectile.velocity != oldVel)
{
Projectile.netSpam = 0;
Projectile.netUpdate = true;
}
}
Vector2 holdoutOffset = Projectile.velocity * 20f + new Vector2(0f, -5f);
Projectile.Center = armPosition + holdoutOffset;
Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
Projectile.spriteDirection = Projectile.direction;
}
public override bool? CanDamage() => false;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

+141
View File
@@ -0,0 +1,141 @@
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class BuzzkillSaw : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override void SetStaticDefaults()
{
Main.projFrames[Projectile.type] = 4;
}
public override void SetDefaults()
{
Projectile.width = 38;
Projectile.height = 40;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.timeLeft = 480;
Projectile.penetrate = 3;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration;
}
public override void AI()
{
Projectile.ai[1]++;
if (Projectile.ai[1] == 1f)
Projectile.rotation = Main.rand.NextFloat(0f, MathHelper.TwoPi);
if (Projectile.frame < 1)
Projectile.frame = 1;
Projectile.frameCounter++;
if (Projectile.frameCounter >= 3)
{
Projectile.frameCounter = 0;
Projectile.frame++;
if (Projectile.frame > 3)
Projectile.frame = 1;
}
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
SoundEngine.PlaySound(SoundID.Item178, Projectile.Center); // Probably placeholder sound?
for (int d = 0; d < 8; d++)
{
Vector2 dustVel = Main.rand.NextVector2CircularEdge(1f, 1f);
dustVel.SafeNormalize(Vector2.Zero);
dustVel *= Main.rand.NextFloat(3f, 7f);
Dust collisionDust = Dust.NewDustPerfect(Projectile.Center, 84, dustVel);
collisionDust.noGravity = true;
}
Projectile.penetrate--;
if (Projectile.penetrate <= 0)
{
Projectile.Kill();
}
else
{
if (Projectile.velocity.X != oldVelocity.X)
Projectile.velocity.X = -oldVelocity.X;
if (Projectile.velocity.Y != oldVelocity.Y)
Projectile.velocity.Y = -oldVelocity.Y;
}
return false;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
for (int p = 0; p < 6; p++)
{
Particle hitSparks = new AltLineParticle(target.Center, new Vector2(Main.rand.NextFloat(-6.5f, 6.5f), Main.rand.NextFloat(-6.5f, 6.5f)), false, 30, 0.6f, new Color(112, 16, 16));
GeneralParticleHandler.SpawnParticle(hitSparks);
}
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/CeramicImpact", 2), Projectile.Center);
for (int d = 0; d < 8; d++)
{
Vector2 dustVel = Main.rand.NextVector2CircularEdge(1f, 1f);
dustVel.SafeNormalize(Vector2.Zero);
dustVel *= Main.rand.NextFloat(5f, 9f);
Dust collisionDust = Dust.NewDustPerfect(Projectile.Center, 84, dustVel);
collisionDust.noGravity = true;
}
int goreToExclude = Main.rand.Next(3);
switch (goreToExclude)
{
case 0:
Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)), Mod.Find<ModGore>("BuzzkillSaw2").Type, 0.8f);
Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)), Mod.Find<ModGore>("BuzzkillSaw3").Type, 0.8f);
break;
case 1:
Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)), Mod.Find<ModGore>("BuzzkillSaw1").Type, 0.8f);
Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)), Mod.Find<ModGore>("BuzzkillSaw3").Type, 0.8f);
break;
case 2:
Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)), Mod.Find<ModGore>("BuzzkillSaw1").Type, 0.8f);
Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)), Mod.Find<ModGore>("BuzzkillSaw2").Type, 0.8f);
break;
}
}
public override bool PreDraw(ref Color lightColor)
{
if (Projectile.ai[1] > 10)
{
Texture2D slashTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/BuzzkillSawSlash").Value;
Color drawColor = Color.White;
Main.EntitySpriteDraw(slashTexture, Projectile.Center - Main.screenPosition + new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-10f, 10f)), null, drawColor, Projectile.ai[1] * 7f, slashTexture.Size() / 2, 1f, SpriteEffects.None);
if (Projectile.ai[1] % 4 == 0)
{
Vector2 randomParticleOffset = new Vector2(Main.rand.NextFloat(-Projectile.width, Projectile.width), Main.rand.NextFloat(-Projectile.width, Projectile.width));
float randomParticleScale = Main.rand.NextFloat(0.35f, 0.65f);
Particle bloomCircle = new BloomParticle(Projectile.Center + randomParticleOffset, Projectile.velocity, Main.rand.NextBool() ? Color.White : new Color(112, 16, 16), randomParticleScale, randomParticleScale, 4, false);
GeneralParticleHandler.SpawnParticle(bloomCircle);
}
}
return true;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB