Forbidden Oathblade line projectile piercing tweaks. Multiple refactors. Skeletron Prime defense scales with number of arms remaining and all arms explode when the head reaches phase 2. Gatling Laser sound bug fix. Yharon and Birb tornado/aura spawner projectiles last longer so they can actually reach their max velocity.
169 lines
6.6 KiB
C#
169 lines
6.6 KiB
C#
using CalamityMod.World;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using System;
|
|
using System.IO;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Projectiles.Boss
|
|
{
|
|
public class BigFlare2 : ModProjectile
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Big Flare");
|
|
Main.projFrames[projectile.type] = 4;
|
|
ProjectileID.Sets.TrailCacheLength[projectile.type] = 5;
|
|
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
projectile.width = 100;
|
|
projectile.height = 100;
|
|
projectile.hostile = true;
|
|
projectile.alpha = 255;
|
|
projectile.penetrate = -1;
|
|
projectile.timeLeft = 1200;
|
|
projectile.scale = 1.5f;
|
|
}
|
|
|
|
public override void SendExtraAI(BinaryWriter writer)
|
|
{
|
|
writer.Write(projectile.localAI[0]);
|
|
}
|
|
|
|
public override void ReceiveExtraAI(BinaryReader reader)
|
|
{
|
|
projectile.localAI[0] = reader.ReadSingle();
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
projectile.frameCounter++;
|
|
if (projectile.frameCounter > 4)
|
|
{
|
|
projectile.frame++;
|
|
projectile.frameCounter = 0;
|
|
}
|
|
if (projectile.frame > 3)
|
|
{
|
|
projectile.frame = 0;
|
|
}
|
|
|
|
if (projectile.ai[1] > 0f)
|
|
{
|
|
int num625 = (int)projectile.ai[1] - 1;
|
|
if (num625 < 255)
|
|
{
|
|
projectile.localAI[0] += 1f;
|
|
if (projectile.localAI[0] > 10f)
|
|
{
|
|
int num626 = 6;
|
|
for (int num627 = 0; num627 < num626; num627++)
|
|
{
|
|
Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f;
|
|
vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)(float)num626, default) + projectile.Center;
|
|
Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8);
|
|
int num628 = Dust.NewDust(vector45 + value15, 0, 0, 244, value15.X * 2f, value15.Y * 2f, 100, default, 1.4f);
|
|
Main.dust[num628].noGravity = true;
|
|
Main.dust[num628].noLight = true;
|
|
Main.dust[num628].velocity /= 4f;
|
|
Main.dust[num628].velocity -= projectile.velocity;
|
|
}
|
|
projectile.alpha -= 5;
|
|
if (projectile.alpha < 100)
|
|
{
|
|
projectile.alpha = 100;
|
|
}
|
|
}
|
|
|
|
Vector2 value16 = Main.player[num625].Center - projectile.Center;
|
|
float num629 = 4f;
|
|
num629 += projectile.localAI[0] / 60f;
|
|
projectile.velocity = Vector2.Normalize(value16) * num629;
|
|
if (value16.Length() < 64f)
|
|
{
|
|
projectile.Kill();
|
|
}
|
|
}
|
|
}
|
|
|
|
if (projectile.wet)
|
|
{
|
|
projectile.position.Y = projectile.position.Y - 16f;
|
|
projectile.Kill();
|
|
}
|
|
}
|
|
|
|
public override Color? GetAlpha(Color lightColor)
|
|
{
|
|
return new Color(255, Main.DiscoG, 53, projectile.alpha);
|
|
}
|
|
|
|
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
|
{
|
|
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
|
|
return false;
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive;
|
|
Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 20);
|
|
int num226 = 36;
|
|
for (int num227 = 0; num227 < num226; num227++)
|
|
{
|
|
Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f;
|
|
vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center;
|
|
Vector2 vector7 = vector6 - projectile.Center;
|
|
int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 244, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f);
|
|
Main.dust[num228].noGravity = true;
|
|
Main.dust[num228].noLight = true;
|
|
Main.dust[num228].velocity = vector7;
|
|
}
|
|
if (projectile.owner == Main.myPlayer)
|
|
{
|
|
int num231 = (int)(projectile.Center.Y / 16f);
|
|
int num232 = (int)(projectile.Center.X / 16f);
|
|
int num233 = 100;
|
|
if (num232 < 10)
|
|
{
|
|
num232 = 10;
|
|
}
|
|
if (num232 > Main.maxTilesX - 10)
|
|
{
|
|
num232 = Main.maxTilesX - 10;
|
|
}
|
|
if (num231 < 10)
|
|
{
|
|
num231 = 10;
|
|
}
|
|
if (num231 > Main.maxTilesY - num233 - 10)
|
|
{
|
|
num231 = Main.maxTilesY - num233 - 10;
|
|
}
|
|
int spawnAreaY = Main.maxTilesY - num231;
|
|
for (int num234 = num231; num234 < num231 + spawnAreaY; num234++)
|
|
{
|
|
Tile tile = Main.tile[num232, num234 + 10];
|
|
if (tile.active() && !TileID.Sets.Platforms[tile.type] && (Main.tileSolid[(int)tile.type] || tile.liquid != 0))
|
|
{
|
|
num231 = num234;
|
|
break;
|
|
}
|
|
}
|
|
int spawnLimitY = (int)(Main.player[projectile.owner].Center.Y / 16f) + 75;
|
|
if (num231 > spawnLimitY)
|
|
{
|
|
num231 = spawnLimitY;
|
|
}
|
|
int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, ModContent.ProjectileType<Infernado2>(), 0, 4f, Main.myPlayer, 11f, 24f + (revenge ? 2f : 0f));
|
|
Main.projectile[num236].netUpdate = true;
|
|
}
|
|
}
|
|
}
|
|
}
|