Note: Does not include item rarities, and appears to shown nonexistant using directive movement in the commit. This does not really affect anything, however.
97 lines
3.1 KiB
C#
97 lines
3.1 KiB
C#
using CalamityMod.Buffs.DamageOverTime;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.Projectiles.Boss
|
|
{
|
|
public class AstralLaser : ModProjectile
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Astral Laser Volley");
|
|
Main.projFrames[projectile.type] = 3;
|
|
ProjectileID.Sets.TrailCacheLength[projectile.type] = 4;
|
|
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
projectile.width = 20;
|
|
projectile.height = 20;
|
|
projectile.hostile = true;
|
|
projectile.ignoreWater = true;
|
|
projectile.tileCollide = false;
|
|
projectile.alpha = 255;
|
|
projectile.penetrate = -1;
|
|
projectile.timeLeft = 240;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
projectile.frameCounter++;
|
|
if (projectile.frameCounter > 4)
|
|
{
|
|
projectile.frame++;
|
|
projectile.frameCounter = 0;
|
|
}
|
|
if (projectile.frame > 2)
|
|
{
|
|
projectile.frame = 0;
|
|
}
|
|
if (projectile.velocity.X < 0f)
|
|
{
|
|
projectile.spriteDirection = -1;
|
|
projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X);
|
|
}
|
|
else
|
|
{
|
|
projectile.spriteDirection = 1;
|
|
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X);
|
|
}
|
|
Lighting.AddLight(projectile.Center, 0.3f, 0.3f, 0f);
|
|
projectile.ai[0] += 1f;
|
|
if (projectile.ai[0] > 9f)
|
|
{
|
|
if (projectile.alpha > 0)
|
|
{
|
|
projectile.alpha -= 5;
|
|
}
|
|
}
|
|
}
|
|
|
|
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
|
{
|
|
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
|
|
return false;
|
|
}
|
|
|
|
public override bool CanDamage()
|
|
{
|
|
if (projectile.timeLeft < 85)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public override Color? GetAlpha(Color lightColor)
|
|
{
|
|
if (projectile.timeLeft < 85)
|
|
{
|
|
byte b2 = (byte)(projectile.timeLeft * 3);
|
|
byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f));
|
|
return new Color((int)b2, (int)b2, (int)b2, (int)a2);
|
|
}
|
|
return new Color(255, 255, 255, projectile.alpha);
|
|
}
|
|
|
|
public override void OnHitPlayer(Player target, int damage, bool crit)
|
|
{
|
|
target.AddBuff(ModContent.BuffType<AstralInfectionDebuff>(), 120);
|
|
}
|
|
}
|
|
}
|