87 lines
3.1 KiB
C#
87 lines
3.1 KiB
C#
using CalamityMod.Projectiles.Melee.Shortswords;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Projectiles.Melee
|
|
{
|
|
public class DNA2 : ModProjectile
|
|
{
|
|
public override string Texture => "CalamityMod/Projectiles/Melee/DNA";
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("DNA");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 14;
|
|
Projectile.height = 14;
|
|
Projectile.aiStyle = ProjAIStyleID.Vilethorn;
|
|
Projectile.friendly = true;
|
|
Projectile.alpha = 255;
|
|
Projectile.penetrate = -1;
|
|
Projectile.tileCollide = false;
|
|
Projectile.DamageType = DamageClass.Melee;
|
|
Projectile.ignoreWater = true;
|
|
AIType = ProjectileID.CrystalVileShardShaft;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f;
|
|
if (Projectile.ai[0] == 0f)
|
|
{
|
|
Projectile.alpha -= 50;
|
|
if (Projectile.alpha <= 0)
|
|
{
|
|
Projectile.alpha = 0;
|
|
Projectile.ai[0] = 1f;
|
|
if (Projectile.ai[1] == 0f)
|
|
{
|
|
Projectile.ai[1] += 1f;
|
|
Projectile.position += Projectile.velocity * 1f;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (Projectile.alpha < 170 && Projectile.alpha + 5 >= 170)
|
|
{
|
|
for (int num55 = 0; num55 < 3; num55++)
|
|
{
|
|
int num56 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 234, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f, 200, default, 1f);
|
|
Main.dust[num56].noGravity = true;
|
|
Main.dust[num56].velocity *= 0.5f;
|
|
}
|
|
}
|
|
Projectile.alpha += 7;
|
|
if (Projectile.alpha >= 255)
|
|
{
|
|
Projectile.Kill();
|
|
}
|
|
}
|
|
if (Main.rand.NextBool(10))
|
|
{
|
|
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 234, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f);
|
|
}
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
for (int k = 0; k < 1; k++)
|
|
{
|
|
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 234, Projectile.oldVelocity.X * 0.005f, Projectile.oldVelocity.Y * 0.005f);
|
|
}
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
|
{
|
|
Main.player[Projectile.owner].GiveIFrames(LucreciaProj.OnHitIFrames);
|
|
target.immune[Projectile.owner] = 5;
|
|
}
|
|
}
|
|
}
|