Files
CalamityModPublic/Projectiles/Typeless/PauldronExplosion.cs
T
Xyk e1fd580f5d All Custom knockback now uses the Util
Fixed custom knockback not being server synced
Also slightly adjusted some knockback stuff like:
Supernova stealth launch vel is higher and basher knockback is lower with no right click and higher with right click.
2025-02-23 10:29:53 -08:00

56 lines
2.4 KiB
C#

using System;
using CalamityMod.Dusts;
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.Typeless
{
public class PauldronExplosion : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Typeless";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public Player Owner => Main.player[Projectile.owner];
private static float ExplosionRadius = 150f;
public override void SetDefaults()
{
//These shouldn't matter because its circular
Projectile.width = 150;
Projectile.height = 150;
Projectile.friendly = true;
Projectile.DamageType = AverageDamageClass.Instance;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.penetrate = -1;
Projectile.timeLeft = 2;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(BuffID.OnFire3, 240);
//Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.OrangeRed, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0f, Main.rand.NextFloat(0.8f, 1.1f), 20);
//GeneralParticleHandler.SpawnParticle(pulse);
//Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.DarkOrange, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0f, Main.rand.NextFloat(0.6f, 0.9f), 20);
//GeneralParticleHandler.SpawnParticle(pulse2);
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox);
public override bool? CanDamage() => base.CanDamage();
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
target.MoveNPC(launchVel, 15, true);
}
public override bool? CanCutTiles() => false;
}
}