Moved several boss AIs from the CalamityAIs folder to their actual files

Bosses moved: Astrum Aureus, Brimstone Elemental, Calamitas Clone, Dragonfolly, Old Duke

Also internally renamed Dragonfolly and Draconic Swarmers because I'm pretty sure Fabsol was the only person who insisted on keeping it Bumblefuck
This commit is contained in:
CongratsIsTrash committed 2025-06-06 13:45:51 -04:00
1 parent c365144ae9
commit 48e1c167fa
34 files changed
+6807 -6795

No files matched your search

+5 -5
View File
@@ -261,7 +261,7 @@ namespace CalamityMod
{ ModContent.NPCType<ProfanedGuardianCommander>(), 0.8 },
{ ModContent.NPCType<Bumblefuck>(), 0.8 },
{ ModContent.NPCType<Dragonfolly>(), 0.8 },
{ ModContent.NPCType<StormWeaverBody>(), 0.8 },
{ ModContent.NPCType<StormWeaverTail>(), 0.8 },
@@ -510,8 +510,8 @@ namespace CalamityMod
{ ModContent.NPCType<ProfanedGuardianHealer>(), new int[] { 100, 200, 220, 240, 300 } },
{ ModContent.NPCType<ProfanedRocks>(), new int[] { 100, 200, 220, 232, 300 } },
{ ModContent.NPCType<Bumblefuck>(), new int[] { 170, 256, 288, 320, 504 } },
{ ModContent.NPCType<Bumblefuck2>(), new int[] { 145, 220, 242, 264, 435 } },
{ ModContent.NPCType<Dragonfolly>(), new int[] { 170, 256, 288, 320, 504 } },
{ ModContent.NPCType<DraconicSwarmer>(), new int[] { 145, 220, 242, 264, 435 } },
{ ModContent.NPCType<CeaselessVoid>(), new int[] { 240, 360, 396, 432, 720 } },
{ ModContent.NPCType<DarkEnergy>(), new int[] { 175, 260, 288, 316, 525 } },
@@ -769,8 +769,8 @@ namespace CalamityMod
{ new Tuple<int, int>(ModContent.NPCType<ProfanedGuardianHealer>(), ModContent.ProjectileType<HolyBurnOrb>()), new int[] { 120, 192, 220, 248, 360 } },
{ new Tuple<int, int>(ModContent.NPCType<ProfanedGuardianHealer>(), ModContent.ProjectileType<HolyLight>()), new int[] { 35, 50, 50, 0, 0 } },
{ new Tuple<int, int>(ModContent.NPCType<Bumblefuck>(), ModContent.ProjectileType<RedLightningFeather>()), new int[] { 140, 220, 244, 268, 420 } },
{ new Tuple<int, int>(ModContent.NPCType<Bumblefuck>(), ModContent.ProjectileType<BirbAuraFlare>()), new int[] { 200, 300, 332, 364, 600 } },
{ new Tuple<int, int>(ModContent.NPCType<Dragonfolly>(), ModContent.ProjectileType<RedLightningFeather>()), new int[] { 140, 220, 244, 268, 420 } },
{ new Tuple<int, int>(ModContent.NPCType<Dragonfolly>(), ModContent.ProjectileType<BirbAuraFlare>()), new int[] { 200, 300, 332, 364, 600 } },
{ new Tuple<int, int>(ModContent.NPCType<Providence>(), ModContent.ProjectileType<HolyBlast>()), new int[] { 150, 264, 288, 312, 450 } }, // Split holy fire does: 113, 198, 216, 234, 338
{ new Tuple<int, int>(ModContent.NPCType<Providence>(), ModContent.ProjectileType<HolyFire>()), new int[] { 120, 192, 220, 248, 360 } },
+1 -1
View File
@@ -309,7 +309,7 @@ namespace CalamityMod.Events
NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, type);
}, permittedNPCs: new int[] { ModContent.NPCType<ProfanedGuardianDefender>(), ModContent.NPCType<ProfanedGuardianHealer>(), ModContent.NPCType<ProfanedRocks>() }),
new Boss(ModContent.NPCType<Bumblefuck>(), permittedNPCs: new int[] { ModContent.NPCType<Bumblefuck2>() }),
new Boss(ModContent.NPCType<Dragonfolly>(), permittedNPCs: new int[] { ModContent.NPCType<DraconicSwarmer>() }),
new Boss(ModContent.NPCType<Providence>(), TimeChangeContext.Day, type =>
{
+2 -2
View File
@@ -34,12 +34,12 @@ namespace CalamityMod.Items.SummonItems
public override bool CanUseItem(Player player)
{
return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType<Bumblefuck>()) && !BossRushEvent.BossRushActive;
return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType<Dragonfolly>()) && !BossRushEvent.BossRushActive;
}
public override bool? UseItem(Player player)
{
CalamityUtils.SpawnBossUsingItem<Bumblefuck>(player, SoundID.Roar);
CalamityUtils.SpawnBossUsingItem<Dragonfolly>(player, SoundID.Roar);
return true;
}
+1 -1
View File
@@ -57,7 +57,7 @@ namespace CalamityMod.Items.TreasureBags
public override void ModifyItemLoot(ItemLoot itemLoot)
{
// Money
itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType<Bumblefuck>()));
itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType<Dragonfolly>()));
// Materials
itemLoot.Add(ModContent.ItemType<EffulgentFeather>(), 1, 30, 35);
@@ -563,3 +563,7 @@ SeaKing: {
Princess_LovesNPC: "{NPCName} always smiles when I'm nearby, I like being around him just for that!"
}
}
WildBumblebirb.DisplayName: Wild Bumblebirb
DraconicSwarmer.DisplayName: Draconic Swarmer
Dragonfolly.DisplayName: Dragonfolly
+1 -1
View File
@@ -741,7 +741,7 @@ namespace CalamityMod
{
string entryName = "Dragonfolly";
BossChecklistProgressionValues.TryGetValue(entryName, out float order);
int type = NPCType<Bumblefuck>();
int type = NPCType<Dragonfolly>();
List<int> collection = new List<int>() { ItemType<DragonfollyRelic>(), ItemType<DragonfollyTrophy>(), ItemType<BumblefuckMask>(), ItemType<LoreDragonfolly>(), ItemType<ThankYouPainting>() };
AddBoss(bossChecklist, calamity, entryName, order, DownedDragonfolly, type, new Dictionary<string, object>()
{
+931 -3
View File
@@ -19,12 +19,13 @@ using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Items.Weapons.Rogue;
using CalamityMod.Items.Weapons.Summon;
using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs;
using CalamityMod.NPCs.TownNPCs;
using CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies;
using CalamityMod.Projectiles.Boss;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
@@ -153,7 +154,934 @@ namespace CalamityMod.NPCs.AstrumAureus
public override void AI()
{
AstrumAureusAI.VanillaAstrumAureusAI(NPC, Mod);
CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity();
CalamityGlobalNPC.astrumAureus = NPC.whoAmI;
// Variables
bool bossRush = BossRushEvent.BossRushActive;
bool expertMode = Main.expertMode || bossRush;
bool revenge = CalamityWorld.revenge || bossRush;
bool death = CalamityWorld.death || bossRush;
// Percent life remaining
float lifeRatio = NPC.life / (float)NPC.lifeMax;
// Phases
bool phase2 = lifeRatio < (revenge ? 0.85f : expertMode ? 0.8f : 0.75f);
bool phase3 = lifeRatio < (revenge ? 0.7f : expertMode ? 0.6f : 0.5f);
bool phase4 = lifeRatio < (revenge ? 0.5f : 0.4f) && expertMode;
bool phase5 = lifeRatio < 0.3f && revenge;
// Exhaustion
bool exhausted = NPC.ai[2] >= (phase3 ? 2f : 1f);
calamityGlobalNPC.DR = exhausted ? 0.2f : 0.4f;
NPC.defense = exhausted ? NPC.defDefense / 2 : NPC.defDefense;
// Get a target
if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active)
NPC.TargetClosest();
// Despawn safety, make sure to target another player if the current player target is too far away
if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles)
NPC.TargetClosest();
Player player = Main.player[NPC.target];
// Don't fire projectiles and don't increment phase timers for 4 seconds after the teleport phase to avoid cheap bullshit
float noProjectileOrPhaseIncrementTime = 240f;
bool dontAttack = NPC.localAI[3] > 0f;
if (dontAttack)
{
NPC.localAI[3] -= 1f;
if (NPC.Distance(player.Center) < 240f)
NPC.localAI[3] -= death ? 4f : expertMode ? 2f : 1f;
}
float enrageScale = bossRush ? 1f : 0f;
if ((Main.IsItDay() && !player.Calamity().ZoneAstral) || bossRush)
{
NPC.Calamity().CurrentlyEnraged = !bossRush;
enrageScale += 1f;
}
float astralFlameBarrageTimerIncrement = 1f;
if (expertMode)
astralFlameBarrageTimerIncrement += death ? (float)Math.Round(3f * (1f - lifeRatio)) : (float)Math.Round(2f * (1f - lifeRatio));
float walkingVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 6f : 5f;
walkingVelocity += 3f * enrageScale;
if (phase5)
walkingVelocity += 2f;
if (expertMode)
walkingVelocity += 1.5f * (1f - lifeRatio);
if (revenge)
walkingVelocity += Math.Abs(NPC.Center.X - player.Center.X) * 0.0025f;
if (Main.getGoodWorld)
walkingVelocity *= 1.15f;
float walkingProjectileVelocity = walkingVelocity * 0.8f;
// Direction
NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1;
// Used to reduce Aureus' fall speed
bool reduceFallSpeed = NPC.velocity.Y > 0f && Collision.SolidCollision(NPC.position + Vector2.UnitY * 1.1f * NPC.velocity.Y, NPC.width, NPC.height) && NPC.ai[0] == 4f;
// Despawn
bool despawnDistance = Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles;
if (!player.active || player.dead || despawnDistance)
{
NPC.TargetClosest(false);
player = Main.player[NPC.target];
if (!player.active || player.dead || despawnDistance)
{
NPC.noTileCollide = true;
if (NPC.velocity.Y < -3f)
NPC.velocity.Y = -3f;
NPC.velocity.Y += 0.1f;
if (NPC.velocity.Y > 12f)
NPC.velocity.Y = 12f;
if (NPC.timeLeft > 60)
NPC.timeLeft = 60;
if (NPC.ai[0] != 0f)
{
NPC.ai[0] = 0f;
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
NPC.ai[3] = 0f;
NPC.localAI[2] = 0f;
NPC.localAI[3] = 0f;
calamityGlobalNPC.newAI[0] = 0f;
calamityGlobalNPC.newAI[1] = 0f;
NPC.netUpdate = true;
}
return;
}
}
else if (NPC.timeLeft < 1800)
NPC.timeLeft = 1800;
bool geldonPhase1 = lifeRatio > 0.6f && lifeRatio <= 0.7f;
bool geldonPhase2 = lifeRatio <= 0.1f;
if (Main.zenithWorld && (geldonPhase1 || geldonPhase2))
{
slimeProjCounter++;
if (slimeProjCounter % 180 == 0)
{
SoundEngine.PlaySound(SoundID.Item33, NPC.Center); // Intentionally keeping the old laser sound in GFB
if (slimePhase == 1)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int type = ModContent.ProjectileType<AstralFlame>();
int damage = NPC.GetProjectileDamage(type);
int totalProjectiles = bossRush ? 14 : death ? 12 : revenge ? 10 : expertMode ? 8 : 6;
float radians = MathHelper.TwoPi / totalProjectiles;
float velocity = 10f;
Vector2 spinningPoint = new Vector2(0f, -velocity);
for (int k = 0; k < totalProjectiles; k++)
{
Vector2 velocity2 = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f);
}
}
slimePhase = 0;
}
else
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int type = ModContent.ProjectileType<AstralLaser>();
int damage = NPC.GetProjectileDamage(type);
float aureusLaserSpeed = 7f;
float aureusLaserTargetX = player.Center.X - NPC.Center.X;
float aureusLaserTargetY = player.Center.Y - NPC.Center.Y;
float aureusLaserTargetDist = (float)Math.Sqrt(aureusLaserTargetX * aureusLaserTargetX + aureusLaserTargetY * aureusLaserTargetY);
aureusLaserTargetDist = aureusLaserSpeed / aureusLaserTargetDist;
aureusLaserTargetX *= aureusLaserTargetDist;
aureusLaserTargetY *= aureusLaserTargetDist;
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, aureusLaserTargetX, aureusLaserTargetY, type, damage, 0f, Main.myPlayer);
for (int i = 0; i < 4; i++)
{
Vector2 offset = new Vector2(Main.rand.Next(-6, 7), Main.rand.Next(-6, 7));
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, aureusLaserTargetX + offset.X, aureusLaserTargetY + offset.Y, type, damage, 0f, Main.myPlayer);
}
}
slimePhase = 1;
}
}
RevengeanceAndDeathAI.BuffedMimicAI(NPC, Mod);
NPC.noGravity = false;
NPC.noTileCollide = false;
return;
}
else
{
NPC.noGravity = true;
}
// Emit light when not Idle
if (NPC.ai[0] != 1f)
Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1.3f, 0.5f, 0f);
// Fire projectiles while walking, teleporting, or falling
if (NPC.ai[0] == 2f || NPC.ai[0] >= 5f)
{
if (!dontAttack)
NPC.localAI[0] += NPC.ai[0] == 2f ? 1f : astralFlameBarrageTimerIncrement;
float astralFlameBarrageGateValue = phase4 ? 30f : 60f;
if (NPC.localAI[0] >= astralFlameBarrageGateValue)
{
// Fire astral flames while teleporting
if (NPC.ai[0] >= 5f && NPC.ai[0] != 7)
{
NPC.localAI[0] = 0f;
SoundEngine.PlaySound(FlameCrystalSound, NPC.Center);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
float velocity = death ? (8f + NPC.localAI[2] * 0.025f) : 7f;
int type = ModContent.ProjectileType<AstralFlame>();
int damage = NPC.GetProjectileDamage(type);
float spreadLimit = (phase4 ? 100f : 50f) + enrageScale * 50f;
float randomSpread = (Main.rand.NextFloat() - 0.5f) * spreadLimit;
Vector2 spawnVector = new Vector2(NPC.Center.X, NPC.Center.Y - 80f * NPC.scale);
Vector2 destination = new Vector2(spawnVector.X + randomSpread, spawnVector.Y - 100f * NPC.scale);
Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, Vector2.Normalize(destination - spawnVector) * velocity, type, damage, 0f, Main.myPlayer);
}
}
}
float laserBarrageGateValue = phase5 ? 160f : phase3 ? 120f : phase2 ? 80f : 60f;
if (NPC.localAI[0] >= laserBarrageGateValue)
{
// Fire astral lasers while walking
if (NPC.ai[0] == 2f)
{
NPC.localAI[0] = 0f;
SoundEngine.PlaySound(LaserSound, NPC.Center);
if (calamityGlobalNPC.newAI[2] == 0f)
{
calamityGlobalNPC.newAI[2] = 1f;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int maxProjectiles = !phase2 ? (bossRush ? 5 : 3) : (bossRush ? 7 : 5);
int spread = !phase2 ? (bossRush ? 11 : 8) : (bossRush ? 12 : 10);
int type = ModContent.ProjectileType<AstralLaser>();
int damage = NPC.GetProjectileDamage(type);
Vector2 projectileVelocity = Vector2.Normalize(player.Center - NPC.Center) * walkingProjectileVelocity;
float rotation = MathHelper.ToRadians(spread);
for (int i = 0; i < maxProjectiles; i++)
{
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1)));
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, walkingProjectileVelocity * 2f);
}
if (phase3)
{
float flameVelocity = walkingProjectileVelocity;
maxProjectiles = 2;
spread = 45;
type = ModContent.ProjectileType<AstralFlame>();
damage = NPC.GetProjectileDamage(type);
projectileVelocity = Vector2.Normalize(player.Center - NPC.Center) * flameVelocity;
rotation = MathHelper.ToRadians(spread);
for (int i = 0; i < maxProjectiles; i++)
{
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1)));
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer);
}
}
}
}
else
{
calamityGlobalNPC.newAI[2] = 0f;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int maxProjectiles = !phase3 ? (bossRush ? 13 : death ? 11 : 9) : (bossRush ? 19 : death ? 17 : 15);
int spread = !phase3 ? (bossRush ? 20 : death ? 18 : 16) : (bossRush ? 24 : death ? 22 : 20);
int type = ModContent.ProjectileType<AstralLaser>();
int damage = NPC.GetProjectileDamage(type);
int centralLaser = maxProjectiles / 2;
int[] lasersToNotFire = new int[6] { centralLaser - 3, centralLaser - 2, centralLaser - 1, centralLaser + 1, centralLaser + 2, centralLaser + 3 };
Vector2 projectileVelocity = Vector2.Normalize(player.Center - NPC.Center) * walkingProjectileVelocity;
float rotation = MathHelper.ToRadians(spread);
for (int i = 0; i < maxProjectiles; i++)
{
if (i != lasersToNotFire[0] && i != lasersToNotFire[1] && i != lasersToNotFire[2] && i != lasersToNotFire[3] && i != lasersToNotFire[4] && i != lasersToNotFire[5])
{
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1)));
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, walkingProjectileVelocity * 2f);
}
}
}
}
}
}
}
else
NPC.localAI[0] = 0f;
// Start up
if (NPC.ai[0] == 0f)
{
// Avoid cheap bullshit
NPC.damage = 0;
NPC.ai[0] = 1f;
NPC.netUpdate = true;
CustomGravity();
}
// Idle
else if (NPC.ai[0] == 1f)
{
// Avoid cheap bullshit
NPC.damage = 0;
// Slow down
NPC.velocity.X *= 0.8f;
// Stay vulnerable for 3 seconds
NPC.ai[1] += 1f;
if (NPC.Distance(player.Center) < 240f)
NPC.ai[1] += death ? 4f : expertMode ? 2f : 1f;
if (NPC.ai[1] >= 180f || bossRush)
{
// Set AI to random state and reset other AI arrays
NPC.TargetClosest();
switch (Main.rand.Next(phase3 ? 3 : 2))
{
case 0:
NPC.ai[0] = 2f;
break;
case 1:
NPC.ai[0] = 3f;
break;
case 2:
NPC.ai[0] = 5f;
break;
default:
break;
}
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
// Stop colliding with tiles if entering walking phase
NPC.noTileCollide = NPC.ai[0] == 2f;
NPC.netUpdate = true;
}
else
CustomGravity();
}
// Walk
else if (NPC.ai[0] == 2f)
{
// Avoid cheap bullshit
NPC.damage = 0;
// Set walking direction
if (Math.Abs(NPC.Center.X - player.Center.X) < 200f * NPC.scale)
{
NPC.velocity.X *= 0.8f;
if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1)
NPC.velocity.X = 0f;
}
else
{
float playerLocation = NPC.Center.X - player.Center.X;
NPC.direction = playerLocation < 0 ? 1 : -1;
if (NPC.direction > 0)
NPC.velocity.X = (NPC.velocity.X * 20f + walkingVelocity) / 21f;
if (NPC.direction < 0)
NPC.velocity.X = (NPC.velocity.X * 20f - walkingVelocity) / 21f;
}
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && player.position.Y <= NPC.position.Y + NPC.height && !NPC.collideX)
{
CustomGravity();
NPC.noTileCollide = false;
}
else
{
NPC.noTileCollide = true;
// Walk through tiles if colliding with tiles and player is out of reach
int aureusHitboxWidth = 80;
int aureusHitboxHeight = 20;
Vector2 aureusHitboxTileCollideSize = new Vector2(NPC.Center.X - (aureusHitboxWidth / 2), NPC.position.Y + NPC.height - aureusHitboxHeight);
bool nearPlayerWalkingThroughTiles = false;
if (NPC.position.X < player.position.X && NPC.position.X + NPC.width > player.position.X + player.width && NPC.position.Y + NPC.height < player.position.Y + player.height - 16f)
nearPlayerWalkingThroughTiles = true;
if (nearPlayerWalkingThroughTiles)
{
NPC.velocity.Y += 0.5f;
}
else if (Collision.SolidCollision(aureusHitboxTileCollideSize, aureusHitboxWidth, aureusHitboxHeight))
{
if (NPC.velocity.Y > 0f)
NPC.velocity.Y = 0f;
if (NPC.velocity.Y > -0.2)
NPC.velocity.Y -= 0.025f;
else
NPC.velocity.Y -= 0.2f;
if (NPC.velocity.Y < -4f)
NPC.velocity.Y = -4f;
}
else
{
if (NPC.velocity.Y < 0f)
NPC.velocity.Y = 0f;
if (NPC.velocity.Y < 0.1)
NPC.velocity.Y += 0.025f;
else
NPC.velocity.Y += 0.5f;
}
}
// Walk for a maximum of 6 seconds
if (!dontAttack)
{
NPC.ai[1] += 1f;
if (NPC.Distance(player.Center) < 240f)
NPC.ai[1] += death ? 4f : expertMode ? 2f : 1f;
}
if (NPC.ai[1] >= ((bossRush ? 270f : 360f) - (death ? 90f * (1f - lifeRatio) : 0f)))
{
// Collide with tiles again
NPC.noTileCollide = false;
// Set AI to next phase (Jump) and reset other AI
NPC.TargetClosest();
NPC.ai[0] = exhausted ? 1f : 3f;
NPC.ai[1] = 0f;
NPC.ai[2] += 1f;
NPC.netUpdate = true;
}
// Limit downward velocity
if (NPC.velocity.Y > 10f)
NPC.velocity.Y = 10f;
}
// Jump
else if (NPC.ai[0] == 3f)
{
// Avoid cheap bullshit
NPC.damage = 0;
NPC.noTileCollide = false;
if (NPC.velocity.Y == 0f)
{
// Slow down
NPC.velocity.X *= 0.8f;
// Half second delay before jumping
if (!dontAttack)
NPC.ai[1] += 1f;
if (NPC.ai[1] >= 30f)
{
NPC.ai[1] = -20f;
}
else if (NPC.ai[1] == -1f)
{
// Set damage
NPC.damage = NPC.defDamage;
// Set jump velocity, reset and set AI to next phase (Stomp)
float distanceFromPlayerOnXAxis = NPC.Center.X - player.Center.X;
NPC.direction = distanceFromPlayerOnXAxis < 0 ? 1 : -1;
calamityGlobalNPC.newAI[3] = NPC.direction;
// The limit for how much Aureus can multiply its jump velocity
float speedMultLimit = 1f;
// Maxes out when the player is a full 2000 pixels away from or above Aureus
float multiplier = 1f / 2000f;
// Increase Aureus jump velocity X if it's far enough away from the player
float distanceAwayFromTarget = Math.Abs(distanceFromPlayerOnXAxis);
float distanceGateValue = 400f;
bool increaseJumpVelocityX = distanceAwayFromTarget > distanceGateValue && expertMode;
if (increaseJumpVelocityX)
{
calamityGlobalNPC.newAI[0] = (distanceAwayFromTarget - distanceGateValue) * multiplier;
if (calamityGlobalNPC.newAI[0] > speedMultLimit)
calamityGlobalNPC.newAI[0] = speedMultLimit;
}
// Increase Aureus jump velocity Y if it's far enough above the player
float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f);
bool increaseJumpVelocityY = distanceBelowTarget > 0f && revenge;
if (increaseJumpVelocityY)
{
calamityGlobalNPC.newAI[1] = distanceBelowTarget * multiplier;
if (calamityGlobalNPC.newAI[1] > speedMultLimit)
calamityGlobalNPC.newAI[1] = speedMultLimit;
}
float velocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 27f : 20f;
velocity += 6f * enrageScale;
if (expertMode)
velocity += death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio);
if (Main.getGoodWorld)
velocity *= 1.15f;
NPC.velocity = (new Vector2(player.Center.X, player.Center.Y - 500f) - NPC.Center).SafeNormalize(Vector2.Zero) * velocity;
NPC.velocity *= new Vector2(calamityGlobalNPC.newAI[0] + 1f, calamityGlobalNPC.newAI[1] + 1f);
NPC.noTileCollide = true;
NPC.ai[0] = 4f;
NPC.ai[1] = 0f;
SoundEngine.PlaySound(JumpSound, NPC.Center);
NPC.netUpdate = true;
}
}
// Don't run custom gravity when starting a jump
if (NPC.ai[0] != 4f)
CustomGravity();
}
// Stomp
else if (NPC.ai[0] == 4f)
{
if (NPC.velocity.Y == 0f)
{
// Avoid cheap bullshit
NPC.damage = 0;
// Play stomp sound. Gotta specify the filepath to avoid confusion between the namespace and NPC
SoundStyle soundToPlay = Main.zenithWorld ? ExoMechs.Ares.AresGaussNuke.NukeExplosionSound : StompSound;
SoundEngine.PlaySound(soundToPlay, NPC.Center);
if (Main.zenithWorld)
{
float screenShakePower = 16 * Utils.GetLerpValue(1300f, 0f, NPC.Distance(Main.LocalPlayer.Center), true);
if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower)
Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower;
}
// Stomp and jump again, if stomped twice then reset and set AI to next phase (Teleport or Idle)
NPC.TargetClosest();
NPC.localAI[1] += 1f;
float maxStompAmt = phase5 ? 5f : phase3 ? 2f : 3f;
if (NPC.localAI[1] >= maxStompAmt)
{
NPC.ai[0] = exhausted ? 1f : (phase3 ? 5f : 2f);
NPC.localAI[1] = 0f;
NPC.ai[2] += 1f;
NPC.ai[3] = 0f;
NPC.noTileCollide = false;
NPC.netUpdate = true;
}
else
{
float playerLocation = NPC.Center.X - player.Center.X;
NPC.direction = playerLocation < 0 ? 1 : -1;
NPC.ai[0] = 3f;
NPC.ai[3] = 0f;
NPC.netUpdate = true;
}
calamityGlobalNPC.newAI[0] = 0f;
calamityGlobalNPC.newAI[1] = 0f;
calamityGlobalNPC.newAI[3] = 0f;
// Spawn dust for visual effect
for (int i = (int)NPC.position.X - 20; i < (int)NPC.position.X + NPC.width + 40; i += 20)
{
for (int j = 0; j < 4; j++)
{
int stompDust = Dust.NewDust(new Vector2(NPC.position.X - 20f, NPC.position.Y + NPC.height), NPC.width + 20, 4, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 1.5f);
Main.dust[stompDust].velocity *= 0.2f;
}
}
// Fire lasers or flames on stomp
SoundEngine.PlaySound(LaserSound, NPC.Center);
if (Main.zenithWorld)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int type = Main.rand.NextBool() ? ModContent.ProjectileType<AstralLaser>() : ModContent.ProjectileType<AstralFlame>();
int damage = NPC.GetProjectileDamage(type);
int totalProjectiles = bossRush ? 14 : death ? 12 : revenge ? 10 : expertMode ? 8 : 6;
float radians = MathHelper.TwoPi / totalProjectiles;
float velocity = 10f;
Vector2 spinningPoint = new Vector2(0f, -velocity);
for (int k = 0; k < totalProjectiles; k++)
{
Vector2 velocity2 = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f);
}
}
}
else if (calamityGlobalNPC.newAI[2] == 0f && phase2)
{
calamityGlobalNPC.newAI[2] = 1f;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
float flameVelocity = 6f;
int maxProjectiles = bossRush ? 4 : death ? 3 : 2;
int spread = bossRush ? 36 : death ? 28 : 20;
int type = ModContent.ProjectileType<AstralFlame>();
int damage = NPC.GetProjectileDamage(type);
Vector2 spawnVector = new Vector2(NPC.Center.X, NPC.Center.Y - 80f * NPC.scale);
Vector2 destination = new Vector2(spawnVector.X, spawnVector.Y + 100f * NPC.scale);
Vector2 projectileVelocity = Vector2.Normalize(destination - spawnVector) * flameVelocity;
float rotation = MathHelper.ToRadians(spread);
for (int i = 0; i < maxProjectiles; i++)
{
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1)));
Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector + Vector2.Normalize(perturbedSpeed) * 100f, perturbedSpeed, type, damage, 0f, Main.myPlayer);
}
}
}
else
{
calamityGlobalNPC.newAI[2] = 0f;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
float laserVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 7f : death ? 6f : 5f;
int maxProjectiles = !phase3 ? (bossRush ? 13 : death ? 11 : 9) : (bossRush ? 17 : death ? 15 : 13);
int spread = !phase3 ? (bossRush ? 20 : death ? 18 : 16) : (bossRush ? 24 : death ? 22 : 20);
int type = ModContent.ProjectileType<AstralLaser>();
int damage = NPC.GetProjectileDamage(type);
int[] lasersToNotFire = new int[4] { 1, 3, maxProjectiles - 2, maxProjectiles - 4 };
Vector2 projectileVelocity = Vector2.Normalize(player.Center - NPC.Center) * laserVelocity;
float rotation = MathHelper.ToRadians(spread);
for (int i = 0; i < maxProjectiles; i++)
{
if (i != lasersToNotFire[0] && i != lasersToNotFire[1] && i != lasersToNotFire[2] && i != lasersToNotFire[3])
{
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1)));
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, laserVelocity * 2f);
}
}
}
}
}
else
{
// Set damage
NPC.damage = NPC.defDamage;
// Set velocities while falling, this happens before the stomp
// Fall through
if (!player.dead)
{
if ((player.position.Y > NPC.Bottom.Y && NPC.velocity.Y > 0f) || (player.position.Y < NPC.Bottom.Y && NPC.velocity.Y < 0f))
NPC.noTileCollide = true;
else if ((NPC.velocity.Y > 0f && NPC.Bottom.Y > Main.player[NPC.target].Top.Y) || (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)))
NPC.noTileCollide = false;
}
if (NPC.position.X < player.position.X && NPC.position.X + NPC.width > player.position.X + player.width)
{
// Make sure Aureus falls quickly when directly on top of or below the player
if (NPC.ai[3] < 30f)
NPC.ai[3] = 30f;
NPC.velocity.X *= 0.8f;
if (NPC.Bottom.Y < player.position.Y)
{
// Make sure Aureus falls rather quickly
if (NPC.velocity.Y < -3f)
NPC.velocity.Y = -3f;
float fallSpeed = 1.2f;
fallSpeed += 0.36f * enrageScale;
if (expertMode)
fallSpeed += death ? 0.36f * (1f - lifeRatio) : 0.24f * (1f - lifeRatio);
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
fallSpeed += 0.5f;
if (calamityGlobalNPC.newAI[1] > 0f)
fallSpeed *= calamityGlobalNPC.newAI[1] + 1f;
NPC.velocity.Y += fallSpeed;
}
}
else
{
// Push Aureus towards the player on the X axis if he's not directly on top of or below the player
float velocityXChange = 0.2f + Math.Abs(NPC.Center.X - player.Center.X) * 0.0001f;
velocityXChange += 0.1f * enrageScale;
if (calamityGlobalNPC.newAI[0] > 0f)
velocityXChange *= calamityGlobalNPC.newAI[0] + 1f;
if (NPC.direction < 0)
NPC.velocity.X -= velocityXChange;
else if (NPC.direction > 0)
NPC.velocity.X += velocityXChange;
float velocityXCap = 12f;
velocityXCap += 3.6f * enrageScale;
if (expertMode)
velocityXCap += death ? 3.6f * (1f - lifeRatio) : 2.4f * (1f - lifeRatio);
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
velocityXCap += 5f;
if (calamityGlobalNPC.newAI[0] > 0f)
velocityXCap *= calamityGlobalNPC.newAI[0] + 1f;
float playerLocation = NPC.Center.X - player.Center.X;
int directionRelativeToTarget = playerLocation < 0 ? 1 : -1;
bool slowDown = directionRelativeToTarget != calamityGlobalNPC.newAI[3];
if (slowDown)
velocityXCap *= 0.333f;
if (NPC.velocity.X < -velocityXCap)
NPC.velocity.X = -velocityXCap;
if (NPC.velocity.X > velocityXCap)
NPC.velocity.X = velocityXCap;
}
// Don't start falling quickly until half a second has passed
NPC.ai[3] += 1f;
if (NPC.ai[3] > 30f)
CustomGravity();
}
}
// Teleport
else if (NPC.ai[0] == 5f)
{
// Avoid cheap bullshit
NPC.damage = 0;
// Slow down
NPC.velocity.X *= 0.8f;
// Start teleport
if (Main.netMode != NetmodeID.MultiplayerClient)
{
NPC.localAI[1] += 1f;
if (death)
NPC.localAI[2] += 1.25f;
if (phase4)
{
NPC.localAI[1] += 1f;
if (death)
NPC.localAI[2] += 1.25f;
}
if (NPC.localAI[1] >= (bossRush ? 60f : death ? 180f : 240f))
{
// Reset localAI and find a teleport destination
NPC.TargetClosest();
NPC.localAI[1] = 0f;
Vector2 vectorAimedAheadOfTarget = Main.player[NPC.target].Center + new Vector2((float)Math.Round(Main.player[NPC.target].velocity.X), 0f).SafeNormalize(Vector2.Zero) * 1000f;
Point point4 = vectorAimedAheadOfTarget.ToTileCoordinates();
int teleportTries = 0;
while (teleportTries < 100)
{
teleportTries++;
int teleportTileX = Main.rand.Next(point4.X - 5, point4.X + 6);
int teleportTileY = Main.rand.Next(point4.Y - 5, point4.Y);
if (!Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile)
{
NPC.ai[1] = teleportTileX * 16 + 8;
NPC.ai[3] = teleportTileY * 16 + 16;
break;
}
}
// Default teleport if the above conditions aren't met in 100 iterations
if (teleportTries >= 100)
{
Vector2 bottom = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)].Bottom;
NPC.ai[1] = bottom.X;
NPC.ai[3] = bottom.Y;
}
// Set AI to next phase (Mid-teleport)
NPC.ai[0] = 6f;
NPC.netUpdate = true;
}
}
CustomGravity();
}
// Mid-teleport
else if (NPC.ai[0] == 6f)
{
// Avoid cheap bullshit
NPC.damage = 0;
if (death)
NPC.localAI[2] += 1.25f;
if (phase4)
{
if (death)
NPC.localAI[2] += 1.25f;
}
// Turn invisible
NPC.alpha += 10;
if (NPC.alpha >= 255)
{
// Set position to teleport destination
NPC.Bottom = new Vector2(NPC.ai[1], NPC.ai[3]);
// Reset alpha and set AI to next phase (End of teleport)
NPC.alpha = 255;
NPC.ai[0] = 7f;
NPC.localAI[2] = 0f;
NPC.netUpdate = true;
}
// Play sound for cool effect
if (NPC.soundDelay == 0)
{
NPC.soundDelay = 15;
SoundEngine.PlaySound(TeleportSound, NPC.Center);
}
// Emit dust to make the teleport pretty
for (int i = 0; i < 10; i++)
{
int teleportDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), NPC.velocity.X, NPC.velocity.Y, 255, default, 2f);
Main.dust[teleportDust].noGravity = true;
Main.dust[teleportDust].velocity *= 0.5f;
}
CustomGravity();
}
// End of teleport
else if (NPC.ai[0] == 7f)
{
// Avoid cheap bullshit
NPC.damage = 0;
// Turn visible
NPC.alpha -= 10;
if (NPC.alpha <= 0)
{
// Spawn Aureus Spawns
bool spawnFlag = expertMode;
if (NPC.CountNPCS(ModContent.NPCType<AureusSpawn>()) >= 2)
spawnFlag = false;
if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient)
{
int aureusSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y - 25f * NPC.scale), ModContent.NPCType<AureusSpawn>());
Main.npc[aureusSpawn].velocity.Y = -10f;
Main.npc[aureusSpawn].netUpdate = true;
if (revenge)
{
aureusSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y - 25f * NPC.scale), ModContent.NPCType<AureusSpawn>());
Main.npc[aureusSpawn].velocity.Y = -15f;
Main.npc[aureusSpawn].netUpdate = true;
}
if (death)
{
int damageAmt = NPC.lifeMax / 50;
NPC.life -= damageAmt;
if (NPC.life < 1)
NPC.life = 1;
NPC.DamageEffect(damageAmt);
}
}
// Reset alpha and set AI to next phase (Idle)
NPC.alpha = 0;
NPC.ai[0] = exhausted ? 1f : 2f;
NPC.ai[1] = 0f;
NPC.ai[2] += 1f;
NPC.localAI[3] = noProjectileOrPhaseIncrementTime;
// Stop colliding with tiles if entering walking phase
NPC.noTileCollide = NPC.ai[0] == 2f;
NPC.netUpdate = true;
}
// Play sound at teleport destination for cool effect
if (NPC.soundDelay == 0)
{
NPC.soundDelay = 15;
SoundEngine.PlaySound(SoundID.Item109, NPC.Center);
}
// Emit dust to make the teleport pretty
for (int i = 0; i < 10; i++)
{
int teleportDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), NPC.velocity.X, NPC.velocity.Y, 255, default, 2f);
Main.dust[teleportDust].noGravity = true;
Main.dust[teleportDust].velocity *= 0.5f;
}
CustomGravity();
}
void CustomGravity()
{
float gravity = 0.36f + 0.12f * enrageScale;
float maxFallSpeed = reduceFallSpeed ? 12f : 12f + 4f * enrageScale;
if (calamityGlobalNPC.newAI[1] > 0f && !reduceFallSpeed)
maxFallSpeed *= calamityGlobalNPC.newAI[1] + 1f;
if (Main.getGoodWorld && !reduceFallSpeed)
{
gravity *= 1.15f;
maxFallSpeed *= 1.15f;
}
NPC.velocity.Y += gravity;
if (NPC.velocity.Y > maxFallSpeed)
NPC.velocity.Y = maxFallSpeed;
}
}
public override void FindFrame(int frameHeight)
+707 -1
View File
@@ -16,9 +16,12 @@ using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Items.Weapons.Summon;
using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs;
using CalamityMod.Projectiles.Boss;
using CalamityMod.Projectiles.Enemy;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
@@ -123,7 +126,710 @@ namespace CalamityMod.NPCs.BrimstoneElemental
public override void AI()
{
BrimstoneElementalAI.VanillaBrimstoneElementalAI(NPC, Mod);
CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity();
// Used for Brimling AI states
CalamityGlobalNPC.brimstoneElemental = NPC.whoAmI;
// Emit light
Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1.2f, 0f, 0f);
// Get a target
if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active)
NPC.TargetClosest();
Player player = Main.player[NPC.target];
bool despawnDistance = Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles;
if (!player.active || player.dead || despawnDistance)
{
NPC.TargetClosest(false);
player = Main.player[NPC.target];
if (!player.active || player.dead || despawnDistance)
{
NPC.rotation = NPC.velocity.X * 0.04f;
if (NPC.velocity.Y > 3f)
NPC.velocity.Y = 3f;
NPC.velocity.Y -= 0.1f;
if (NPC.velocity.Y < -12f)
NPC.velocity.Y = -12f;
if (NPC.timeLeft > 60)
NPC.timeLeft = 60;
if (NPC.ai[0] != 0f)
{
NPC.ai[0] = 0f;
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
NPC.ai[3] = 0f;
NPC.localAI[0] = 0f;
NPC.localAI[1] = 0f;
NPC.netUpdate = true;
}
return;
}
}
else if (NPC.timeLeft < 1800)
NPC.timeLeft = 1800;
// Reset defense
NPC.defense = NPC.defDefense;
calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = NPC.ai[0] == 4f;
// Percent life remaining
float lifeRatio = NPC.life / (float)NPC.lifeMax;
// Variables for buffing the AI
bool bossRush = BossRushEvent.BossRushActive;
bool expertMode = Main.expertMode || bossRush;
bool revenge = CalamityWorld.revenge || bossRush;
bool death = CalamityWorld.death || bossRush;
bool phase2 = lifeRatio < 0.5f && revenge;
bool phase3 = lifeRatio < 0.33f;
// Enrage
if ((!player.ZoneUnderworldHeight || !player.Calamity().ZoneCalamity) && !bossRush)
{
if (calamityGlobalNPC.newAI[3] > 0f)
calamityGlobalNPC.newAI[3] -= 1f;
}
else
calamityGlobalNPC.newAI[3] = CalamityGlobalNPC.biomeEnrageTimerMax;
bool biomeEnraged = calamityGlobalNPC.newAI[3] <= 0f || bossRush;
float enrageScale = bossRush ? 0.5f : 0f;
if (biomeEnraged && (!player.ZoneUnderworldHeight || bossRush))
{
NPC.Calamity().CurrentlyEnraged = !bossRush;
enrageScale += 0.5f;
}
if (biomeEnraged && (!player.Calamity().ZoneCalamity || bossRush))
{
NPC.Calamity().CurrentlyEnraged = !bossRush;
enrageScale += 1f;
}
NPC.Calamity().DR = NPC.ai[0] == 4f ? 0.6f : 0.2f;
// Emit dust
int dustAmt = (NPC.ai[0] == 2f) ? 2 : 1;
int size = (NPC.ai[0] == 2f) ? 50 : 35;
if (NPC.ai[0] != 1f)
{
for (int i = 0; i < 2; i++)
{
if (Main.rand.Next(3) < dustAmt)
{
int dust = Dust.NewDust(NPC.Center - new Vector2(size), size * 2, size * 2, DustID.LifeDrain, NPC.velocity.X * 0.5f, NPC.velocity.Y * 0.5f, 90, default, 1.5f);
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity *= 0.2f;
Main.dust[dust].fadeIn = 1f;
}
}
}
// Distance from destination where Brimmy stops moving
float movementDistanceGateValue = 100f;
// How fast Brimmy moves to the destination
float baseVelocity = (death ? 6f : revenge ? 5.5f : expertMode ? 5f : 4.5f) * (NPC.ai[0] == 5f ? 0.05f : NPC.ai[0] == 3f ? 1.5f : 1f);
baseVelocity += 3f * enrageScale;
if (expertMode)
baseVelocity += death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio);
float baseAcceleration = (death ? 0.12f : 0.1f) * (NPC.ai[0] == 5f ? 0.5f : NPC.ai[0] == 3f ? 1.5f : 1f);
baseAcceleration += 0.06f * enrageScale;
if (expertMode)
baseAcceleration += 0.03f * (1f - lifeRatio);
// This is where Brimmy should be
Vector2 destination = NPC.ai[0] != 3f ? player.Center : new Vector2(player.Center.X, player.Center.Y - 300f);
// How far Brimmy is from where she's supposed to be
Vector2 distanceFromDestination = destination - NPC.Center;
// Movement
if (NPC.ai[0] != 4f)
CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, baseAcceleration, true);
// Rotation and direction
if (NPC.ai[0] <= 2f || NPC.ai[0] == 5f)
{
NPC.rotation = NPC.velocity.X * 0.04f;
if (NPC.ai[0] != 5 || (NPC.ai[1] < 180f && NPC.ai[0] == 5f))
{
float playerLocation = NPC.Center.X - player.Center.X;
NPC.direction = playerLocation < 0f ? 1 : -1;
NPC.spriteDirection = NPC.direction;
}
}
if (Main.zenithWorld) // in gfb, Brimmy channels the power of the other elementals.
{
int newMode;
if (lifeRatio <= 0.8f && lifeRatio > 0.6f)
{
newMode = 1; // Sand
}
else if (lifeRatio <= 0.6f && lifeRatio > 0.4f)
{
newMode = 2; // Rare Sand
}
else if (lifeRatio <= 0.4f && lifeRatio > 0.2f)
{
newMode = 3; // Cloud
}
else if (lifeRatio <= 0.2f)
{
newMode = 4; // Water
}
else
{
newMode = 0; // Brimstone, default
}
if (newMode != currentMode)
{
SoundEngine.PlaySound(SoundID.Item29, NPC.Center);
}
currentMode = newMode;
}
if (NPC.ai[0] == -1f)
{
// Avoid cheap bullshit
NPC.damage = 0;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int phase;
int random = phase2 ? 6 : 5;
do phase = Main.rand.Next(random);
while (phase == NPC.ai[1] || (phase == 0 && phase3 && revenge) || phase == 1 || phase == 2 || (phase == 4 && NPC.localAI[3] != 0f));
NPC.ai[0] = phase;
NPC.ai[1] = 0f;
// Cocoon phase cooldown
if (NPC.localAI[3] > 0f)
NPC.localAI[3] -= 1f;
else if (phase == 4)
{
NPC.localAI[3] = 3f;
SoundEngine.PlaySound(HideInShellSound, player.Center);
}
// Prevent netUpdate from being blocked by the spam counter.
// A phase switch sync is a critical operation that must be synced.
NPC.ForceNetUpdate(false);
}
}
// Pick a location to teleport to
else if (NPC.ai[0] == 0f)
{
// Avoid cheap bullshit
NPC.damage = 0;
NPC.chaseable = true;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
NPC.localAI[1] += 1f;
if (NPC.Distance(player.Center) < 160f)
NPC.localAI[1] += death ? 4f : expertMode ? 2f : 1f;
if (NPC.localAI[1] >= (bossRush ? 90f : death ? 120f : 180f))
{
NPC.TargetClosest();
NPC.localAI[1] = 0f;
int timer = 0;
int playerPosX;
int playerPosY;
while (true)
{
timer++;
playerPosX = (int)player.Center.X / 16;
playerPosY = (int)player.Center.Y / 16;
int min = 12;
int max = 16;
if (Main.rand.NextBool())
playerPosX += Main.rand.Next(min, max);
else
playerPosX -= Main.rand.Next(min, max);
if (Main.rand.NextBool())
playerPosY += Main.rand.Next(min, max);
else
playerPosY -= Main.rand.Next(min, max);
if (!WorldGen.SolidTile(playerPosX, playerPosY))
break;
if (timer > 100)
return;
}
NPC.ai[0] = 1f;
NPC.ai[1] = playerPosX;
NPC.ai[2] = playerPosY;
NPC.netUpdate = true;
}
}
}
// Teleport to location
else if (NPC.ai[0] == 1f)
{
// Avoid cheap bullshit
NPC.damage = 0;
NPC.chaseable = true;
Vector2 position = new Vector2(NPC.ai[1] * 16f - (NPC.width / 2), NPC.ai[2] * 16f - (NPC.height / 2));
for (int m = 0; m < 5; m++)
{
int dust = Dust.NewDust(position, NPC.width, NPC.height, DustID.LifeDrain, 0f, -1f, 90, default, 2f);
Main.dust[dust].noGravity = true;
Main.dust[dust].fadeIn = 1f;
}
NPC.alpha += bossRush ? 8 : death ? 5 : revenge ? 4 : expertMode ? 3 : 2;
if (NPC.alpha >= 255)
{
int spawnType = currentMode == 3 ? NPCID.AngryNimbus : ModContent.NPCType<Brimling>();
int enemyCount = currentMode == 3 ? 3 : 1; // 3 angry nimbi if cloud, otherwise 1 brimling
if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(spawnType) < (death ? 1 : 2) && revenge && currentMode != 2) // dont spawn anything if gfb rare sand
{
for (int i = 0; i < enemyCount; i++)
NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, spawnType);
}
SoundEngine.PlaySound(TeleportSound, NPC.Center);
NPC.alpha = 255;
NPC.position = position;
for (int n = 0; n < 15; n++)
{
int warpDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.LifeDrain, 0f, -1f, 90, default, 3f);
Main.dust[warpDust].noGravity = true;
}
NPC.ai[0] = 2f;
NPC.netUpdate = true;
}
}
// Either teleport again or go to next AI state
else if (NPC.ai[0] == 2f)
{
// Avoid cheap bullshit
NPC.damage = 0;
if (NPC.alpha >= 255)
{
if (Main.zenithWorld)
{
SoundEngine.PlaySound(SoundID.Item68, NPC.Center);
int type = ModContent.ProjectileType<BrimstoneRay>();
int damage = NPC.GetProjectileDamage(type);
Vector2 pos = NPC.Center;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
Projectile.NewProjectile(NPC.GetSource_FromAI(), pos, new Vector2(0, 1), type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
Projectile.NewProjectile(NPC.GetSource_FromAI(), pos, new Vector2(0, -1), type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
Projectile.NewProjectile(NPC.GetSource_FromAI(), pos, new Vector2(1, 0), type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
Projectile.NewProjectile(NPC.GetSource_FromAI(), pos, new Vector2(-1, 0), type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
}
if (currentMode >= 1 && currentMode <= 3)
{
int tornadoType = currentMode == 3 ? ModContent.ProjectileType<StormMarkHostile>() : ProjectileID.SandnadoHostileMark;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
Projectile.NewProjectile(NPC.GetSource_FromAI(), pos, Vector2.Zero, tornadoType, damage, 0f, Main.myPlayer, 0f, 0f);
}
}
if (currentMode == 2)
{
int healAmt = NPC.lifeMax / 25;
if (healAmt > 0)
{
NPC.life += healAmt;
NPC.HealEffect(healAmt, true);
NPC.netUpdate = true;
}
}
}
}
NPC.alpha -= 50;
if (NPC.alpha <= 0)
{
NPC.chaseable = true;
NPC.ai[3] += 1f;
NPC.alpha = 0;
if (NPC.ai[3] >= 2f || phase2 || Main.getGoodWorld)
{
NPC.ai[0] = -1f;
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
NPC.ai[3] = 0f;
}
else
{
NPC.ai[0] = 0f;
}
NPC.netUpdate = true;
}
}
// Float above target and fire projectiles
else if (NPC.ai[0] == 3f)
{
// Avoid cheap bullshit
NPC.damage = 0;
NPC.chaseable = true;
NPC.rotation = NPC.velocity.X * 0.04f;
float playerLocation = NPC.Center.X - player.Center.X;
NPC.direction = playerLocation < 0f ? 1 : -1;
NPC.spriteDirection = NPC.direction;
NPC.ai[1] += 1f;
float divisor = expertMode ? (death ? 80f : revenge ? 45f : 50f) - (float)Math.Ceiling(10f * (1f - lifeRatio)) : 50f;
divisor -= 3f * enrageScale;
float divisor2 = divisor * 2f;
if (NPC.ai[1] % divisor == divisor - 1f)
{
float velocity = (death ? 7f : revenge ? 6f : 5f) + (2f * enrageScale) + (expertMode ? 3f * (1f - lifeRatio) : 0f);
int type = ModContent.ProjectileType<BrimstoneHellfireball>();
int damage = NPC.GetProjectileDamage(type);
if (currentMode == 4)
{
type = ModContent.ProjectileType<FrostMist>();
SoundEngine.PlaySound(SoundID.Item30, player.Center);
}
else
{
SoundEngine.PlaySound(HellfireballSound, player.Center);
}
Vector2 projectileVelocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * velocity;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 5f, projectileVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y);
Main.projectile[proj].timeLeft = 240;
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
Main.projectile[proj].extraUpdates += 1;
}
if (NPC.ai[1] % divisor2 == divisor2 - 1f)
{
velocity = (death ? 5f : 4f) + 2f * enrageScale;
type = ModContent.ProjectileType<BrimstoneBarrage>();
damage = NPC.GetProjectileDamage(type);
if (currentMode == 4)
{
type = ModContent.ProjectileType<WaterSpear>();
SoundEngine.PlaySound(SoundID.Item21, player.Center);
}
else
{
SoundEngine.PlaySound(DartSound, player.Center);
}
projectileVelocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * velocity;
int numProj = death ? 8 : 4;
int spread = death ? 90 : 45;
if (Main.getGoodWorld)
{
numProj *= 3;
spread *= 2;
}
if (Main.netMode != NetmodeID.MultiplayerClient)
{
float rotation = MathHelper.ToRadians(spread);
float projectileVelocityToPass = velocity * 3f;
for (int i = 0; i < numProj; i++)
{
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1)));
int proj2 = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass);
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
Main.projectile[proj2].extraUpdates += 1;
}
}
}
}
if (NPC.ai[1] >= divisor * (death ? 5f : 10f))
{
NPC.TargetClosest();
NPC.ai[0] = -1f;
NPC.ai[1] = 3f;
NPC.ai[2] = 0f;
NPC.ai[3] = 0f;
NPC.netUpdate = true;
}
}
// Cocoon bullet hell
else if (NPC.ai[0] == 4f)
{
// Avoid cheap bullshit
NPC.damage = 0;
NPC.defense = NPC.defDefense * 4;
NPC.chaseable = false;
NPC.localAI[0] += 1f;
if (Main.getGoodWorld)
NPC.localAI[0] += 2f;
if (expertMode)
NPC.localAI[0] += 1f - lifeRatio;
NPC.localAI[0] += enrageScale;
if (NPC.localAI[0] >= 120f)
{
NPC.localAI[0] = 0f;
float projectileSpeed = death ? 9f : revenge ? 8f : 6f;
projectileSpeed += 2f * enrageScale;
Vector2 projectileVelocity = player.Center - NPC.Center;
float radialOffset = 0.2f;
float diameter = 80f;
projectileVelocity = projectileVelocity.SafeNormalize(Vector2.UnitY) * projectileSpeed;
Vector2 velocity = projectileVelocity;
velocity = velocity.SafeNormalize(Vector2.UnitY);
velocity *= diameter;
int totalProjectiles = 6;
float offsetAngle = MathHelper.Pi * radialOffset;
int type = ModContent.ProjectileType<BrimstoneHellblast>();
int damage = NPC.GetProjectileDamage(type);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
for (int j = 0; j < totalProjectiles; j++)
{
float radians = j - (totalProjectiles - 1f) / 2f;
Vector2 offset = velocity.RotatedBy(offsetAngle * radians);
int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, projectileVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f);
Main.projectile[proj].timeLeft = 300;
Main.projectile[proj].tileCollide = false;
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
Main.projectile[proj].extraUpdates += 1;
}
}
totalProjectiles = 12;
float radians2 = MathHelper.TwoPi / totalProjectiles;
type = ModContent.ProjectileType<BrimstoneBarrage>();
damage = NPC.GetProjectileDamage(type);
if (currentMode == 4)
{
type = ModContent.ProjectileType<SirenSong>();
SoundEngine.PlaySound(SoundID.Item26, player.Center);
}
else
{
SoundEngine.PlaySound(ShellFireSound, player.Center);
}
double angleA = radians2 * 0.5;
double angleB = MathHelper.ToRadians(90f) - angleA;
float velocityX = (float)(projectileSpeed * Math.Sin(angleA) / Math.Sin(angleB));
Vector2 spinningPoint = NPC.localAI[2] % 2f == 0f ? new Vector2(0f, -projectileSpeed) : new Vector2(-velocityX, -projectileSpeed);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
float projectileVelocityToPass = projectileSpeed * 3f;
for (int k = 0; k < totalProjectiles; k++)
{
Vector2 vector255 = spinningPoint.RotatedBy(radians2 * k);
int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass);
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
Main.projectile[proj].extraUpdates += 1;
}
if (death)
{
spinningPoint = NPC.localAI[2] % 2f == 0f ? new Vector2(-velocityX, -projectileSpeed) : new Vector2(0f, -projectileSpeed);
for (int k = 0; k < totalProjectiles; k++)
{
Vector2 vector255 = spinningPoint.RotatedBy(radians2 * k);
int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255 * 0.75f, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass);
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
Main.projectile[proj].extraUpdates += 1;
}
}
}
NPC.localAI[2] += 1f;
}
NPC.velocity *= 0.95f;
NPC.rotation = NPC.velocity.X * 0.04f;
float playerLocation = NPC.Center.X - player.Center.X;
NPC.direction = playerLocation < 0f ? 1 : -1;
NPC.spriteDirection = NPC.direction;
NPC.ai[1] += 1f;
if (NPC.ai[1] >= (death ? 240f : 300f))
{
NPC.TargetClosest();
NPC.ai[0] = -1f;
NPC.ai[1] = 4f;
NPC.ai[2] = 0f;
NPC.ai[3] = 0f;
NPC.localAI[0] = 0f;
NPC.netUpdate = true;
}
}
// Laser beam attack
else if (NPC.ai[0] == 5f)
{
// Avoid cheap bullshit
NPC.damage = 0;
NPC.chaseable = true;
NPC.defense = NPC.defDefense * 2;
Vector2 source = new Vector2(NPC.Center.X + (NPC.spriteDirection > 0 ? 34f : -34f), NPC.Center.Y - 74f);
Vector2 aimAt = player.Center + player.velocity * 20f;
float aimResponsiveness = bossRush ? 0.05f : (NPC.ai[2] == 1f || death) ? 0.1f : 0.25f;
Vector2 aimVector = (aimAt - source).SafeNormalize(Vector2.UnitY);
if (aimVector.HasNaNs())
aimVector = -Vector2.UnitY;
aimVector = Vector2.Lerp(aimVector, NPC.velocity.SafeNormalize(Vector2.UnitY), aimResponsiveness).SafeNormalize(Vector2.UnitY);
aimVector *= 6f;
Vector2 laserVelocity = aimVector.SafeNormalize(Vector2.UnitY);
if (laserVelocity.HasNaNs())
laserVelocity = -Vector2.UnitY;
calamityGlobalNPC.newAI[1] = laserVelocity.X;
calamityGlobalNPC.newAI[2] = laserVelocity.Y;
// Rev = 190 + 165 = 355
// Death = 165
NPC.ai[1] += 1f;
if (NPC.ai[1] >= 240f)
{
NPC.TargetClosest();
NPC.ai[2] += 1f;
NPC.localAI[0] = 0f;
NPC.localAI[1] = 0f;
if (NPC.ai[2] >= (death ? 1f : 2f))
{
NPC.ai[0] = -1f;
NPC.ai[1] = 5f;
NPC.ai[2] = 0f;
calamityGlobalNPC.newAI[0] = 0f;
}
else
{
NPC.ai[1] = 0f;
calamityGlobalNPC.newAI[0] = 0f;
}
}
else if (NPC.ai[1] >= 180f)
{
NPC.velocity *= 0.95f;
if (NPC.ai[1] == 180f)
{
SoundEngine.PlaySound(SoundID.Item68, source);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
Vector2 laserVelocity2 = new Vector2(NPC.localAI[0], NPC.localAI[1]);
laserVelocity2 = laserVelocity2.SafeNormalize(Vector2.UnitY);
int type = ModContent.ProjectileType<BrimstoneRay>();
int damage = NPC.GetProjectileDamage(type);
Projectile.NewProjectile(NPC.GetSource_FromAI(), source, laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
if (Main.getGoodWorld)
Projectile.NewProjectile(NPC.GetSource_FromAI(), source, -laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
if (Main.zenithWorld)
{
Projectile.NewProjectile(NPC.GetSource_FromAI(), source, new Vector2(-laserVelocity2.X, laserVelocity2.Y), type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
Projectile.NewProjectile(NPC.GetSource_FromAI(), source, new Vector2(laserVelocity2.X, -laserVelocity2.Y), type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
}
}
}
}
else
{
float playSoundTimer = 30f;
if (NPC.ai[1] < 150f)
{
switch ((int)NPC.ai[2])
{
case 0:
NPC.ai[1] += 0.5f;
break;
case 1:
NPC.ai[1] += 1f;
playSoundTimer = 40f;
break;
}
if (death)
{
NPC.ai[1] += 0.5f;
playSoundTimer += 10f;
}
}
if (NPC.ai[1] % playSoundTimer == 0f)
SoundEngine.PlaySound(SoundID.Item20, NPC.Center);
if (NPC.ai[1] < 150f && calamityGlobalNPC.newAI[0] == 0f)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
Projectile.NewProjectile(NPC.GetSource_FromAI(), source, laserVelocity, ModContent.ProjectileType<BrimstoneTargetRay>(), 0, 0f, Main.myPlayer, 0f, NPC.whoAmI);
if (Main.getGoodWorld)
Projectile.NewProjectile(NPC.GetSource_FromAI(), source, -laserVelocity, ModContent.ProjectileType<BrimstoneTargetRay>(), 0, 0f, Main.myPlayer, 0f, NPC.whoAmI);
if (Main.zenithWorld)
{
Projectile.NewProjectile(NPC.GetSource_FromAI(), source, new Vector2(-laserVelocity.X, laserVelocity.Y), ModContent.ProjectileType<BrimstoneTargetRay>(), 0, 0f, Main.myPlayer, 0f, NPC.whoAmI);
Projectile.NewProjectile(NPC.GetSource_FromAI(), source, new Vector2(laserVelocity.X, -laserVelocity.Y), ModContent.ProjectileType<BrimstoneTargetRay>(), 0, 0f, Main.myPlayer, 0f, NPC.whoAmI);
}
}
calamityGlobalNPC.newAI[0] = 1f;
}
else
{
if (NPC.ai[1] == 150f)
{
NPC.localAI[0] = laserVelocity.X;
NPC.localAI[1] = laserVelocity.Y;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
Projectile.NewProjectile(NPC.GetSource_FromAI(), source.X, source.Y, NPC.localAI[0], NPC.localAI[1], ModContent.ProjectileType<BrimstoneTargetRay>(), 0, 0f, Main.myPlayer, 1f, NPC.whoAmI);
if (Main.getGoodWorld)
Projectile.NewProjectile(NPC.GetSource_FromAI(), source.X, source.Y, -NPC.localAI[0], -NPC.localAI[1], ModContent.ProjectileType<BrimstoneTargetRay>(), 0, 0f, Main.myPlayer, 1f, NPC.whoAmI);
if (Main.zenithWorld)
{
Projectile.NewProjectile(NPC.GetSource_FromAI(), source.X, source.Y, -NPC.localAI[0], NPC.localAI[1], ModContent.ProjectileType<BrimstoneTargetRay>(), 0, 0f, Main.myPlayer, 1f, NPC.whoAmI);
Projectile.NewProjectile(NPC.GetSource_FromAI(), source.X, source.Y, NPC.localAI[0], -NPC.localAI[1], ModContent.ProjectileType<BrimstoneTargetRay>(), 0, 0f, Main.myPlayer, 1f, NPC.whoAmI);
}
}
}
}
}
}
}
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
-539
View File
@@ -1,539 +0,0 @@
using System;
using System.IO;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Events;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Armor.Vanity;
using CalamityMod.Items.LoreItems;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Mounts;
using CalamityMod.Items.Placeables.Furniture.BossRelics;
using CalamityMod.Items.Placeables.Furniture.DevPaintings;
using CalamityMod.Items.Placeables.Furniture.Trophies;
using CalamityMod.Items.Potions;
using CalamityMod.Items.TreasureBags;
using CalamityMod.Items.Weapons.Magic;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs;
using CalamityMod.Projectiles.Boss;
using CalamityMod.Sounds;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.GameContent.Bestiary;
using Terraria.GameContent.ItemDropRules;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.Bumblebirb
{
[AutoloadBossHead]
public class Bumblefuck : ModNPC
{
public static Asset<Texture2D> GlowTexture;
public override void SetStaticDefaults()
{
Main.npcFrameCount[Type] = 6;
NPCID.Sets.TrailingMode[Type] = 1;
NPCID.Sets.BossBestiaryPriority.Add(Type);
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers()
{
Scale = 0.5f,
PortraitScale = 0.85f,
PortraitPositionYOverride = 14f
};
value.Position.X += 20f;
value.Position.Y += 8f;
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
NPCID.Sets.MPAllowedEnemies[Type] = true;
if (!Main.dedServ)
{
GlowTexture = ModContent.Request<Texture2D>("CalamityMod/NPCs/Bumblebirb/BirbGlow", AssetRequestMode.AsyncLoad);
}
}
public override string Texture => "CalamityMod/NPCs/Bumblebirb/Birb";
public override string BossHeadTexture => "CalamityMod/NPCs/Bumblebirb/Birb_Head_Boss";
public override void SetDefaults()
{
NPC.Calamity().canBreakPlayerDefense = true;
NPC.npcSlots = 32f;
NPC.aiStyle = -1;
AIType = -1;
NPC.GetNPCDamage();
NPC.width = 130;
NPC.height = 100;
NPC.defense = 40;
NPC.DR_NERD(0.1f);
NPC.LifeMaxNERB(187500, 225000, 300000); // Old HP - 227500, 252500
NPC.knockBackResist = 0f;
NPC.boss = true;
NPC.noTileCollide = true;
NPC.lavaImmune = true;
NPC.noGravity = true;
NPC.value = Item.buyPrice(1, 0, 0, 0);
NPC.HitSound = SoundID.NPCHit51;
NPC.DeathSound = SoundID.NPCDeath46;
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToCold = true;
NPC.Calamity().VulnerableToSickness = true;
NPC.Calamity().VulnerableToElectricity = false;
// Scale HP in Master
CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true);
}
public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
{
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[]
{
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle,
new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Bumblefuck")
});
}
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(NPC.localAI[0]);
writer.Write(NPC.localAI[1]);
writer.Write(NPC.localAI[2]);
writer.Write(NPC.localAI[3]);
for (int i = 0; i < 4; i++)
writer.Write(NPC.Calamity().newAI[i]);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
NPC.localAI[0] = reader.ReadSingle();
NPC.localAI[1] = reader.ReadSingle();
NPC.localAI[2] = reader.ReadSingle();
NPC.localAI[3] = reader.ReadSingle();
for (int i = 0; i < 4; i++)
NPC.Calamity().newAI[i] = reader.ReadSingle();
}
public override void AI()
{
BumblebirbAI.VanillaBumblebirbAI(NPC, Mod);
}
public override void FindFrame(int frameHeight)
{
CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity();
bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive;
bool death = CalamityWorld.death || BossRushEvent.BossRushActive;
// Percent life remaining
float lifeRatio = NPC.life / (float)NPC.lifeMax;
// Phases
bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death;
bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f);
bool birbSpawn = NPC.ai[0] == 4f && NPC.ai[1] > 0f;
// Animation goes nyoom
if (Main.zenithWorld)
{
NPC.frameCounter += 4;
}
float newPhaseTimer = 180f;
bool phaseSwitchPhase = (phase2 && calamityGlobalNPC.newAI[0] < newPhaseTimer && calamityGlobalNPC.newAI[2] != 1f) ||
(phase3 && calamityGlobalNPC.newAI[1] < newPhaseTimer && calamityGlobalNPC.newAI[3] != 1f);
if (phaseSwitchPhase || birbSpawn)
{
float frameGateValue = birbSpawn ? NPC.ai[1] : phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0];
int frameTimer = 180;
if (frameGateValue < (frameTimer - 60) || frameGateValue > (frameTimer - 20))
{
NPC.frameCounter += 1D;
if (NPC.frameCounter > 5D)
{
NPC.frameCounter = 0D;
NPC.frame.Y += frameHeight;
}
if (NPC.frame.Y >= frameHeight * 5)
{
NPC.frame.Y = 0;
}
}
else
{
NPC.frame.Y = frameHeight * 4;
if (frameGateValue > (frameTimer - 50) && frameGateValue < (frameTimer - 25))
{
NPC.frame.Y = frameHeight * 5;
}
}
}
else if (NPC.ai[0] == 5f)
{
int otherFrameTimer = 120;
if (NPC.ai[1] < (otherFrameTimer - 50) || NPC.ai[1] > (otherFrameTimer - 10))
{
NPC.frameCounter += 1D;
if (NPC.frameCounter > 5D)
{
NPC.frameCounter = 0D;
NPC.frame.Y += frameHeight;
}
if (NPC.frame.Y >= frameHeight * 5)
{
NPC.frame.Y = 0;
}
}
else
{
NPC.frame.Y = frameHeight * 4;
if (NPC.ai[1] > (otherFrameTimer - 40) && NPC.ai[1] < (otherFrameTimer - 15))
{
NPC.frame.Y = frameHeight * 5;
}
}
}
else
{
NPC.frameCounter += (NPC.ai[0] == 3.2f ? 1.5 : 1D);
if (NPC.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base
{
NPC.frameCounter = 0D;
NPC.frame.Y += frameHeight;
}
if (NPC.frame.Y >= frameHeight * 5)
{
NPC.frame.Y = 0;
}
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
{
CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity();
bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive;
bool death = CalamityWorld.death || BossRushEvent.BossRushActive;
// Percent life remaining
float lifeRatio = NPC.life / (float)NPC.lifeMax;
// Phases
bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death;
bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f);
float newPhaseTimer = 180f;
bool phaseSwitchPhase = (phase2 && calamityGlobalNPC.newAI[0] < newPhaseTimer && calamityGlobalNPC.newAI[2] != 1f) ||
(phase3 && calamityGlobalNPC.newAI[1] < newPhaseTimer && calamityGlobalNPC.newAI[3] != 1f);
SpriteEffects spriteEffects = SpriteEffects.None;
if (NPC.spriteDirection == 1)
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[Type].Value;
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2));
Color color = drawColor;
Color altColor = Color.White;
float lerpDrawTransition = 0f;
int newAITracker = 120;
int buffColorDampener = 60;
if (phase3 && calamityGlobalNPC.newAI[3] == 1f)
{
color = CalamityGlobalNPC.buffColor(color, 0.9f, 0.6f, 0.2f, 1f);
}
else if (phase2 && calamityGlobalNPC.newAI[2] == 1f)
{
color = CalamityGlobalNPC.buffColor(color, 0.7f, 0.7f, 0.3f, 1f);
}
else if (phase2 && calamityGlobalNPC.newAI[0] > (float)newAITracker)
{
float phase2TranBuff = calamityGlobalNPC.newAI[0] - (float)newAITracker;
phase2TranBuff /= (float)buffColorDampener;
color = CalamityGlobalNPC.buffColor(color, 1f - 0.3f * phase2TranBuff, 1f - 0.3f * phase2TranBuff, 1f - 0.7f * phase2TranBuff, 1f);
}
int afterimageAmt = 10;
int afterimageIncrement = 2;
if (NPC.ai[0] == 0f || NPC.ai[0] == 3.1f || NPC.ai[0] == 4f || NPC.ai[0] == 4.2f)
{
afterimageAmt = 4;
}
if (NPC.ai[0] == 1f || NPC.ai[0] == 3f || NPC.ai[0] == 4.1f)
{
afterimageAmt = 7;
}
if (NPC.ai[0] == 2f || NPC.ai[0] == 3.2f || (phase2 && calamityGlobalNPC.newAI[2] == 1f))
{
altColor = Color.Yellow;
lerpDrawTransition = 0.5f;
}
else
{
color = altColor;
}
if (CalamityClientConfig.Instance.Afterimages)
{
for (int i = 1; i < afterimageAmt; i += afterimageIncrement)
{
Color afterimageColor = color;
afterimageColor = Color.Lerp(afterimageColor, altColor, lerpDrawTransition);
afterimageColor = NPC.GetAlpha(afterimageColor);
afterimageColor *= (float)(afterimageAmt - i) / 15f;
Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
afterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f;
afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
}
int extraAfterimageAmt = 0;
float extraAfterimageDampener = 0f;
float afterimageScaler = 0f;
if (NPC.ai[0] == 0f || NPC.ai[0] == 3.1f || NPC.ai[0] == 4f || NPC.ai[0] == 4.2f)
{
extraAfterimageAmt = 4;
}
if (NPC.ai[0] == 5f)
{
if (NPC.ai[1] > 60f)
{
extraAfterimageAmt = 6;
extraAfterimageDampener = 1f - (float)Math.Cos((double)((NPC.ai[1] - 60f) / 30f * MathHelper.TwoPi));
extraAfterimageDampener /= 3f;
afterimageScaler = 40f;
}
}
if (phaseSwitchPhase)
{
if (phase3 && calamityGlobalNPC.newAI[1] > (float)newAITracker)
{
extraAfterimageAmt = 6;
extraAfterimageDampener = 1f - (float)Math.Cos((double)((calamityGlobalNPC.newAI[1] - (float)newAITracker) / (float)buffColorDampener * MathHelper.TwoPi));
extraAfterimageDampener /= 3f;
afterimageScaler = 60f;
}
else if (phase2 && calamityGlobalNPC.newAI[0] > (float)newAITracker)
{
extraAfterimageAmt = 6;
extraAfterimageDampener = 1f - (float)Math.Cos((double)((calamityGlobalNPC.newAI[0] - (float)newAITracker) / (float)buffColorDampener * MathHelper.TwoPi));
extraAfterimageDampener /= 3f;
afterimageScaler = 60f;
}
}
if (CalamityClientConfig.Instance.Afterimages)
{
for (int j = 0; j < extraAfterimageAmt; j++)
{
Color extraAfterimageColor = altColor;
extraAfterimageColor = Color.Lerp(extraAfterimageColor, altColor, lerpDrawTransition);
extraAfterimageColor = NPC.GetAlpha(extraAfterimageColor);
extraAfterimageColor *= 1f - extraAfterimageDampener;
Vector2 extraAfterimageDrawPos = NPC.Center + ((float)j / (float)extraAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScaler * extraAfterimageDampener - screenPos;
extraAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f;
extraAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, extraAfterimageDrawPos, NPC.frame, extraAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
}
Color mainDrawingColor = altColor;
mainDrawingColor = Color.Lerp(mainDrawingColor, altColor, lerpDrawTransition);
mainDrawingColor = NPC.GetAlpha(mainDrawingColor);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, (phase3 && calamityGlobalNPC.newAI[3] == 1f ? mainDrawingColor : NPC.GetAlpha(altColor)), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
if (phase2)
{
texture2D15 = GlowTexture.Value;
Color glowmaskColor = Color.Lerp(Color.White, Color.Red, 0.5f);
altColor = Color.Red;
lerpDrawTransition = 1f;
extraAfterimageDampener = 0.5f;
afterimageScaler = 10f;
afterimageIncrement = 1;
if (phaseSwitchPhase)
{
float glowmaskDampener = (phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]) - (float)newAITracker;
glowmaskDampener /= (float)buffColorDampener;
altColor *= glowmaskDampener;
glowmaskColor *= glowmaskDampener;
}
if (CalamityClientConfig.Instance.Afterimages)
{
for (int k = 1; k < afterimageAmt; k += afterimageIncrement)
{
Color glowmaskAfterimageColor = glowmaskColor;
glowmaskAfterimageColor = Color.Lerp(glowmaskAfterimageColor, altColor, lerpDrawTransition);
glowmaskAfterimageColor *= (float)(afterimageAmt - k) / 15f;
Vector2 glowmaskAfterimageDrawPos = NPC.oldPos[k] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
glowmaskAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f;
glowmaskAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, glowmaskAfterimageDrawPos, NPC.frame, glowmaskAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
for (int l = 1; l < extraAfterimageAmt; l++)
{
Color extraGlowmaskAfterimageColor = glowmaskColor;
extraGlowmaskAfterimageColor = Color.Lerp(extraGlowmaskAfterimageColor, altColor, lerpDrawTransition);
extraGlowmaskAfterimageColor = NPC.GetAlpha(extraGlowmaskAfterimageColor);
extraGlowmaskAfterimageColor *= 1f - extraAfterimageDampener;
Vector2 extraGlowmaskAfterimageDrawPos = NPC.Center + ((float)l / (float)extraAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScaler * extraAfterimageDampener - screenPos;
extraGlowmaskAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f;
extraGlowmaskAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, extraGlowmaskAfterimageDrawPos, NPC.frame, extraGlowmaskAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
}
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
return false;
}
private static Color buffColor(Color newColor, float R, float G, float B, float A)
{
newColor.R = (byte)((float)newColor.R * R);
newColor.G = (byte)((float)newColor.G * G);
newColor.B = (byte)((float)newColor.B * B);
newColor.A = (byte)((float)newColor.A * A);
return newColor;
}
public override void BossLoot(ref string name, ref int potionType) => potionType = ItemID.SuperHealingPotion;
public override void ModifyNPCLoot(NPCLoot npcLoot)
{
npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType<DragonfollyBag>()));
// Normal drops: Everything that would otherwise be in the bag
var normalOnly = npcLoot.DefineNormalOnlyDropSet();
{
// Weapons
int[] items = new int[]
{
ModContent.ItemType<GildedProboscis>(),
ModContent.ItemType<GoldenEagle>(),
ModContent.ItemType<RougeSlash>()
};
normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, items));
normalOnly.Add(ModContent.ItemType<Swordsplosion>(), 10);
// Materials
normalOnly.Add(ModContent.ItemType<EffulgentFeather>(), 1, 25, 30);
// Equipment
normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType<DynamoStemCells>()));
normalOnly.Add(ModContent.ItemType<FollyFeed>(), DropHelper.NormalWeaponDropRateFraction);
// Vanity
normalOnly.Add(ModContent.ItemType<BumblefuckMask>(), 7);
normalOnly.Add(ModContent.ItemType<ThankYouPainting>(), ThankYouPainting.DropInt);
}
npcLoot.Add(ModContent.ItemType<DragonfollyTrophy>(), 10);
// Relic
npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType<DragonfollyRelic>());
// GFB Omega Healing Potion drop
npcLoot.DefineConditionalDropSet(DropHelper.GFB).Add(DropHelper.PerPlayer(ModContent.ItemType<OmegaHealingPotion>(), 1, 50, 100), true);
// Lore
npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedDragonfolly, ModContent.ItemType<LoreDragonfolly>(), desc: DropHelper.FirstKillText);
}
public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo)
{
if (hurtInfo.Damage > 0)
target.AddBuff(ModContent.BuffType<VermillionFlux>(), Main.zenithWorld ? 360 : 180);
}
public override void OnKill()
{
// Don't bother running any of this in Boss Rush.
if (BossRushEvent.BossRushActive)
return;
CalamityGlobalNPC.SetNewBossJustDowned(NPC);
// Mark The Dragonfolly as dead
DownedBossSystem.downedDragonfolly = true;
CalamityNetcode.SyncWorld();
if (Main.zenithWorld)
{
int spacing = 40;
int amt = 7;
SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
for (int i = 0; i < amt; i++)
{
Vector2 fireFrom = new Vector2(NPC.Center.X + (spacing * i) - (spacing * amt / 2), NPC.Center.Y - 900f);
Vector2 ai0 = NPC.Center - fireFrom;
float ai = Main.rand.Next(100);
Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f;
Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType<RedLightning>(), NPC.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai);
}
}
}
}
public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment)
{
NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment);
NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier());
}
public override void ModifyTypeName(ref string typeName)
{
if (Main.zenithWorld)
{
typeName = CalamityUtils.GetTextValue("NPCs.Bumblebirb");
}
}
public override void HitEffect(NPC.HitInfo hit)
{
for (int k = 0; k < 5; k++)
{
Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f);
}
if (NPC.life <= 0)
{
for (int k = 0; k < 50; k++)
{
Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f);
}
if (!Main.dedServ)
{
for (int i = 0; i < 6; i++) // 1 head, 1 wing, 4 legs = 6. one wing due to them being chonky boyes now
{
string gore = "Bumble";
float randomSpread = Main.rand.Next(-200, 201) / 100f;
gore += i == 0 ? "Head" : i > 1 ? "Leg" : "Wing";
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find<ModGore>(gore).Type, 1f);
}
}
}
}
}
}
-153
View File
@@ -1,153 +0,0 @@
using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs;
using CalamityMod.Projectiles.Boss;
using CalamityMod.Sounds;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.Bumblebirb
{
public class Bumblefuck2 : ModNPC
{
public override void SetStaticDefaults()
{
Main.npcFrameCount[Type] = 5;
NPCID.Sets.TrailingMode[Type] = 1;
this.HideFromBestiary();
}
public override string Texture => "CalamityMod/NPCs/Bumblebirb/BumbleFolly";
public override void SetDefaults()
{
NPC.npcSlots = 1f;
NPC.aiStyle = -1;
AIType = -1;
NPC.GetNPCDamage();
NPC.width = 120;
NPC.height = 80;
NPC.defense = 20;
NPC.LifeMaxNERB(9375, 11250, 5000);
NPC.knockBackResist = 0.15f;
NPC.lavaImmune = true;
NPC.noTileCollide = true;
NPC.noGravity = true;
NPC.HitSound = SoundID.NPCHit51;
NPC.DeathSound = SoundID.NPCDeath46;
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToCold = true;
NPC.Calamity().VulnerableToSickness = true;
// Scale stats in Expert and Master
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC);
}
public override void AI()
{
BumblebirbAI.VanillaBumblebirb2AI(NPC, Mod, true);
}
public override void OnKill()
{
int closestPlayer = Player.FindClosest(NPC.Center, 1, 1);
if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2)
Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart);
if (Main.zenithWorld)
{
SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
for (int i = 0; i < 5; i++)
{
Vector2 fireFrom = new Vector2(NPC.Center.X + (40 * i) - 120, NPC.Center.Y - 900f);
Vector2 ai0 = NPC.Center - fireFrom;
float ai = Main.rand.Next(100);
Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f;
Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType<RedLightning>(), NPC.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai);
}
}
}
}
public override void FindFrame(int frameHeight)
{
NPC.frameCounter += NPC.ai[0] == 2.1f ? 1.5 : 1D;
if (Main.zenithWorld)
{
NPC.frameCounter += 2D;
}
if (NPC.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base
{
NPC.frameCounter = 0D;
NPC.frame.Y += frameHeight;
}
if (NPC.frame.Y >= frameHeight * 4)
{
NPC.frame.Y = 0;
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
{
SpriteEffects spriteEffects = SpriteEffects.None;
if (NPC.spriteDirection == 1)
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[Type].Value;
Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2);
int afterimageAmt = NPC.ai[0] == 2.1f ? 7 : 0;
if (CalamityClientConfig.Instance.Afterimages)
{
for (int i = 1; i < afterimageAmt; i += 2)
{
Color afterimageColor = drawColor;
afterimageColor = Color.Lerp(afterimageColor, Color.Gold, 0.5f);
afterimageColor = NPC.GetAlpha(afterimageColor);
afterimageColor *= (afterimageAmt - i) / 15f;
Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
afterimageDrawPos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f;
afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
}
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
return false;
}
public override void ModifyTypeName(ref string typeName)
{
if (Main.zenithWorld)
{
typeName = CalamityUtils.GetTextValue("NPCs.Bumblebirb");
}
}
public override void HitEffect(NPC.HitInfo hit)
{
for (int k = 0; k < 5; k++)
{
Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f);
}
if (NPC.life <= 0)
{
for (int k = 0; k < 50; k++)
{
Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f);
}
}
}
}
}
+369
View File
@@ -0,0 +1,369 @@
using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs;
using CalamityMod.Projectiles.Boss;
using CalamityMod.Sounds;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.Bumblebirb
{
public class DraconicSwarmer : ModNPC
{
public override void SetStaticDefaults()
{
Main.npcFrameCount[Type] = 5;
NPCID.Sets.TrailingMode[Type] = 1;
this.HideFromBestiary();
}
public override string Texture => "CalamityMod/NPCs/Bumblebirb/BumbleFolly";
public override void SetDefaults()
{
NPC.npcSlots = 1f;
NPC.aiStyle = -1;
AIType = -1;
NPC.GetNPCDamage();
NPC.width = 120;
NPC.height = 80;
NPC.defense = 20;
NPC.LifeMaxNERB(9375, 11250, 5000);
NPC.knockBackResist = 0.15f;
NPC.lavaImmune = true;
NPC.noTileCollide = true;
NPC.noGravity = true;
NPC.HitSound = SoundID.NPCHit51;
NPC.DeathSound = SoundID.NPCDeath46;
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToCold = true;
NPC.Calamity().VulnerableToSickness = true;
// Scale stats in Expert and Master
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC);
}
public override void AI()
{
Player player = Main.player[NPC.target];
float rotationMult = 4f;
float rotationAmt = 0.04f;
if (Vector2.Distance(player.Center, NPC.Center) > 5600f)
{
if (NPC.timeLeft > 5)
NPC.timeLeft = 5;
}
NPC.rotation = (NPC.rotation * rotationMult + NPC.velocity.X * rotationAmt * 1.25f) / 10f;
if (NPC.ai[0] == 0f || NPC.ai[0] == 1f)
{
for (int i = 0; i < Main.maxNPCs; i++)
{
if (i != NPC.whoAmI && Main.npc[i].active && Main.npc[i].type == NPC.type)
{
Vector2 otherSwarmerDirection = Main.npc[i].Center - NPC.Center;
if (otherSwarmerDirection.Length() < (NPC.width + NPC.height))
{
otherSwarmerDirection.Normalize();
otherSwarmerDirection *= -0.1f;
NPC.velocity += otherSwarmerDirection;
NPC nPC6 = Main.npc[i];
nPC6.velocity -= otherSwarmerDirection;
}
}
}
}
if (NPC.target < 0 || Main.player[NPC.target].dead || !Main.player[NPC.target].active)
{
NPC.TargetClosest(true);
Vector2 swarmerTargetDist = Main.player[NPC.target].Center - NPC.Center;
if (Main.player[NPC.target].dead || swarmerTargetDist.Length() > 5600f)
NPC.ai[0] = -1f;
}
else
{
Vector2 swarmerCatchUpTargetDist = Main.player[NPC.target].Center - NPC.Center;
if (NPC.ai[0] > 1f && swarmerCatchUpTargetDist.Length() > 3600f)
NPC.ai[0] = 1f;
}
if (NPC.ai[0] == -1f)
{
// Avoid cheap bullshit
NPC.damage = 0;
Vector2 swarmerDespawnVelMult = new Vector2(0f, -8f);
NPC.velocity = (NPC.velocity * 21f + swarmerDespawnVelMult) / 10f;
return;
}
if (NPC.ai[0] == 0f)
{
// Avoid cheap bullshit
NPC.damage = 0;
NPC.TargetClosest(true);
NPC.spriteDirection = NPC.direction;
Vector2 swarmerIdleTargetDist = Main.player[NPC.target].Center - NPC.Center;
if (swarmerIdleTargetDist.Length() > 2800f)
{
NPC.ai[0] = 1f;
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
NPC.ai[3] = 0f;
}
else if (swarmerIdleTargetDist.Length() > 400f)
{
float swarmerIdleSpeed = 9f + swarmerIdleTargetDist.Length() / 100f + NPC.ai[1] / 15f;
swarmerIdleTargetDist.Normalize();
swarmerIdleTargetDist *= swarmerIdleSpeed;
NPC.velocity = (NPC.velocity * 29f + swarmerIdleTargetDist) / 30f;
if (Main.getGoodWorld && !Main.zenithWorld)
NPC.velocity *= 1.15f;
}
else if (NPC.velocity.Length() > 2f)
NPC.velocity *= 0.95f;
else if (NPC.velocity.Length() < 1f)
NPC.velocity *= 1.05f;
NPC.ai[1] += 1f;
if (NPC.ai[1] >= 90f)
{
NPC.ai[1] = 0f;
NPC.ai[0] = 2f;
}
}
else
{
if (NPC.ai[0] == 1f)
{
// Avoid cheap bullshit
NPC.damage = 0;
if (NPC.target < 0 || !Main.player[NPC.target].active || Main.player[NPC.target].dead)
NPC.TargetClosest(true);
if (NPC.velocity.X < 0f)
NPC.direction = -1;
else if (NPC.velocity.X > 0f)
NPC.direction = 1;
NPC.spriteDirection = NPC.direction;
NPC.rotation = (NPC.rotation * rotationMult + NPC.velocity.X * rotationAmt) / 10f;
Vector2 swarmerChargeTargetDist = Main.player[NPC.target].Center - NPC.Center;
if (swarmerChargeTargetDist.Length() < 800f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height))
{
NPC.ai[0] = 0f;
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
NPC.ai[3] = 0f;
}
NPC.ai[2] += 0.0166666675f;
float swarmerChargeSpeed = 12f + NPC.ai[2] + swarmerChargeTargetDist.Length() / 150f;
float swarmerChargeVelMult = 25f;
swarmerChargeTargetDist.Normalize();
swarmerChargeTargetDist *= swarmerChargeSpeed;
NPC.velocity = (NPC.velocity * (swarmerChargeVelMult - 1f) + swarmerChargeTargetDist) / swarmerChargeVelMult;
if (Main.getGoodWorld && !Main.zenithWorld)
NPC.velocity *= 1.15f;
NPC.ForceNetUpdate();
return;
}
if (NPC.ai[0] == 2f)
{
// Avoid cheap bullshit
NPC.damage = 0;
if (NPC.velocity.X < 0f)
NPC.direction = -1;
else if (NPC.velocity.X > 0f)
NPC.direction = 1;
NPC.spriteDirection = NPC.direction;
NPC.rotation = (NPC.rotation * rotationMult * 0.75f + NPC.velocity.X * rotationAmt * 1.25f) / 8f;
Vector2 swarmerDecelerateTargetDist = Main.player[NPC.target].Center - NPC.Center;
swarmerDecelerateTargetDist.Y -= 8f;
float swarmerDecelerateSpeed = 18f;
float swarmerDecelerateVelMult = 8f;
swarmerDecelerateTargetDist.Normalize();
swarmerDecelerateTargetDist *= swarmerDecelerateSpeed;
NPC.velocity = (NPC.velocity * (swarmerDecelerateVelMult - 1f) + swarmerDecelerateTargetDist) / swarmerDecelerateVelMult;
if (Main.getGoodWorld && !Main.zenithWorld)
NPC.velocity *= 1.15f;
if (NPC.velocity.X < 0f)
NPC.direction = -1;
else
NPC.direction = 1;
NPC.spriteDirection = NPC.direction;
NPC.ai[1] += 1f;
if (NPC.ai[1] > 10f)
{
// Set damage
NPC.damage = NPC.defDamage;
NPC.velocity = swarmerDecelerateTargetDist;
if (Main.getGoodWorld && !Main.zenithWorld)
NPC.velocity *= 1.15f;
if (NPC.velocity.X < 0f)
NPC.direction = -1;
else
NPC.direction = 1;
NPC.ai[0] = 2.1f;
NPC.ai[1] = 0f;
}
}
else if (NPC.ai[0] == 2.1f)
{
// Set damage
NPC.damage = NPC.defDamage;
if (NPC.velocity.X < 0f)
NPC.direction = -1;
else if (NPC.velocity.X > 0f)
NPC.direction = 1;
NPC.spriteDirection = NPC.direction;
NPC.velocity *= 1.01f;
NPC.ai[1] += 1f;
if (NPC.ai[1] > 30f)
{
if (!Collision.SolidCollision(NPC.position, NPC.width, NPC.height))
{
NPC.ai[0] = 0f;
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
return;
}
if (NPC.ai[1] > 60f)
{
NPC.ai[0] = 1f;
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
}
}
}
}
}
public override void OnKill()
{
int closestPlayer = Player.FindClosest(NPC.Center, 1, 1);
if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2)
Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart);
if (Main.zenithWorld)
{
SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
for (int i = 0; i < 5; i++)
{
Vector2 fireFrom = new Vector2(NPC.Center.X + (40 * i) - 120, NPC.Center.Y - 900f);
Vector2 ai0 = NPC.Center - fireFrom;
float ai = Main.rand.Next(100);
Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f;
Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType<RedLightning>(), NPC.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai);
}
}
}
}
public override void FindFrame(int frameHeight)
{
NPC.frameCounter += NPC.ai[0] == 2.1f ? 1.5 : 1D;
if (Main.zenithWorld)
{
NPC.frameCounter += 2D;
}
if (NPC.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base
{
NPC.frameCounter = 0D;
NPC.frame.Y += frameHeight;
}
if (NPC.frame.Y >= frameHeight * 4)
{
NPC.frame.Y = 0;
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
{
SpriteEffects spriteEffects = SpriteEffects.None;
if (NPC.spriteDirection == 1)
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[Type].Value;
Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2);
int afterimageAmt = NPC.ai[0] == 2.1f ? 7 : 0;
if (CalamityClientConfig.Instance.Afterimages)
{
for (int i = 1; i < afterimageAmt; i += 2)
{
Color afterimageColor = drawColor;
afterimageColor = Color.Lerp(afterimageColor, Color.Gold, 0.5f);
afterimageColor = NPC.GetAlpha(afterimageColor);
afterimageColor *= (afterimageAmt - i) / 15f;
Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
afterimageDrawPos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f;
afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
}
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
return false;
}
public override void ModifyTypeName(ref string typeName)
{
if (Main.zenithWorld)
{
typeName = CalamityUtils.GetTextValue("NPCs.Bumblebirb");
}
}
public override void HitEffect(NPC.HitInfo hit)
{
for (int k = 0; k < 5; k++)
{
Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f);
}
if (NPC.life <= 0)
{
for (int k = 0; k < 50; k++)
{
Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f);
}
}
}
}
}
File diff suppressed because it is too large. Load diff
+715 -3
View File
@@ -14,14 +14,14 @@ using CalamityMod.Items.Weapons.Magic;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Items.Weapons.Summon;
using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs;
using CalamityMod.NPCs.TownNPCs;
using CalamityMod.Sounds;
using CalamityMod.Projectiles.Boss;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using ReLogic.Utilities;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
@@ -134,7 +134,719 @@ namespace CalamityMod.NPCs.CalClone
public override void AI()
{
CalamitasCloneAI.VanillaCalamitasCloneAI(NPC, BulletHellWarnSlot);
CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity();
// Emit light
Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1f, 0f, 0f);
// Variables for increasing difficulty
bool bossRush = BossRushEvent.BossRushActive;
bool death = CalamityWorld.death || bossRush;
bool revenge = CalamityWorld.revenge || bossRush;
bool expertMode = Main.expertMode || bossRush;
// Percent life remaining
float lifeRatio = NPC.life / (float)NPC.lifeMax;
// Phases
bool phase2 = lifeRatio < 0.7f || death;
bool phase3 = lifeRatio < 0.35f;
bool phase4 = lifeRatio <= 0.1f && death;
// Don't take damage during bullet hells
NPC.dontTakeDamage = calamityGlobalNPC.newAI[2] > 0f;
// Variable for live brothers
bool brotherAlive = false;
// For seekers
CalamityGlobalNPC.calamitas = NPC.whoAmI;
// Seeker ring
if (calamityGlobalNPC.newAI[1] == 0f && phase3 && expertMode)
{
SoundEngine.PlaySound(SoundID.Item72, NPC.Center);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int seekerAmt = death ? 10 : 5;
int seekerSpread = 360 / seekerAmt;
int seekerDistance = death ? 180 : 150;
for (int i = 0; i < seekerAmt; i++)
{
int spawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + (Math.Sin(i * seekerSpread) * seekerDistance)), (int)(NPC.Center.Y + (Math.Cos(i * seekerSpread) * seekerDistance)), ModContent.NPCType<SoulSeeker>(), NPC.whoAmI, 0, 0, 0, -1);
Main.npc[spawn].ai[0] = i * seekerSpread;
}
}
string key = "Mods.CalamityMod.Status.Boss.CalamitasBossText3";
Color messageColor = Color.Orange;
CalamityUtils.DisplayLocalizedText(key, messageColor);
calamityGlobalNPC.newAI[1] = 1f;
}
// CIT 14SEP2024: Fixed bug where her phases would get offset by dealing a large amount of damage in a single hit to take her into a new phase.
// newAI[0] now starts at 1 and has 0.3 subtracted from it for each phase, instead of it storing her current health when she enters a new phase.
// Do bullet hell or spawn brothers
if (calamityGlobalNPC.newAI[0] == 0f && NPC.life > 0)
calamityGlobalNPC.newAI[0] = 1f;
// Bullet hells at 70% and 10%, brothers at 40%
if (NPC.life > 0)
{
int calClonePhaseThreshold = (int)(NPC.lifeMax * 0.3);
if (((NPC.life + calClonePhaseThreshold) / (float)NPC.lifeMax) < calamityGlobalNPC.newAI[0])
{
calamityGlobalNPC.newAI[0] -= 0.3f;
if (calamityGlobalNPC.newAI[0] <= 0.1f)
{
SoundEngine.PlaySound(SoundID.Item109, NPC.Center);
calamityGlobalNPC.newAI[2] = 2f;
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
calamityGlobalNPC.newAI[3] = 0f;
SpawnDust();
}
else if (calamityGlobalNPC.newAI[0] <= 0.4f)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.position.Y + NPC.height, ModContent.NPCType<Cataclysm>(), NPC.whoAmI);
NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.position.Y + NPC.height, ModContent.NPCType<Catastrophe>(), NPC.whoAmI);
}
string key = "Mods.CalamityMod.Status.Boss.CalamitasBossText2";
Color messageColor = Color.Orange;
CalamityUtils.DisplayLocalizedText(key, messageColor);
SpawnDust();
}
else
{
SoundEngine.PlaySound(SoundID.Item109, NPC.Center);
calamityGlobalNPC.newAI[2] = 1f;
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
calamityGlobalNPC.newAI[3] = 0f;
SpawnDust();
}
}
}
// Immunity if brothers are alive
if (CalamityGlobalNPC.cataclysm != -1)
{
if (Main.npc[CalamityGlobalNPC.cataclysm].active)
brotherAlive = true;
}
if (CalamityGlobalNPC.catastrophe != -1)
{
if (Main.npc[CalamityGlobalNPC.catastrophe].active)
brotherAlive = true;
}
if (brotherAlive)
NPC.dontTakeDamage = true;
void SpawnDust()
{
int dustAmt = 50;
int random = 3;
for (int j = 0; j < 10; j++)
{
random += j;
int dustAmtSpawned = 0;
int scale = random * 6;
float dustPositionX = NPC.Center.X - (scale / 2);
float dustPositionY = NPC.Center.Y - (scale / 2);
while (dustAmtSpawned < dustAmt)
{
float dustVelocityX = Main.rand.Next(-random, random);
float dustVelocityY = Main.rand.Next(-random, random);
float dustVelocityScalar = random * 2f;
float dustVelocity = (float)Math.Sqrt(dustVelocityX * dustVelocityX + dustVelocityY * dustVelocityY);
dustVelocity = dustVelocityScalar / dustVelocity;
dustVelocityX *= dustVelocity;
dustVelocityY *= dustVelocity;
int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f);
Main.dust[dust].noGravity = true;
Main.dust[dust].position.X = NPC.Center.X;
Main.dust[dust].position.Y = NPC.Center.Y;
Main.dust[dust].position.X += Main.rand.Next(-10, 11);
Main.dust[dust].position.Y += Main.rand.Next(-10, 11);
Main.dust[dust].velocity.X = dustVelocityX;
Main.dust[dust].velocity.Y = dustVelocityY;
dustAmtSpawned++;
}
}
}
// Get a target
if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active)
NPC.TargetClosest();
// Target variable
Player player = Main.player[NPC.target];
float enrageScale = bossRush ? 1f : 0f;
if (Main.IsItDay() || bossRush)
{
NPC.Calamity().CurrentlyEnraged = !bossRush;
enrageScale += 2f;
}
// Rotation
Vector2 npcCenter = new Vector2(NPC.Center.X, NPC.position.Y + NPC.height - 59f);
Vector2 lookAt = new Vector2(player.position.X - (player.width / 2), player.position.Y - (player.height / 2));
Vector2 rotationVector = npcCenter - lookAt;
// Boss Rush predictive charge rotation
if (NPC.ai[1] == 4f && phase4 && bossRush)
{
// Velocity
float chargeVelocity = 30f;
chargeVelocity += 5f * enrageScale;
lookAt += Main.player[NPC.target].velocity * 20f;
rotationVector = Vector2.Normalize(npcCenter - lookAt) * chargeVelocity;
}
float rotation = (float)Math.Atan2(rotationVector.Y, rotationVector.X) + MathHelper.PiOver2;
if (rotation < 0f)
rotation += MathHelper.TwoPi;
else if (rotation > MathHelper.TwoPi)
rotation -= MathHelper.TwoPi;
float rotationAmt = 0.1f;
if (NPC.rotation < rotation)
{
if ((rotation - NPC.rotation) > MathHelper.Pi)
NPC.rotation -= rotationAmt;
else
NPC.rotation += rotationAmt;
}
else if (NPC.rotation > rotation)
{
if ((NPC.rotation - rotation) > MathHelper.Pi)
NPC.rotation += rotationAmt;
else
NPC.rotation -= rotationAmt;
}
if (NPC.rotation > rotation - rotationAmt && NPC.rotation < rotation + rotationAmt)
NPC.rotation = rotation;
if (NPC.rotation < 0f)
NPC.rotation += MathHelper.TwoPi;
else if (NPC.rotation > MathHelper.TwoPi)
NPC.rotation -= MathHelper.TwoPi;
if (NPC.rotation > rotation - rotationAmt && NPC.rotation < rotation + rotationAmt)
NPC.rotation = rotation;
// Despawn
if (!player.active || player.dead)
{
NPC.TargetClosest(false);
player = Main.player[NPC.target];
if (!player.active || player.dead)
{
if (SoundEngine.TryGetActiveSound(BulletHellWarnSlot, out var warningSound) && warningSound.IsPlaying)
warningSound.Stop();
if (NPC.velocity.Y > 3f)
NPC.velocity.Y = 3f;
NPC.velocity.Y -= 0.1f;
if (NPC.velocity.Y < -12f)
NPC.velocity.Y = -12f;
if (NPC.timeLeft > 60)
NPC.timeLeft = 60;
if (NPC.ai[1] != 0f)
{
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
NPC.ai[3] = 0f;
calamityGlobalNPC.newAI[2] = 0f;
calamityGlobalNPC.newAI[3] = 0f;
NPC.alpha = 0;
NPC.netUpdate = true;
}
return;
}
}
else if (NPC.timeLeft < 1800)
NPC.timeLeft = 1800;
// Distance from destination where Cal Clone stops moving
float movementDistanceGateValue = 100f;
// How fast Cal Clone moves to the destination
float baseVelocity = (expertMode ? 10f : 8.5f) * (NPC.ai[1] == 4f ? 1.4f : 1f);
float baseAcceleration = (expertMode ? 0.18f : 0.155f) * (NPC.ai[1] == 4f ? 1.4f : 1f);
baseVelocity += 4f * enrageScale;
baseAcceleration += 0.1f * enrageScale;
if (revenge)
{
baseVelocity += 1.5f * (1f - lifeRatio);
baseAcceleration += 0.03f * (1f - lifeRatio);
}
if (death)
{
baseVelocity += 1.5f * (1f - lifeRatio);
baseAcceleration += 0.03f * (1f - lifeRatio);
}
if (Main.getGoodWorld)
{
baseVelocity *= 1.15f;
baseAcceleration *= 1.15f;
}
// What side Cal Clone should be on, relative to the target
int xPos = 1;
if (NPC.Center.X < player.Center.X)
xPos = -1;
// How far Cal Clone should be from the target
float averageDistance = 500f;
float chargeDistance = phase4 ? 300f : 400f;
// This is where Cal Clone should be
Vector2 destination = (calamityGlobalNPC.newAI[2] > 0f || NPC.ai[1] == 0f) ? new Vector2(player.Center.X, player.Center.Y - averageDistance) :
NPC.ai[1] == 1f ? new Vector2(player.Center.X + averageDistance * xPos, player.Center.Y) :
new Vector2(player.Center.X + chargeDistance * xPos, player.Center.Y);
// Add some random distance to the destination after certain attacks
if (NPC.localAI[0] == 1f)
{
NPC.localAI[0] = 0f;
NPC.localAI[2] = Main.rand.Next(-50, 51);
NPC.localAI[3] = Main.rand.Next(-300, 301);
NPC.netUpdate = true;
}
// Add a bit of randomness to the destination
if (death)
{
destination.X += NPC.ai[1] == 0f ? NPC.localAI[3] : NPC.localAI[2];
destination.Y += NPC.ai[1] == 0f ? NPC.localAI[2] : NPC.localAI[3];
}
// How far Cal Clone is from where she's supposed to be
Vector2 distanceFromDestination = destination - NPC.Center;
// Movement
if (NPC.ai[1] == 0f || NPC.ai[1] == 1f || NPC.ai[1] == 4f || calamityGlobalNPC.newAI[2] > 0f)
CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, baseAcceleration, true);
// Bullet hell phase
if (calamityGlobalNPC.newAI[2] > 0f)
{
// Avoid cheap bullshit
NPC.damage = 0;
if (calamityGlobalNPC.newAI[3] < 900f)
{
calamityGlobalNPC.newAI[3] += 1f;
NPC.dontTakeDamage = true;
NPC.alpha = 255;
float rotX = player.Center.X - NPC.Center.X;
float rotY = player.Center.Y - NPC.Center.Y;
NPC.rotation = (float)Math.Atan2(rotY, rotX) - MathHelper.PiOver2;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
if (calamityGlobalNPC.newAI[2] == 2f)
{
int type = ModContent.ProjectileType<SCalBrimstoneFireblast>();
int damage = NPC.GetProjectileDamage(type);
if (Main.zenithWorld)
type = ModContent.ProjectileType<SCalBrimstoneGigablast>();
float gigaBlastFrequency = (Main.getGoodWorld ? 120f : expertMode ? 180f : 240f) - enrageScale * 15f;
float projSpeed = bossRush ? 6.25f : 5f;
if (calamityGlobalNPC.newAI[3] <= 300f)
{
if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from top
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer);
}
else if (calamityGlobalNPC.newAI[3] <= 600f && calamityGlobalNPC.newAI[3] > 300f)
{
if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from right
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -projSpeed, 0f, type, damage, 0f, Main.myPlayer);
}
else if (calamityGlobalNPC.newAI[3] > 600f)
{
if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from top
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer);
}
}
}
NPC.ai[0] += 1f;
float hellblastGateValue = (expertMode ? 12f : 16f) - enrageScale;
if (NPC.ai[0] >= hellblastGateValue)
{
NPC.ai[0] = 0f;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int type = ModContent.ProjectileType<BrimstoneHellblast2>();
int damage = NPC.GetProjectileDamage(type);
float projSpeed = bossRush ? 4.5f : 4f;
// Blasts aimed directly at the player's horizontal position, does not spawn during the second bullet hell
if (calamityGlobalNPC.newAI[3] % (hellblastGateValue * 6f) == 0f && calamityGlobalNPC.newAI[2] != 2f)
{
float distance = Main.rand.NextBool() ? -1000f : 1000f;
float velocity = distance == -1000f ? projSpeed : -projSpeed;
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f);
}
if (calamityGlobalNPC.newAI[3] < 300f) // Blasts from above
{
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer, 2f, 0f);
}
else if (calamityGlobalNPC.newAI[3] < 600f) // Blasts from left and right
{
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 0.5f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f);
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 0.5f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f);
}
else // Blasts from above, left, and right
{
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed - 1f, type, damage, 0f, Main.myPlayer, 2f, 0f);
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 1f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f);
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 1f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f);
}
}
}
if (calamityGlobalNPC.newAI[3] == 900f - 360f)
BulletHellWarnSlot = SoundEngine.PlaySound(CalamitasClone.BulletHellWarning, player.Center);
if (calamityGlobalNPC.newAI[3] > 900f - 360f)
{
if (SoundEngine.TryGetActiveSound(BulletHellWarnSlot, out var warningSound) && warningSound.IsPlaying)
warningSound.Position = player.Center;
}
}
else
{
NPC.ai[0] = 0f;
NPC.ai[3] = 0f;
NPC.localAI[1] = 0f;
calamityGlobalNPC.newAI[2] = 0f;
calamityGlobalNPC.newAI[3] = 0f;
SoundEngine.PlaySound(CalamitasClone.BulletHellEnd, player.Center);
// Prevent bullshit charge hits when second bullet hell ends.
if (phase4)
{
NPC.ai[1] = 4f;
NPC.ai[2] = -105f;
NPC.TargetClosest();
}
else
{
if (death)
{
int AIState = Main.rand.Next(3);
switch (AIState)
{
case 0:
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
break;
case 1:
NPC.ai[1] = 1f;
NPC.ai[2] = 0f;
break;
case 2:
NPC.ai[1] = 4f;
NPC.ai[2] = -105f;
NPC.TargetClosest();
break;
}
}
else
{
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
}
if (death)
NPC.localAI[0] = 1f;
}
NPC.netUpdate = true;
for (int x = 0; x < Main.maxProjectiles; x++)
{
Projectile projectile = Main.projectile[x];
if (projectile.active)
{
if (projectile.type == ModContent.ProjectileType<BrimstoneHellblast2>() || projectile.type == ModContent.ProjectileType<BrimstoneBarrage>())
{
if (projectile.timeLeft > 60)
projectile.timeLeft = 60;
}
else if (projectile.type == ModContent.ProjectileType<SCalBrimstoneFireblast>())
{
projectile.ai[2] = 1f;
if (projectile.timeLeft > 60)
projectile.timeLeft = 60;
}
}
}
}
return;
}
else if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
{
if (calamityGlobalNPC.newAI[3] < 900f)
calamityGlobalNPC.newAI[3] += 1f;
else
calamityGlobalNPC.newAI[3] = 0f;
NPC.ai[0] += 1f;
float hellblastGateValue = 30f - enrageScale;
if (NPC.ai[0] >= hellblastGateValue)
{
NPC.ai[0] = 0f;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int type = ModContent.ProjectileType<BrimstoneHellblast2>();
int damage = NPC.GetProjectileDamage(type);
float projSpeed = bossRush ? 5f : 4f;
if (calamityGlobalNPC.newAI[3] % (hellblastGateValue * 6f) == 0f)
{
float distance = Main.rand.NextBool() ? -1000f : 1000f;
float velocity = distance == -1000f ? projSpeed : -projSpeed;
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f);
}
if (calamityGlobalNPC.newAI[3] < 300f) // Blasts from above
{
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer, 2f, 0f);
}
else if (calamityGlobalNPC.newAI[3] < 600f) // Blasts from left and right
{
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 0.5f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f);
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 0.5f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f);
}
else // Blasts from above, left, and right
{
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed - 1f, type, damage, 0f, Main.myPlayer, 2f, 0f);
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 1f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f);
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 1f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f);
}
}
}
}
NPC.alpha = NPC.dontTakeDamage ? 255 : 0;
// Float above target and fire hellfireballs
if (NPC.ai[1] == 0f)
{
// Avoid cheap bullshit
NPC.damage = 0;
NPC.ai[2] += 1f;
float phaseTimer = 400f - (death ? 120f * (1f - lifeRatio) : 0f);
if (NPC.ai[2] >= phaseTimer || phase4)
{
if (death && !phase4 && Main.rand.NextBool() && !brotherAlive)
NPC.ai[1] = 4f;
else
NPC.ai[1] = 1f;
NPC.ai[2] = 0f;
if (death)
NPC.localAI[0] = 1f;
NPC.netUpdate = true;
}
if (Main.netMode != NetmodeID.MultiplayerClient)
{
NPC.localAI[1] += 1f;
if (!brotherAlive)
{
if (expertMode)
NPC.localAI[1] += death ? 2f * (1f - lifeRatio) : 1f - lifeRatio;
if (revenge)
NPC.localAI[1] += 0.5f;
}
if (NPC.localAI[1] >= (brotherAlive ? 180f : 120f))
{
NPC.localAI[1] = 0f;
SoundEngine.PlaySound(BrimstoneElemental.BrimstoneElemental.HellfireballSound, NPC.Center);
float projectileVelocity = expertMode ? 14f : 12.5f;
projectileVelocity += 3f * enrageScale;
int type = ModContent.ProjectileType<BrimstoneHellfireball>();
int damage = NPC.GetProjectileDamage(type);
bool shootPredictiveShot = CalamityWorld.LegendaryMode && CalamityWorld.revenge && Main.rand.NextBool();
Vector2 predictionVector = shootPredictiveShot ? player.velocity * 20f : Vector2.Zero;
Vector2 fireballVelocity = Vector2.Normalize(player.Center + predictionVector - NPC.Center) * projectileVelocity;
Vector2 offset = Vector2.Normalize(fireballVelocity) * 40f;
int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y);
Main.projectile[proj].netUpdate = true;
}
}
}
// Float to the side of the target and fire
else if (NPC.ai[1] == 1f)
{
// Avoid cheap bullshit
NPC.damage = 0;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
NPC.localAI[1] += 1f;
if (!brotherAlive)
{
if (revenge)
NPC.localAI[1] += 0.5f;
if (expertMode)
NPC.localAI[1] += 0.5f;
}
if (NPC.localAI[1] >= (brotherAlive ? 75f : 50f) && Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
{
NPC.localAI[1] = 0f;
float projectileVelocity = expertMode ? 12.5f : 11f;
projectileVelocity += 3f * enrageScale;
int type = brotherAlive ? ModContent.ProjectileType<BrimstoneHellfireball>() : ModContent.ProjectileType<BrimstoneHellblast>();
int damage = NPC.GetProjectileDamage(type);
Vector2 fireballVelocity = Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity;
Vector2 offset = Vector2.Normalize(fireballVelocity) * 40f;
if (!Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
{
type = ModContent.ProjectileType<BrimstoneHellfireball>();
damage = NPC.GetProjectileDamage(type);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y);
}
else
{
float ai0 = type == ModContent.ProjectileType<BrimstoneHellblast>() ? 1f : player.position.X;
float ai1 = type == ModContent.ProjectileType<BrimstoneHellblast>() ? 0f : player.position.Y;
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, ai0, ai1);
}
}
}
NPC.ai[2] += 1f;
float phaseTimer = 240f - (death ? 60f * (1f - lifeRatio) : 0f);
if (NPC.ai[2] >= phaseTimer || phase4)
{
if (death && !phase4 && Main.rand.NextBool() && !brotherAlive)
NPC.ai[1] = 0f;
else
NPC.ai[1] = !brotherAlive && phase2 && revenge ? 4f : 0f;
NPC.ai[2] = 0f;
if (death)
NPC.localAI[0] = 1f;
NPC.netUpdate = true;
}
}
else if (NPC.ai[1] == 2f)
{
// Set damage
NPC.damage = NPC.defDamage;
SoundEngine.PlaySound(CalamitasClone.ChargeSound, NPC.Center);
NPC.rotation = rotation;
float chargeVelocity = phase4 ? 30f : death ? 28f : 25f;
chargeVelocity += 5f * enrageScale;
Vector2 vector = Vector2.Normalize(player.Center + (phase4 && bossRush ? player.velocity * 20f : Vector2.Zero) - NPC.Center);
NPC.velocity = vector * chargeVelocity;
NPC.ai[1] = 3f;
NPC.netUpdate = true;
}
else if (NPC.ai[1] == 3f)
{
// Set damage
NPC.damage = NPC.defDamage;
NPC.ai[2] += 1f;
float chargeTime = phase4 ? 35f : death ? 40f : 45f;
if (NPC.ai[2] >= chargeTime)
{
// Avoid cheap bullshit
NPC.damage = 0;
NPC.velocity *= 0.9f;
if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1)
NPC.velocity.X = 0f;
if (NPC.velocity.Y > -0.1 && NPC.velocity.Y < 0.1)
NPC.velocity.Y = 0f;
}
else
{
NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) - MathHelper.PiOver2;
// Leave behind slow hellblasts in Death Mode
if (Main.netMode != NetmodeID.MultiplayerClient && death && phase3 && NPC.ai[2] % (phase4 ? 6f : 10f) == 0f)
{
int type = ModContent.ProjectileType<BrimstoneHellblast>();
int damage = NPC.GetProjectileDamage(type);
Vector2 fireballVelocity = CalamityWorld.LegendaryMode ? Main.rand.NextVector2CircularEdge(0.02f, 0.02f) : NPC.velocity * 0.01f;
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, fireballVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f);
}
}
if (NPC.ai[2] >= chargeTime + 10f)
{
if (!phase4)
NPC.ai[3] += 1f;
NPC.ai[2] = 0f;
NPC.rotation = rotation;
NPC.netUpdate = true;
if (NPC.ai[3] >= 2f)
{
NPC.TargetClosest();
NPC.ai[1] = 0f;
NPC.ai[3] = 0f;
return;
}
NPC.ai[1] = 4f;
}
}
else
{
// Avoid cheap bullshit
NPC.damage = 0;
NPC.ai[2] += 1f;
if (NPC.ai[2] >= (phase4 ? 15f : 30f))
{
NPC.ai[1] = 2f;
NPC.ai[2] = 0f;
if (death)
NPC.localAI[0] = 1f;
NPC.netUpdate = true;
}
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
+333 -2
View File
@@ -4,11 +4,12 @@ using CalamityMod.Dusts;
using CalamityMod.Events;
using CalamityMod.Items.Placeables.Furniture.Trophies;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs;
using CalamityMod.Projectiles.Boss;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
@@ -109,7 +110,337 @@ namespace CalamityMod.NPCs.CalClone
public override void AI()
{
CalamitasCloneAI.VanillaCataclysmAI(NPC, Mod);
CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity();
if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active)
{
if (NPC.alpha < 255)
{
NPC.velocity *= 0.9f;
NPC.alpha += 2;
if (NPC.alpha > 255)
NPC.alpha = 255;
int dustAmount = (int)Math.Round(MathHelper.Lerp(1f, 5f, (255 - NPC.alpha) / 255f));
for (int i = 0; i < dustAmount; i++)
{
int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.LifeDrain, 0f, -1f, 90, default, Main.rand.NextFloat(0.5f, 2f));
Main.dust[dust].noGravity = true;
Main.dust[dust].fadeIn = 1f;
}
}
else
NPC.active = false;
NPC.active = false;
return;
}
// Percent life remaining
float lifeRatio = NPC.life / (float)NPC.lifeMax;
CalamityGlobalNPC.cataclysm = NPC.whoAmI;
// Emit light
Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1f, 0f, 0f);
bool bossRush = BossRushEvent.BossRushActive;
bool death = CalamityWorld.death || bossRush;
bool revenge = CalamityWorld.revenge || bossRush;
bool expertMode = Main.expertMode || bossRush;
// Get a target
if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active)
NPC.TargetClosest();
Player player = Main.player[NPC.target];
float enrageScale = bossRush ? 1f : 0f;
if (Main.IsItDay() || bossRush)
{
NPC.Calamity().CurrentlyEnraged = !bossRush;
enrageScale += 2f;
}
float calCloneBroPlayerXDist = NPC.position.X + (NPC.width / 2) - player.position.X - (player.width / 2);
float calCloneBroPlayerYDist = NPC.position.Y + NPC.height - 59f - player.position.Y - (player.height / 2);
float calCloneBroRotation = (float)Math.Atan2(calCloneBroPlayerYDist, calCloneBroPlayerXDist) + MathHelper.PiOver2;
if (calCloneBroRotation < 0f)
calCloneBroRotation += MathHelper.TwoPi;
else if (calCloneBroRotation > MathHelper.TwoPi)
calCloneBroRotation -= MathHelper.TwoPi;
float calCloneBroRotationSpeed = 0.15f;
if (NPC.rotation < calCloneBroRotation)
{
if ((calCloneBroRotation - NPC.rotation) > MathHelper.Pi)
NPC.rotation -= calCloneBroRotationSpeed;
else
NPC.rotation += calCloneBroRotationSpeed;
}
else if (NPC.rotation > calCloneBroRotation)
{
if ((NPC.rotation - calCloneBroRotation) > MathHelper.Pi)
NPC.rotation += calCloneBroRotationSpeed;
else
NPC.rotation -= calCloneBroRotationSpeed;
}
if (NPC.rotation > calCloneBroRotation - calCloneBroRotationSpeed && NPC.rotation < calCloneBroRotation + calCloneBroRotationSpeed)
NPC.rotation = calCloneBroRotation;
if (NPC.rotation < 0f)
NPC.rotation += MathHelper.TwoPi;
else if (NPC.rotation > MathHelper.TwoPi)
NPC.rotation -= MathHelper.TwoPi;
if (NPC.rotation > calCloneBroRotation - calCloneBroRotationSpeed && NPC.rotation < calCloneBroRotation + calCloneBroRotationSpeed)
NPC.rotation = calCloneBroRotation;
if (!player.active || player.dead)
{
NPC.TargetClosest(false);
player = Main.player[NPC.target];
if (!player.active || player.dead)
{
if (NPC.velocity.Y > 3f)
NPC.velocity.Y = 3f;
NPC.velocity.Y -= 0.1f;
if (NPC.velocity.Y < -12f)
NPC.velocity.Y = -12f;
if (NPC.timeLeft > 60)
NPC.timeLeft = 60;
if (NPC.ai[1] != 0f)
{
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
NPC.ai[3] = 0f;
NPC.netUpdate = true;
}
return;
}
}
if (NPC.ai[1] == 0f)
{
// Avoid cheap bullshit
NPC.damage = (int)Math.Round(NPC.defDamage * 0.5);
float calCloneBroProjAttackMaxSpeed = 5f;
float calCloneBroProjAttackAccel = 0.1f;
calCloneBroProjAttackMaxSpeed += 2f * enrageScale;
calCloneBroProjAttackAccel += 0.06f * enrageScale;
if (Main.getGoodWorld)
{
calCloneBroProjAttackMaxSpeed *= 1.15f;
calCloneBroProjAttackAccel *= 1.15f;
}
int calCloneBroProjAttackDirection = 1;
if (NPC.position.X + (NPC.width / 2) < player.position.X + player.width)
calCloneBroProjAttackDirection = -1;
Vector2 calCloneBroProjLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
float calCloneBroProjTargetX = player.position.X + (player.width / 2) + (calCloneBroProjAttackDirection * 180) - calCloneBroProjLocation.X;
float calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y;
float calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY);
if (expertMode)
{
if (calCloneBroProjTargetDist > 300f)
calCloneBroProjAttackMaxSpeed += 0.5f;
if (calCloneBroProjTargetDist > 400f)
calCloneBroProjAttackMaxSpeed += 0.5f;
if (calCloneBroProjTargetDist > 500f)
calCloneBroProjAttackMaxSpeed += 0.55f;
if (calCloneBroProjTargetDist > 600f)
calCloneBroProjAttackMaxSpeed += 0.55f;
if (calCloneBroProjTargetDist > 700f)
calCloneBroProjAttackMaxSpeed += 0.6f;
if (calCloneBroProjTargetDist > 800f)
calCloneBroProjAttackMaxSpeed += 0.6f;
}
calCloneBroProjTargetDist = calCloneBroProjAttackMaxSpeed / calCloneBroProjTargetDist;
calCloneBroProjTargetX *= calCloneBroProjTargetDist;
calCloneBroProjTargetY *= calCloneBroProjTargetDist;
if (NPC.velocity.X < calCloneBroProjTargetX)
{
NPC.velocity.X += calCloneBroProjAttackAccel;
if (NPC.velocity.X < 0f && calCloneBroProjTargetX > 0f)
NPC.velocity.X += calCloneBroProjAttackAccel;
}
else if (NPC.velocity.X > calCloneBroProjTargetX)
{
NPC.velocity.X -= calCloneBroProjAttackAccel;
if (NPC.velocity.X > 0f && calCloneBroProjTargetX < 0f)
NPC.velocity.X -= calCloneBroProjAttackAccel;
}
if (NPC.velocity.Y < calCloneBroProjTargetY)
{
NPC.velocity.Y += calCloneBroProjAttackAccel;
if (NPC.velocity.Y < 0f && calCloneBroProjTargetY > 0f)
NPC.velocity.Y += calCloneBroProjAttackAccel;
}
else if (NPC.velocity.Y > calCloneBroProjTargetY)
{
NPC.velocity.Y -= calCloneBroProjAttackAccel;
if (NPC.velocity.Y > 0f && calCloneBroProjTargetY < 0f)
NPC.velocity.Y -= calCloneBroProjAttackAccel;
}
NPC.ai[2] += 1f;
if (NPC.ai[2] >= (240f - (death ? 120f * (1f - lifeRatio) : 0f)))
{
NPC.ai[1] = 1f;
NPC.ai[2] = 0f;
NPC.target = 255;
NPC.netUpdate = true;
}
bool fireDelay = NPC.ai[2] > 120f || NPC.life < NPC.lifeMax * 0.9;
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height) && fireDelay)
{
if (NPC.localAI[2] == 0f)
SoundEngine.PlaySound(Cataclysm.FlamethrowerStart, NPC.Center);
NPC.localAI[2] += 1f;
if (NPC.localAI[2] > 30f)
{
NPC.localAI[2] = 1f;
SoundEngine.PlaySound(Cataclysm.FlamethrowerLoop, NPC.Center);
}
if (Main.netMode != NetmodeID.MultiplayerClient)
{
NPC.localAI[1] += 3f;
if (revenge)
NPC.localAI[1] += 1f;
if (NPC.localAI[1] > 12f)
{
NPC.localAI[1] = 0f;
float calCloneBroProjSpeed = NPC.AnyNPCs(ModContent.NPCType<Catastrophe>()) ? 4f : 6f;
calCloneBroProjSpeed += enrageScale;
int type = ModContent.ProjectileType<BrimstoneFire>();
int damage = NPC.GetProjectileDamage(type);
calCloneBroProjLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
calCloneBroProjTargetX = player.position.X + (player.width / 2) - calCloneBroProjLocation.X;
calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y;
calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY);
calCloneBroProjTargetDist = calCloneBroProjSpeed / calCloneBroProjTargetDist;
calCloneBroProjTargetX *= calCloneBroProjTargetDist;
calCloneBroProjTargetY *= calCloneBroProjTargetDist;
calCloneBroProjTargetY += NPC.velocity.Y * 0.5f;
calCloneBroProjTargetX += NPC.velocity.X * 0.5f;
calCloneBroProjLocation.X -= calCloneBroProjTargetX;
calCloneBroProjLocation.Y -= calCloneBroProjTargetY;
Projectile.NewProjectile(NPC.GetSource_FromAI(), calCloneBroProjLocation.X, calCloneBroProjLocation.Y, calCloneBroProjTargetX, calCloneBroProjTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f);
}
}
}
}
else
{
if (NPC.ai[1] == 1f)
{
// Set damage
NPC.damage = NPC.defDamage;
SoundEngine.PlaySound(SoundID.Roar, NPC.Center);
NPC.rotation = calCloneBroRotation;
float calCloneBroChargeSpeed = 14f + (death ? 4f * (1f - lifeRatio) : 0f);
calCloneBroChargeSpeed += 3f * enrageScale;
if (expertMode)
calCloneBroChargeSpeed += 2f;
if (revenge)
calCloneBroChargeSpeed += 2f;
if (Main.getGoodWorld)
calCloneBroChargeSpeed *= 1.25f;
Vector2 calCloneBroChargeCenter = NPC.Center;
float calCloneBroChargeTargetXDist = player.Center.X - calCloneBroChargeCenter.X;
float calCloneBroChargeTargetYDist = player.Center.Y - calCloneBroChargeCenter.Y;
float calCloneBroChargeTargetDistance = (float)Math.Sqrt(calCloneBroChargeTargetXDist * calCloneBroChargeTargetXDist + calCloneBroChargeTargetYDist * calCloneBroChargeTargetYDist);
calCloneBroChargeTargetDistance = calCloneBroChargeSpeed / calCloneBroChargeTargetDistance;
NPC.velocity.X = calCloneBroChargeTargetXDist * calCloneBroChargeTargetDistance;
NPC.velocity.Y = calCloneBroChargeTargetYDist * calCloneBroChargeTargetDistance;
NPC.ai[1] = 2f;
if (Main.zenithWorld)
{
SoundEngine.PlaySound(SupremeCalamitas.SupremeCalamitas.BrimstoneShotSound, NPC.Center);
int type = ModContent.ProjectileType<BrimstoneBarrage>();
int damage = NPC.GetProjectileDamage(ModContent.ProjectileType<BrimstoneFire>());
if (bossRush)
damage /= 2;
int totalProjectiles = bossRush ? 12 : death ? 10 : revenge ? 8 : expertMode ? 6 : 4;
float radians = MathHelper.TwoPi / totalProjectiles;
float velocity = 5f;
Vector2 spinningPoint = new Vector2(0f, -velocity);
float projectileVelocityToPass = velocity * 3f;
for (int k = 0; k < totalProjectiles; k++)
{
Vector2 velocity2 = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass);
}
for (int i = 0; i < 6; i++)
Dust.NewDust(NPC.position + NPC.velocity, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f);
}
return;
}
if (NPC.ai[1] == 2f)
{
// Set damage
NPC.damage = NPC.defDamage;
NPC.ai[2] += 1f + (death ? 0.5f * (1f - lifeRatio) : 0f);
if (expertMode)
NPC.ai[2] += 0.25f;
if (revenge)
NPC.ai[2] += 0.25f;
if (NPC.ai[2] >= 75f)
{
// Avoid cheap bullshit
NPC.damage = (int)Math.Round(NPC.defDamage * 0.5);
NPC.velocity.X *= 0.93f;
NPC.velocity.Y *= 0.93f;
if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1)
NPC.velocity.X = 0f;
if (NPC.velocity.Y > -0.1 && NPC.velocity.Y < 0.1)
NPC.velocity.Y = 0f;
}
else
NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) - MathHelper.PiOver2;
if (NPC.ai[2] >= 105f)
{
NPC.ai[3] += 1f;
NPC.ai[2] = 0f;
NPC.target = 255;
NPC.rotation = calCloneBroRotation;
if (NPC.ai[3] >= 3f)
{
NPC.ai[1] = 0f;
NPC.ai[3] = 0f;
return;
}
NPC.ai[1] = 1f;
}
}
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
+329 -2
View File
@@ -4,12 +4,14 @@ using CalamityMod.Dusts;
using CalamityMod.Events;
using CalamityMod.Items.Placeables.Furniture.Trophies;
using CalamityMod.Items.Weapons.Rogue;
using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs;
using CalamityMod.Projectiles.Boss;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.GameContent.Bestiary;
using Terraria.GameContent.ItemDropRules;
@@ -103,7 +105,332 @@ namespace CalamityMod.NPCs.CalClone
public override void AI()
{
CalamitasCloneAI.VanillaCatastropheAI(NPC, Mod);
CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity();
if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active)
{
if (NPC.alpha < 255)
{
NPC.velocity *= 0.9f;
NPC.alpha += 2;
if (NPC.alpha > 255)
NPC.alpha = 255;
int dustAmount = (int)Math.Round(MathHelper.Lerp(1f, 5f, (255 - NPC.alpha) / 255f));
for (int i = 0; i < dustAmount; i++)
{
int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.LifeDrain, 0f, -1f, 90, default, Main.rand.NextFloat(0.5f, 2f));
Main.dust[dust].noGravity = true;
Main.dust[dust].fadeIn = 1f;
}
}
else
NPC.active = false;
return;
}
// Percent life remaining
float lifeRatio = NPC.life / (float)NPC.lifeMax;
CalamityGlobalNPC.catastrophe = NPC.whoAmI;
// Emit light
Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1f, 0f, 0f);
bool bossRush = BossRushEvent.BossRushActive;
bool death = CalamityWorld.death || bossRush;
bool revenge = CalamityWorld.revenge || bossRush;
bool expertMode = Main.expertMode || bossRush;
// Get a target
if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active)
NPC.TargetClosest();
Player player = Main.player[NPC.target];
float enrageScale = bossRush ? 1f : 0f;
if (Main.IsItDay() || bossRush)
{
NPC.Calamity().CurrentlyEnraged = !bossRush;
enrageScale += 2f;
}
float calCloneBroPlayerXDist = NPC.position.X + (NPC.width / 2) - player.position.X - (player.width / 2);
float calCloneBroPlayerYDist = NPC.position.Y + NPC.height - 59f - player.position.Y - (player.height / 2);
float calCloneBroRotation = (float)Math.Atan2(calCloneBroPlayerYDist, calCloneBroPlayerXDist) + MathHelper.PiOver2;
if (calCloneBroRotation < 0f)
calCloneBroRotation += MathHelper.TwoPi;
else if (calCloneBroRotation > MathHelper.TwoPi)
calCloneBroRotation -= MathHelper.TwoPi;
float calCloneBroRotationSpeed = 0.15f;
if (NPC.rotation < calCloneBroRotation)
{
if ((calCloneBroRotation - NPC.rotation) > MathHelper.Pi)
NPC.rotation -= calCloneBroRotationSpeed;
else
NPC.rotation += calCloneBroRotationSpeed;
}
else if (NPC.rotation > calCloneBroRotation)
{
if ((NPC.rotation - calCloneBroRotation) > MathHelper.Pi)
NPC.rotation += calCloneBroRotationSpeed;
else
NPC.rotation -= calCloneBroRotationSpeed;
}
if (NPC.rotation > calCloneBroRotation - calCloneBroRotationSpeed && NPC.rotation < calCloneBroRotation + calCloneBroRotationSpeed)
NPC.rotation = calCloneBroRotation;
if (NPC.rotation < 0f)
NPC.rotation += MathHelper.TwoPi;
else if (NPC.rotation > MathHelper.TwoPi)
NPC.rotation -= MathHelper.TwoPi;
if (NPC.rotation > calCloneBroRotation - calCloneBroRotationSpeed && NPC.rotation < calCloneBroRotation + calCloneBroRotationSpeed)
NPC.rotation = calCloneBroRotation;
if (!player.active || player.dead)
{
NPC.TargetClosest(false);
player = Main.player[NPC.target];
if (!player.active || player.dead)
{
if (NPC.velocity.Y > 3f)
NPC.velocity.Y = 3f;
NPC.velocity.Y -= 0.1f;
if (NPC.velocity.Y < -12f)
NPC.velocity.Y = -12f;
if (NPC.timeLeft > 60)
NPC.timeLeft = 60;
if (NPC.ai[1] != 0f)
{
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
NPC.ai[3] = 0f;
NPC.netUpdate = true;
}
return;
}
}
if (NPC.ai[1] == 0f)
{
// Avoid cheap bullshit
NPC.damage = (int)Math.Round(NPC.defDamage * 0.5);
float calCloneBroProjAttackMaxSpeed = 4.5f;
float calCloneBroProjAttackAccel = 0.2f;
calCloneBroProjAttackMaxSpeed += 2f * enrageScale;
calCloneBroProjAttackAccel += 0.1f * enrageScale;
if (Main.getGoodWorld)
{
calCloneBroProjAttackMaxSpeed *= 1.15f;
calCloneBroProjAttackAccel *= 1.15f;
}
int calCloneBroProjAttackDirection = 1;
if (NPC.Center.X < player.Center.X)
calCloneBroProjAttackDirection = -1;
Vector2 calCloneBroProjLocation = NPC.Center;
float calCloneBroProjTargetX = player.Center.X + (calCloneBroProjAttackDirection * 180) - calCloneBroProjLocation.X;
float calCloneBroProjTargetY = player.Center.Y - calCloneBroProjLocation.Y;
float calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY);
if (expertMode)
{
if (calCloneBroProjTargetDist > 300f)
calCloneBroProjAttackMaxSpeed += 0.5f;
if (calCloneBroProjTargetDist > 400f)
calCloneBroProjAttackMaxSpeed += 0.5f;
if (calCloneBroProjTargetDist > 500f)
calCloneBroProjAttackMaxSpeed += 0.55f;
if (calCloneBroProjTargetDist > 600f)
calCloneBroProjAttackMaxSpeed += 0.55f;
if (calCloneBroProjTargetDist > 700f)
calCloneBroProjAttackMaxSpeed += 0.6f;
if (calCloneBroProjTargetDist > 800f)
calCloneBroProjAttackMaxSpeed += 0.6f;
}
calCloneBroProjTargetDist = calCloneBroProjAttackMaxSpeed / calCloneBroProjTargetDist;
calCloneBroProjTargetX *= calCloneBroProjTargetDist;
calCloneBroProjTargetY *= calCloneBroProjTargetDist;
if (NPC.velocity.X < calCloneBroProjTargetX)
{
NPC.velocity.X += calCloneBroProjAttackAccel;
if (NPC.velocity.X < 0f && calCloneBroProjTargetX > 0f)
NPC.velocity.X += calCloneBroProjAttackAccel;
}
else if (NPC.velocity.X > calCloneBroProjTargetX)
{
NPC.velocity.X -= calCloneBroProjAttackAccel;
if (NPC.velocity.X > 0f && calCloneBroProjTargetX < 0f)
NPC.velocity.X -= calCloneBroProjAttackAccel;
}
if (NPC.velocity.Y < calCloneBroProjTargetY)
{
NPC.velocity.Y += calCloneBroProjAttackAccel;
if (NPC.velocity.Y < 0f && calCloneBroProjTargetY > 0f)
NPC.velocity.Y += calCloneBroProjAttackAccel;
}
else if (NPC.velocity.Y > calCloneBroProjTargetY)
{
NPC.velocity.Y -= calCloneBroProjAttackAccel;
if (NPC.velocity.Y > 0f && calCloneBroProjTargetY < 0f)
NPC.velocity.Y -= calCloneBroProjAttackAccel;
}
NPC.ai[2] += 1f;
if (NPC.ai[2] >= (180f - (death ? 90f * (1f - lifeRatio) : 0f)))
{
NPC.ai[1] = 1f;
NPC.ai[2] = 0f;
NPC.target = 255;
NPC.netUpdate = true;
}
bool fireDelay = NPC.ai[2] > 120f || lifeRatio < 0.9f;
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height) && fireDelay)
{
NPC.localAI[2] += 1f;
if (NPC.localAI[2] > 36f)
{
NPC.localAI[2] = 0f;
SoundEngine.PlaySound(SoundID.Item34, NPC.Center);
}
if (Main.netMode != NetmodeID.MultiplayerClient)
{
NPC.localAI[1] += 1f;
if (revenge)
NPC.localAI[1] += 0.5f;
if (NPC.localAI[1] > 50f)
{
NPC.localAI[1] = 0f;
float calCloneBroProjSpeed = death ? 14f : 12f;
calCloneBroProjSpeed += 3f * enrageScale;
int type = ModContent.ProjectileType<BrimstoneBall>();
int damage = NPC.GetProjectileDamage(type);
calCloneBroProjLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
calCloneBroProjTargetX = player.position.X + (player.width / 2) - calCloneBroProjLocation.X;
calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y;
calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY);
calCloneBroProjTargetDist = calCloneBroProjSpeed / calCloneBroProjTargetDist;
calCloneBroProjTargetX *= calCloneBroProjTargetDist;
calCloneBroProjTargetY *= calCloneBroProjTargetDist;
calCloneBroProjTargetY += NPC.velocity.Y * 0.5f;
calCloneBroProjTargetX += NPC.velocity.X * 0.5f;
calCloneBroProjLocation.X -= calCloneBroProjTargetX;
calCloneBroProjLocation.Y -= calCloneBroProjTargetY;
Projectile.NewProjectile(NPC.GetSource_FromAI(), calCloneBroProjLocation.X, calCloneBroProjLocation.Y, calCloneBroProjTargetX, calCloneBroProjTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f);
}
}
}
}
else
{
if (NPC.ai[1] == 1f)
{
// Set damage
NPC.damage = NPC.defDamage;
SoundEngine.PlaySound(SoundID.Roar, NPC.Center);
NPC.rotation = calCloneBroRotation;
float calCloneBroChargeSpeed = (NPC.AnyNPCs(ModContent.NPCType<Cataclysm>()) ? 12f : 16f) + (death ? 4f * (1f - lifeRatio) : 0f);
calCloneBroChargeSpeed += 4f * enrageScale;
if (expertMode)
calCloneBroChargeSpeed += 2f;
if (revenge)
calCloneBroChargeSpeed += 2f;
if (Main.getGoodWorld)
calCloneBroChargeSpeed *= 1.25f;
Vector2 calCloneBroChargeCenter = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
float calCloneBroChargeTargetXDist = player.position.X + (player.width / 2) - calCloneBroChargeCenter.X;
float calCloneBroChargeTargetYDist = player.position.Y + (player.height / 2) - calCloneBroChargeCenter.Y;
float calCloneBroChargeTargetDistance = (float)Math.Sqrt(calCloneBroChargeTargetXDist * calCloneBroChargeTargetXDist + calCloneBroChargeTargetYDist * calCloneBroChargeTargetYDist);
calCloneBroChargeTargetDistance = calCloneBroChargeSpeed / calCloneBroChargeTargetDistance;
NPC.velocity.X = calCloneBroChargeTargetXDist * calCloneBroChargeTargetDistance;
NPC.velocity.Y = calCloneBroChargeTargetYDist * calCloneBroChargeTargetDistance;
NPC.ai[1] = 2f;
if (Main.zenithWorld)
{
SoundEngine.PlaySound(SupremeCalamitas.SupremeCalamitas.BrimstoneShotSound, NPC.Center);
int type = ModContent.ProjectileType<BrimstoneBarrage>();
int damage = NPC.GetProjectileDamage(ModContent.ProjectileType<BrimstoneBall>());
if (bossRush)
damage /= 2;
int totalProjectiles = bossRush ? 12 : death ? 10 : revenge ? 8 : expertMode ? 6 : 4;
float radians = MathHelper.TwoPi / totalProjectiles;
float velocity = 5f;
Vector2 spinningPoint = new Vector2(0f, -velocity);
float projectileVelocityToPass = velocity * 3f;
for (int k = 0; k < totalProjectiles; k++)
{
Vector2 velocity2 = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass);
}
for (int i = 0; i < 6; i++)
Dust.NewDust(NPC.position + NPC.velocity, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f);
}
return;
}
if (NPC.ai[1] == 2f)
{
// Set damage
NPC.damage = NPC.defDamage;
NPC.ai[2] += 1f + (death ? 0.5f * (1f - lifeRatio) : 0f);
if (expertMode)
NPC.ai[2] += 0.25f;
if (revenge)
NPC.ai[2] += 0.25f;
if (NPC.ai[2] >= 60f) //50
{
// Avoid cheap bullshit
NPC.damage = (int)Math.Round(NPC.defDamage * 0.5);
NPC.velocity.X *= 0.93f;
NPC.velocity.Y *= 0.93f;
if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1)
NPC.velocity.X = 0f;
if (NPC.velocity.Y > -0.1 && NPC.velocity.Y < 0.1)
NPC.velocity.Y = 0f;
}
else
NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) - MathHelper.PiOver2;
if (NPC.ai[2] >= 90f) //80
{
NPC.ai[3] += 1f;
NPC.ai[2] = 0f;
NPC.rotation = calCloneBroRotation;
if (NPC.ai[3] >= 4f)
{
NPC.ai[1] = 0f;
NPC.ai[3] = 0f;
return;
}
NPC.ai[1] = 1f;
}
}
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
@@ -1,969 +0,0 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.CalPlayer;
using CalamityMod.Dusts;
using CalamityMod.Events;
using CalamityMod.NPCs.Abyss;
using CalamityMod.NPCs.AquaticScourge;
using CalamityMod.NPCs.AstrumAureus;
using CalamityMod.NPCs.AstrumDeus;
using CalamityMod.NPCs.BrimstoneElemental;
using CalamityMod.NPCs.Bumblebirb;
using CalamityMod.NPCs.CalClone;
using CalamityMod.NPCs.CeaselessVoid;
using CalamityMod.NPCs.Crags;
using CalamityMod.NPCs.NormalNPCs;
using CalamityMod.NPCs.OldDuke;
using CalamityMod.NPCs.SulphurousSea;
using CalamityMod.NPCs.SunkenSea;
using CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies;
using CalamityMod.Projectiles.Boss;
using CalamityMod.Projectiles.Enemy;
using CalamityMod.Sounds;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
{
public static class AstrumAureusAI
{
public static void VanillaAstrumAureusAI(NPC npc, Mod mod)
{
CalamityGlobalNPC calamityGlobalNPC = npc.Calamity();
CalamityGlobalNPC.astrumAureus = npc.whoAmI;
// Variables
bool bossRush = BossRushEvent.BossRushActive;
bool expertMode = Main.expertMode || bossRush;
bool revenge = CalamityWorld.revenge || bossRush;
bool death = CalamityWorld.death || bossRush;
// Percent life remaining
float lifeRatio = npc.life / (float)npc.lifeMax;
// Phases
bool phase2 = lifeRatio < (revenge ? 0.85f : expertMode ? 0.8f : 0.75f);
bool phase3 = lifeRatio < (revenge ? 0.7f : expertMode ? 0.6f : 0.5f);
bool phase4 = lifeRatio < (revenge ? 0.5f : 0.4f) && expertMode;
bool phase5 = lifeRatio < 0.3f && revenge;
// Exhaustion
bool exhausted = npc.ai[2] >= (phase3 ? 2f : 1f);
calamityGlobalNPC.DR = exhausted ? 0.2f : 0.4f;
npc.defense = exhausted ? npc.defDefense / 2 : npc.defDefense;
// Get a target
if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active)
npc.TargetClosest();
// Despawn safety, make sure to target another player if the current player target is too far away
if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles)
npc.TargetClosest();
Player player = Main.player[npc.target];
// Don't fire projectiles and don't increment phase timers for 4 seconds after the teleport phase to avoid cheap bullshit
float noProjectileOrPhaseIncrementTime = 240f;
bool dontAttack = npc.localAI[3] > 0f;
if (dontAttack)
{
npc.localAI[3] -= 1f;
if (npc.Distance(player.Center) < 240f)
npc.localAI[3] -= death ? 4f : expertMode ? 2f : 1f;
}
float enrageScale = bossRush ? 1f : 0f;
if ((Main.IsItDay() && !player.Calamity().ZoneAstral) || bossRush)
{
npc.Calamity().CurrentlyEnraged = !bossRush;
enrageScale += 1f;
}
float astralFlameBarrageTimerIncrement = 1f;
if (expertMode)
astralFlameBarrageTimerIncrement += death ? (float)Math.Round(3f * (1f - lifeRatio)) : (float)Math.Round(2f * (1f - lifeRatio));
float walkingVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 6f : 5f;
walkingVelocity += 3f * enrageScale;
if (phase5)
walkingVelocity += 2f;
if (expertMode)
walkingVelocity += 1.5f * (1f - lifeRatio);
if (revenge)
walkingVelocity += Math.Abs(npc.Center.X - player.Center.X) * 0.0025f;
if (Main.getGoodWorld)
walkingVelocity *= 1.15f;
float walkingProjectileVelocity = walkingVelocity * 0.8f;
// Direction
npc.spriteDirection = (npc.direction > 0) ? 1 : -1;
// Used to reduce Aureus' fall speed
bool reduceFallSpeed = npc.velocity.Y > 0f && Collision.SolidCollision(npc.position + Vector2.UnitY * 1.1f * npc.velocity.Y, npc.width, npc.height) && npc.ai[0] == 4f;
// Despawn
bool despawnDistance = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles;
if (!player.active || player.dead || despawnDistance)
{
npc.TargetClosest(false);
player = Main.player[npc.target];
if (!player.active || player.dead || despawnDistance)
{
npc.noTileCollide = true;
if (npc.velocity.Y < -3f)
npc.velocity.Y = -3f;
npc.velocity.Y += 0.1f;
if (npc.velocity.Y > 12f)
npc.velocity.Y = 12f;
if (npc.timeLeft > 60)
npc.timeLeft = 60;
if (npc.ai[0] != 0f)
{
npc.ai[0] = 0f;
npc.ai[1] = 0f;
npc.ai[2] = 0f;
npc.ai[3] = 0f;
npc.localAI[2] = 0f;
npc.localAI[3] = 0f;
calamityGlobalNPC.newAI[0] = 0f;
calamityGlobalNPC.newAI[1] = 0f;
npc.netUpdate = true;
}
return;
}
}
else if (npc.timeLeft < 1800)
npc.timeLeft = 1800;
bool geldonPhase1 = lifeRatio > 0.6f && lifeRatio <= 0.7f;
bool geldonPhase2 = lifeRatio <= 0.1f;
if (Main.zenithWorld && (geldonPhase1 || geldonPhase2))
{
AstrumAureus.AstrumAureus astrumAureus = npc.ModNPC<AstrumAureus.AstrumAureus>();
astrumAureus.slimeProjCounter++;
if (astrumAureus.slimeProjCounter % 180 == 0)
{
SoundEngine.PlaySound(SoundID.Item33, npc.Center); // Intentionally keeping the old laser sound in GFB
if (astrumAureus.slimePhase == 1)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int type = ModContent.ProjectileType<AstralFlame>();
int damage = npc.GetProjectileDamage(type);
int totalProjectiles = bossRush ? 14 : death ? 12 : revenge ? 10 : expertMode ? 8 : 6;
float radians = MathHelper.TwoPi / totalProjectiles;
float velocity = 10f;
Vector2 spinningPoint = new Vector2(0f, -velocity);
for (int k = 0; k < totalProjectiles; k++)
{
Vector2 velocity2 = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f);
}
}
astrumAureus.slimePhase = 0;
}
else
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int type = ModContent.ProjectileType<AstralLaser>();
int damage = npc.GetProjectileDamage(type);
float aureusLaserSpeed = 7f;
float aureusLaserTargetX = player.Center.X - npc.Center.X;
float aureusLaserTargetY = player.Center.Y - npc.Center.Y;
float aureusLaserTargetDist = (float)Math.Sqrt(aureusLaserTargetX * aureusLaserTargetX + aureusLaserTargetY * aureusLaserTargetY);
aureusLaserTargetDist = aureusLaserSpeed / aureusLaserTargetDist;
aureusLaserTargetX *= aureusLaserTargetDist;
aureusLaserTargetY *= aureusLaserTargetDist;
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, aureusLaserTargetX, aureusLaserTargetY, type, damage, 0f, Main.myPlayer);
for (int i = 0; i < 4; i++)
{
Vector2 offset = new Vector2(Main.rand.Next(-6, 7), Main.rand.Next(-6, 7));
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, aureusLaserTargetX + offset.X, aureusLaserTargetY + offset.Y, type, damage, 0f, Main.myPlayer);
}
}
astrumAureus.slimePhase = 1;
}
}
RevengeanceAndDeathAI.BuffedMimicAI(npc, mod);
npc.noGravity = false;
npc.noTileCollide = false;
return;
}
else
{
npc.noGravity = true;
}
// Emit light when not Idle
if (npc.ai[0] != 1f)
Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1.3f, 0.5f, 0f);
// Fire projectiles while walking, teleporting, or falling
if (npc.ai[0] == 2f || npc.ai[0] >= 5f)
{
if (!dontAttack)
npc.localAI[0] += npc.ai[0] == 2f ? 1f : astralFlameBarrageTimerIncrement;
float astralFlameBarrageGateValue = phase4 ? 30f : 60f;
if (npc.localAI[0] >= astralFlameBarrageGateValue)
{
// Fire astral flames while teleporting
if (npc.ai[0] >= 5f && npc.ai[0] != 7)
{
npc.localAI[0] = 0f;
SoundEngine.PlaySound(AstrumAureus.AstrumAureus.FlameCrystalSound, npc.Center);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
float velocity = death ? (8f + npc.localAI[2] * 0.025f) : 7f;
int type = ModContent.ProjectileType<AstralFlame>();
int damage = npc.GetProjectileDamage(type);
float spreadLimit = (phase4 ? 100f : 50f) + enrageScale * 50f;
float randomSpread = (Main.rand.NextFloat() - 0.5f) * spreadLimit;
Vector2 spawnVector = new Vector2(npc.Center.X, npc.Center.Y - 80f * npc.scale);
Vector2 destination = new Vector2(spawnVector.X + randomSpread, spawnVector.Y - 100f * npc.scale);
Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, Vector2.Normalize(destination - spawnVector) * velocity, type, damage, 0f, Main.myPlayer);
}
}
}
float laserBarrageGateValue = phase5 ? 160f : phase3 ? 120f : phase2 ? 80f : 60f;
if (npc.localAI[0] >= laserBarrageGateValue)
{
// Fire astral lasers while walking
if (npc.ai[0] == 2f)
{
npc.localAI[0] = 0f;
SoundEngine.PlaySound(AstrumAureus.AstrumAureus.LaserSound, npc.Center);
if (calamityGlobalNPC.newAI[2] == 0f)
{
calamityGlobalNPC.newAI[2] = 1f;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int maxProjectiles = !phase2 ? (bossRush ? 5 : 3) : (bossRush ? 7 : 5);
int spread = !phase2 ? (bossRush ? 11 : 8) : (bossRush ? 12 : 10);
int type = ModContent.ProjectileType<AstralLaser>();
int damage = npc.GetProjectileDamage(type);
Vector2 projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * walkingProjectileVelocity;
float rotation = MathHelper.ToRadians(spread);
for (int i = 0; i < maxProjectiles; i++)
{
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1)));
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, walkingProjectileVelocity * 2f);
}
if (phase3)
{
float flameVelocity = walkingProjectileVelocity;
maxProjectiles = 2;
spread = 45;
type = ModContent.ProjectileType<AstralFlame>();
damage = npc.GetProjectileDamage(type);
projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * flameVelocity;
rotation = MathHelper.ToRadians(spread);
for (int i = 0; i < maxProjectiles; i++)
{
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1)));
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer);
}
}
}
}
else
{
calamityGlobalNPC.newAI[2] = 0f;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int maxProjectiles = !phase3 ? (bossRush ? 13 : death ? 11 : 9) : (bossRush ? 19 : death ? 17 : 15);
int spread = !phase3 ? (bossRush ? 20 : death ? 18 : 16) : (bossRush ? 24 : death ? 22 : 20);
int type = ModContent.ProjectileType<AstralLaser>();
int damage = npc.GetProjectileDamage(type);
int centralLaser = maxProjectiles / 2;
int[] lasersToNotFire = new int[6] { centralLaser - 3, centralLaser - 2, centralLaser - 1, centralLaser + 1, centralLaser + 2, centralLaser + 3 };
Vector2 projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * walkingProjectileVelocity;
float rotation = MathHelper.ToRadians(spread);
for (int i = 0; i < maxProjectiles; i++)
{
if (i != lasersToNotFire[0] && i != lasersToNotFire[1] && i != lasersToNotFire[2] && i != lasersToNotFire[3] && i != lasersToNotFire[4] && i != lasersToNotFire[5])
{
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1)));
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, walkingProjectileVelocity * 2f);
}
}
}
}
}
}
}
else
npc.localAI[0] = 0f;
// Start up
if (npc.ai[0] == 0f)
{
// Avoid cheap bullshit
npc.damage = 0;
npc.ai[0] = 1f;
npc.netUpdate = true;
CustomGravity();
}
// Idle
else if (npc.ai[0] == 1f)
{
// Avoid cheap bullshit
npc.damage = 0;
// Slow down
npc.velocity.X *= 0.8f;
// Stay vulnerable for 3 seconds
npc.ai[1] += 1f;
if (npc.Distance(player.Center) < 240f)
npc.ai[1] += death ? 4f : expertMode ? 2f : 1f;
if (npc.ai[1] >= 180f || bossRush)
{
// Set AI to random state and reset other AI arrays
npc.TargetClosest();
switch (Main.rand.Next(phase3 ? 3 : 2))
{
case 0:
npc.ai[0] = 2f;
break;
case 1:
npc.ai[0] = 3f;
break;
case 2:
npc.ai[0] = 5f;
break;
default:
break;
}
npc.ai[1] = 0f;
npc.ai[2] = 0f;
// Stop colliding with tiles if entering walking phase
npc.noTileCollide = npc.ai[0] == 2f;
npc.netUpdate = true;
}
else
CustomGravity();
}
// Walk
else if (npc.ai[0] == 2f)
{
// Avoid cheap bullshit
npc.damage = 0;
// Set walking direction
if (Math.Abs(npc.Center.X - player.Center.X) < 200f * npc.scale)
{
npc.velocity.X *= 0.8f;
if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1)
npc.velocity.X = 0f;
}
else
{
float playerLocation = npc.Center.X - player.Center.X;
npc.direction = playerLocation < 0 ? 1 : -1;
if (npc.direction > 0)
npc.velocity.X = (npc.velocity.X * 20f + walkingVelocity) / 21f;
if (npc.direction < 0)
npc.velocity.X = (npc.velocity.X * 20f - walkingVelocity) / 21f;
}
if (Collision.CanHit(npc.position, npc.width, npc.height, player.Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height) && player.position.Y <= npc.position.Y + npc.height && !npc.collideX)
{
CustomGravity();
npc.noTileCollide = false;
}
else
{
npc.noTileCollide = true;
// Walk through tiles if colliding with tiles and player is out of reach
int aureusHitboxWidth = 80;
int aureusHitboxHeight = 20;
Vector2 aureusHitboxTileCollideSize = new Vector2(npc.Center.X - (aureusHitboxWidth / 2), npc.position.Y + npc.height - aureusHitboxHeight);
bool nearPlayerWalkingThroughTiles = false;
if (npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width && npc.position.Y + npc.height < player.position.Y + player.height - 16f)
nearPlayerWalkingThroughTiles = true;
if (nearPlayerWalkingThroughTiles)
{
npc.velocity.Y += 0.5f;
}
else if (Collision.SolidCollision(aureusHitboxTileCollideSize, aureusHitboxWidth, aureusHitboxHeight))
{
if (npc.velocity.Y > 0f)
npc.velocity.Y = 0f;
if (npc.velocity.Y > -0.2)
npc.velocity.Y -= 0.025f;
else
npc.velocity.Y -= 0.2f;
if (npc.velocity.Y < -4f)
npc.velocity.Y = -4f;
}
else
{
if (npc.velocity.Y < 0f)
npc.velocity.Y = 0f;
if (npc.velocity.Y < 0.1)
npc.velocity.Y += 0.025f;
else
npc.velocity.Y += 0.5f;
}
}
// Walk for a maximum of 6 seconds
if (!dontAttack)
{
npc.ai[1] += 1f;
if (npc.Distance(player.Center) < 240f)
npc.ai[1] += death ? 4f : expertMode ? 2f : 1f;
}
if (npc.ai[1] >= ((bossRush ? 270f : 360f) - (death ? 90f * (1f - lifeRatio) : 0f)))
{
// Collide with tiles again
npc.noTileCollide = false;
// Set AI to next phase (Jump) and reset other AI
npc.TargetClosest();
npc.ai[0] = exhausted ? 1f : 3f;
npc.ai[1] = 0f;
npc.ai[2] += 1f;
npc.netUpdate = true;
}
// Limit downward velocity
if (npc.velocity.Y > 10f)
npc.velocity.Y = 10f;
}
// Jump
else if (npc.ai[0] == 3f)
{
// Avoid cheap bullshit
npc.damage = 0;
npc.noTileCollide = false;
if (npc.velocity.Y == 0f)
{
// Slow down
npc.velocity.X *= 0.8f;
// Half second delay before jumping
if (!dontAttack)
npc.ai[1] += 1f;
if (npc.ai[1] >= 30f)
{
npc.ai[1] = -20f;
}
else if (npc.ai[1] == -1f)
{
// Set damage
npc.damage = npc.defDamage;
// Set jump velocity, reset and set AI to next phase (Stomp)
float distanceFromPlayerOnXAxis = npc.Center.X - player.Center.X;
npc.direction = distanceFromPlayerOnXAxis < 0 ? 1 : -1;
calamityGlobalNPC.newAI[3] = npc.direction;
// The limit for how much Aureus can multiply its jump velocity
float speedMultLimit = 1f;
// Maxes out when the player is a full 2000 pixels away from or above Aureus
float multiplier = 1f / 2000f;
// Increase Aureus jump velocity X if it's far enough away from the player
float distanceAwayFromTarget = Math.Abs(distanceFromPlayerOnXAxis);
float distanceGateValue = 400f;
bool increaseJumpVelocityX = distanceAwayFromTarget > distanceGateValue && expertMode;
if (increaseJumpVelocityX)
{
calamityGlobalNPC.newAI[0] = (distanceAwayFromTarget - distanceGateValue) * multiplier;
if (calamityGlobalNPC.newAI[0] > speedMultLimit)
calamityGlobalNPC.newAI[0] = speedMultLimit;
}
// Increase Aureus jump velocity Y if it's far enough above the player
float distanceBelowTarget = npc.position.Y - (player.position.Y + 80f);
bool increaseJumpVelocityY = distanceBelowTarget > 0f && revenge;
if (increaseJumpVelocityY)
{
calamityGlobalNPC.newAI[1] = distanceBelowTarget * multiplier;
if (calamityGlobalNPC.newAI[1] > speedMultLimit)
calamityGlobalNPC.newAI[1] = speedMultLimit;
}
float velocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 27f : 20f;
velocity += 6f * enrageScale;
if (expertMode)
velocity += death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio);
if (Main.getGoodWorld)
velocity *= 1.15f;
npc.velocity = (new Vector2(player.Center.X, player.Center.Y - 500f) - npc.Center).SafeNormalize(Vector2.Zero) * velocity;
npc.velocity *= new Vector2(calamityGlobalNPC.newAI[0] + 1f, calamityGlobalNPC.newAI[1] + 1f);
npc.noTileCollide = true;
npc.ai[0] = 4f;
npc.ai[1] = 0f;
SoundEngine.PlaySound(AstrumAureus.AstrumAureus.JumpSound, npc.Center);
npc.netUpdate = true;
}
}
// Don't run custom gravity when starting a jump
if (npc.ai[0] != 4f)
CustomGravity();
}
// Stomp
else if (npc.ai[0] == 4f)
{
if (npc.velocity.Y == 0f)
{
// Avoid cheap bullshit
npc.damage = 0;
// Play stomp sound. Gotta specify the filepath to avoid confusion between the namespace and npc
SoundStyle soundToPlay = Main.zenithWorld ? NPCs.ExoMechs.Ares.AresGaussNuke.NukeExplosionSound : NPCs.AstrumAureus.AstrumAureus.StompSound;
SoundEngine.PlaySound(soundToPlay, npc.Center);
if (Main.zenithWorld)
{
float screenShakePower = 16 * Utils.GetLerpValue(1300f, 0f, npc.Distance(Main.LocalPlayer.Center), true);
if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower)
Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower;
}
// Stomp and jump again, if stomped twice then reset and set AI to next phase (Teleport or Idle)
npc.TargetClosest();
npc.localAI[1] += 1f;
float maxStompAmt = phase5 ? 5f : phase3 ? 2f : 3f;
if (npc.localAI[1] >= maxStompAmt)
{
npc.ai[0] = exhausted ? 1f : (phase3 ? 5f : 2f);
npc.localAI[1] = 0f;
npc.ai[2] += 1f;
npc.ai[3] = 0f;
npc.noTileCollide = false;
npc.netUpdate = true;
}
else
{
float playerLocation = npc.Center.X - player.Center.X;
npc.direction = playerLocation < 0 ? 1 : -1;
npc.ai[0] = 3f;
npc.ai[3] = 0f;
npc.netUpdate = true;
}
calamityGlobalNPC.newAI[0] = 0f;
calamityGlobalNPC.newAI[1] = 0f;
calamityGlobalNPC.newAI[3] = 0f;
// Spawn dust for visual effect
for (int i = (int)npc.position.X - 20; i < (int)npc.position.X + npc.width + 40; i += 20)
{
for (int j = 0; j < 4; j++)
{
int stompDust = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + npc.height), npc.width + 20, 4, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 1.5f);
Main.dust[stompDust].velocity *= 0.2f;
}
}
// Fire lasers or flames on stomp
SoundEngine.PlaySound(AstrumAureus.AstrumAureus.LaserSound, npc.Center);
if (Main.zenithWorld)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int type = Main.rand.NextBool() ? ModContent.ProjectileType<AstralLaser>() : ModContent.ProjectileType<AstralFlame>();
int damage = npc.GetProjectileDamage(type);
int totalProjectiles = bossRush ? 14 : death ? 12 : revenge ? 10 : expertMode ? 8 : 6;
float radians = MathHelper.TwoPi / totalProjectiles;
float velocity = 10f;
Vector2 spinningPoint = new Vector2(0f, -velocity);
for (int k = 0; k < totalProjectiles; k++)
{
Vector2 velocity2 = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f);
}
}
}
else if (calamityGlobalNPC.newAI[2] == 0f && phase2)
{
calamityGlobalNPC.newAI[2] = 1f;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
float flameVelocity = 6f;
int maxProjectiles = bossRush ? 4 : death ? 3 : 2;
int spread = bossRush ? 36 : death ? 28 : 20;
int type = ModContent.ProjectileType<AstralFlame>();
int damage = npc.GetProjectileDamage(type);
Vector2 spawnVector = new Vector2(npc.Center.X, npc.Center.Y - 80f * npc.scale);
Vector2 destination = new Vector2(spawnVector.X, spawnVector.Y + 100f * npc.scale);
Vector2 projectileVelocity = Vector2.Normalize(destination - spawnVector) * flameVelocity;
float rotation = MathHelper.ToRadians(spread);
for (int i = 0; i < maxProjectiles; i++)
{
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1)));
Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector + Vector2.Normalize(perturbedSpeed) * 100f, perturbedSpeed, type, damage, 0f, Main.myPlayer);
}
}
}
else
{
calamityGlobalNPC.newAI[2] = 0f;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
float laserVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 7f : death ? 6f : 5f;
int maxProjectiles = !phase3 ? (bossRush ? 13 : death ? 11 : 9) : (bossRush ? 17 : death ? 15 : 13);
int spread = !phase3 ? (bossRush ? 20 : death ? 18 : 16) : (bossRush ? 24 : death ? 22 : 20);
int type = ModContent.ProjectileType<AstralLaser>();
int damage = npc.GetProjectileDamage(type);
int[] lasersToNotFire = new int[4] { 1, 3, maxProjectiles - 2, maxProjectiles - 4 };
Vector2 projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * laserVelocity;
float rotation = MathHelper.ToRadians(spread);
for (int i = 0; i < maxProjectiles; i++)
{
if (i != lasersToNotFire[0] && i != lasersToNotFire[1] && i != lasersToNotFire[2] && i != lasersToNotFire[3])
{
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1)));
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, laserVelocity * 2f);
}
}
}
}
}
else
{
// Set damage
npc.damage = npc.defDamage;
// Set velocities while falling, this happens before the stomp
// Fall through
if (!player.dead)
{
if ((player.position.Y > npc.Bottom.Y && npc.velocity.Y > 0f) || (player.position.Y < npc.Bottom.Y && npc.velocity.Y < 0f))
npc.noTileCollide = true;
else if ((npc.velocity.Y > 0f && npc.Bottom.Y > Main.player[npc.target].Top.Y) || (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)))
npc.noTileCollide = false;
}
if (npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width)
{
// Make sure Aureus falls quickly when directly on top of or below the player
if (npc.ai[3] < 30f)
npc.ai[3] = 30f;
npc.velocity.X *= 0.8f;
if (npc.Bottom.Y < player.position.Y)
{
// Make sure Aureus falls rather quickly
if (npc.velocity.Y < -3f)
npc.velocity.Y = -3f;
float fallSpeed = 1.2f;
fallSpeed += 0.36f * enrageScale;
if (expertMode)
fallSpeed += death ? 0.36f * (1f - lifeRatio) : 0.24f * (1f - lifeRatio);
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
fallSpeed += 0.5f;
if (calamityGlobalNPC.newAI[1] > 0f)
fallSpeed *= calamityGlobalNPC.newAI[1] + 1f;
npc.velocity.Y += fallSpeed;
}
}
else
{
// Push Aureus towards the player on the X axis if he's not directly on top of or below the player
float velocityXChange = 0.2f + Math.Abs(npc.Center.X - player.Center.X) * 0.0001f;
velocityXChange += 0.1f * enrageScale;
if (calamityGlobalNPC.newAI[0] > 0f)
velocityXChange *= calamityGlobalNPC.newAI[0] + 1f;
if (npc.direction < 0)
npc.velocity.X -= velocityXChange;
else if (npc.direction > 0)
npc.velocity.X += velocityXChange;
float velocityXCap = 12f;
velocityXCap += 3.6f * enrageScale;
if (expertMode)
velocityXCap += death ? 3.6f * (1f - lifeRatio) : 2.4f * (1f - lifeRatio);
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
velocityXCap += 5f;
if (calamityGlobalNPC.newAI[0] > 0f)
velocityXCap *= calamityGlobalNPC.newAI[0] + 1f;
float playerLocation = npc.Center.X - player.Center.X;
int directionRelativeToTarget = playerLocation < 0 ? 1 : -1;
bool slowDown = directionRelativeToTarget != calamityGlobalNPC.newAI[3];
if (slowDown)
velocityXCap *= 0.333f;
if (npc.velocity.X < -velocityXCap)
npc.velocity.X = -velocityXCap;
if (npc.velocity.X > velocityXCap)
npc.velocity.X = velocityXCap;
}
// Don't start falling quickly until half a second has passed
npc.ai[3] += 1f;
if (npc.ai[3] > 30f)
CustomGravity();
}
}
// Teleport
else if (npc.ai[0] == 5f)
{
// Avoid cheap bullshit
npc.damage = 0;
// Slow down
npc.velocity.X *= 0.8f;
// Start teleport
if (Main.netMode != NetmodeID.MultiplayerClient)
{
npc.localAI[1] += 1f;
if (death)
npc.localAI[2] += 1.25f;
if (phase4)
{
npc.localAI[1] += 1f;
if (death)
npc.localAI[2] += 1.25f;
}
if (npc.localAI[1] >= (bossRush ? 60f : death ? 180f : 240f))
{
// Reset localAI and find a teleport destination
npc.TargetClosest();
npc.localAI[1] = 0f;
Vector2 vectorAimedAheadOfTarget = Main.player[npc.target].Center + new Vector2((float)Math.Round(Main.player[npc.target].velocity.X), 0f).SafeNormalize(Vector2.Zero) * 1000f;
Point point4 = vectorAimedAheadOfTarget.ToTileCoordinates();
int teleportTries = 0;
while (teleportTries < 100)
{
teleportTries++;
int teleportTileX = Main.rand.Next(point4.X - 5, point4.X + 6);
int teleportTileY = Main.rand.Next(point4.Y - 5, point4.Y);
if (!Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile)
{
npc.ai[1] = teleportTileX * 16 + 8;
npc.ai[3] = teleportTileY * 16 + 16;
break;
}
}
// Default teleport if the above conditions aren't met in 100 iterations
if (teleportTries >= 100)
{
Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom;
npc.ai[1] = bottom.X;
npc.ai[3] = bottom.Y;
}
// Set AI to next phase (Mid-teleport)
npc.ai[0] = 6f;
npc.netUpdate = true;
}
}
CustomGravity();
}
// Mid-teleport
else if (npc.ai[0] == 6f)
{
// Avoid cheap bullshit
npc.damage = 0;
if (death)
npc.localAI[2] += 1.25f;
if (phase4)
{
if (death)
npc.localAI[2] += 1.25f;
}
// Turn invisible
npc.alpha += 10;
if (npc.alpha >= 255)
{
// Set position to teleport destination
npc.Bottom = new Vector2(npc.ai[1], npc.ai[3]);
// Reset alpha and set AI to next phase (End of teleport)
npc.alpha = 255;
npc.ai[0] = 7f;
npc.localAI[2] = 0f;
npc.netUpdate = true;
}
// Play sound for cool effect
if (npc.soundDelay == 0)
{
npc.soundDelay = 15;
SoundEngine.PlaySound(AstrumAureus.AstrumAureus.TeleportSound, npc.Center);
}
// Emit dust to make the teleport pretty
for (int i = 0; i < 10; i++)
{
int teleportDust = Dust.NewDust(npc.position, npc.width, npc.height, ModContent.DustType<AstralOrange>(), npc.velocity.X, npc.velocity.Y, 255, default, 2f);
Main.dust[teleportDust].noGravity = true;
Main.dust[teleportDust].velocity *= 0.5f;
}
CustomGravity();
}
// End of teleport
else if (npc.ai[0] == 7f)
{
// Avoid cheap bullshit
npc.damage = 0;
// Turn visible
npc.alpha -= 10;
if (npc.alpha <= 0)
{
// Spawn Aureus Spawns
bool spawnFlag = expertMode;
if (NPC.CountNPCS(ModContent.NPCType<AureusSpawn>()) >= 2)
spawnFlag = false;
if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient)
{
int aureusSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.Center.Y - 25f * npc.scale), ModContent.NPCType<AureusSpawn>());
Main.npc[aureusSpawn].velocity.Y = -10f;
Main.npc[aureusSpawn].netUpdate = true;
if (revenge)
{
aureusSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.Center.Y - 25f * npc.scale), ModContent.NPCType<AureusSpawn>());
Main.npc[aureusSpawn].velocity.Y = -15f;
Main.npc[aureusSpawn].netUpdate = true;
}
if (death)
{
int damageAmt = npc.lifeMax / 50;
npc.life -= damageAmt;
if (npc.life < 1)
npc.life = 1;
npc.DamageEffect(damageAmt);
}
}
// Reset alpha and set AI to next phase (Idle)
npc.alpha = 0;
npc.ai[0] = exhausted ? 1f : 2f;
npc.ai[1] = 0f;
npc.ai[2] += 1f;
npc.localAI[3] = noProjectileOrPhaseIncrementTime;
// Stop colliding with tiles if entering walking phase
npc.noTileCollide = npc.ai[0] == 2f;
npc.netUpdate = true;
}
// Play sound at teleport destination for cool effect
if (npc.soundDelay == 0)
{
npc.soundDelay = 15;
SoundEngine.PlaySound(SoundID.Item109, npc.Center);
}
// Emit dust to make the teleport pretty
for (int i = 0; i < 10; i++)
{
int teleportDust = Dust.NewDust(npc.position, npc.width, npc.height, ModContent.DustType<AstralOrange>(), npc.velocity.X, npc.velocity.Y, 255, default, 2f);
Main.dust[teleportDust].noGravity = true;
Main.dust[teleportDust].velocity *= 0.5f;
}
CustomGravity();
}
void CustomGravity()
{
float gravity = 0.36f + 0.12f * enrageScale;
float maxFallSpeed = reduceFallSpeed ? 12f : 12f + 4f * enrageScale;
if (calamityGlobalNPC.newAI[1] > 0f && !reduceFallSpeed)
maxFallSpeed *= calamityGlobalNPC.newAI[1] + 1f;
if (Main.getGoodWorld && !reduceFallSpeed)
{
gravity *= 1.15f;
maxFallSpeed *= 1.15f;
}
npc.velocity.Y += gravity;
if (npc.velocity.Y > maxFallSpeed)
npc.velocity.Y = maxFallSpeed;
}
}
}
}
@@ -1,734 +0,0 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.CalPlayer;
using CalamityMod.Dusts;
using CalamityMod.Events;
using CalamityMod.NPCs.Abyss;
using CalamityMod.NPCs.BrimstoneElemental;
using CalamityMod.Projectiles.Boss;
using CalamityMod.Projectiles.Enemy;
using CalamityMod.Sounds;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
{
public static class BrimstoneElementalAI
{
public static void VanillaBrimstoneElementalAI(NPC npc, Mod mod)
{
CalamityGlobalNPC calamityGlobalNPC = npc.Calamity();
BrimstoneElemental.BrimstoneElemental brimmy = npc.ModNPC<BrimstoneElemental.BrimstoneElemental>();
// Used for Brimling AI states
CalamityGlobalNPC.brimstoneElemental = npc.whoAmI;
// Emit light
Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1.2f, 0f, 0f);
// Get a target
if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active)
npc.TargetClosest();
Player player = Main.player[npc.target];
bool despawnDistance = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles;
if (!player.active || player.dead || despawnDistance)
{
npc.TargetClosest(false);
player = Main.player[npc.target];
if (!player.active || player.dead || despawnDistance)
{
npc.rotation = npc.velocity.X * 0.04f;
if (npc.velocity.Y > 3f)
npc.velocity.Y = 3f;
npc.velocity.Y -= 0.1f;
if (npc.velocity.Y < -12f)
npc.velocity.Y = -12f;
if (npc.timeLeft > 60)
npc.timeLeft = 60;
if (npc.ai[0] != 0f)
{
npc.ai[0] = 0f;
npc.ai[1] = 0f;
npc.ai[2] = 0f;
npc.ai[3] = 0f;
npc.localAI[0] = 0f;
npc.localAI[1] = 0f;
npc.netUpdate = true;
}
return;
}
}
else if (npc.timeLeft < 1800)
npc.timeLeft = 1800;
CalamityPlayer modPlayer = player.Calamity();
// Reset defense
npc.defense = npc.defDefense;
calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = npc.ai[0] == 4f;
// Percent life remaining
float lifeRatio = npc.life / (float)npc.lifeMax;
// Variables for buffing the AI
bool bossRush = BossRushEvent.BossRushActive;
bool expertMode = Main.expertMode || bossRush;
bool revenge = CalamityWorld.revenge || bossRush;
bool death = CalamityWorld.death || bossRush;
bool phase2 = lifeRatio < 0.5f && revenge;
bool phase3 = lifeRatio < 0.33f;
// Enrage
if ((!player.ZoneUnderworldHeight || !modPlayer.ZoneCalamity) && !bossRush)
{
if (calamityGlobalNPC.newAI[3] > 0f)
calamityGlobalNPC.newAI[3] -= 1f;
}
else
calamityGlobalNPC.newAI[3] = CalamityGlobalNPC.biomeEnrageTimerMax;
bool biomeEnraged = calamityGlobalNPC.newAI[3] <= 0f || bossRush;
float enrageScale = bossRush ? 0.5f : 0f;
if (biomeEnraged && (!player.ZoneUnderworldHeight || bossRush))
{
npc.Calamity().CurrentlyEnraged = !bossRush;
enrageScale += 0.5f;
}
if (biomeEnraged && (!modPlayer.ZoneCalamity || bossRush))
{
npc.Calamity().CurrentlyEnraged = !bossRush;
enrageScale += 1f;
}
npc.Calamity().DR = npc.ai[0] == 4f ? 0.6f : 0.2f;
// Emit dust
int dustAmt = (npc.ai[0] == 2f) ? 2 : 1;
int size = (npc.ai[0] == 2f) ? 50 : 35;
if (npc.ai[0] != 1f)
{
for (int i = 0; i < 2; i++)
{
if (Main.rand.Next(3) < dustAmt)
{
int dust = Dust.NewDust(npc.Center - new Vector2(size), size * 2, size * 2, DustID.LifeDrain, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f);
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity *= 0.2f;
Main.dust[dust].fadeIn = 1f;
}
}
}
// Distance from destination where Brimmy stops moving
float movementDistanceGateValue = 100f;
// How fast Brimmy moves to the destination
float baseVelocity = (death ? 6f : revenge ? 5.5f : expertMode ? 5f : 4.5f) * (npc.ai[0] == 5f ? 0.05f : npc.ai[0] == 3f ? 1.5f : 1f);
baseVelocity += 3f * enrageScale;
if (expertMode)
baseVelocity += death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio);
float baseAcceleration = (death ? 0.12f : 0.1f) * (npc.ai[0] == 5f ? 0.5f : npc.ai[0] == 3f ? 1.5f : 1f);
baseAcceleration += 0.06f * enrageScale;
if (expertMode)
baseAcceleration += 0.03f * (1f - lifeRatio);
// This is where Brimmy should be
Vector2 destination = npc.ai[0] != 3f ? player.Center : new Vector2(player.Center.X, player.Center.Y - 300f);
// How far Brimmy is from where she's supposed to be
Vector2 distanceFromDestination = destination - npc.Center;
// Movement
if (npc.ai[0] != 4f)
CalamityUtils.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity, baseAcceleration, true);
// Rotation and direction
if (npc.ai[0] <= 2f || npc.ai[0] == 5f)
{
npc.rotation = npc.velocity.X * 0.04f;
if (npc.ai[0] != 5 || (npc.ai[1] < 180f && npc.ai[0] == 5f))
{
float playerLocation = npc.Center.X - player.Center.X;
npc.direction = playerLocation < 0f ? 1 : -1;
npc.spriteDirection = npc.direction;
}
}
if (Main.zenithWorld) // in gfb, Brimmy channels the power of the other elementals.
{
int newMode;
if (lifeRatio <= 0.8f && lifeRatio > 0.6f)
{
newMode = 1; // Sand
}
else if (lifeRatio <= 0.6f && lifeRatio > 0.4f)
{
newMode = 2; // Rare Sand
}
else if (lifeRatio <= 0.4f && lifeRatio > 0.2f)
{
newMode = 3; // Cloud
}
else if (lifeRatio <= 0.2f)
{
newMode = 4; // Water
}
else
{
newMode = 0; // Brimstone, default
}
if (newMode != brimmy.currentMode)
{
SoundEngine.PlaySound(SoundID.Item29, npc.Center);
}
brimmy.currentMode = newMode;
}
if (npc.ai[0] == -1f)
{
// Avoid cheap bullshit
npc.damage = 0;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int phase;
int random = phase2 ? 6 : 5;
do phase = Main.rand.Next(random);
while (phase == npc.ai[1] || (phase == 0 && phase3 && revenge) || phase == 1 || phase == 2 || (phase == 4 && npc.localAI[3] != 0f));
npc.ai[0] = phase;
npc.ai[1] = 0f;
// Cocoon phase cooldown
if (npc.localAI[3] > 0f)
npc.localAI[3] -= 1f;
else if (phase == 4)
{
npc.localAI[3] = 3f;
SoundEngine.PlaySound(BrimstoneElemental.BrimstoneElemental.HideInShellSound, player.Center);
}
// Prevent netUpdate from being blocked by the spam counter.
// A phase switch sync is a critical operation that must be synced.
npc.ForceNetUpdate(false);
}
}
// Pick a location to teleport to
else if (npc.ai[0] == 0f)
{
// Avoid cheap bullshit
npc.damage = 0;
npc.chaseable = true;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
npc.localAI[1] += 1f;
if (npc.Distance(player.Center) < 160f)
npc.localAI[1] += death ? 4f : expertMode ? 2f : 1f;
if (npc.localAI[1] >= (bossRush ? 90f : death ? 120f : 180f))
{
npc.TargetClosest();
npc.localAI[1] = 0f;
int timer = 0;
int playerPosX;
int playerPosY;
while (true)
{
timer++;
playerPosX = (int)player.Center.X / 16;
playerPosY = (int)player.Center.Y / 16;
int min = 12;
int max = 16;
if (Main.rand.NextBool())
playerPosX += Main.rand.Next(min, max);
else
playerPosX -= Main.rand.Next(min, max);
if (Main.rand.NextBool())
playerPosY += Main.rand.Next(min, max);
else
playerPosY -= Main.rand.Next(min, max);
if (!WorldGen.SolidTile(playerPosX, playerPosY))
break;
if (timer > 100)
return;
}
npc.ai[0] = 1f;
npc.ai[1] = playerPosX;
npc.ai[2] = playerPosY;
npc.netUpdate = true;
}
}
}
// Teleport to location
else if (npc.ai[0] == 1f)
{
// Avoid cheap bullshit
npc.damage = 0;
npc.chaseable = true;
Vector2 position = new Vector2(npc.ai[1] * 16f - (npc.width / 2), npc.ai[2] * 16f - (npc.height / 2));
for (int m = 0; m < 5; m++)
{
int dust = Dust.NewDust(position, npc.width, npc.height, DustID.LifeDrain, 0f, -1f, 90, default, 2f);
Main.dust[dust].noGravity = true;
Main.dust[dust].fadeIn = 1f;
}
npc.alpha += bossRush ? 8 : death ? 5 : revenge ? 4 : expertMode ? 3 : 2;
if (npc.alpha >= 255)
{
int spawnType = brimmy.currentMode == 3 ? NPCID.AngryNimbus : ModContent.NPCType<Brimling>();
int enemyCount = brimmy.currentMode == 3 ? 3 : 1; // 3 angry nimbi if cloud, otherwise 1 brimling
if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(spawnType) < (death ? 1 : 2) && revenge && brimmy.currentMode != 2) // dont spawn anything if gfb rare sand
{
for (int i = 0; i < enemyCount; i++)
NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, spawnType);
}
SoundEngine.PlaySound(BrimstoneElemental.BrimstoneElemental.TeleportSound, npc.Center);
npc.alpha = 255;
npc.position = position;
for (int n = 0; n < 15; n++)
{
int warpDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.LifeDrain, 0f, -1f, 90, default, 3f);
Main.dust[warpDust].noGravity = true;
}
npc.ai[0] = 2f;
npc.netUpdate = true;
}
}
// Either teleport again or go to next AI state
else if (npc.ai[0] == 2f)
{
// Avoid cheap bullshit
npc.damage = 0;
if (npc.alpha >= 255)
{
if (Main.zenithWorld)
{
SoundEngine.PlaySound(SoundID.Item68, npc.Center);
int type = ModContent.ProjectileType<BrimstoneRay>();
int damage = npc.GetProjectileDamage(type);
Vector2 pos = npc.Center;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(0, 1), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI);
Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(0, -1), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI);
Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(1, 0), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI);
Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(-1, 0), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI);
}
if (brimmy.currentMode >= 1 && brimmy.currentMode <= 3)
{
int tornadoType = brimmy.currentMode == 3 ? ModContent.ProjectileType<StormMarkHostile>() : ProjectileID.SandnadoHostileMark;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
Projectile.NewProjectile(npc.GetSource_FromAI(), pos, Vector2.Zero, tornadoType, damage, 0f, Main.myPlayer, 0f, 0f);
}
}
if (brimmy.currentMode == 2)
{
int healAmt = npc.lifeMax / 25;
if (healAmt > 0)
{
npc.life += healAmt;
npc.HealEffect(healAmt, true);
npc.netUpdate = true;
}
}
}
}
npc.alpha -= 50;
if (npc.alpha <= 0)
{
npc.chaseable = true;
npc.ai[3] += 1f;
npc.alpha = 0;
if (npc.ai[3] >= 2f || phase2 || Main.getGoodWorld)
{
npc.ai[0] = -1f;
npc.ai[1] = 0f;
npc.ai[2] = 0f;
npc.ai[3] = 0f;
}
else
{
npc.ai[0] = 0f;
}
npc.netUpdate = true;
}
}
// Float above target and fire projectiles
else if (npc.ai[0] == 3f)
{
// Avoid cheap bullshit
npc.damage = 0;
npc.chaseable = true;
npc.rotation = npc.velocity.X * 0.04f;
float playerLocation = npc.Center.X - player.Center.X;
npc.direction = playerLocation < 0f ? 1 : -1;
npc.spriteDirection = npc.direction;
npc.ai[1] += 1f;
float divisor = expertMode ? (death ? 80f : revenge ? 45f : 50f) - (float)Math.Ceiling(10f * (1f - lifeRatio)) : 50f;
divisor -= 3f * enrageScale;
float divisor2 = divisor * 2f;
if (npc.ai[1] % divisor == divisor - 1f)
{
float velocity = (death ? 7f : revenge ? 6f : 5f) + (2f * enrageScale) + (expertMode ? 3f * (1f - lifeRatio) : 0f);
int type = ModContent.ProjectileType<BrimstoneHellfireball>();
int damage = npc.GetProjectileDamage(type);
if (brimmy.currentMode == 4)
{
type = ModContent.ProjectileType<FrostMist>();
SoundEngine.PlaySound(SoundID.Item30, player.Center);
}
else
{
SoundEngine.PlaySound(BrimstoneElemental.BrimstoneElemental.HellfireballSound, player.Center);
}
Vector2 projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 5f, projectileVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y);
Main.projectile[proj].timeLeft = 240;
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
Main.projectile[proj].extraUpdates += 1;
}
if (npc.ai[1] % divisor2 == divisor2 - 1f)
{
velocity = (death ? 5f : 4f) + 2f * enrageScale;
type = ModContent.ProjectileType<BrimstoneBarrage>();
damage = npc.GetProjectileDamage(type);
if (brimmy.currentMode == 4)
{
type = ModContent.ProjectileType<WaterSpear>();
SoundEngine.PlaySound(SoundID.Item21, player.Center);
}
else
{
SoundEngine.PlaySound(BrimstoneElemental.BrimstoneElemental.DartSound, player.Center);
}
projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity;
int numProj = death ? 8 : 4;
int spread = death ? 90 : 45;
if (Main.getGoodWorld)
{
numProj *= 3;
spread *= 2;
}
if (Main.netMode != NetmodeID.MultiplayerClient)
{
float rotation = MathHelper.ToRadians(spread);
float projectileVelocityToPass = velocity * 3f;
for (int i = 0; i < numProj; i++)
{
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1)));
int proj2 = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass);
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
Main.projectile[proj2].extraUpdates += 1;
}
}
}
}
if (npc.ai[1] >= divisor * (death ? 5f : 10f))
{
npc.TargetClosest();
npc.ai[0] = -1f;
npc.ai[1] = 3f;
npc.ai[2] = 0f;
npc.ai[3] = 0f;
npc.netUpdate = true;
}
}
// Cocoon bullet hell
else if (npc.ai[0] == 4f)
{
// Avoid cheap bullshit
npc.damage = 0;
npc.defense = npc.defDefense * 4;
npc.chaseable = false;
npc.localAI[0] += 1f;
if (Main.getGoodWorld)
npc.localAI[0] += 2f;
if (expertMode)
npc.localAI[0] += 1f - lifeRatio;
npc.localAI[0] += enrageScale;
if (npc.localAI[0] >= 120f)
{
npc.localAI[0] = 0f;
float projectileSpeed = death ? 9f : revenge ? 8f : 6f;
projectileSpeed += 2f * enrageScale;
Vector2 projectileVelocity = player.Center - npc.Center;
float radialOffset = 0.2f;
float diameter = 80f;
projectileVelocity = projectileVelocity.SafeNormalize(Vector2.UnitY) * projectileSpeed;
Vector2 velocity = projectileVelocity;
velocity = velocity.SafeNormalize(Vector2.UnitY);
velocity *= diameter;
int totalProjectiles = 6;
float offsetAngle = (float)Math.PI * radialOffset;
int type = ModContent.ProjectileType<BrimstoneHellblast>();
int damage = npc.GetProjectileDamage(type);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
for (int j = 0; j < totalProjectiles; j++)
{
float radians = j - (totalProjectiles - 1f) / 2f;
Vector2 offset = velocity.RotatedBy(offsetAngle * radians);
int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, projectileVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f);
Main.projectile[proj].timeLeft = 300;
Main.projectile[proj].tileCollide = false;
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
Main.projectile[proj].extraUpdates += 1;
}
}
totalProjectiles = 12;
float radians2 = MathHelper.TwoPi / totalProjectiles;
type = ModContent.ProjectileType<BrimstoneBarrage>();
damage = npc.GetProjectileDamage(type);
if (brimmy.currentMode == 4)
{
type = ModContent.ProjectileType<SirenSong>();
SoundEngine.PlaySound(SoundID.Item26, player.Center);
}
else
{
SoundEngine.PlaySound(BrimstoneElemental.BrimstoneElemental.ShellFireSound, player.Center);
}
double angleA = radians2 * 0.5;
double angleB = MathHelper.ToRadians(90f) - angleA;
float velocityX = (float)(projectileSpeed * Math.Sin(angleA) / Math.Sin(angleB));
Vector2 spinningPoint = npc.localAI[2] % 2f == 0f ? new Vector2(0f, -projectileSpeed) : new Vector2(-velocityX, -projectileSpeed);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
float projectileVelocityToPass = projectileSpeed * 3f;
for (int k = 0; k < totalProjectiles; k++)
{
Vector2 vector255 = spinningPoint.RotatedBy(radians2 * k);
int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass);
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
Main.projectile[proj].extraUpdates += 1;
}
if (death)
{
spinningPoint = npc.localAI[2] % 2f == 0f ? new Vector2(-velocityX, -projectileSpeed) : new Vector2(0f, -projectileSpeed);
for (int k = 0; k < totalProjectiles; k++)
{
Vector2 vector255 = spinningPoint.RotatedBy(radians2 * k);
int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255 * 0.75f, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass);
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
Main.projectile[proj].extraUpdates += 1;
}
}
}
npc.localAI[2] += 1f;
}
npc.velocity *= 0.95f;
npc.rotation = npc.velocity.X * 0.04f;
float playerLocation = npc.Center.X - player.Center.X;
npc.direction = playerLocation < 0f ? 1 : -1;
npc.spriteDirection = npc.direction;
npc.ai[1] += 1f;
if (npc.ai[1] >= (death ? 240f : 300f))
{
npc.TargetClosest();
npc.ai[0] = -1f;
npc.ai[1] = 4f;
npc.ai[2] = 0f;
npc.ai[3] = 0f;
npc.localAI[0] = 0f;
npc.netUpdate = true;
}
}
// Laser beam attack
else if (npc.ai[0] == 5f)
{
// Avoid cheap bullshit
npc.damage = 0;
npc.chaseable = true;
npc.defense = npc.defDefense * 2;
Vector2 source = new Vector2(npc.Center.X + (npc.spriteDirection > 0 ? 34f : -34f), npc.Center.Y - 74f);
Vector2 aimAt = player.Center + player.velocity * 20f;
float aimResponsiveness = bossRush ? 0.05f : (npc.ai[2] == 1f || death) ? 0.1f : 0.25f;
Vector2 aimVector = (aimAt - source).SafeNormalize(Vector2.UnitY);
if (aimVector.HasNaNs())
aimVector = -Vector2.UnitY;
aimVector = (Vector2.Lerp(aimVector, npc.velocity.SafeNormalize(Vector2.UnitY), aimResponsiveness)).SafeNormalize(Vector2.UnitY);
aimVector *= 6f;
Vector2 laserVelocity = aimVector.SafeNormalize(Vector2.UnitY);
if (laserVelocity.HasNaNs())
laserVelocity = -Vector2.UnitY;
calamityGlobalNPC.newAI[1] = laserVelocity.X;
calamityGlobalNPC.newAI[2] = laserVelocity.Y;
// Rev = 190 + 165 = 355
// Death = 165
npc.ai[1] += 1f;
if (npc.ai[1] >= 240f)
{
npc.TargetClosest();
npc.ai[2] += 1f;
npc.localAI[0] = 0f;
npc.localAI[1] = 0f;
if (npc.ai[2] >= (death ? 1f : 2f))
{
npc.ai[0] = -1f;
npc.ai[1] = 5f;
npc.ai[2] = 0f;
calamityGlobalNPC.newAI[0] = 0f;
}
else
{
npc.ai[1] = 0f;
calamityGlobalNPC.newAI[0] = 0f;
}
}
else if (npc.ai[1] >= 180f)
{
npc.velocity *= 0.95f;
if (npc.ai[1] == 180f)
{
SoundEngine.PlaySound(SoundID.Item68, source);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
Vector2 laserVelocity2 = new Vector2(npc.localAI[0], npc.localAI[1]);
laserVelocity2 = laserVelocity2.SafeNormalize(Vector2.UnitY);
int type = ModContent.ProjectileType<BrimstoneRay>();
int damage = npc.GetProjectileDamage(type);
Projectile.NewProjectile(npc.GetSource_FromAI(), source, laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI);
if (Main.getGoodWorld)
Projectile.NewProjectile(npc.GetSource_FromAI(), source, -laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI);
if (Main.zenithWorld)
{
Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(-laserVelocity2.X, laserVelocity2.Y), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI);
Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(laserVelocity2.X, -laserVelocity2.Y), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI);
}
}
}
}
else
{
float playSoundTimer = 30f;
if (npc.ai[1] < 150f)
{
switch ((int)npc.ai[2])
{
case 0:
npc.ai[1] += 0.5f;
break;
case 1:
npc.ai[1] += 1f;
playSoundTimer = 40f;
break;
}
if (death)
{
npc.ai[1] += 0.5f;
playSoundTimer += 10f;
}
}
if (npc.ai[1] % playSoundTimer == 0f)
SoundEngine.PlaySound(SoundID.Item20, npc.Center);
if (npc.ai[1] < 150f && calamityGlobalNPC.newAI[0] == 0f)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
Projectile.NewProjectile(npc.GetSource_FromAI(), source, laserVelocity, ModContent.ProjectileType<BrimstoneTargetRay>(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI);
if (Main.getGoodWorld)
Projectile.NewProjectile(npc.GetSource_FromAI(), source, -laserVelocity, ModContent.ProjectileType<BrimstoneTargetRay>(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI);
if (Main.zenithWorld)
{
Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(-laserVelocity.X, laserVelocity.Y), ModContent.ProjectileType<BrimstoneTargetRay>(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI);
Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(laserVelocity.X, -laserVelocity.Y), ModContent.ProjectileType<BrimstoneTargetRay>(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI);
}
}
calamityGlobalNPC.newAI[0] = 1f;
}
else
{
if (npc.ai[1] == 150f)
{
npc.localAI[0] = laserVelocity.X;
npc.localAI[1] = laserVelocity.Y;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, npc.localAI[0], npc.localAI[1], ModContent.ProjectileType<BrimstoneTargetRay>(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI);
if (Main.getGoodWorld)
Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, -npc.localAI[0], -npc.localAI[1], ModContent.ProjectileType<BrimstoneTargetRay>(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI);
if (Main.zenithWorld)
{
Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, -npc.localAI[0], npc.localAI[1], ModContent.ProjectileType<BrimstoneTargetRay>(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI);
Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, npc.localAI[0], -npc.localAI[1], ModContent.ProjectileType<BrimstoneTargetRay>(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI);
}
}
}
}
}
}
}
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -1614,7 +1614,7 @@ namespace CalamityMod.NPCs
{ NPCType<PlaguebringerGoliath.PlaguebringerGoliath>(), 10800 }, // 3:00 (180 seconds)
{ NPCType<RavagerBody>(), 10800 }, // 3:00 (180 seconds)
{ NPCType<ProfanedGuardianCommander>(), 5400 }, // 1:30 (90 seconds)
{ NPCType<Bumblefuck>(), 7200 }, // 2:00 (120 seconds)
{ NPCType<Dragonfolly>(), 7200 }, // 2:00 (120 seconds)
{ NPCType<Providence.Providence>(), 14400 }, // 4:00 (240 seconds)
{ NPCType<CeaselessVoid.CeaselessVoid>(), 10800 }, // 3:00 (180 seconds)
{ NPCType<DarkEnergy>(), 1200 }, // 0:20 (20 seconds)
@@ -9002,7 +9002,7 @@ namespace CalamityMod.NPCs
{
return DownedBossSystem.downedGuardians;
}
else if (type == NPCType<Bumblefuck>())
else if (type == NPCType<Dragonfolly>())
{
return DownedBossSystem.downedDragonfolly;
}
+389
View File
@@ -0,0 +1,389 @@
using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables.Banners;
using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs;
using CalamityMod.Projectiles.Boss;
using CalamityMod.Sounds;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.GameContent.Bestiary;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.Utilities;
namespace CalamityMod.NPCs.NormalNPCs
{
public class WildBumblebirb : ModNPC
{
public override void SetStaticDefaults()
{
Main.npcFrameCount[Type] = 5;
NPCID.Sets.TrailingMode[Type] = 1;
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers()
{
Position = Vector2.UnitX * 36f
};
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
}
public override string Texture => "CalamityMod/NPCs/Bumblebirb/BumbleFolly";
public override void SetDefaults()
{
NPC.npcSlots = 1f;
NPC.aiStyle = -1;
AIType = -1;
NPC.damage = 90;
NPC.width = 120;
NPC.height = 80;
NPC.defense = 20;
NPC.LifeMaxNERB(9375, 11250, 5000); // Old HP - 12000, 15000
NPC.knockBackResist = 0.15f;
NPC.lavaImmune = true;
NPC.noTileCollide = true;
NPC.noGravity = true;
NPC.HitSound = SoundID.NPCHit51;
NPC.DeathSound = SoundID.NPCDeath46;
Banner = NPC.type;
BannerItem = ModContent.ItemType<DraconicSwarmerBanner>();
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToCold = true;
NPC.Calamity().VulnerableToSickness = true;
// Scale stats in Expert and Master
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC);
}
public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
{
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[]
{
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle,
new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.WildBumblefuck")
});
}
public override float SpawnChance(NPCSpawnInfo spawnInfo)
{
if (spawnInfo.PlayerSafe || !NPC.downedMoonlord || spawnInfo.Player.Calamity().ZoneSunkenSea || !spawnInfo.Player.ZoneJungle)
return 0f;
// Keep this as a separate if check, because it's a loop and we don't want to be checking it constantly.
if (NPC.AnyNPCs(NPC.type))
return 0f;
return SpawnCondition.SurfaceJungle.Chance * 0.14f;
}
public override void AI()
{
Player player = Main.player[NPC.target];
float rotationMult = 4f;
float rotationAmt = 0.04f;
if (Vector2.Distance(player.Center, NPC.Center) > 5600f)
{
if (NPC.timeLeft > 5)
NPC.timeLeft = 5;
}
NPC.rotation = (NPC.rotation * rotationMult + NPC.velocity.X * rotationAmt * 1.25f) / 10f;
if (NPC.ai[0] == 0f || NPC.ai[0] == 1f)
{
for (int i = 0; i < Main.maxNPCs; i++)
{
if (i != NPC.whoAmI && Main.npc[i].active && Main.npc[i].type == NPC.type)
{
Vector2 otherSwarmerDirection = Main.npc[i].Center - NPC.Center;
if (otherSwarmerDirection.Length() < (NPC.width + NPC.height))
{
otherSwarmerDirection.Normalize();
otherSwarmerDirection *= -0.1f;
NPC.velocity += otherSwarmerDirection;
NPC nPC6 = Main.npc[i];
nPC6.velocity -= otherSwarmerDirection;
}
}
}
}
if (NPC.target < 0 || Main.player[NPC.target].dead || !Main.player[NPC.target].active)
{
NPC.TargetClosest(true);
Vector2 swarmerTargetDist = Main.player[NPC.target].Center - NPC.Center;
if (Main.player[NPC.target].dead || swarmerTargetDist.Length() > 2800f)
NPC.ai[0] = -1f;
}
else
{
Vector2 swarmerCatchUpTargetDist = Main.player[NPC.target].Center - NPC.Center;
if (NPC.ai[0] > 1f && swarmerCatchUpTargetDist.Length() > 3600f)
NPC.ai[0] = 1f;
}
if (NPC.ai[0] == -1f)
{
// Avoid cheap bullshit
NPC.damage = 0;
Vector2 swarmerDespawnVelMult = new Vector2(0f, -8f);
NPC.velocity = (NPC.velocity * 21f + swarmerDespawnVelMult) / 10f;
return;
}
if (NPC.ai[0] == 0f)
{
// Avoid cheap bullshit
NPC.damage = 0;
NPC.TargetClosest(true);
NPC.spriteDirection = NPC.direction;
Vector2 swarmerIdleTargetDist = Main.player[NPC.target].Center - NPC.Center;
if (swarmerIdleTargetDist.Length() > 2800f)
{
NPC.ai[0] = 1f;
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
NPC.ai[3] = 0f;
}
else if (swarmerIdleTargetDist.Length() > 400f)
{
float swarmerIdleSpeed = 7f + swarmerIdleTargetDist.Length() / 100f + NPC.ai[1] / 15f;
swarmerIdleTargetDist.Normalize();
swarmerIdleTargetDist *= swarmerIdleSpeed;
NPC.velocity = (NPC.velocity * 29f + swarmerIdleTargetDist) / 30f;
if (Main.getGoodWorld && !Main.zenithWorld)
NPC.velocity *= 1.15f;
}
else if (NPC.velocity.Length() > 2f)
NPC.velocity *= 0.95f;
else if (NPC.velocity.Length() < 1f)
NPC.velocity *= 1.05f;
NPC.ai[1] += 1f;
if (NPC.ai[1] >= 105f)
{
NPC.ai[1] = 0f;
NPC.ai[0] = 2f;
}
}
else
{
if (NPC.ai[0] == 1f)
{
// Avoid cheap bullshit
NPC.damage = 0;
if (NPC.target < 0 || !Main.player[NPC.target].active || Main.player[NPC.target].dead)
NPC.TargetClosest(true);
if (NPC.velocity.X < 0f)
NPC.direction = -1;
else if (NPC.velocity.X > 0f)
NPC.direction = 1;
NPC.spriteDirection = NPC.direction;
NPC.rotation = (NPC.rotation * rotationMult + NPC.velocity.X * rotationAmt) / 10f;
Vector2 swarmerChargeTargetDist = Main.player[NPC.target].Center - NPC.Center;
if (swarmerChargeTargetDist.Length() < 800f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height))
{
NPC.ai[0] = 0f;
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
NPC.ai[3] = 0f;
}
NPC.ai[2] += 0.0166666675f;
float swarmerChargeSpeed = 9f + NPC.ai[2] + swarmerChargeTargetDist.Length() / 150f;
float swarmerChargeVelMult = 25f;
swarmerChargeTargetDist.Normalize();
swarmerChargeTargetDist *= swarmerChargeSpeed;
NPC.velocity = (NPC.velocity * (swarmerChargeVelMult - 1f) + swarmerChargeTargetDist) / swarmerChargeVelMult;
if (Main.getGoodWorld && !Main.zenithWorld)
NPC.velocity *= 1.15f;
NPC.ForceNetUpdate();
return;
}
if (NPC.ai[0] == 2f)
{
// Avoid cheap bullshit
NPC.damage = 0;
if (NPC.velocity.X < 0f)
NPC.direction = -1;
else if (NPC.velocity.X > 0f)
NPC.direction = 1;
NPC.spriteDirection = NPC.direction;
NPC.rotation = (NPC.rotation * rotationMult * 0.75f + NPC.velocity.X * rotationAmt * 1.25f) / 8f;
Vector2 swarmerDecelerateTargetDist = Main.player[NPC.target].Center - NPC.Center;
swarmerDecelerateTargetDist.Y -= 8f;
float swarmerDecelerateSpeed = 14f;
float swarmerDecelerateVelMult = 8f;
swarmerDecelerateTargetDist.Normalize();
swarmerDecelerateTargetDist *= swarmerDecelerateSpeed;
NPC.velocity = (NPC.velocity * (swarmerDecelerateVelMult - 1f) + swarmerDecelerateTargetDist) / swarmerDecelerateVelMult;
if (Main.getGoodWorld && !Main.zenithWorld)
NPC.velocity *= 1.15f;
if (NPC.velocity.X < 0f)
NPC.direction = -1;
else
NPC.direction = 1;
NPC.spriteDirection = NPC.direction;
NPC.ai[1] += 1f;
if (NPC.ai[1] > 10f)
{
// Set damage
NPC.damage = NPC.defDamage;
NPC.velocity = swarmerDecelerateTargetDist;
if (Main.getGoodWorld && !Main.zenithWorld)
NPC.velocity *= 1.15f;
if (NPC.velocity.X < 0f)
NPC.direction = -1;
else
NPC.direction = 1;
NPC.ai[0] = 2.1f;
NPC.ai[1] = 0f;
}
}
else if (NPC.ai[0] == 2.1f)
{
// Set damage
NPC.damage = NPC.defDamage;
if (NPC.velocity.X < 0f)
NPC.direction = -1;
else if (NPC.velocity.X > 0f)
NPC.direction = 1;
NPC.spriteDirection = NPC.direction;
NPC.velocity *= 1.01f;
NPC.ai[1] += 1f;
if (NPC.ai[1] > 30f)
{
if (!Collision.SolidCollision(NPC.position, NPC.width, NPC.height))
{
NPC.ai[0] = 0f;
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
return;
}
if (NPC.ai[1] > 60f)
{
NPC.ai[0] = 1f;
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
}
}
}
}
}
public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType<EffulgentFeather>(), 1, 5, 7);
public override void OnKill()
{
if (Main.zenithWorld)
{
SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
for (int i = 0; i < 5; i++)
{
Vector2 fireFrom = new Vector2(NPC.Center.X + (40 * i) - 120, NPC.Center.Y - 900f);
Vector2 ai0 = NPC.Center - fireFrom;
float ai = Main.rand.Next(100);
Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f;
Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType<RedLightning>(), NPC.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai);
}
}
}
}
public override void FindFrame(int frameHeight)
{
NPC.frameCounter += NPC.ai[0] == 2.1f ? 1.5 : 1D;
if (Main.zenithWorld)
{
NPC.frameCounter += 2D;
}
if (NPC.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base
{
NPC.frameCounter = 0D;
NPC.frame.Y += frameHeight;
}
if (NPC.frame.Y >= frameHeight * 4)
{
NPC.frame.Y = 0;
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
{
SpriteEffects spriteEffects = SpriteEffects.None;
if (NPC.spriteDirection == 1)
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[Type].Value;
Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2);
int afterimageAmt = NPC.ai[0] == 2.1f ? 7 : 0;
if (CalamityClientConfig.Instance.Afterimages)
{
for (int i = 1; i < afterimageAmt; i += 2)
{
Color afterimageColor = drawColor;
afterimageColor = Color.Lerp(afterimageColor, Color.Gold, 0.5f);
afterimageColor = NPC.GetAlpha(afterimageColor);
afterimageColor *= (afterimageAmt - i) / 15f;
Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f;
afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
}
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
return false;
}
public override void HitEffect(NPC.HitInfo hit)
{
for (int k = 0; k < 5; k++)
{
Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f);
}
if (NPC.life <= 0)
{
for (int k = 0; k < 50; k++)
{
Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f);
}
}
}
}
}
-173
View File
@@ -1,173 +0,0 @@
using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables.Banners;
using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs;
using CalamityMod.Projectiles.Boss;
using CalamityMod.Sounds;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.GameContent.Bestiary;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.Utilities;
namespace CalamityMod.NPCs.NormalNPCs
{
public class WildBumblefuck : ModNPC
{
public override void SetStaticDefaults()
{
Main.npcFrameCount[Type] = 5;
NPCID.Sets.TrailingMode[Type] = 1;
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers()
{
Position = Vector2.UnitX * 36f
};
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
}
public override string Texture => "CalamityMod/NPCs/Bumblebirb/BumbleFolly";
public override void SetDefaults()
{
NPC.npcSlots = 1f;
NPC.aiStyle = -1;
AIType = -1;
NPC.damage = 90;
NPC.width = 120;
NPC.height = 80;
NPC.defense = 20;
NPC.LifeMaxNERB(9375, 11250, 5000); // Old HP - 12000, 15000
NPC.knockBackResist = 0.15f;
NPC.lavaImmune = true;
NPC.noTileCollide = true;
NPC.noGravity = true;
NPC.HitSound = SoundID.NPCHit51;
NPC.DeathSound = SoundID.NPCDeath46;
Banner = NPC.type;
BannerItem = ModContent.ItemType<DraconicSwarmerBanner>();
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToCold = true;
NPC.Calamity().VulnerableToSickness = true;
// Scale stats in Expert and Master
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC);
}
public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
{
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[]
{
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle,
new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.WildBumblefuck")
});
}
public override float SpawnChance(NPCSpawnInfo spawnInfo)
{
if (spawnInfo.PlayerSafe || !NPC.downedMoonlord || spawnInfo.Player.Calamity().ZoneSunkenSea || !spawnInfo.Player.ZoneJungle)
return 0f;
// Keep this as a separate if check, because it's a loop and we don't want to be checking it constantly.
if (NPC.AnyNPCs(NPC.type))
return 0f;
return SpawnCondition.SurfaceJungle.Chance * 0.14f;
}
public override void AI()
{
BumblebirbAI.VanillaBumblebirb2AI(NPC, Mod, false);
}
public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType<EffulgentFeather>(), 1, 5, 7);
public override void OnKill()
{
if (Main.zenithWorld)
{
SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
for (int i = 0; i < 5; i++)
{
Vector2 fireFrom = new Vector2(NPC.Center.X + (40 * i) - 120, NPC.Center.Y - 900f);
Vector2 ai0 = NPC.Center - fireFrom;
float ai = Main.rand.Next(100);
Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f;
Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType<RedLightning>(), NPC.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai);
}
}
}
}
public override void FindFrame(int frameHeight)
{
NPC.frameCounter += NPC.ai[0] == 2.1f ? 1.5 : 1D;
if (Main.zenithWorld)
{
NPC.frameCounter += 2D;
}
if (NPC.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base
{
NPC.frameCounter = 0D;
NPC.frame.Y += frameHeight;
}
if (NPC.frame.Y >= frameHeight * 4)
{
NPC.frame.Y = 0;
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
{
SpriteEffects spriteEffects = SpriteEffects.None;
if (NPC.spriteDirection == 1)
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[Type].Value;
Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2);
int afterimageAmt = NPC.ai[0] == 2.1f ? 7 : 0;
if (CalamityClientConfig.Instance.Afterimages)
{
for (int i = 1; i < afterimageAmt; i += 2)
{
Color afterimageColor = drawColor;
afterimageColor = Color.Lerp(afterimageColor, Color.Gold, 0.5f);
afterimageColor = NPC.GetAlpha(afterimageColor);
afterimageColor *= (afterimageAmt - i) / 15f;
Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f;
afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
}
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
return false;
}
public override void HitEffect(NPC.HitInfo hit)
{
for (int k = 0; k < 5; k++)
{
Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f);
}
if (NPC.life <= 0)
{
for (int k = 0; k < 50; k++)
{
Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f);
}
}
}
}
}
+1648 -5
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -3180,10 +3180,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas
{
for (int x = 0; x < 5; x++)
{
NPC.NewNPC(NPC.GetSource_FromAI(), spawnX + 50, tempSpawnY, ModContent.NPCType<Bumblefuck>());
NPC.NewNPC(NPC.GetSource_FromAI(), spawnX + 50, tempSpawnY, ModContent.NPCType<Dragonfolly>());
spawnX += spawnXAdd;
NPC.NewNPC(NPC.GetSource_FromAI(), spawnX2 - 50, tempSpawnY, ModContent.NPCType<Bumblefuck>());
NPC.NewNPC(NPC.GetSource_FromAI(), spawnX2 - 50, tempSpawnY, ModContent.NPCType<Dragonfolly>());
spawnX2 -= spawnXAdd;
tempSpawnY += spawnYAdd;
}
+2 -2
View File
@@ -2026,8 +2026,8 @@ namespace CalamityMod.NPCs.Yharon
{
if (CalamityWorld.LegendaryMode && revenge)
{
if (!NPC.AnyNPCs(ModContent.NPCType<Bumblefuck>()))
NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType<Bumblefuck>());
if (!NPC.AnyNPCs(ModContent.NPCType<Dragonfolly>()))
NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType<Dragonfolly>());
}
float bulletHellTeleportLocationDistance = 540f;
+1 -1
View File
@@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Boss
float y = projTileX * 16 + 900;
Vector2 laserVelocity = new Vector2(x, 160f) - new Vector2(x, y);
int type = ModContent.ProjectileType<BirbAura>();
int damage = Projectile.GetProjectileDamage(ModContent.NPCType<Bumblefuck>());
int damage = Projectile.GetProjectileDamage(ModContent.NPCType<Dragonfolly>());
if (Projectile.ai[0] >= 2f)
{
x += 1000f;
+1 -1
View File
@@ -9,7 +9,7 @@ namespace CalamityMod.Systems
{
public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium;
public override int NPCType => ModContent.NPCType<Bumblefuck>();
public override int NPCType => ModContent.NPCType<Dragonfolly>();
public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("Dragonfolly");
public override int VanillaMusic => MusicID.Boss4;
public override int OtherworldMusic => MusicID.OtherworldlyBoss2;
@@ -80,7 +80,7 @@ namespace CalamityMod.Systems.Collections
NPCType<CryogenShield>(),
NPCType<OldDukeToothBall>(),
NPCType<SulphurousSharkron>(),
NPCType<Bumblefuck2>(),
NPCType<DraconicSwarmer>(),
NPCType<AureusSpawn>(),
NPCType<Brimling>(),
NPCType<CrabShroom>(),
+1 -1
View File
@@ -78,7 +78,7 @@ namespace CalamityMod.Systems.Collections
{ NPCType<AstrumDeusHead>(), 28 },
{ NPCID.MoonLordCore, 29 },
{ NPCType<ProfanedGuardianCommander>(), 30 },
{ NPCType<Bumblefuck>(), 31 },
{ NPCType<Dragonfolly>(), 31 },
{ NPCType<Providence>(), 32 },
{ NPCType<CeaselessVoid>(), 33 },
{ NPCType<StormWeaverHead>(), 34 },
@@ -162,7 +162,7 @@ namespace CalamityMod.Systems.Collections
NPCType<RavagerHead>(),
NPCType<ProfanedGuardianDefender>(),
NPCType<ProfanedGuardianHealer>(),
NPCType<Bumblefuck2>(),
NPCType<DraconicSwarmer>(),
NPCType<ProvSpawnDefense>(),
NPCType<ProvSpawnHealer>(),
NPCType<ProvSpawnOffense>(),
+1 -1
View File
@@ -108,7 +108,7 @@ namespace CalamityMod.Tiles
npc = NPCType<AuroraSpirit>();
break;
case 11:
npc = NPCType<WildBumblefuck>(); // There's also the boss variant but I dont think we want banners to affect them?
npc = NPCType<WildBumblebirb>(); // There's also the boss variant but I dont think we want banners to affect them?
break;
/*case 12:
npc = NPCType<Unused>(); - Formerly Sea Urchin
+1 -1
View File
@@ -118,7 +118,7 @@ namespace CalamityMod.UI
28 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<AstrumDeusHead>()]].Value,
29 => TextureAssets.NpcHeadBoss[8].Value, // Moon Lord
30 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<ProfanedGuardianCommander>()]].Value,
31 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<Bumblefuck>()]].Value,
31 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<Dragonfolly>()]].Value,
32 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<Providence>()]].Value,
33 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<CeaselessVoid>()]].Value,
34 => ModContent.Request<Texture2D>("CalamityMod/NPCs/StormWeaver/StormWeaverHeadNaked_Head_Boss").Value,
+3 -3
View File
@@ -249,9 +249,9 @@ namespace CalamityMod
{ ModContent.NPCType<ProfanedGuardianHealer>(), holy },
{ ModContent.NPCType<ProfanedRocks>(), holy },
{ ModContent.NPCType<Bumblefuck>(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType<VermillionFlux>() }) },
{ ModContent.NPCType<Bumblefuck2>(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType<VermillionFlux>() }) },
{ ModContent.NPCType<WildBumblefuck>(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType<VermillionFlux>() }) },
{ ModContent.NPCType<Dragonfolly>(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType<VermillionFlux>() }) },
{ ModContent.NPCType<DraconicSwarmer>(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType<VermillionFlux>() }) },
{ ModContent.NPCType<WildBumblebirb>(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType<VermillionFlux>() }) },
{ ModContent.NPCType<Providence>(), holy },
{ ModContent.NPCType<ProvSpawnOffense>(), holy },