Files
CalamityModPublic/Projectiles/Boss/BrimstoneHellblast2.cs
T

79 lines
3.0 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Boss
{
public class BrimstoneHellblast2 : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Brimstone Hellblast");
Main.projFrames[projectile.type] = 4;
}
public override void SetDefaults()
{
projectile.width = 40;
projectile.height = 40;
projectile.hostile = true;
projectile.ignoreWater = true;
projectile.tileCollide = false;
projectile.extraUpdates = 1;
projectile.penetrate = -1;
projectile.timeLeft = 1500;
projectile.alpha = 0;
cooldownSlot = 1;
}
public override void AI()
{
projectile.frameCounter++;
if (projectile.frameCounter > 12)
{
projectile.frame++;
projectile.frameCounter = 0;
}
if (projectile.frame > 3)
{
projectile.frame = 0;
}
projectile.alpha += 1;
Lighting.AddLight(projectile.Center, 0.9f, 0f, 0f);
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 bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
Texture2D texture2D13 = Main.projectileTexture[projectile.type];
int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
int y6 = num214 * projectile.frame;
Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f);
return false;
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(250, 50, 50, projectile.alpha);
}
public override void OnHitPlayer(Player target, int damage, bool crit)
{
target.AddBuff(ModContent.BuffType<AbyssalFlames>(), 180);
target.AddBuff(ModContent.BuffType<VulnerabilityHex>(), 120, true);
}
}
}