Files
CalamityModPublic/Projectiles/Rogue/ExplosiveSun.cs
T
tomat 67bceff6e7 Initial dotnet format pass.
This commit formats the entire codebase according to `dotnet format` and its limited understanding of our provided `.editorconfig`.
2024-02-28 21:49:50 -08:00

95 lines
4.3 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class ExplosiveSun : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Rogue";
public override void SetDefaults()
{
Projectile.width = 22;
Projectile.height = 22;
//Projectile.aiStyle = ProjAIStyleID.TerrarianBeam;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.penetrate = 1;
Projectile.light = 0.5f;
Projectile.alpha = 50;
Projectile.scale = 1.2f;
Projectile.timeLeft = 60;
Projectile.tileCollide = false;
Projectile.DamageType = RogueDamageClass.Instance;
}
public override void AI()
{
Projectile.velocity.X *= 0.985f;
Projectile.velocity.Y *= 0.985f;
}
public override bool PreDraw(ref Color lightColor)
{
//Changes the texture of the projectile
if (Projectile.ai[0] == 1f)
{
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Rogue/ExplosiveSun2").Value;
Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, texture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0);
return false;
}
if (Projectile.ai[0] == 2f)
{
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Rogue/ExplosiveSun3").Value;
Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, texture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0);
return false;
}
return true;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<HolyFlames>(), 120);
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType<HolyFlames>(), 120);
public override void OnKill(int timeLeft)
{
Projectile.position = Projectile.Center;
Projectile.width = Projectile.height = 192;
Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2);
Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2);
Projectile.maxPenetrate = -1;
Projectile.penetrate = -1;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
Projectile.damage /= 2;
Projectile.Damage();
if (Main.rand.NextBool(3))
{
SoundEngine.PlaySound(SoundID.Item14 with { Volume = SoundID.Item14.Volume * 0.5f }, Projectile.Center);
}
for (int i = 0; i < 5; i++)
{
int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f);
Main.dust[dust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[dust].scale = 0.5f;
Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
for (int j = 0; j < 10; j++)
{
int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 3f);
Main.dust[dust2].noGravity = true;
Main.dust[dust2].velocity *= 5f;
dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f);
Main.dust[dust2].velocity *= 2f;
}
}
}
}