This commit formats the entire codebase according to `dotnet format` and its limited understanding of our provided `.editorconfig`.
93 lines
3.9 KiB
C#
93 lines
3.9 KiB
C#
using System;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using Terraria;
|
|
using Terraria.Audio;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.Projectiles.Melee
|
|
{
|
|
public class HolyColliderHolyFire : ModProjectile, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Projectiles.Melee";
|
|
public override string Texture => "CalamityMod/Projectiles/Boss/HolyFire2";
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
Main.projFrames[Projectile.type] = 4;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 26;
|
|
Projectile.height = 26;
|
|
Projectile.friendly = true;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.DamageType = DamageClass.Melee;
|
|
Projectile.penetrate = 1;
|
|
Projectile.tileCollide = false;
|
|
Projectile.timeLeft = 90;
|
|
}
|
|
|
|
public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 75 && target.CanBeChasedBy(Projectile);
|
|
|
|
public override void AI()
|
|
{
|
|
Projectile.frameCounter++;
|
|
if (Projectile.frameCounter > 6)
|
|
{
|
|
Projectile.frame++;
|
|
Projectile.frameCounter = 0;
|
|
}
|
|
if (Projectile.frame > 3)
|
|
Projectile.frame = 0;
|
|
|
|
if (Math.Abs(Projectile.velocity.X) < 7f)
|
|
Projectile.velocity.X *= 1.05f;
|
|
|
|
if (Projectile.timeLeft < 75)
|
|
CalamityUtils.HomeInOnNPC(Projectile, true, 450f, 12f, 20f);
|
|
}
|
|
|
|
public override Color? GetAlpha(Color lightColor)
|
|
{
|
|
return new Color(250, 150, 0, Projectile.alpha);
|
|
}
|
|
|
|
public override bool PreDraw(ref Color lightColor)
|
|
{
|
|
Texture2D texture2D13 = ModContent.Request<Texture2D>(Texture).Value;
|
|
int framing = ModContent.Request<Texture2D>(Texture).Value.Height / Main.projFrames[Projectile.type];
|
|
int y6 = framing * 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, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0);
|
|
return false;
|
|
}
|
|
|
|
public override void OnKill(int timeLeft)
|
|
{
|
|
SoundEngine.PlaySound(SoundID.Item20, Projectile.position);
|
|
Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2);
|
|
Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2);
|
|
Projectile.width = 150;
|
|
Projectile.height = 150;
|
|
Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2);
|
|
Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2);
|
|
for (int i = 0; i < 5; i++)
|
|
{
|
|
int holy = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f);
|
|
if (Main.rand.NextBool())
|
|
{
|
|
Main.dust[holy].scale = 0.5f;
|
|
Main.dust[holy].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
|
}
|
|
}
|
|
for (int j = 0; j < 10; j++)
|
|
{
|
|
int holy2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 3f);
|
|
Main.dust[holy2].noGravity = true;
|
|
holy2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f);
|
|
}
|
|
}
|
|
}
|
|
}
|