101 lines
3.2 KiB
C#
101 lines
3.2 KiB
C#
using CalamityMod.Dusts;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Projectiles.Magic
|
|
{
|
|
public class SeethingDischargeBrimstoneHellblast : ModProjectile
|
|
{
|
|
private bool initialized = false;
|
|
public override string Texture => "CalamityMod/Projectiles/Boss/BrimstoneHellblast";
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Hellblast");
|
|
Main.projFrames[projectile.type] = 4;
|
|
ProjectileID.Sets.TrailCacheLength[projectile.type] = 4;
|
|
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
projectile.width = 40;
|
|
projectile.height = 40;
|
|
projectile.friendly = true;
|
|
projectile.magic = true;
|
|
projectile.ignoreWater = true;
|
|
projectile.tileCollide = false;
|
|
projectile.penetrate = 1;
|
|
projectile.timeLeft = 255;
|
|
projectile.alpha = 0;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
if (!initialized)
|
|
{
|
|
if (projectile.npcProj)
|
|
{
|
|
projectile.usesLocalNPCImmunity = true;
|
|
projectile.localNPCHitCooldown = 5;
|
|
projectile.penetrate = 10;
|
|
}
|
|
initialized = true;
|
|
}
|
|
projectile.frameCounter++;
|
|
if (projectile.frameCounter >= 10)
|
|
{
|
|
projectile.frame++;
|
|
projectile.frameCounter = 0;
|
|
}
|
|
if (projectile.frame >= 4)
|
|
{
|
|
projectile.frame = 0;
|
|
}
|
|
projectile.alpha += 1;
|
|
Lighting.AddLight(projectile.Center, 0.9f, 0f, 0f);
|
|
if (projectile.ai[1] == 0f)
|
|
{
|
|
projectile.ai[1] = 1f;
|
|
Main.PlaySound(SoundID.Item20, projectile.position);
|
|
}
|
|
projectile.velocity.X *= 1.03f;
|
|
projectile.velocity.Y *= 1.03f;
|
|
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);
|
|
}
|
|
}
|
|
|
|
public override Color? GetAlpha(Color lightColor)
|
|
{
|
|
return new Color(250, 50, 50, projectile.alpha);
|
|
}
|
|
|
|
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
|
{
|
|
CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1);
|
|
return false;
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
Main.PlaySound(SoundID.Item20, projectile.position);
|
|
for (int dust = 0; dust <= 5; dust++)
|
|
{
|
|
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f);
|
|
}
|
|
}
|
|
}
|
|
}
|