Holy Fire Bullet touch ups

The bullets deal increased damage along with the increased explosion size, and the explosion no longer hits the enemy the bullet spawned it on. new visuals.
This commit is contained in:
Xyk committed 2025-04-22 01:16:43 -07:00
1 parent ea1f426a53
commit 9c2de19b26
7 files changed
+131 -85

No files matched your search

+3 -5
View File
@@ -10,18 +10,16 @@ namespace CalamityMod.Items.Ammo
public class HolyFireBullet : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Ammo";
internal const float ExplosionMultiplier = 0.275f;
public static readonly SoundStyle Explosion = new("CalamityMod/Sounds/Item/HolyFireBulletExplosion") { PitchVariance = 0.2f, Volume = 0.6f };
public override void SetStaticDefaults()
{
Item.ResearchUnlockCount = 99;
}
public override void SetDefaults()
{
Item.width = 22;
Item.height = 22;
Item.damage = 20;
Item.damage = 19;
Item.DamageType = DamageClass.Ranged;
Item.maxStack = Item.CommonMaxStack;
Item.consumable = true;
@@ -35,8 +33,8 @@ namespace CalamityMod.Items.Ammo
public override void AddRecipes()
{
CreateRecipe(100).
AddIngredient(ItemID.ExplodingBullet, 100).
CreateRecipe(333).
AddIngredient(ItemID.ExplodingBullet, 333).
AddIngredient<UnholyEssence>().
AddTile(TileID.LunarCraftingStation).
Register();
@@ -92,8 +92,8 @@ HolyFireBullet: {
DisplayName: Holy Fire Bullet
Tooltip:
'''
Profaned bullets that explode on impact, dealing extra damage
The explosion grows weaker the further the bullet travels
Profaned bullets that explode on impact
The explosion is larger and the bullet deals increased damage if impact occurs immediately after firing
'''
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

+1 -1
View File
@@ -197,7 +197,7 @@ namespace CalamityMod.Projectiles.Melee
{
Owner.Calamity().GeneralScreenShakePower = 1.2f;
SoundStyle fire3 = new("CalamityMod/Sounds/Item/HolyFireBulletExplosion");
SoundStyle fire3 = new("CalamityMod/Sounds/Item/DampExplosion");
SoundEngine.PlaySound(fire3 with { Volume = 0.35f, Pitch = 0.7f }, Projectile.Center);
for (int i = 0; i < MathHelper.Clamp(15 - Projectile.numHits * 3, 2, 15); i++)
{
+125 -77
View File
@@ -1,132 +1,180 @@
using CalamityMod.Buffs.DamageOverTime;
using System;
using System.Diagnostics;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Dusts;
using CalamityMod.InverseKinematics;
using CalamityMod.Items.Ammo;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
using static System.Net.Mime.MediaTypeNames;
namespace CalamityMod.Projectiles.Ranged
{
public class HolyFireBulletProj : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
private const int Lifetime = 600;
private static readonly Color Alpha = new Color(1f, 1f, 1f, 0f);
private bool ColorStyle = false;
public Color col = Color.White;
private float SizeVariance;
private float SizeBonus = 2;
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Type] = 5;
ProjectileID.Sets.TrailingMode[Type] = 2;
}
public ref float time => ref Projectile.ai[2];
public ref float sizeBonus => ref Projectile.ai[1];
public override void SetDefaults()
{
Projectile.width = 4;
Projectile.height = 4;
Projectile.width = 8;
Projectile.height = 8;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.MaxUpdates = 5;
Projectile.timeLeft = Lifetime;
Projectile.penetrate = 1;
Projectile.extraUpdates = 7;
Projectile.timeLeft = 600;
Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override void AI()
{
if (Projectile.localAI[0] == 0)
if (time == 0)
{
col = Main.rand.NextBool() ? Color.Orange : Color.Goldenrod;
SizeVariance = Main.rand.NextFloat(0.95f, 1.05f);
ColorStyle = Main.rand.NextBool();
Projectile.velocity *= 0.7f;
Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 14;
}
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90f);
Projectile.spriteDirection = Projectile.direction;
if (Projectile.localAI[0] >= 30 && SizeBonus > 1)
{
SizeBonus -= 0.02f;
}
// Flaking dust
Projectile.localAI[0] += 1f;
if (Projectile.localAI[0] > 4f)
sizeBonus = MathHelper.Lerp(1, 2, (float)Math.Pow(Utils.GetLerpValue(50, 15, time, true), 2));
if (time > 4)
{
float sine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 15f / MathHelper.Pi);
if (Main.rand.NextBool(3))
{
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5), Main.rand.NextBool() ? 262 : 87, -Projectile.velocity.RotatedByRandom(0.05f) * Main.rand.NextFloat(0.01f, 0.1f));
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5), ModContent.DustType<SquashDust>(), -Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.15f, 0.3f) * (Main.rand.NextBool() ? -1 : 1)) * Main.rand.NextFloat(0.2f, 1f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(0.5f, 0.85f);
dust.alpha = 235;
dust.noLightEmittence = true;
dust.color = col;
}
if (Main.rand.NextBool(15))
if (time > 2)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, -Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.2f, 0.4f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(0.4f, 0.7f);
dust.color = ColorStyle ? Color.Orange : Color.Khaki;
Particle trail = new CustomSpark(Projectile.Center, -Projectile.velocity.SafeNormalize(Vector2.UnitX) * 0.5f, "CalamityMod/Particles/DualTrail", false, 4, 0.03f, col * 0.9f, new Vector2(1f, 3), true, true, shrinkSpeed: 0.8f, glowOpacity: 0.6f);
GeneralParticleHandler.SpawnParticle(trail);
}
}
time++;
}
public override Color? GetAlpha(Color lightColor) => Alpha;
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, ColorStyle ? Color.OrangeRed * 8 : Color.Khaki * 8);
return true;
if (time <= 0)
return false;
Asset<Texture2D> tip = ModContent.Request<Texture2D>("CalamityMod/Particles/SquareRotated");
for (int i = 0; i < 2; i++)
Main.EntitySpriteDraw(tip.Value, Projectile.Center - Main.screenPosition, null, Color.Lerp(col, Color.White, i) with { A = 0 } * 0.7f, Projectile.rotation, tip.Size() / 2f, new Vector2(0.2f, 1.4f) * Projectile.scale * (0.28f - 0.1f * i), SpriteEffects.None, 0);
return false;
}
public override void OnKill(int timeLeft)
{
// Spawn an on-hit explosion which deals 30% of the projectile's damage.
if (Projectile.owner == Main.myPlayer)
// Spawn an on-hit explosion which deals part of the projectile's damage to enemies around the target
if (Projectile.numHits == 0)
{
Projectile.damage = (int)(Projectile.damage * HolyFireBullet.ExplosionMultiplier);
Projectile.penetrate = -1;
Projectile.ExpandHitboxBy((25 * SizeVariance) * SizeBonus);
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
Projectile.Damage();
}
SoundEngine.PlaySound(HolyFireBullet.Explosion with { Pitch = -0.15f, Volume = 0.3f }, Projectile.Center);
Vector2 Offset = Main.rand.NextVector2Circular(15, 15);
Particle explosion = new DetailedExplosion(Projectile.Center + Offset, Vector2.Zero, (ColorStyle ? Color.Orange : Color.Khaki) * 0.9f, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, (0.28f * SizeVariance) * SizeBonus, 10);
GeneralParticleHandler.SpawnParticle(explosion);
SparkleParticle impactParticle = new SparkleParticle(Projectile.Center + Offset, Vector2.Zero, Color.White, ColorStyle ? Color.Orange : Color.OrangeRed, 2.5f * (SizeBonus * 0.3f), 7, 0f, 2f);
GeneralParticleHandler.SpawnParticle(impactParticle);
for (int k = 0; k < 9; k++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 262 : 87, new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(0.7f, 1.25f);
dust.alpha = 235;
if (Main.rand.NextBool())
{
Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 303, new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f));
dust2.noGravity = true;
dust2.scale = Main.rand.NextFloat(0.8f, 1.5f);
dust2.alpha = 70;
}
}
for (int k = 0; k < 3; k++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f) + new Vector2(0, -3));
dust.noGravity = false;
dust.scale = Main.rand.NextFloat(0.85f, 1f);
dust.color = ColorStyle ? Color.Orange : Color.Khaki;
MakeBlast(0, false);
}
}
public void MakeBlast(int target, bool hitTarget)
{
float blastSize = 50 * sizeBonus;
float minMultiplier = 0.25f;
int hitsToMinMult = 8;
int blastDamage = (int)(Projectile.damage * 0.5f);
int knockback = -10;
int debuff = ModContent.BuffType<HolyFlames>();
int debuffTime = 180;
if (hitTarget)
{
Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<BasicBurstExclusive>(), blastDamage, knockback, Projectile.owner, blastSize, minMultiplier, hitsToMinMult);
blast.timeLeft = 3;
blast.DamageType = Projectile.DamageType;
blast.localAI[0] = target;
blast.localAI[1] = debuff;
blast.localAI[2] = debuffTime;
}
else
{
Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<BasicBurst>(), blastDamage, knockback, Projectile.owner, blastSize, minMultiplier, hitsToMinMult);
blast.timeLeft = 3;
blast.DamageType = Projectile.DamageType;
blast.localAI[0] = debuff;
blast.localAI[1] = debuffTime;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
SoundEngine.PlaySound(HolyFireBullet.Explosion with { Pitch = -0.2f + 0.3f * sizeBonus, Volume = 0.3f + 0.1f * sizeBonus, MaxInstances = 10 }, Projectile.Center);
float fxScale = MathHelper.Lerp(sizeBonus, 1, 0.25f);
Vector2 Offset = Main.rand.NextVector2Circular(15, 15);
Particle blastvfx = new CustomPulse(Projectile.Center + Offset, Vector2.Zero, Color.Lerp(Color.SlateGray, col, 0.8f) * 0.9f, "CalamityMod/Particles/SmokeExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0.05f * fxScale, 0.1f * fxScale, Main.rand.Next(8, 10 + 1), true);
GeneralParticleHandler.SpawnParticle(blastvfx);
float rot = Main.rand.NextFloat(-5, 5);
for (int i = -1; i <= 1; i += 2)
{
Particle centerShine = new CustomSpark(Projectile.Center + Offset, Vector2.UnitY.RotatedBy(rot + MathHelper.PiOver4 * i) * 0.01f, "CalamityMod/Particles/BloomCircle", false, 5, 0.3f * fxScale, Color.White, new Vector2(1f, 1f), true, false, shrinkSpeed: 2f);
GeneralParticleHandler.SpawnParticle(centerShine);
}
for (int k = 0; k < 7; k++)
{
if (Main.rand.NextBool())
{
Dust dust2 = Dust.NewDustPerfect(Projectile.Center + Offset, ModContent.DustType<DiamondDust>(), new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f) * fxScale);
dust2.noGravity = true;
dust2.scale = Main.rand.NextFloat(0.4f, 0.6f) * fxScale;
dust2.alpha = Main.rand.Next(90, 180 + 1);
dust2.color = col;
dust2.fadeIn = 10f;
dust2.noLight = true;
dust2.noLightEmittence = true;
}
else
{
Dust dust = Dust.NewDustPerfect(Projectile.Center + Offset, ModContent.DustType<LightDust>(), new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f) * fxScale);
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(0.5f, 1f) * fxScale;
dust.alpha = Main.rand.Next(160, 230 + 1); ;
dust.color = Color.White;
dust.noLight = true;
dust.noLightEmittence = true;
}
}
for (int k = 0; k < 2; k++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center + Offset, ModContent.DustType<SquashDust>(), new Vector2(6, 6).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f) * fxScale + new Vector2(0, -5));
dust.noGravity = false;
dust.scale = Main.rand.NextFloat(0.75f, 0.95f) * fxScale;
dust.color = Main.rand.NextBool() ? Color.Orange : Color.Goldenrod;
dust.fadeIn = 1;
}
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 300);
MakeBlast(target.whoAmI, true);
if (sizeBonus == 2)
{
SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode with { Pitch = 0.3f, Volume = 0.4f, MaxInstances = 10 }, Projectile.Center);
}
modifiers.SourceDamage *= MathHelper.Lerp(1, 1.25f, sizeBonus - 1); // Up to 25% damage bonus
}
}
}
Binary file not shown.
Binary file not shown.