64 lines
2.5 KiB
C#
64 lines
2.5 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.Projectiles.Magic
|
|
{
|
|
public class WaterStream2 : ModProjectile
|
|
{
|
|
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
// DisplayName.SetDefault("Stream");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 32;
|
|
Projectile.height = 32;
|
|
Projectile.friendly = true;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.penetrate = 1;
|
|
Projectile.extraUpdates = 2;
|
|
Projectile.timeLeft = 80;
|
|
Projectile.DamageType = DamageClass.Magic;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.25f / 255f);
|
|
Projectile.scale -= 0.002f;
|
|
if (Projectile.scale <= 0f)
|
|
{
|
|
Projectile.Kill();
|
|
}
|
|
if (Projectile.ai[0] <= 3f)
|
|
{
|
|
Projectile.ai[0] += 1f;
|
|
return;
|
|
}
|
|
Projectile.velocity.Y = Projectile.velocity.Y + 0.075f;
|
|
for (int num151 = 0; num151 < 3; num151++)
|
|
{
|
|
float num152 = Projectile.velocity.X / 3f * (float)num151;
|
|
float num153 = Projectile.velocity.Y / 3f * (float)num151;
|
|
int num154 = 14;
|
|
int num155 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num154, Projectile.position.Y + (float)num154), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 1f);
|
|
Dust dust = Main.dust[num155];
|
|
dust.noGravity = true;
|
|
dust.velocity *= 0.1f;
|
|
dust.velocity += Projectile.velocity * 0.5f;
|
|
dust.position.X -= num152;
|
|
dust.position.Y -= num153;
|
|
}
|
|
if (Main.rand.NextBool(8))
|
|
{
|
|
int num156 = 16;
|
|
int num157 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num156, Projectile.position.Y + (float)num156), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 0.5f);
|
|
Main.dust[num157].velocity *= 0.25f;
|
|
Main.dust[num157].velocity += Projectile.velocity * 0.5f;
|
|
}
|
|
}
|
|
}
|
|
}
|