94 lines
3.4 KiB
C#
94 lines
3.4 KiB
C#
using CalamityMod.Buffs.DamageOverTime;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
using Terraria.Audio;
|
|
|
|
namespace CalamityMod.Projectiles.Rogue
|
|
{
|
|
public class CosmicScythe : ModProjectile, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Projectiles.Rogue";
|
|
public override string Texture => "CalamityMod/Projectiles/Boss/SignusScythe";
|
|
|
|
private int originalDamage;
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4;
|
|
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 26;
|
|
Projectile.height = 26;
|
|
Projectile.friendly = true;
|
|
Projectile.tileCollide = false;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.timeLeft = 400;
|
|
Projectile.alpha = 100;
|
|
Projectile.penetrate = 5;
|
|
Projectile.DamageType = RogueDamageClass.Instance;
|
|
Projectile.extraUpdates = 1;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Projectile.rotation += 0.5f * (float)Projectile.direction;
|
|
int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f);
|
|
Main.dust[shadow].noGravity = true;
|
|
Main.dust[shadow].velocity *= 0f;
|
|
Projectile.velocity *= 0.95f;
|
|
if (Projectile.timeLeft == 400)
|
|
{
|
|
originalDamage = Projectile.damage;
|
|
Projectile.damage = 0;
|
|
}
|
|
if (Projectile.timeLeft <= 375)
|
|
{
|
|
if (Projectile.timeLeft > 350)
|
|
Projectile.velocity *= 1.06f;
|
|
Projectile.damage = (int)(originalDamage * 1.25);
|
|
CalamityUtils.HomeInOnNPC(Projectile, true, 300f, 12f, 20f);
|
|
}
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
|
{
|
|
Projectile.Kill();
|
|
}
|
|
|
|
public override bool PreDraw(ref Color lightColor)
|
|
{
|
|
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
|
|
return false;
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
SoundEngine.PlaySound(SoundID.Item14, Projectile.Center);
|
|
Projectile.ExpandHitboxBy(50);
|
|
for (int d = 0; d < 4; d++)
|
|
{
|
|
int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, default, 2f);
|
|
Main.dust[shadow].velocity *= 3f;
|
|
if (Main.rand.NextBool(2))
|
|
{
|
|
Main.dust[shadow].scale = 0.5f;
|
|
Main.dust[shadow].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
|
}
|
|
}
|
|
for (int d = 0; d < 12; d++)
|
|
{
|
|
int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, default, 3f);
|
|
Main.dust[shadow].noGravity = true;
|
|
Main.dust[shadow].velocity *= 5f;
|
|
shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, default, 2f);
|
|
Main.dust[shadow].velocity *= 2f;
|
|
}
|
|
}
|
|
}
|
|
}
|