fully integrated the gfb bool gfb polter gets a bit spookier (wip) resprited armor crunch, cal eye banner added sounds: - astrum deus shoot sounds - final dawn use sound - supernova explosion sound - plasma rifle use sounds - aew charge and death sounds
204 lines
9.8 KiB
C#
204 lines
9.8 KiB
C#
using System;
|
|
using CalamityMod.Buffs.DamageOverTime;
|
|
using CalamityMod.World;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.Audio;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Projectiles.Boss
|
|
{
|
|
public class HiveBombGoliath : ModProjectile, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Projectiles.Boss";
|
|
public override void SetStaticDefaults()
|
|
{
|
|
Main.projFrames[Projectile.type] = 4;
|
|
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4;
|
|
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.Calamity().DealsDefenseDamage = true;
|
|
Projectile.width = 22;
|
|
Projectile.height = 22;
|
|
Projectile.hostile = true;
|
|
Projectile.tileCollide = false;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.penetrate = 1;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
if (Projectile.velocity.Length() < 18f)
|
|
Projectile.velocity *= 1.01f + (Projectile.ai[0] * 0.0002f);
|
|
|
|
if (Projectile.position.Y > Projectile.ai[1])
|
|
Projectile.tileCollide = true;
|
|
|
|
Projectile.frameCounter++;
|
|
if (Projectile.frameCounter > 4)
|
|
{
|
|
Projectile.frame++;
|
|
Projectile.frameCounter = 0;
|
|
}
|
|
if (Projectile.frame > 3)
|
|
{
|
|
Projectile.frame = 0;
|
|
}
|
|
if (Math.Abs(Projectile.velocity.X) >= 3f || Math.Abs(Projectile.velocity.Y) >= 3f)
|
|
{
|
|
float num247 = 0f;
|
|
float num248 = 0f;
|
|
if (Main.rand.Next(2) == 1)
|
|
{
|
|
num247 = Projectile.velocity.X * 0.5f;
|
|
num248 = Projectile.velocity.Y * 0.5f;
|
|
}
|
|
int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 0.5f);
|
|
Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f;
|
|
Main.dust[num249].velocity *= 0.2f;
|
|
Main.dust[num249].noGravity = true;
|
|
num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.25f);
|
|
Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f;
|
|
Main.dust[num249].velocity *= 0.05f;
|
|
}
|
|
else if (Main.rand.NextBool(4))
|
|
{
|
|
int num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 0.5f);
|
|
Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f;
|
|
Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f;
|
|
Main.dust[num252].noGravity = true;
|
|
Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f;
|
|
Main.rand.Next(2);
|
|
num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f);
|
|
Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f;
|
|
Main.dust[num252].noGravity = true;
|
|
Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f;
|
|
}
|
|
Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f;
|
|
}
|
|
|
|
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)
|
|
{
|
|
return new Color(50, 250, 50, Projectile.alpha);
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
Projectile.position = Projectile.Center;
|
|
Projectile.width = Projectile.height = 64;
|
|
Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2);
|
|
Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2);
|
|
Projectile.Damage();
|
|
SoundEngine.PlaySound(SoundID.Item14, Projectile.Center);
|
|
for (int num621 = 0; num621 < 8; num621++)
|
|
{
|
|
int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 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 + (float)Main.rand.Next(10) * 0.1f;
|
|
}
|
|
}
|
|
for (int num623 = 0; num623 < 10; num623++)
|
|
{
|
|
int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 3f);
|
|
Main.dust[num624].noGravity = true;
|
|
Main.dust[num624].velocity *= 5f;
|
|
num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f);
|
|
Main.dust[num624].velocity *= 2f;
|
|
}
|
|
|
|
if (Main.netMode != NetmodeID.Server)
|
|
{
|
|
Vector2 goreSource = Projectile.Center;
|
|
int goreAmt = 3;
|
|
Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f);
|
|
for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++)
|
|
{
|
|
float velocityMult = 0.33f;
|
|
if (goreIndex < (goreAmt / 3))
|
|
{
|
|
velocityMult = 0.66f;
|
|
}
|
|
if (goreIndex >= (2 * goreAmt / 3))
|
|
{
|
|
velocityMult = 1f;
|
|
}
|
|
Mod mod = ModContent.GetInstance<CalamityMod>();
|
|
int type = Main.rand.Next(61, 64);
|
|
int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f);
|
|
Gore gore = Main.gore[smoke];
|
|
gore.velocity *= velocityMult;
|
|
gore.velocity.X += 1f;
|
|
gore.velocity.Y += 1f;
|
|
type = Main.rand.Next(61, 64);
|
|
smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f);
|
|
gore = Main.gore[smoke];
|
|
gore.velocity *= velocityMult;
|
|
gore.velocity.X -= 1f;
|
|
gore.velocity.Y += 1f;
|
|
type = Main.rand.Next(61, 64);
|
|
smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f);
|
|
gore = Main.gore[smoke];
|
|
gore.velocity *= velocityMult;
|
|
gore.velocity.X += 1f;
|
|
gore.velocity.Y -= 1f;
|
|
type = Main.rand.Next(61, 64);
|
|
smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f);
|
|
gore = Main.gore[smoke];
|
|
gore.velocity *= velocityMult;
|
|
gore.velocity.X -= 1f;
|
|
gore.velocity.Y -= 1f;
|
|
}
|
|
}
|
|
|
|
if (Main.netMode != NetmodeID.MultiplayerClient && Main.zenithWorld)
|
|
{
|
|
Vector2 valueBoom = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f);
|
|
float spreadBoom = 15f * 0.0174f;
|
|
double startAngleBoom = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spreadBoom / 2;
|
|
double deltaAngleBoom = spreadBoom / 8f;
|
|
double offsetAngleBoom;
|
|
int iBoom;
|
|
int damageBoom = Projectile.damage / 2;
|
|
for (iBoom = 0; iBoom < 5; iBoom++)
|
|
{
|
|
if (Main.rand.NextBool(5) && iBoom > 0)
|
|
{
|
|
int projectileType = ModContent.ProjectileType<SandPoisonCloud>();
|
|
offsetAngleBoom = startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f + 32f * iBoom;
|
|
float velocity = 0.5f;
|
|
Projectile.NewProjectile(Projectile.GetSource_FromAI(), valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * velocity), (float)(Math.Cos(offsetAngleBoom) * velocity), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f);
|
|
Projectile.NewProjectile(Projectile.GetSource_FromAI(), valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * velocity), (float)(-Math.Cos(offsetAngleBoom) * velocity), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void OnHitPlayer(Player target, Player.HurtInfo info)
|
|
{
|
|
if (info.Damage <= 0)
|
|
return;
|
|
|
|
if (Main.zenithWorld) // it is the plague, you get very sick.
|
|
{
|
|
target.AddBuff(ModContent.BuffType<SulphuricPoisoning>(), 240, true);
|
|
target.AddBuff(BuffID.Poisoned, 240, true);
|
|
target.AddBuff(BuffID.Venom, 240, true);
|
|
}
|
|
target.AddBuff(ModContent.BuffType<Plague>(), 240, true);
|
|
}
|
|
}
|
|
}
|