2 - DoG only spits fireballs if his head is looking towards the player. 3 - DoG becomes visible more gradually in phase 1 when he's done firing laser walls. 4 - Fixed a few DoG netmode checks.
156 lines
5.8 KiB
C#
156 lines
5.8 KiB
C#
using CalamityMod.Buffs.DamageOverTime;
|
|
using Microsoft.Xna.Framework;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
using Terraria.Audio;
|
|
namespace CalamityMod.Projectiles.Boss
|
|
{
|
|
public class DoGFire : ModProjectile
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Death Fire");
|
|
Main.projFrames[Projectile.type] = 6;
|
|
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3;
|
|
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.Calamity().DealsDefenseDamage = true;
|
|
Projectile.width = 34;
|
|
Projectile.height = 34;
|
|
Projectile.hostile = true;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.tileCollide = false;
|
|
Projectile.extraUpdates = 1;
|
|
Projectile.penetrate = -1;
|
|
Projectile.timeLeft = 480;
|
|
CooldownSlot = ImmunityCooldownID.Bosses;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
if (Projectile.localAI[0] == 0f && Projectile.ai[1] == 0f)
|
|
{
|
|
Projectile.localAI[0] = 1f;
|
|
SoundEngine.PlaySound(SoundID.Item20, Projectile.Center);
|
|
}
|
|
|
|
Projectile.frameCounter++;
|
|
if (Projectile.frameCounter > 4)
|
|
{
|
|
Projectile.frame++;
|
|
Projectile.frameCounter = 0;
|
|
}
|
|
if (Projectile.frame > 5)
|
|
Projectile.frame = 0;
|
|
|
|
int dust = Dust.NewDust(new Vector2(Projectile.position.X + Projectile.velocity.X, Projectile.position.Y + Projectile.velocity.Y), Projectile.width, Projectile.height, 173, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 0.8f);
|
|
Main.dust[dust].noGravity = true;
|
|
|
|
Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2;
|
|
|
|
if (Projectile.ai[1] > 0f)
|
|
{
|
|
if (Projectile.velocity.Length() < Projectile.ai[1])
|
|
Projectile.velocity *= Projectile.ai[0];
|
|
}
|
|
}
|
|
|
|
public override bool PreDraw(ref Color lightColor)
|
|
{
|
|
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
|
|
return false;
|
|
}
|
|
|
|
public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, 0);
|
|
|
|
public override void OnHitPlayer(Player target, int damage, bool crit)
|
|
{
|
|
if (damage <= 0)
|
|
return;
|
|
|
|
target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 240);
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
SoundEngine.PlaySound(SoundID.Item74, Projectile.Center);
|
|
Projectile.position = Projectile.Center;
|
|
Projectile.width = Projectile.height = 64;
|
|
Projectile.position.X = Projectile.position.X - Projectile.width / 2;
|
|
Projectile.position.Y = Projectile.position.Y - Projectile.height / 2;
|
|
for (int num621 = 0; num621 < 5; num621++)
|
|
{
|
|
int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f);
|
|
Main.dust[num622].velocity *= 3f;
|
|
if (Main.rand.NextBool(2))
|
|
{
|
|
Main.dust[num622].scale = 0.5f;
|
|
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
|
|
}
|
|
}
|
|
for (int num623 = 0; num623 < 10; num623++)
|
|
{
|
|
int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 3f);
|
|
Main.dust[num624].noGravity = true;
|
|
Main.dust[num624].velocity *= 5f;
|
|
num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f);
|
|
Main.dust[num624].velocity *= 2f;
|
|
}
|
|
for (int num640 = 0; num640 < 200; num640++)
|
|
{
|
|
float num641 = 12f;
|
|
if (num640 < 150)
|
|
num641 = 9f;
|
|
if (num640 < 100)
|
|
num641 = 6f;
|
|
if (num640 < 50)
|
|
num641 = 3f;
|
|
|
|
int num643 = Dust.NewDust(Projectile.Center, 6, 6, 173, 0f, 0f, 100, default, 1f);
|
|
float num644 = Main.dust[num643].velocity.X;
|
|
float num645 = Main.dust[num643].velocity.Y;
|
|
|
|
if (num644 == 0f && num645 == 0f)
|
|
num644 = 1f;
|
|
|
|
float num646 = (float)Math.Sqrt(num644 * num644 + num645 * num645);
|
|
num646 = num641 / num646;
|
|
num644 *= num646;
|
|
num645 *= num646;
|
|
|
|
float scale = 1f;
|
|
switch ((int)num641)
|
|
{
|
|
case 4:
|
|
scale = 1.2f;
|
|
break;
|
|
case 8:
|
|
scale = 1.1f;
|
|
break;
|
|
case 12:
|
|
scale = 1f;
|
|
break;
|
|
case 16:
|
|
scale = 0.9f;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
Dust dust = Main.dust[num643];
|
|
dust.velocity *= 0.5f;
|
|
dust.velocity.X += num644;
|
|
dust.velocity.Y += num645;
|
|
dust.scale = scale;
|
|
dust.noGravity = true;
|
|
}
|
|
Projectile.Damage();
|
|
}
|
|
}
|
|
}
|