76 lines
2.8 KiB
C#
76 lines
2.8 KiB
C#
using CalamityMod.Buffs.StatDebuffs;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
using static Terraria.ModLoader.ModContent;
|
|
using static CalamityMod.CalamityUtils;
|
|
using Terraria.Audio;
|
|
|
|
|
|
namespace CalamityMod.Projectiles.Melee
|
|
{
|
|
public class PurityProjection : ModProjectile, ILocalizedModType //The boring plain one
|
|
{
|
|
public new string LocalizationCategory => "Projectiles.Melee";
|
|
public override string Texture => "CalamityMod/Projectiles/Melee/BrokenBiomeBlade_PurityProjection";
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5;
|
|
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = Projectile.height = 32;
|
|
Projectile.aiStyle = ProjAIStyleID.Beam;
|
|
AIType = ProjectileID.LightBeam;
|
|
Projectile.friendly = true;
|
|
Projectile.penetrate = 1;
|
|
Projectile.timeLeft = 40;
|
|
Projectile.DamageType = DamageClass.Melee;
|
|
Projectile.tileCollide = false;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
if (Projectile.timeLeft < 35)
|
|
Projectile.tileCollide = true;
|
|
|
|
Lighting.AddLight(Projectile.Center, 0.75f, 1f, 0.24f);
|
|
int dustParticle = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 75, 0f, 0f, 100, default, 0.9f);
|
|
Main.dust[dustParticle].noGravity = true;
|
|
Main.dust[dustParticle].velocity *= 0.5f;
|
|
Main.dust[dustParticle].velocity += Projectile.velocity * 0.1f;
|
|
}
|
|
|
|
public override bool PreDraw(ref Color lightColor)
|
|
{
|
|
if (Projectile.timeLeft > 35)
|
|
return false;
|
|
|
|
DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
|
|
return false;
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
SoundEngine.PlaySound(SoundID.Item43, Projectile.Center);
|
|
for (int i = 0; i <= 15; i++)
|
|
{
|
|
Vector2 displace = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * (-0.5f + (i / 15f)) * 88f;
|
|
int dustParticle = Dust.NewDust(Projectile.Center + displace, Projectile.width, Projectile.height, 75, 0f, 0f, 100, default, 2f);
|
|
Main.dust[dustParticle].noGravity = true;
|
|
Main.dust[dustParticle].velocity = Projectile.oldVelocity;
|
|
}
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
|
{
|
|
int debuffTime = 90;
|
|
target.AddBuff(BuffType<ArmorCrunch>(), debuffTime);
|
|
}
|
|
}
|
|
}
|