Files
CalamityModPublic/Projectiles/Enemy/PearlRain.cs
T

59 lines
2.0 KiB
C#

using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Enemy
{
public class PearlRain : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Enemy";
public override string Texture => "CalamityMod/Projectiles/Enemy/PearlBurst";
public override void SetStaticDefaults()
{
Main.projFrames[Projectile.type] = 4;
}
public override void SetDefaults()
{
Projectile.width = 40;
Projectile.height = 64;
Projectile.hostile = true;
Projectile.penetrate = -1;
Projectile.alpha = 255;
Projectile.timeLeft = 300;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
}
public override void AI()
{
if (Projectile.ai[0] == 0) // saving pcs on the zenith seed
{
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f);
if (Main.rand.NextBool(5))
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 92, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.7f);
}
}
Projectile.frameCounter++;
if (Projectile.frameCounter > 3)
{
Projectile.frame++;
Projectile.frameCounter = 0;
}
if (Projectile.frame > 3)
{
Projectile.frame = 0;
}
Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f;
Projectile.alpha -= 6;
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(255, 255, 255);
}
}
}