see #bosses
Message Link: https://discord.com/channels/458428222061936650/458430366139678742/1482606762874900480
This commit is contained in:
1 parent
f90454d295
commit
7d4d0701c4
9 files changed
+519
-8
No files matched your search
@@ -87,6 +87,7 @@ HellfireExplosion.DisplayName: Brimstone Hellfire Explosion
|
||||
HiveBombGoliath.DisplayName: Hive Bomb
|
||||
HolyAura.DisplayName: Holy Aura
|
||||
HolyBlast.DisplayName: Holy Blast
|
||||
HolyBlastFrags.DisplayName: Holy Blast Frag
|
||||
HolyBomb.DisplayName: Holy Bomb
|
||||
HolyBurnOrb.DisplayName: Holy Orb
|
||||
HolyExplosionBoom.DisplayName: Holy Explosion
|
||||
@@ -107,6 +108,7 @@ Infernado.DisplayName: Infernado
|
||||
Infernado2.DisplayName: Infernado
|
||||
InfernadoRevenge.DisplayName: Infernado
|
||||
JewelProjectile.DisplayName: Ruby Bolt
|
||||
LingeringHolyInferno.DisplayName: Lingering Holy Inferno
|
||||
LeviathanBomb.DisplayName: Meteor Vomit
|
||||
LeviathanSpawner.DisplayName: Spawner
|
||||
MajesticSparkle.DisplayName: Majestic Sparkle
|
||||
|
||||
@@ -1418,6 +1418,15 @@ namespace CalamityMod.NPCs.Providence
|
||||
}
|
||||
}
|
||||
|
||||
float shorterFlameCocoonDistance = 2800f - ((CalamityWorld.death || NPC.localAI[1] == (float)BossMode.Enraged) ? 600f : CalamityWorld.revenge ? 400f : Main.expertMode ? 200f : 0f);
|
||||
if (attackerAlive || defenderAlive || healerAlive)
|
||||
shorterFlameCocoonDistance = 2800f;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
for (var i = 0; i < 100; i++)
|
||||
{
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + new Vector2(Main.rand.NextFloat(shorterFlameCocoonDistance, shorterFlameCocoonDistance + (death? 1000 : 500)), 0).RotatedBy(MathHelper.TwoPi * i / 100f + Main.rand.NextFloat(-0.0025f,0.0025f)), Vector2.Zero, ModContent.ProjectileType<LingeringHolyInferno>(), BlobDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer, NPC.Center.X, NPC.Center.Y, shorterFlameCocoonDistance);
|
||||
}
|
||||
|
||||
text = false;
|
||||
AIState = (int)Phase.PhaseChange;
|
||||
NPC.localAI[2] = attackDelayAfterCocoon;
|
||||
@@ -1596,6 +1605,16 @@ namespace CalamityMod.NPCs.Providence
|
||||
NPC.ai[3] += 1f;
|
||||
if (NPC.ai[3] >= phaseTime)
|
||||
{
|
||||
|
||||
float shorterSpearCocoonDistance = 2800f - ((CalamityWorld.death || NPC.localAI[1] == (float)BossMode.Enraged) ? 1000f : CalamityWorld.revenge ? 650f : Main.expertMode ? 300f : 0f);
|
||||
if (attackerAlive || defenderAlive || healerAlive)
|
||||
shorterSpearCocoonDistance = 2800f;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
for (var i = 0; i < 100; i++)
|
||||
{
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + new Vector2(Main.rand.NextFloat(shorterSpearCocoonDistance, shorterSpearCocoonDistance + (death ? 1000 : 500)),0).RotatedBy(MathHelper.TwoPi * i/100f + Main.rand.NextFloat(-0.0025f, 0.0025f)), Vector2.Zero, ModContent.ProjectileType<LingeringHolyInferno>(), BlobDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer, NPC.Center.X,NPC.Center.Y, shorterSpearCocoonDistance);
|
||||
}
|
||||
|
||||
AIState = (int)Phase.PhaseChange;
|
||||
NPC.localAI[2] = attackDelayAfterCocoon;
|
||||
NPC.TargetClosest();
|
||||
@@ -1930,7 +1949,7 @@ namespace CalamityMod.NPCs.Providence
|
||||
Projectile projectile = Main.projectile[x];
|
||||
if (projectile.active)
|
||||
{
|
||||
if (projectile.type == ModContent.ProjectileType<HolyFire2>() || projectile.type == ModContent.ProjectileType<HolyFlare>())
|
||||
if (projectile.type == ModContent.ProjectileType<HolyFire2>() || projectile.type == ModContent.ProjectileType<HolyFlare>() || projectile.type == ModContent.ProjectileType<LingeringHolyInferno>())
|
||||
projectile.Kill();
|
||||
else if (projectile.type == ModContent.ProjectileType<HolyBlast>() || projectile.type == ModContent.ProjectileType<HolyFire>())
|
||||
projectile.active = false;
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace CalamityMod.Projectiles.Boss
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = TimeLeft;
|
||||
CooldownSlot = ImmunityCooldownID.Bosses;
|
||||
Projectile.scale = 0;
|
||||
}
|
||||
|
||||
public override void OnSpawn(IEntitySource source)
|
||||
@@ -66,6 +67,8 @@ namespace CalamityMod.Projectiles.Boss
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.scale < 1)
|
||||
Projectile.scale += 0.05f;
|
||||
ProvUtils.ApplyGFBDamage(Projectile, 180, 20);
|
||||
|
||||
Lighting.AddLight(Projectile.Center, 0.9f, 0.7f, 0f);
|
||||
@@ -162,7 +165,7 @@ namespace CalamityMod.Projectiles.Boss
|
||||
totalProjectiles *= 2;
|
||||
|
||||
float radians = MathHelper.TwoPi / totalProjectiles;
|
||||
int type = ModContent.ProjectileType<HolyFire2>();
|
||||
int type = ModContent.ProjectileType<HolyBlastFrags>();
|
||||
float velocity = 5f;
|
||||
Vector2 spinningPoint = new Vector2(0f, -velocity);
|
||||
Vector2 additionalVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 2.5f;
|
||||
|
||||
@@ -0,0 +1,187 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using CalamityMod.NPCs.Providence;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Utilities.Daybreak;
|
||||
using CalamityMod.Utilities.Daybreak.Buffers;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Boss
|
||||
{
|
||||
public class HolyBlastFrags : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/Boss/HolyFire2";
|
||||
|
||||
public new string LocalizationCategory => "Projectiles.Boss";
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 15;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 2;
|
||||
Main.projFrames[Type] = 4;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 26;
|
||||
Projectile.height = 26;
|
||||
Projectile.hostile = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.timeLeft = 600;
|
||||
CooldownSlot = ImmunityCooldownID.Bosses;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
ProvUtils.ApplyGFBDamage(Projectile, 120, 10);
|
||||
|
||||
Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f);
|
||||
|
||||
Projectile.frameCounter++;
|
||||
if (Projectile.frameCounter > 6)
|
||||
{
|
||||
Projectile.frame++;
|
||||
Projectile.frameCounter = 0;
|
||||
}
|
||||
if (Projectile.frame > 3)
|
||||
Projectile.frame = 0;
|
||||
|
||||
float maxVelocity = Projectile.ai[0] == 0f ? 7f : CalamityWorld.death ? 11f : CalamityWorld.revenge ? 10f : Main.expertMode ? 9f : 7f;
|
||||
if (Math.Abs(Projectile.velocity.X) < maxVelocity)
|
||||
Projectile.velocity.X *= 1.05f;
|
||||
|
||||
int playerTracker = Player.FindClosest(Projectile.Center, 1, 1);
|
||||
|
||||
Projectile.ai[1] += 1f;
|
||||
if (Projectile.ai[1] < 180f && Projectile.ai[1] > 60f)
|
||||
{
|
||||
float projVelocityMult = Projectile.velocity.Length();
|
||||
Vector2 playerDirection = Main.player[playerTracker].Center - Projectile.Center;
|
||||
playerDirection.Normalize();
|
||||
playerDirection *= projVelocityMult;
|
||||
float inertia = !ProvUtils.StandardAI() ? 20f : 25f;
|
||||
Projectile.velocity = (Projectile.velocity * (inertia - 1f) + playerDirection) / inertia;
|
||||
Projectile.velocity.Normalize();
|
||||
Projectile.velocity *= projVelocityMult;
|
||||
}
|
||||
|
||||
float vel = Math.Clamp(((Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) / 2), 0f, 1f);
|
||||
|
||||
if (Projectile.timeLeft % 3 == 0)
|
||||
GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.2f, false, 10, Main.rand.NextFloat(0.8f, 1.2f), ProvUtils.GetProjectileColor(255)));
|
||||
|
||||
if (Main.rand.NextBool())
|
||||
GeneralParticleHandler.SpawnParticle(new MediumMistParticle(Projectile.Center, Vector2.Zero, Color.LightSlateGray, Color.DarkSlateGray, Main.rand.NextFloat(vel), 150, MathHelper.ToRadians(Main.rand.NextFloat(-1f, 1f))));
|
||||
|
||||
Projectile.rotation = MathHelper.Lerp(0f, MathHelper.WrapAngle(Vector2.Zero.AngleTo(Projectile.velocity) + MathHelper.ToRadians(-90f)), Math.Clamp(vel, 0f, 1f));
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor) => ProvUtils.GetProjectileColor(lightColor);
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
|
||||
Main.spriteBatch.End(out var ss);
|
||||
var device = Main.instance.GraphicsDevice;
|
||||
using var lease = RenderTargetPool.Shared.Rent(
|
||||
device,
|
||||
Main.screenWidth / 2,
|
||||
Main.screenHeight / 2,
|
||||
RenderTargetDescriptor.Default
|
||||
);
|
||||
using (lease.Scope(clearColor: Color.Transparent))
|
||||
{
|
||||
var list = Projectile.oldPos.Take(12).ToList();
|
||||
|
||||
list.Insert(0, Projectile.position + (Projectile.rotation+MathHelper.PiOver2 * Projectile.spriteDirection).ToRotationVector2() * 16f);
|
||||
|
||||
GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak"));
|
||||
PrimitiveRenderer.RenderTrail(list.ToArray(), new(FireWidthFunction, FireColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), Projectile.oldPos.Length + 32);
|
||||
}
|
||||
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.Transform);
|
||||
Main.spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.End();
|
||||
|
||||
Main.spriteBatch.Begin(ss);
|
||||
Texture2D texture = ProvUtils.StandardAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request<Texture2D>("CalamityMod/Projectiles/Boss/HolyFire2Night").Value;
|
||||
int framing = texture.Height / Main.projFrames[Type];
|
||||
int y6 = framing * Projectile.frame;
|
||||
Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, texture);
|
||||
Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0);
|
||||
return false;
|
||||
}
|
||||
public float FireWidthFunction(float completion, Vector2 pos)
|
||||
{
|
||||
float width;
|
||||
float maxBodyWidth = 38f * Projectile.scale;
|
||||
float curveRatio = 0.2f;
|
||||
var positions = Projectile.oldPos.ToList();
|
||||
positions.RemoveAll(x => x == Vector2.Zero);
|
||||
// Crop the tip of the trail into a conic shape.
|
||||
if (completion < curveRatio)
|
||||
width = MathF.Pow(completion / curveRatio, 0.5f) * maxBodyWidth;
|
||||
else
|
||||
width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f);
|
||||
|
||||
// Pulse inwards and outwards over time.
|
||||
float pulseInterpolant = MathF.Cos(MathHelper.Pi * completion - Main.GlobalTimeWrappedHourly * 20f) * 0.5f + 0.5f;
|
||||
float additionalPulseWidth = MathHelper.Lerp(0f, 12f, pulseInterpolant);
|
||||
return (width + additionalPulseWidth) * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type];
|
||||
}
|
||||
|
||||
public Color FireColorFunction(float completion, Vector2 pos)
|
||||
{
|
||||
Color mainColor = ProvUtils.GetProjectileColor(255);
|
||||
Color endColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true));
|
||||
return Color.Lerp(mainColor, endColor, completion) * Projectile.Opacity;
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item20, Projectile.Center);
|
||||
Projectile.position.X = Projectile.position.X + (Projectile.width / 2);
|
||||
Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2);
|
||||
Projectile.width = 40;
|
||||
Projectile.height = 40;
|
||||
Projectile.position.X = Projectile.position.X - (Projectile.width / 2);
|
||||
Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2);
|
||||
int dustType = ProvUtils.GetDustID();
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[holyDust].noGravity = true;
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Main.dust[holyDust].scale = 0.5f;
|
||||
Main.dust[holyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < 10; j++)
|
||||
{
|
||||
int holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f);
|
||||
Main.dust[holyDust2].noGravity = true;
|
||||
holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[holyDust2].noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player target, Player.HurtInfo info)
|
||||
{
|
||||
// If the player is dodging, don't apply debuffs
|
||||
if (info.Damage <= 0 || target.creativeGodMode)
|
||||
return;
|
||||
|
||||
ProvUtils.ApplyDebuffs(target, 120);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ namespace CalamityMod.Projectiles.Boss
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
CooldownSlot = ImmunityCooldownID.Bosses;
|
||||
Projectile.scale = 0;
|
||||
}
|
||||
|
||||
public override void OnSpawn(IEntitySource source)
|
||||
@@ -46,6 +47,8 @@ namespace CalamityMod.Projectiles.Boss
|
||||
}
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.scale < 1)
|
||||
Projectile.scale += 0.1f;
|
||||
ProvUtils.ApplyGFBDamage(Projectile, 120, 20);
|
||||
|
||||
Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f);
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using CalamityMod.NPCs.Providence;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Utilities.Daybreak;
|
||||
using CalamityMod.Utilities.Daybreak.Buffers;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -30,10 +35,16 @@ namespace CalamityMod.Projectiles.Boss
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.timeLeft = 600;
|
||||
CooldownSlot = ImmunityCooldownID.Bosses;
|
||||
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 15;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 2;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 15;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 2;
|
||||
ProvUtils.ApplyGFBDamage(Projectile, 120, 10);
|
||||
|
||||
Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f);
|
||||
@@ -68,7 +79,8 @@ namespace CalamityMod.Projectiles.Boss
|
||||
|
||||
float vel = Math.Clamp(((Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) / 2), 0f, 1f);
|
||||
|
||||
GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.2f, false, 10, Main.rand.NextFloat(0.8f, 1.2f), ProvUtils.GetProjectileColor(255)));
|
||||
if (Projectile.timeLeft % 3 == 0)
|
||||
GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.2f, false, 10, Main.rand.NextFloat(0.8f, 1.2f), ProvUtils.GetProjectileColor(255)));
|
||||
|
||||
if (Main.rand.NextBool())
|
||||
GeneralParticleHandler.SpawnParticle(new MediumMistParticle(Projectile.Center, Vector2.Zero, Color.LightSlateGray, Color.DarkSlateGray, Main.rand.NextFloat(vel), 150, MathHelper.ToRadians(Main.rand.NextFloat(-1f, 1f))));
|
||||
@@ -80,6 +92,30 @@ namespace CalamityMod.Projectiles.Boss
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
|
||||
Main.spriteBatch.End(out var ss);
|
||||
var device = Main.instance.GraphicsDevice;
|
||||
using var lease = RenderTargetPool.Shared.Rent(
|
||||
device,
|
||||
Main.screenWidth / 2,
|
||||
Main.screenHeight / 2,
|
||||
RenderTargetDescriptor.Default
|
||||
);
|
||||
using (lease.Scope(clearColor: Color.Transparent))
|
||||
{
|
||||
var list = Projectile.oldPos.Take(8).ToList();
|
||||
|
||||
list.Insert(0, Projectile.position + (Projectile.rotation + MathHelper.PiOver2 * Projectile.spriteDirection).ToRotationVector2() * 16f);
|
||||
|
||||
GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak"));
|
||||
PrimitiveRenderer.RenderTrail(list.ToArray(), new(FireWidthFunction, FireColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), Projectile.oldPos.Length + 32);
|
||||
}
|
||||
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.Transform);
|
||||
Main.spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White * 0.75f, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.End();
|
||||
|
||||
Main.spriteBatch.Begin(ss);
|
||||
Texture2D texture = ProvUtils.StandardAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request<Texture2D>("CalamityMod/Projectiles/Boss/HolyFire2Night").Value;
|
||||
int framing = texture.Height / Main.projFrames[Type];
|
||||
int y6 = framing * Projectile.frame;
|
||||
@@ -87,6 +123,31 @@ namespace CalamityMod.Projectiles.Boss
|
||||
Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0);
|
||||
return false;
|
||||
}
|
||||
public float FireWidthFunction(float completion, Vector2 pos)
|
||||
{
|
||||
float width;
|
||||
float maxBodyWidth = 16f * Projectile.scale;
|
||||
float curveRatio = 0.2f;
|
||||
var positions = Projectile.oldPos.ToList();
|
||||
positions.RemoveAll(x => x == Vector2.Zero);
|
||||
// Crop the tip of the trail into a conic shape.
|
||||
if (completion < curveRatio)
|
||||
width = MathF.Pow(completion / curveRatio, 0.5f) * maxBodyWidth;
|
||||
else
|
||||
width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f);
|
||||
|
||||
// Pulse inwards and outwards over time.
|
||||
float pulseInterpolant = MathF.Cos(MathHelper.Pi * completion - Main.GlobalTimeWrappedHourly * 20f) * 0.5f + 0.5f;
|
||||
float additionalPulseWidth = MathHelper.Lerp(0f, 12f, pulseInterpolant);
|
||||
return (width + additionalPulseWidth) * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type];
|
||||
}
|
||||
|
||||
public Color FireColorFunction(float completion, Vector2 pos)
|
||||
{
|
||||
Color mainColor = ProvUtils.GetProjectileColor(255);
|
||||
Color endColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true));
|
||||
return Color.Lerp(mainColor, endColor, completion) * Projectile.Opacity;
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,238 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using CalamityMod.NPCs.Providence;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Utilities.Daybreak;
|
||||
using CalamityMod.Utilities.Daybreak.Buffers;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static CalamityMod.NPCs.Providence.Providence;
|
||||
|
||||
namespace CalamityMod.Projectiles.Boss
|
||||
{
|
||||
public class LingeringHolyInferno : ModProjectile, ILocalizedModType
|
||||
{
|
||||
bool started = false;
|
||||
public new string LocalizationCategory => "Projectiles.Boss";
|
||||
public override string Texture => "CalamityMod/Projectiles/StarProj";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 15;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 2;
|
||||
}
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.localAI[1] = Main.rand.NextFloat(30f);
|
||||
Projectile.width = Projectile.height = 32;
|
||||
Projectile.hostile = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.alpha = 0;
|
||||
CooldownSlot = ImmunityCooldownID.Bosses;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = CalamityUtils.MinutesToFrames(2);
|
||||
Projectile.Calamity().DealsDefenseDamage = true;
|
||||
Projectile.MaxUpdates = 2;
|
||||
}
|
||||
Vector2 OrbitPos = new();
|
||||
public override void AI()
|
||||
{
|
||||
ProvUtils.ApplyGFBDamage(Projectile, 120, 50);
|
||||
|
||||
Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f);
|
||||
|
||||
if (!started)
|
||||
{
|
||||
started = true;
|
||||
OrbitPos = new Vector2(Projectile.ai[0], Projectile.ai[1]);
|
||||
Projectile.ai[0] = OrbitPos.DirectionTo(Projectile.Center).ToRotation();
|
||||
Projectile.ai[1] = OrbitPos.Distance(Projectile.Center);
|
||||
|
||||
}
|
||||
|
||||
Projectile.ai[0] += (Projectile.ai[1] - (Projectile.ai[2]-1000)) * 0.0000025f * (CalamityWorld.death ? 6 : CalamityWorld.revenge ? 2 : 1);
|
||||
|
||||
Projectile.Center = OrbitPos + Projectile.ai[0].ToRotationVector2() * Projectile.ai[1];
|
||||
|
||||
Projectile.position.X = MathHelper.Clamp(Projectile.position.X, 5, (Main.maxTilesX - 5) * 16);
|
||||
Projectile.position.Y = MathHelper.Clamp(Projectile.position.Y, 5, (Main.maxTilesY - 5) * 16);
|
||||
Projectile.localAI[1] += 0.1f;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
float totalOpacity = MathHelper.Clamp(1-(Projectile.Distance(Main.LocalPlayer.Center) - 600) / 80f, 0.5f, 1f);
|
||||
if (totalOpacity == 0)
|
||||
return false;
|
||||
|
||||
Main.spriteBatch.End(out var ss);
|
||||
var device = Main.instance.GraphicsDevice;
|
||||
using var lease = RenderTargetPool.Shared.Rent(
|
||||
device,
|
||||
Main.screenWidth / 2,
|
||||
Main.screenHeight / 2,
|
||||
RenderTargetDescriptor.Default
|
||||
);
|
||||
using var mainLease = RenderTargetPool.Shared.Rent(
|
||||
device,
|
||||
Main.screenWidth,
|
||||
Main.screenHeight,
|
||||
RenderTargetDescriptor.Default
|
||||
);
|
||||
|
||||
using (mainLease.Scope(clearColor: Color.Transparent))
|
||||
{
|
||||
|
||||
using (lease.Scope(clearColor: Color.Transparent))
|
||||
{
|
||||
GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak"));
|
||||
PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(FireWidthFunction, FireColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), Projectile.oldPos.Length + 32);
|
||||
|
||||
Vector2[] fireCoreLength = Projectile.oldPos.Take(8).ToArray();
|
||||
GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/SylvestaffStreak"));
|
||||
PrimitiveRenderer.RenderTrail(fireCoreLength, new(FireCoreWidthFunction, FireCoreColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), fireCoreLength.Length + 24);
|
||||
}
|
||||
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity);
|
||||
Main.spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f);
|
||||
|
||||
|
||||
float lerpMult = MathHelper.Lerp(0.5f, 1f, Math.Abs(MathF.Sin(Projectile.localAI[1] / 10f)));
|
||||
|
||||
Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
|
||||
Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY);
|
||||
Color baseColor = ProvUtils.GetProjectileColor(255, true) * 4;
|
||||
Color baseColor2 = ProvUtils.GetProjectileColor(255);
|
||||
baseColor.A = 0;
|
||||
baseColor *= lerpMult;
|
||||
baseColor2 *= lerpMult;
|
||||
Vector2 origin = texture.Size() / 2f;
|
||||
Vector2 scale = new Vector2(0.5f, 1f) * ((lerpMult - 1) * 0.5f + 1f);
|
||||
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (Projectile.spriteDirection == -1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
Projectile.rotation += MathHelper.ToRadians(lerpMult * 2f);
|
||||
|
||||
float upRight = MathHelper.PiOver4;
|
||||
float up = MathHelper.PiOver2;
|
||||
float upLeft = 3f * MathHelper.PiOver4;
|
||||
float left = MathHelper.Pi;
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upLeft + Projectile.rotation, origin, scale, spriteEffects, 0);
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upRight - Projectile.rotation, origin, scale, spriteEffects, 0);
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upLeft + Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0);
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upRight - Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0);
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, baseColor, up + Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0);
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, baseColor, left - Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0);
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, up + Projectile.rotation, origin, scale * 0.36f, spriteEffects, 0);
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, left - Projectile.rotation, origin, scale * 0.36f, spriteEffects, 0);
|
||||
|
||||
|
||||
scale = new Vector2(1f, 1f);
|
||||
texture = ModContent.Request<Texture2D>("CalamityMod/Particles/GlowOrbParticle").Value;
|
||||
using (Main.spriteBatch.Scope())
|
||||
{
|
||||
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity);
|
||||
Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, baseColor2, 0, texture.Size() * 0.5f, 1f, 0, 0f);
|
||||
Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, Color.White, 0, texture.Size() * 0.5f, 0.5f, 0, 0f);
|
||||
Main.spriteBatch.End();
|
||||
}
|
||||
Main.spriteBatch.End();
|
||||
}
|
||||
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.Transform);
|
||||
Main.spriteBatch.Draw(mainLease.Target, Vector2.Zero, null, Color.White * totalOpacity, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(ss);
|
||||
return false;
|
||||
}
|
||||
|
||||
public float FireWidthFunction(float completion, Vector2 pos)
|
||||
{
|
||||
float width;
|
||||
float maxBodyWidth = 38f * Projectile.scale;
|
||||
float curveRatio = 0.2f;
|
||||
var positions = Projectile.oldPos.ToList();
|
||||
positions.RemoveAll(x => x == Vector2.Zero);
|
||||
// Crop the tip of the trail into a conic shape.
|
||||
if (completion < curveRatio)
|
||||
width = MathF.Pow(completion / curveRatio, 0.5f) * maxBodyWidth;
|
||||
else
|
||||
width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f);
|
||||
|
||||
// Pulse inwards and outwards over time.
|
||||
float pulseInterpolant = MathF.Cos(MathHelper.Pi * completion - Main.GlobalTimeWrappedHourly * 20f) * 0.5f + 0.5f;
|
||||
float additionalPulseWidth = MathHelper.Lerp(0f, 12f, pulseInterpolant);
|
||||
return (width + additionalPulseWidth) * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type];
|
||||
}
|
||||
|
||||
public Color FireColorFunction(float completion, Vector2 pos)
|
||||
{
|
||||
Color mainColor = ProvUtils.GetProjectileColor(255,true) * 1.3f;
|
||||
Color endColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true));
|
||||
return Color.Lerp(mainColor, endColor, completion) * Projectile.Opacity;
|
||||
}
|
||||
|
||||
public float FireCoreWidthFunction(float completion, Vector2 pos)
|
||||
{
|
||||
float width;
|
||||
float maxBodyWidth = Projectile.scale * 24;
|
||||
float curveRatio = 0.25f;
|
||||
var positions = Projectile.oldPos.ToList();
|
||||
positions.RemoveAll(x => x == Vector2.Zero);
|
||||
|
||||
if (completion < curveRatio)
|
||||
width = MathF.Sin(completion / curveRatio * MathHelper.PiOver2) * maxBodyWidth + curveRatio;
|
||||
else
|
||||
width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f);
|
||||
return width * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type];
|
||||
}
|
||||
|
||||
public Color FireCoreColorFunction(float completion, Vector2 pos)
|
||||
{
|
||||
Color mainColor = ProvUtils.GetProjectileColor(255);
|
||||
Color tipColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true));
|
||||
Color fullBodyColor = Color.Lerp(mainColor, tipColor, completion);
|
||||
return Color.Lerp(fullBodyColor, Color.White, 0.175f) * Projectile.Opacity;
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item14, Projectile.Center);
|
||||
Color particleColor = ProvUtils.GetProjectileColor(0);
|
||||
Color smokeColor = Color.Lerp(particleColor, Color.DarkSlateGray, 0.5f);
|
||||
Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, smokeColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.06f, 18);
|
||||
GeneralParticleHandler.SpawnParticle(pulse);
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
Particle smoke = new HeavySmokeParticle(Projectile.Center, (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(7f), smokeColor, 30, Main.rand.NextFloat(0.6f, 1f), 0.5f, Main.rand.NextFloat(-0.03f, 0.03f), true);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
}
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<LightDust>(), (Vector2.UnitX).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(1.8f, 10f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(1f, 1.8f);
|
||||
dust.color = particleColor;
|
||||
dust.noLightEmittence = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player target, Player.HurtInfo info)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<HolyInferno>(), 180);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -161,10 +161,11 @@ namespace CalamityMod.Projectiles.Boss
|
||||
int blobAmt = !ProvUtils.StandardAI() ? 9 : 6;
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
Vector2 additionalBlobVelocity = new Vector2(Projectile.velocity.X * 0.1f, Projectile.velocity.Y);
|
||||
Vector2 additionalBlobVelocity = new Vector2(Projectile.velocity.X, Projectile.velocity.Y);
|
||||
for (int b = 0; b < blobAmt; b++)
|
||||
{
|
||||
Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f) + additionalBlobVelocity;
|
||||
velocity.Y = -Math.Abs(velocity.Y);
|
||||
if (Main.getGoodWorld)
|
||||
velocity *= 2f;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Boss
|
||||
Projectile.height = 12;
|
||||
Projectile.hostile = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 900;
|
||||
Projectile.timeLeft = 120;
|
||||
Projectile.scale = 1.5f;
|
||||
CooldownSlot = ImmunityCooldownID.Bosses;
|
||||
}
|
||||
@@ -65,9 +65,6 @@ namespace CalamityMod.Projectiles.Boss
|
||||
{
|
||||
if (!inLava)
|
||||
{
|
||||
if (Projectile.velocity.Y < 0f)
|
||||
Projectile.velocity.Y = 0f;
|
||||
|
||||
Projectile.velocity.Y += 0.15f;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user