Removed second Skeletron Prime head
Plus some leftover Oblivion code that I missed
This commit is contained in:
1 parent
66948d0ac6
commit
1bb010de0b
19 files changed
+73
-1389
No files matched your search
@@ -213,7 +213,6 @@ namespace CalamityMod
|
||||
{ ModContent.NPCType<BrimstoneElemental>(), 0.8 },
|
||||
|
||||
{ NPCID.SkeletronPrime, 0.85 },
|
||||
{ ModContent.NPCType<SkeletronPrime2>(), 0.85 },
|
||||
{ NPCID.PrimeCannon, 0.85 },
|
||||
{ NPCID.PrimeLaser, 0.85 },
|
||||
{ NPCID.PrimeSaw, 0.85 },
|
||||
@@ -416,12 +415,6 @@ namespace CalamityMod
|
||||
102, // 204 while spinning
|
||||
119, // 238 while spinning
|
||||
153 } }, // 306 while spinning
|
||||
{ ModContent.NPCType<SkeletronPrime2>(), new int[] {
|
||||
50, // 100 while spinning
|
||||
85, // 170 while spinning
|
||||
102, // 204 while spinning
|
||||
119, // 238 while spinning
|
||||
153 } }, // 306 while spinning
|
||||
{ NPCID.PrimeVice, new int[] { 70, 102, 136, 170, 255 } },
|
||||
{ NPCID.PrimeSaw, new int[] { 70, 102, 136, 170, 255 } },
|
||||
{ NPCID.PrimeCannon, new int[] { 30, 51, 68, 85, 102 } },
|
||||
@@ -666,9 +659,6 @@ namespace CalamityMod
|
||||
{ new Tuple<int, int>(NPCID.SkeletronPrime, ProjectileID.Skull), new int[] { 50, 108, 124, 140, 210 } },
|
||||
{ new Tuple<int, int>(NPCID.SkeletronPrime, ProjectileID.DeathLaser), new int[] { 50, 108, 124, 140, 210 } },
|
||||
{ new Tuple<int, int>(NPCID.SkeletronPrime, ProjectileID.RocketSkeleton), new int[] { 60, 120, 148, 176, 264 } },
|
||||
{ new Tuple<int, int>(ModContent.NPCType<SkeletronPrime2>(), ProjectileID.Skull), new int[] { 50, 108, 124, 140, 210 } },
|
||||
{ new Tuple<int, int>(ModContent.NPCType<SkeletronPrime2>(), ProjectileID.BombSkeletronPrime), new int[] { 80, 160, 180, 200, 300 } },
|
||||
{ new Tuple<int, int>(ModContent.NPCType<SkeletronPrime2>(), ProjectileID.FrostBeam), new int[] { 50, 108, 124, 140, 210 } },
|
||||
{ new Tuple<int, int>(NPCID.PrimeCannon, ProjectileID.RocketSkeleton), new int[] { 60, 120, 148, 176, 264 } },
|
||||
{ new Tuple<int, int>(NPCID.PrimeCannon, ProjectileID.BombSkeletronPrime), new int[] { 80, 160, 0, 0, 300 } },
|
||||
{ new Tuple<int, int>(NPCID.PrimeLaser, ProjectileID.DeathLaser), new int[] { 50, 108, 124, 140, 210 } },
|
||||
|
||||
@@ -221,7 +221,7 @@ namespace CalamityMod.Events
|
||||
|
||||
new Boss(ModContent.NPCType<BrimstoneElemental>(), TimeChangeContext.Day, permittedNPCs: ModContent.NPCType<Brimling>()),
|
||||
|
||||
new Boss(NPCID.SkeletronPrime, TimeChangeContext.Night, permittedNPCs: new int[] { ModContent.NPCType<SkeletronPrime2>(), NPCID.PrimeCannon, NPCID.PrimeSaw, NPCID.PrimeVice, NPCID.PrimeLaser, NPCID.Probe }),
|
||||
new Boss(NPCID.SkeletronPrime, TimeChangeContext.Night, permittedNPCs: new int[] { NPCID.PrimeCannon, NPCID.PrimeSaw, NPCID.PrimeVice, NPCID.PrimeLaser }),
|
||||
|
||||
new Boss(ModContent.NPCType<CalamitasClone>(), TimeChangeContext.Night, permittedNPCs: new int[] { ModContent.NPCType<Cataclysm>(), ModContent.NPCType<Catastrophe>(),
|
||||
ModContent.NPCType<SoulSeeker>() }),
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.5 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 588 B |
Binary file not shown.
|
Before Width: | Height: | Size: 493 B |
@@ -20,10 +20,6 @@ namespace CalamityMod.ExtraTextures
|
||||
public static Asset<Texture2D> DestroyerBodyGlowmask;
|
||||
public static Asset<Texture2D> DestroyerTailGlowmask;
|
||||
|
||||
// Master Rev+ Skeletron Prime
|
||||
public static Asset<Texture2D> ChadPrime;
|
||||
public static Asset<Texture2D> ChadPrimeEyeGlowmask;
|
||||
|
||||
// WoF, These are not "exactly" the ExtraTextures. But
|
||||
public static Asset<Texture2D> WallOfFleshEyeGlowmask;
|
||||
public static Asset<Texture2D> WallOfFleshDemonSickleTexture;
|
||||
@@ -43,16 +39,6 @@ namespace CalamityMod.ExtraTextures
|
||||
public static Asset<Texture2D> CircularSmearFire2;
|
||||
public static Asset<Texture2D> CircularSmearFire3;
|
||||
|
||||
// Boss Heads
|
||||
// I know it's not exactly a Texture2D but it belongs to ExtraTextures.
|
||||
public static int BossHeadIndex_ChadPrime;
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
string chadPrimeIconPath = "CalamityMod/ExtraTextures/ChadPrime_Head_Boss";
|
||||
BossHeadIndex_ChadPrime = CalamityMod.Instance.AddBossHeadTexture(chadPrimeIconPath, -1);
|
||||
}
|
||||
|
||||
|
||||
// TODO: - Every other ExtraTextures Reference could be move in here
|
||||
public override void OnModLoad()
|
||||
@@ -61,9 +47,6 @@ namespace CalamityMod.ExtraTextures
|
||||
DestroyerBodyGlowmask = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerBodyGlow", AssetRequestMode.AsyncLoad);
|
||||
DestroyerTailGlowmask = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerTailGlow", AssetRequestMode.AsyncLoad);
|
||||
|
||||
ChadPrime = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/ChadPrime", AssetRequestMode.AsyncLoad);
|
||||
ChadPrimeEyeGlowmask = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/ChadPrimeHeadGlow", AssetRequestMode.AsyncLoad);
|
||||
|
||||
WallOfFleshEyeGlowmask = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/VanillaBossGlowmasks/WallOfFleshEyeTelegraphGlow", AssetRequestMode.AsyncLoad);
|
||||
WallOfFleshDemonSickleTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/ForbiddenOathbladeProjectile", AssetRequestMode.AsyncLoad);
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 602 B |
@@ -168,7 +168,6 @@ CryoSlime.DisplayName: Cryo Slime
|
||||
EbonianBlightSlime.DisplayName: Ebonian Blight Slime
|
||||
Eidolist.DisplayName: Eidolist
|
||||
FearlessGoldfishWarrior.DisplayName: Fearless Goldfish Warrior
|
||||
Foveanator.DisplayName: Foveanator
|
||||
Frogfish.DisplayName: Frogfish
|
||||
Horse.DisplayName: Earth Elemental
|
||||
IceClasper.DisplayName: Ice Clasper
|
||||
@@ -189,7 +188,6 @@ Rotdog.DisplayName: Rotdog
|
||||
ScornEater.DisplayName: Scorn Eater
|
||||
ShockstormShuttle.DisplayName: Shockstorm Shuttle
|
||||
Shroomble.DisplayName: Shroomble
|
||||
SkeletronPrime2.DisplayName: Skeletron Prime
|
||||
Stormlion.DisplayName: Stormlion
|
||||
StormlionSentry.DisplayName: Stormlion Sentry
|
||||
Sunskater.DisplayName: Sunskater
|
||||
|
||||
+41
-107
@@ -1910,10 +1910,9 @@ namespace CalamityMod.NPCs
|
||||
|
||||
npc.scale *= Main.zenithWorld ? 2f : 1.2f;
|
||||
}
|
||||
else if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType<SkeletronPrime2>())
|
||||
else if (npc.type == NPCID.SkeletronPrime)
|
||||
{
|
||||
// HP boosted in Death Mode due to having two heads (piercing can make them die faster than normal here since they share an HP bar)
|
||||
npc.lifeMax = (int)Math.Round(npc.lifeMax * (CalamityWorld.death ? 1.7 : 1.2));
|
||||
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2);
|
||||
npc.npcSlots = 12f;
|
||||
}
|
||||
else if (npc.type <= NPCID.PrimeLaser && npc.type >= NPCID.PrimeCannon)
|
||||
@@ -3941,9 +3940,6 @@ namespace CalamityMod.NPCs
|
||||
{
|
||||
if (CalamityWorld.revenge || BossRushEvent.BossRushActive)
|
||||
{
|
||||
if (npc.type == NPCID.SkeletronPrime && (CalamityWorld.death || BossRushEvent.BossRushActive))
|
||||
index = ExtraTextureRefs.BossHeadIndex_ChadPrime;
|
||||
|
||||
if (npc.type == NPCID.DukeFishron && (CalamityWorld.death || BossRushEvent.BossRushActive))
|
||||
{
|
||||
float lifeRatio = npc.life / (float)npc.lifeMax;
|
||||
@@ -6651,26 +6647,6 @@ namespace CalamityMod.NPCs
|
||||
#region Check Dead
|
||||
public override bool CheckDead(NPC npc)
|
||||
{
|
||||
if (npc.type == NPCID.SkeletronPrime)
|
||||
{
|
||||
if (CalamityWorld.death || BossRushEvent.BossRushActive)
|
||||
{
|
||||
// Kill the other head if he's still alive when this head dies
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC nPC = Main.npc[i];
|
||||
if (nPC.active && nPC.type == NPCType<SkeletronPrime2>() && nPC.life > 0)
|
||||
{
|
||||
nPC.life = 0;
|
||||
nPC.HitEffect();
|
||||
nPC.checkDead();
|
||||
nPC.active = false;
|
||||
nPC.netUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (npc.lifeMax > 1000 && npc.type != NPCID.DungeonSpirit &&
|
||||
npc.type != NPCType<PhantomSpirit>() &&
|
||||
npc.type != NPCType<PhantomSpiritS>() &&
|
||||
@@ -7462,11 +7438,11 @@ namespace CalamityMod.NPCs
|
||||
#region Drawing
|
||||
public override void FindFrame(NPC npc, int frameHeight)
|
||||
{
|
||||
if (CalamityWorld.revenge || BossRushEvent.BossRushActive)
|
||||
/*if (CalamityWorld.revenge || BossRushEvent.BossRushActive)
|
||||
{
|
||||
if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType<SkeletronPrime2>())
|
||||
if (npc.type == NPCID.SkeletronPrime)
|
||||
npc.frameCounter = 0D;
|
||||
}
|
||||
}*/
|
||||
// Increment the bestiary worm timer when hovering over the NPC or having their entry open. Pauses otherwise
|
||||
if (npc.IsABestiaryIconDummy)
|
||||
{
|
||||
@@ -8013,8 +7989,43 @@ namespace CalamityMod.NPCs
|
||||
|
||||
if (CalamityWorld.revenge || BossRushEvent.BossRushActive)
|
||||
{
|
||||
if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType<SkeletronPrime2>() || DestroyerIDList.Includes(npc.type))
|
||||
if (DestroyerIDList.Includes(npc.type))
|
||||
shouldDrawBool = false;
|
||||
|
||||
// Allows correct frames to draw in Rev+ phases
|
||||
// GFB can rot for all I care
|
||||
if (npc.type == NPCID.SkeletronPrime && !NPC.IsMechQueenUp)
|
||||
{
|
||||
int frameHeight = TextureAssets.Npc[npc.type].Value.Height / Main.npcFrameCount[npc.type];
|
||||
if (npc.ai[1] == 0f || npc.ai[1] == 4f)
|
||||
{
|
||||
newAI[2] += 1f;
|
||||
if (newAI[2] >= 12f)
|
||||
{
|
||||
newAI[2] = 0f;
|
||||
newAI[3] += frameHeight;
|
||||
|
||||
if (newAI[3] / frameHeight >= 2f)
|
||||
newAI[3] = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
// Spinning probe spawn or fly over phase
|
||||
else if (npc.ai[1] == 5f || npc.ai[1] == 6f)
|
||||
{
|
||||
newAI[2] = 0f;
|
||||
newAI[3] = frameHeight;
|
||||
}
|
||||
|
||||
// Spinning phase
|
||||
else
|
||||
{
|
||||
newAI[2] = 0f;
|
||||
newAI[3] = frameHeight * 2;
|
||||
}
|
||||
|
||||
npc.frame.Y = (int)newAI[3];
|
||||
}
|
||||
}
|
||||
|
||||
if (npc.type == NPCID.Corruptor || npc.type == NPCID.BloodSquid || (npc.type == NPCID.HornetHoney && npc.ai[3] == 1f))
|
||||
@@ -8565,83 +8576,6 @@ namespace CalamityMod.NPCs
|
||||
}
|
||||
}
|
||||
|
||||
// His afterimages I can't get to work, so fuck it
|
||||
else if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType<SkeletronPrime2>())
|
||||
{
|
||||
Texture2D npcTexture = (death && npc.type == NPCID.SkeletronPrime) ? ExtraTextureRefs.ChadPrime.Value : TextureAssets.Npc[npc.type].Value;
|
||||
int frameHeight = npcTexture.Height / Main.npcFrameCount[npc.type];
|
||||
|
||||
npc.frame.Y = (int)newAI[3];
|
||||
|
||||
// Mechdusa drawing
|
||||
if (NPC.IsMechQueenUp)
|
||||
{
|
||||
if (npc.ai[1] == 0f || npc.ai[1] == 4f)
|
||||
{
|
||||
newAI[2] += 1f;
|
||||
if (newAI[2] >= 12f)
|
||||
{
|
||||
newAI[2] = 0f;
|
||||
newAI[3] += frameHeight;
|
||||
if (newAI[3] / frameHeight >= 5)
|
||||
newAI[3] = frameHeight * 3;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newAI[2] = 0f;
|
||||
newAI[3] = frameHeight * 5;
|
||||
}
|
||||
}
|
||||
|
||||
// Floating phase
|
||||
else if (npc.ai[1] == 0f || npc.ai[1] == 4f)
|
||||
{
|
||||
newAI[2] += 1f;
|
||||
if (newAI[2] >= 12f)
|
||||
{
|
||||
newAI[2] = 0f;
|
||||
newAI[3] += frameHeight;
|
||||
|
||||
if (newAI[3] / frameHeight >= 2f)
|
||||
newAI[3] = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
// Spinning probe spawn or fly over phase
|
||||
else if (npc.ai[1] == 5f || npc.ai[1] == 6f)
|
||||
{
|
||||
newAI[2] = 0f;
|
||||
newAI[3] = frameHeight;
|
||||
}
|
||||
|
||||
// Spinning phase
|
||||
else
|
||||
{
|
||||
newAI[2] = 0f;
|
||||
newAI[3] = frameHeight * 2;
|
||||
}
|
||||
|
||||
npc.frame.Y = (int)newAI[3];
|
||||
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (npc.spriteDirection == 1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
spriteBatch.Draw(npcTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, npc.GetAlpha(drawColor), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0f);
|
||||
|
||||
Color eyesColor = new Color(200, 200, 200, 0);
|
||||
if (death)
|
||||
{
|
||||
int alpha = 192;
|
||||
eyesColor = npc.type == NPCType<SkeletronPrime2>() ? new Color(150, 100, 255, alpha) : new Color(255, 255, 0, alpha);
|
||||
Texture2D glowTexture = npc.type == NPCID.SkeletronPrime ? ExtraTextureRefs.ChadPrimeEyeGlowmask.Value : SkeletronPrime2.EyeTexture.Value;
|
||||
spriteBatch.Draw(glowTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, eyesColor, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
else
|
||||
spriteBatch.Draw(TextureAssets.BoneEyes.Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, eyesColor, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
|
||||
else if (npc.type == NPCID.Plantera)
|
||||
{
|
||||
// Percent life remaining
|
||||
|
||||
@@ -1,921 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.DataStructures;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.Chat;
|
||||
using Terraria.GameContent.Achievements;
|
||||
using Terraria.GameContent.Bestiary;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.NormalNPCs
|
||||
{
|
||||
[AutoloadBossHead]
|
||||
public class SkeletronPrime2 : ModNPC
|
||||
{
|
||||
public override string BossHeadTexture => $"Terraria/Images/NPC_Head_Boss_18";
|
||||
|
||||
public static Asset<Texture2D> EyeTexture;
|
||||
|
||||
public const int BombTimeLeft = 600;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.npcFrameCount[Type] = 6;
|
||||
NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true };
|
||||
NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData);
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
EyeTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/SkeletronPrime2HeadGlow");
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.Calamity().canBreakPlayerDefense = true;
|
||||
NPC.aiStyle = NPCAIStyleID.SkeletronPrimeHead;
|
||||
NPC.GetNPCDamage();
|
||||
NPC.DR_NERD(0.2f);
|
||||
|
||||
NPC.width = 80;
|
||||
NPC.height = 102;
|
||||
if (Main.tenthAnniversaryWorld)
|
||||
NPC.scale *= 0.5f;
|
||||
if (CalamityWorld.LegendaryMode)
|
||||
NPC.scale *= 1.1f;
|
||||
|
||||
NPC.defense = 24;
|
||||
NPC.lifeMax = 28000;
|
||||
NPC.knockBackResist = 0f;
|
||||
NPC.noGravity = true;
|
||||
NPC.noTileCollide = true;
|
||||
NPC.boss = true;
|
||||
NPC.HitSound = SoundID.NPCHit4;
|
||||
NPC.DeathSound = SoundID.NPCDeath14;
|
||||
NPC.Calamity().VulnerableToElectricity = true;
|
||||
NPC.Calamity().VulnerableToSickness = false;
|
||||
AnimationType = NPCID.SkeletronPrime;
|
||||
Music = MusicID.Boss3;
|
||||
}
|
||||
|
||||
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 BossHeadRotation(ref float rotation)
|
||||
{
|
||||
rotation = (NPC.ai[1] == 1f || NPC.ai[1] == 2f) ? NPC.rotation : 0f;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity();
|
||||
|
||||
bool bossRush = BossRushEvent.BossRushActive;
|
||||
bool death = CalamityWorld.death || bossRush;
|
||||
|
||||
// Percent life remaining
|
||||
float lifeRatio = NPC.life / (float)NPC.lifeMax;
|
||||
|
||||
// Spawn arms
|
||||
if (calamityGlobalNPC.newAI[1] == 0f)
|
||||
{
|
||||
calamityGlobalNPC.newAI[1] = 1f;
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
// This head owns the Cannon and the Vice in Master Mode
|
||||
int arm = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.PrimeCannon, NPC.whoAmI);
|
||||
Main.npc[arm].ai[0] = -1f;
|
||||
Main.npc[arm].ai[1] = NPC.whoAmI;
|
||||
Main.npc[arm].target = NPC.target;
|
||||
Main.npc[arm].netUpdate = true;
|
||||
|
||||
arm = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.PrimeVice, NPC.whoAmI);
|
||||
Main.npc[arm].ai[0] = -1f;
|
||||
Main.npc[arm].ai[1] = NPC.whoAmI;
|
||||
Main.npc[arm].target = NPC.target;
|
||||
Main.npc[arm].ai[3] = 150f;
|
||||
Main.npc[arm].netUpdate = true;
|
||||
}
|
||||
|
||||
NPC.SyncExtraAI();
|
||||
}
|
||||
|
||||
if (!Main.npc[(int)NPC.ai[0]].active || Main.npc[(int)NPC.ai[0]].aiStyle != NPCAIStyleID.SkeletronPrimeHead)
|
||||
{
|
||||
NPC.life = 0;
|
||||
NPC.HitEffect();
|
||||
NPC.active = false;
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set direction to the other head's direction
|
||||
NPC.direction = Main.npc[(int)NPC.ai[0]].direction;
|
||||
|
||||
// Link the HP of both heads
|
||||
if (NPC.life > Main.npc[(int)NPC.ai[0]].life)
|
||||
NPC.life = Main.npc[(int)NPC.ai[0]].life;
|
||||
|
||||
// Push away from the lead head if too close, pull closer if too far, if Mechdusa isn't real
|
||||
if (!NPC.IsMechQueenUp)
|
||||
{
|
||||
float pushVelocity = 0.25f;
|
||||
if (Vector2.Distance(NPC.Center, Main.npc[(int)NPC.ai[0]].Center) < 80f * NPC.scale)
|
||||
{
|
||||
if (NPC.position.X < Main.npc[(int)NPC.ai[0]].position.X)
|
||||
NPC.velocity.X -= pushVelocity;
|
||||
else
|
||||
NPC.velocity.X += pushVelocity;
|
||||
|
||||
if (NPC.position.Y < Main.npc[(int)NPC.ai[0]].position.Y)
|
||||
NPC.velocity.Y -= pushVelocity;
|
||||
else
|
||||
NPC.velocity.Y += pushVelocity;
|
||||
}
|
||||
else if (Vector2.Distance(NPC.Center, Main.npc[(int)NPC.ai[0]].Center) > 240f * NPC.scale)
|
||||
{
|
||||
if (NPC.position.X < Main.npc[(int)NPC.ai[0]].position.X)
|
||||
NPC.velocity.X += pushVelocity;
|
||||
else
|
||||
NPC.velocity.X -= pushVelocity;
|
||||
|
||||
if (NPC.position.Y < Main.npc[(int)NPC.ai[0]].position.Y)
|
||||
NPC.velocity.Y += pushVelocity;
|
||||
else
|
||||
NPC.velocity.Y -= pushVelocity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if arms are alive
|
||||
bool cannonAlive = false;
|
||||
bool laserAlive = false;
|
||||
bool viceAlive = false;
|
||||
bool sawAlive = false;
|
||||
if (CalamityGlobalNPC.primeCannon != -1)
|
||||
{
|
||||
if (Main.npc[CalamityGlobalNPC.primeCannon].active)
|
||||
cannonAlive = true;
|
||||
}
|
||||
if (CalamityGlobalNPC.primeLaser != -1)
|
||||
{
|
||||
if (Main.npc[CalamityGlobalNPC.primeLaser].active)
|
||||
laserAlive = true;
|
||||
}
|
||||
if (CalamityGlobalNPC.primeVice != -1)
|
||||
{
|
||||
if (Main.npc[CalamityGlobalNPC.primeVice].active)
|
||||
viceAlive = true;
|
||||
}
|
||||
if (CalamityGlobalNPC.primeSaw != -1)
|
||||
{
|
||||
if (Main.npc[CalamityGlobalNPC.primeSaw].active)
|
||||
sawAlive = true;
|
||||
}
|
||||
bool allArmsDead = !cannonAlive && !laserAlive && !viceAlive && !sawAlive;
|
||||
NPC.chaseable = allArmsDead;
|
||||
|
||||
NPC.defense = NPC.defDefense;
|
||||
|
||||
// Phases
|
||||
bool phase2 = lifeRatio < 0.66f;
|
||||
bool phase3 = lifeRatio < 0.33f;
|
||||
bool spawnSpazmatism = lifeRatio < 0.5f && !bossRush && NPC.localAI[2] == 0f;
|
||||
|
||||
// Spawn Spazmatism in Master Mode (just like Oblivion from Avalon)
|
||||
if (spawnSpazmatism)
|
||||
{
|
||||
Player spazmatismSpawnPlayer = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)];
|
||||
SoundEngine.PlaySound(SoundID.Roar, spazmatismSpawnPlayer.Center);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int spazmatism = NPC.NewNPC(NPC.GetBossSpawnSource(spazmatismSpawnPlayer.whoAmI), (int)spazmatismSpawnPlayer.Center.X, (int)spazmatismSpawnPlayer.Center.Y - 810, NPCID.Retinazer, 1);
|
||||
if (spazmatism != Main.maxNPCs)
|
||||
{
|
||||
Main.npc[spazmatism].target = spazmatismSpawnPlayer.whoAmI;
|
||||
Main.npc[spazmatism].timeLeft *= 20;
|
||||
Main.npc[spazmatism].localAI[3] = 1f;
|
||||
Main.npc[spazmatism].SyncVanillaLocalAI();
|
||||
string typeName = Main.npc[spazmatism].TypeName;
|
||||
if (Main.dedServ && spazmatism < Main.maxNPCs)
|
||||
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, spazmatism);
|
||||
|
||||
AchievementsHelper.CheckMechaMayhem();
|
||||
}
|
||||
}
|
||||
|
||||
NPC.localAI[2] = 1f;
|
||||
NPC.SyncVanillaLocalAI();
|
||||
}
|
||||
|
||||
// Despawn
|
||||
if (Main.npc[(int)NPC.ai[0]].ai[1] == 3f)
|
||||
NPC.ai[1] = 3f;
|
||||
|
||||
// Activate daytime enrage
|
||||
if (Main.IsItDay() && !bossRush && NPC.ai[1] != 3f && NPC.ai[1] != 2f)
|
||||
{
|
||||
// Heal
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int healAmt = NPC.life - 300;
|
||||
if (healAmt < 0)
|
||||
{
|
||||
int absHeal = Math.Abs(healAmt);
|
||||
NPC.life += absHeal;
|
||||
NPC.HealEffect(absHeal, true);
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
NPC.ai[1] = 2f;
|
||||
SoundEngine.PlaySound(SoundID.ForceRoar, NPC.Center);
|
||||
}
|
||||
|
||||
// Adjust slowing debuff immunity
|
||||
bool immuneToSlowingDebuffs = NPC.ai[1] == 5f;
|
||||
NPC.buffImmune[ModContent.BuffType<GlacialState>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<TemporalSadness>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<Eutrophication>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<TimeDistortion>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<GalvanicCorrosion>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<Vaporfied>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs;
|
||||
|
||||
bool normalLaserRotation = NPC.localAI[1] % 2f == 0f;
|
||||
|
||||
// Prevents cheap hits
|
||||
bool canUseAttackInMaster = NPC.position.Y < Main.player[Main.npc[(int)NPC.ai[0]].target].position.Y - 350f;
|
||||
|
||||
// Float near player
|
||||
if (NPC.ai[1] == 0f || NPC.ai[1] == 4f)
|
||||
{
|
||||
// Avoid unfair bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
// Start other phases; if arms are dead, start with spin phase
|
||||
bool otherHeadChargingOrSpinning = Main.npc[(int)NPC.ai[0]].ai[1] == 5f || Main.npc[(int)NPC.ai[0]].ai[1] == 1f;
|
||||
|
||||
// Start spin phase after 1.875 seconds
|
||||
NPC.ai[2] += phase3 ? 1.2f : 0.8f;
|
||||
if (NPC.ai[2] >= (90f - (death ? 15f * (1f - lifeRatio) : 0f)) && (!otherHeadChargingOrSpinning || phase3) && canUseAttackInMaster)
|
||||
{
|
||||
bool shouldSpinAround = NPC.ai[1] == 4f && NPC.position.Y < Main.player[Main.npc[(int)NPC.ai[0]].target].position.Y - 320f &&
|
||||
Vector2.Distance(Main.player[Main.npc[(int)NPC.ai[0]].target].Center, NPC.Center) < 600f && Vector2.Distance(Main.player[Main.npc[(int)NPC.ai[0]].target].Center, NPC.Center) > 400f;
|
||||
|
||||
bool shouldCharge = !phase2 && !allArmsDead && !CalamityWorld.LegendaryMode;
|
||||
if (shouldCharge)
|
||||
{
|
||||
NPC.ai[2] = 0f;
|
||||
NPC.ai[1] = 1f;
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
else if (shouldSpinAround || NPC.ai[1] != 4f)
|
||||
{
|
||||
if (shouldSpinAround)
|
||||
{
|
||||
NPC.localAI[3] = 300f;
|
||||
NPC.SyncVanillaLocalAI();
|
||||
}
|
||||
|
||||
NPC.ai[2] = 0f;
|
||||
NPC.ai[1] = shouldSpinAround ? 5f : 1f;
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (NPC.IsMechQueenUp)
|
||||
NPC.rotation = NPC.rotation.AngleLerp(NPC.velocity.X / 15f * 0.5f, 0.75f);
|
||||
else
|
||||
NPC.rotation = NPC.velocity.X / 15f;
|
||||
|
||||
float acceleration = (bossRush ? 0.16f : 0.12f) + (death ? 0.05f * (1f - lifeRatio) : 0f);
|
||||
float accelerationMult = 1f;
|
||||
if (!cannonAlive)
|
||||
{
|
||||
acceleration += 0.0125f;
|
||||
accelerationMult += 0.25f;
|
||||
}
|
||||
if (!laserAlive)
|
||||
{
|
||||
acceleration += 0.0125f;
|
||||
accelerationMult += 0.25f;
|
||||
}
|
||||
if (!viceAlive)
|
||||
acceleration += 0.0125f;
|
||||
if (!sawAlive)
|
||||
acceleration += 0.0125f;
|
||||
acceleration *= accelerationMult;
|
||||
|
||||
float topVelocity = acceleration * 100f;
|
||||
float deceleration = 0.7f;
|
||||
|
||||
float headDecelerationUpDist = 0f;
|
||||
float headDecelerationDownDist = 0f;
|
||||
float headDecelerationHorizontalDist = 0f;
|
||||
int headHorizontalDirection = ((!(Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X < NPC.Center.X)) ? 1 : (-1));
|
||||
if (NPC.IsMechQueenUp)
|
||||
{
|
||||
headDecelerationHorizontalDist = -150f * (float)headHorizontalDirection;
|
||||
headDecelerationUpDist = 50f;
|
||||
headDecelerationDownDist = 50f;
|
||||
}
|
||||
|
||||
if (NPC.position.Y > Main.player[Main.npc[(int)NPC.ai[0]].target].position.Y - (320f + headDecelerationUpDist))
|
||||
{
|
||||
if (NPC.velocity.Y > 0f)
|
||||
NPC.velocity.Y *= deceleration;
|
||||
|
||||
NPC.velocity.Y -= acceleration;
|
||||
|
||||
if (NPC.velocity.Y > topVelocity)
|
||||
NPC.velocity.Y = topVelocity;
|
||||
}
|
||||
else if (NPC.position.Y < Main.player[Main.npc[(int)NPC.ai[0]].target].position.Y - (360f + headDecelerationDownDist))
|
||||
{
|
||||
if (NPC.velocity.Y < 0f)
|
||||
NPC.velocity.Y *= deceleration;
|
||||
|
||||
NPC.velocity.Y += acceleration;
|
||||
|
||||
if (NPC.velocity.Y < -topVelocity)
|
||||
NPC.velocity.Y = -topVelocity;
|
||||
}
|
||||
|
||||
if (NPC.Center.X > Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X + (400f + headDecelerationHorizontalDist))
|
||||
{
|
||||
if (NPC.velocity.X > 0f)
|
||||
NPC.velocity.X *= deceleration;
|
||||
|
||||
NPC.velocity.X -= acceleration;
|
||||
|
||||
if (NPC.velocity.X > topVelocity)
|
||||
NPC.velocity.X = topVelocity;
|
||||
}
|
||||
if (NPC.Center.X < Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X - (400f + headDecelerationHorizontalDist))
|
||||
{
|
||||
if (NPC.velocity.X < 0f)
|
||||
NPC.velocity.X *= deceleration;
|
||||
|
||||
NPC.velocity.X += acceleration;
|
||||
|
||||
if (NPC.velocity.X < -topVelocity)
|
||||
NPC.velocity.X = -topVelocity;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// Spinning
|
||||
if (NPC.ai[1] == 1f)
|
||||
{
|
||||
NPC.defense *= 2;
|
||||
NPC.damage = NPC.defDamage * 2;
|
||||
|
||||
calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = true;
|
||||
|
||||
if (phase2 && Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
NPC.localAI[0] += 1f;
|
||||
if (NPC.localAI[0] >= 60f)
|
||||
{
|
||||
NPC.localAI[0] = 0f;
|
||||
|
||||
int totalProjectiles = bossRush ? 20 : death ? 12 : 10;
|
||||
float radians = MathHelper.TwoPi / totalProjectiles;
|
||||
int type = ProjectileID.FrostBeam;
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
|
||||
// Reduce mech boss projectile damage depending on the new ore progression changes
|
||||
if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive)
|
||||
{
|
||||
double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert;
|
||||
double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert;
|
||||
if (!NPC.downedMechBossAny)
|
||||
damage = (int)(damage * firstMechMultiplier);
|
||||
else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1))
|
||||
damage = (int)(damage * secondMechMultiplier);
|
||||
}
|
||||
|
||||
float velocity = 4.5f;
|
||||
double angleA = radians * 0.5;
|
||||
double angleB = MathHelper.ToRadians(90f) - angleA;
|
||||
float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB));
|
||||
Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity);
|
||||
for (int k = 0; k < totalProjectiles; k++)
|
||||
{
|
||||
Vector2 laserFireDirection = spinningPoint.RotatedBy(radians * k);
|
||||
int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + laserFireDirection.SafeNormalize(Vector2.UnitY) * 140f, laserFireDirection, type, damage, 0f, Main.myPlayer, 1f, 0f);
|
||||
Main.projectile[proj].timeLeft = 600;
|
||||
}
|
||||
NPC.localAI[1] += 1f;
|
||||
}
|
||||
}
|
||||
|
||||
NPC.ai[2] += 1f;
|
||||
if (NPC.ai[2] == 2f)
|
||||
SoundEngine.PlaySound(SoundID.ForceRoar, NPC.Center);
|
||||
|
||||
// Spin for 3 seconds then return to floating phase
|
||||
float phaseTimer = 240f;
|
||||
if (phase2 && !phase3)
|
||||
phaseTimer += 60f;
|
||||
|
||||
if (NPC.ai[2] >= (phaseTimer - (death ? 60f * (1f - lifeRatio) : 0f)))
|
||||
{
|
||||
NPC.ai[2] = 0f;
|
||||
NPC.ai[1] = 4f;
|
||||
NPC.localAI[0] = 0f;
|
||||
}
|
||||
|
||||
if (NPC.IsMechQueenUp)
|
||||
NPC.rotation = NPC.rotation.AngleLerp(NPC.velocity.X / 15f * 0.5f, 0.75f);
|
||||
else
|
||||
NPC.rotation += NPC.direction * 0.3f;
|
||||
|
||||
Vector2 headPosition = NPC.Center;
|
||||
float headTargetX = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X - headPosition.X;
|
||||
float headTargetY = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.Y - headPosition.Y;
|
||||
float headTargetDistance = (float)Math.Sqrt(headTargetX * headTargetX + headTargetY * headTargetY);
|
||||
|
||||
float speed = bossRush ? 12f : 8f;
|
||||
if (phase2)
|
||||
speed += 0.5f;
|
||||
if (phase3)
|
||||
speed += 0.5f;
|
||||
|
||||
if (headTargetDistance > 150f)
|
||||
{
|
||||
float baseDistanceVelocityMult = 1f + MathHelper.Clamp((headTargetDistance - 150f) * 0.0015f, 0.05f, 1.5f);
|
||||
speed *= baseDistanceVelocityMult;
|
||||
}
|
||||
|
||||
if (NPC.IsMechQueenUp)
|
||||
{
|
||||
float mechdusaSpeedMult = (NPC.npcsFoundForCheckActive[NPCID.TheDestroyerBody] ? 0.6f : 0.75f);
|
||||
speed *= mechdusaSpeedMult;
|
||||
}
|
||||
|
||||
headTargetDistance = speed / headTargetDistance;
|
||||
NPC.velocity.X = headTargetX * headTargetDistance;
|
||||
NPC.velocity.Y = headTargetY * headTargetDistance;
|
||||
|
||||
if (NPC.IsMechQueenUp)
|
||||
{
|
||||
float mechdusaAccelMult = Vector2.Distance(NPC.Center, Main.player[Main.npc[(int)NPC.ai[0]].target].Center);
|
||||
if (mechdusaAccelMult < 0.1f)
|
||||
mechdusaAccelMult = 0f;
|
||||
|
||||
if (mechdusaAccelMult < speed)
|
||||
NPC.velocity = NPC.velocity.SafeNormalize(Vector2.Zero) * mechdusaAccelMult;
|
||||
}
|
||||
}
|
||||
|
||||
// Daytime enrage
|
||||
if (NPC.ai[1] == 2f)
|
||||
{
|
||||
NPC.damage = 1000;
|
||||
calamityGlobalNPC.DR = 0.9999f;
|
||||
calamityGlobalNPC.unbreakableDR = true;
|
||||
|
||||
calamityGlobalNPC.CurrentlyEnraged = true;
|
||||
calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = true;
|
||||
|
||||
if (NPC.IsMechQueenUp)
|
||||
NPC.rotation = NPC.rotation.AngleLerp(NPC.velocity.X / 15f * 0.5f, 0.75f);
|
||||
else
|
||||
NPC.rotation += NPC.direction * 0.3f;
|
||||
|
||||
Vector2 enragedHeadPosition = NPC.Center;
|
||||
float enragedHeadTargetX = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X - enragedHeadPosition.X;
|
||||
float enragedHeadTargetY = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.Y - enragedHeadPosition.Y;
|
||||
float enragedHeadTargetDist = (float)Math.Sqrt(enragedHeadTargetX * enragedHeadTargetX + enragedHeadTargetY * enragedHeadTargetY);
|
||||
|
||||
float enragedHeadSpeed = 10f;
|
||||
enragedHeadSpeed += enragedHeadTargetDist / 100f;
|
||||
if (enragedHeadSpeed < 8f)
|
||||
enragedHeadSpeed = 8f;
|
||||
if (enragedHeadSpeed > 32f)
|
||||
enragedHeadSpeed = 32f;
|
||||
|
||||
enragedHeadTargetDist = enragedHeadSpeed / enragedHeadTargetDist;
|
||||
NPC.velocity.X = enragedHeadTargetX * enragedHeadTargetDist;
|
||||
NPC.velocity.Y = enragedHeadTargetY * enragedHeadTargetDist;
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
NPC.localAI[0] += 1f;
|
||||
if (NPC.localAI[0] >= 60f)
|
||||
{
|
||||
NPC.localAI[0] = 0f;
|
||||
Vector2 headCenter = NPC.Center;
|
||||
if (Collision.CanHit(headCenter, 1, 1, Main.player[Main.npc[(int)NPC.ai[0]].target].position, Main.player[Main.npc[(int)NPC.ai[0]].target].width, Main.player[Main.npc[(int)NPC.ai[0]].target].height))
|
||||
{
|
||||
enragedHeadSpeed = 7f;
|
||||
float enragedHeadSkullTargetX = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X - headCenter.X + Main.rand.Next(-20, 21);
|
||||
float enragedHeadSkullTargetY = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.Y - headCenter.Y + Main.rand.Next(-20, 21);
|
||||
float enragedHeadSkullTargetDist = (float)Math.Sqrt(enragedHeadSkullTargetX * enragedHeadSkullTargetX + enragedHeadSkullTargetY * enragedHeadSkullTargetY);
|
||||
enragedHeadSkullTargetDist = enragedHeadSpeed / enragedHeadSkullTargetDist;
|
||||
enragedHeadSkullTargetX *= enragedHeadSkullTargetDist;
|
||||
enragedHeadSkullTargetY *= enragedHeadSkullTargetDist;
|
||||
|
||||
Vector2 value = new Vector2(enragedHeadSkullTargetX * 1f + Main.rand.Next(-50, 51) * 0.01f, enragedHeadSkullTargetY * 1f + Main.rand.Next(-50, 51) * 0.01f).SafeNormalize(Vector2.UnitY);
|
||||
value *= enragedHeadSpeed;
|
||||
value += NPC.velocity;
|
||||
enragedHeadSkullTargetX = value.X;
|
||||
enragedHeadSkullTargetY = value.Y;
|
||||
|
||||
int type = ProjectileID.Skull;
|
||||
headCenter += value * 5f;
|
||||
int enragedSkulls = Projectile.NewProjectile(NPC.GetSource_FromAI(), headCenter.X, headCenter.Y, enragedHeadSkullTargetX, enragedHeadSkullTargetY, type, 250, 0f, Main.myPlayer, -1f, 0f);
|
||||
Main.projectile[enragedSkulls].timeLeft = 300;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Despawning
|
||||
if (NPC.ai[1] == 3f)
|
||||
{
|
||||
// Avoid unfair bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
if (NPC.IsMechQueenUp)
|
||||
{
|
||||
int mechdusaBossDespawning = NPC.FindFirstNPC(NPCID.Retinazer);
|
||||
if (mechdusaBossDespawning >= 0)
|
||||
Main.npc[mechdusaBossDespawning].EncourageDespawn(5);
|
||||
|
||||
mechdusaBossDespawning = NPC.FindFirstNPC(NPCID.Spazmatism);
|
||||
if (mechdusaBossDespawning >= 0)
|
||||
Main.npc[mechdusaBossDespawning].EncourageDespawn(5);
|
||||
|
||||
if (!NPC.AnyNPCs(NPCID.Retinazer) && !NPC.AnyNPCs(NPCID.Spazmatism))
|
||||
{
|
||||
mechdusaBossDespawning = NPC.FindFirstNPC(NPCID.TheDestroyer);
|
||||
if (mechdusaBossDespawning >= 0)
|
||||
Main.npc[mechdusaBossDespawning].Transform(NPCID.TheDestroyerTail);
|
||||
|
||||
NPC.EncourageDespawn(5);
|
||||
}
|
||||
|
||||
NPC.velocity.Y += 0.1f;
|
||||
if (NPC.velocity.Y < 0f)
|
||||
NPC.velocity.Y *= 0.95f;
|
||||
|
||||
NPC.velocity.X *= 0.95f;
|
||||
if (NPC.velocity.Y > 13f)
|
||||
NPC.velocity.Y = 13f;
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.velocity.Y += 0.1f;
|
||||
if (NPC.velocity.Y < 0f)
|
||||
NPC.velocity.Y *= 0.9f;
|
||||
|
||||
NPC.velocity.X *= 0.9f;
|
||||
|
||||
if (NPC.timeLeft > 500)
|
||||
NPC.timeLeft = 500;
|
||||
}
|
||||
}
|
||||
|
||||
// Fly around in a circle
|
||||
if (NPC.ai[1] == 5f)
|
||||
{
|
||||
// Avoid unfair bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
NPC.ai[2] += 1f;
|
||||
|
||||
NPC.rotation = NPC.velocity.X / 50f;
|
||||
|
||||
float bombSpawnDivisor = bossRush ? 14f : death ? 22f - (float)Math.Round(5f * (1f - lifeRatio)) : 22f;
|
||||
float totalBombs = 6f;
|
||||
int bombSpread = bossRush ? 250 : death ? 125 : 100;
|
||||
|
||||
// Spin for about 3 seconds
|
||||
float spinVelocity = 24f;
|
||||
if (NPC.ai[2] == 2f)
|
||||
{
|
||||
// Play angry noise
|
||||
SoundEngine.PlaySound(SoundID.ForceRoar, NPC.Center);
|
||||
|
||||
// Set spin direction
|
||||
if (Main.player[Main.npc[(int)NPC.ai[0]].target].velocity.X > 0f)
|
||||
calamityGlobalNPC.newAI[0] = 1f;
|
||||
else if (Main.player[Main.npc[(int)NPC.ai[0]].target].velocity.X < 0f)
|
||||
calamityGlobalNPC.newAI[0] = -1f;
|
||||
else
|
||||
calamityGlobalNPC.newAI[0] = Main.player[Main.npc[(int)NPC.ai[0]].target].direction;
|
||||
|
||||
// Set spin velocity
|
||||
NPC.velocity.X = MathHelper.Pi * NPC.localAI[3] / spinVelocity;
|
||||
NPC.velocity *= -calamityGlobalNPC.newAI[0];
|
||||
NPC.SyncExtraAI();
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
|
||||
// Maintain velocity and spit homing bombs
|
||||
else if (NPC.ai[2] > 2f)
|
||||
{
|
||||
NPC.velocity = NPC.velocity.RotatedBy(MathHelper.Pi / spinVelocity * -calamityGlobalNPC.newAI[0]);
|
||||
if (NPC.ai[2] == 3f)
|
||||
NPC.velocity *= 0.6f;
|
||||
|
||||
if (NPC.ai[2] % bombSpawnDivisor == 0f)
|
||||
{
|
||||
NPC.localAI[0] += 1f;
|
||||
|
||||
if (Vector2.Distance(Main.player[Main.npc[(int)NPC.ai[0]].target].Center, NPC.Center) > 64f)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item61, NPC.Center);
|
||||
CreateParticles(NPC, new Vector2(NPC.Center.X + Main.rand.Next(NPC.width / 2), NPC.Center.Y + 4f));
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
Vector2 headCenter = NPC.Center;
|
||||
float enragedHeadSpeed = 6f + (death ? 2f * (1f - lifeRatio) : 0f);
|
||||
float enragedHeadBombTargetX = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X - headCenter.X + Main.rand.Next(-20, 21);
|
||||
float enragedHeadBombTargetY = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.Y - headCenter.Y + Main.rand.Next(-20, 21);
|
||||
float enragedHeadBombTargetDist = (float)Math.Sqrt(enragedHeadBombTargetX * enragedHeadBombTargetX + enragedHeadBombTargetY * enragedHeadBombTargetY);
|
||||
enragedHeadBombTargetDist = enragedHeadSpeed / enragedHeadBombTargetDist;
|
||||
enragedHeadBombTargetX *= enragedHeadBombTargetDist;
|
||||
enragedHeadBombTargetY *= enragedHeadBombTargetDist;
|
||||
|
||||
Vector2 value = new Vector2(enragedHeadBombTargetX + Main.rand.Next(-bombSpread, bombSpread + 1) * 0.01f, enragedHeadBombTargetY + Main.rand.Next(-bombSpread, bombSpread + 1) * 0.01f).SafeNormalize(Vector2.UnitY);
|
||||
value *= enragedHeadSpeed;
|
||||
enragedHeadBombTargetX = value.X;
|
||||
enragedHeadBombTargetY = value.Y;
|
||||
|
||||
int type = ProjectileID.BombSkeletronPrime;
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
|
||||
// Reduce mech boss projectile damage depending on the new ore progression changes
|
||||
if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive)
|
||||
{
|
||||
double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert;
|
||||
double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert;
|
||||
if (!NPC.downedMechBossAny)
|
||||
damage = (int)(damage * firstMechMultiplier);
|
||||
else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1))
|
||||
damage = (int)(damage * secondMechMultiplier);
|
||||
}
|
||||
|
||||
int enragedBombs = Projectile.NewProjectile(NPC.GetSource_FromAI(), headCenter.X, headCenter.Y + 30f, enragedHeadBombTargetX, enragedHeadBombTargetY, type, damage, 0f, Main.myPlayer, -1f);
|
||||
Main.projectile[enragedBombs].timeLeft = BombTimeLeft;
|
||||
Main.projectile[enragedBombs].tileCollide = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Go to floating phase, or spinning phase if in phase 2
|
||||
if (NPC.localAI[0] >= totalBombs)
|
||||
{
|
||||
NPC.velocity = NPC.velocity.SafeNormalize(Vector2.UnitY);
|
||||
|
||||
// Fly overhead and spit spreads of bombs into the air if on low health
|
||||
NPC.ai[1] = phase3 ? 6f : 1f;
|
||||
NPC.ai[2] = 0f;
|
||||
NPC.localAI[3] = 0f;
|
||||
NPC.localAI[0] = 0f;
|
||||
calamityGlobalNPC.newAI[0] = 0f;
|
||||
NPC.SyncVanillaLocalAI();
|
||||
NPC.SyncExtraAI();
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fly overhead and spit bombs
|
||||
if (NPC.ai[1] == 6f)
|
||||
{
|
||||
// Avoid unfair bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
NPC.rotation = NPC.velocity.X / 15f;
|
||||
|
||||
float flightVelocity = bossRush ? 28f : death ? 25f : 22f;
|
||||
float flightAcceleration = bossRush ? 1.16f : death ? 0.96f : 0.76f;
|
||||
|
||||
Vector2 destination = new Vector2(Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X, Main.player[Main.npc[(int)NPC.ai[0]].target].Center.Y - 420f);
|
||||
NPC.SimpleFlyMovement((destination - NPC.Center).SafeNormalize(Vector2.UnitY) * flightVelocity, flightAcceleration);
|
||||
|
||||
// Spit bombs and then go to floating phase
|
||||
NPC.localAI[3] += 1f;
|
||||
if (Vector2.Distance(NPC.Center, destination) < 160f || NPC.ai[2] > 0f || NPC.localAI[3] > 120f)
|
||||
{
|
||||
float bombSpawnDivisor = death ? 50f : 60f;
|
||||
float totalBombSpreads = 2f;
|
||||
NPC.ai[2] += 1f;
|
||||
if (NPC.ai[2] % bombSpawnDivisor == 0f)
|
||||
{
|
||||
NPC.localAI[0] += 1f;
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int totalProjectiles = bossRush ? 24 : 12;
|
||||
float radians = MathHelper.TwoPi / totalProjectiles;
|
||||
int type = ProjectileID.BombSkeletronPrime;
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
|
||||
// Reduce mech boss projectile damage depending on the new ore progression changes
|
||||
if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive)
|
||||
{
|
||||
double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert;
|
||||
double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert;
|
||||
if (!NPC.downedMechBossAny)
|
||||
damage = (int)(damage * firstMechMultiplier);
|
||||
else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1))
|
||||
damage = (int)(damage * secondMechMultiplier);
|
||||
}
|
||||
|
||||
float velocity = 12f;
|
||||
double angleA = radians * 0.5;
|
||||
double angleB = MathHelper.ToRadians(90f) - angleA;
|
||||
float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB));
|
||||
Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity);
|
||||
Vector2 upwardVelocity = Vector2.UnitY * velocity;
|
||||
for (int k = 0; k < totalProjectiles; k++)
|
||||
{
|
||||
Vector2 bombVelocity = spinningPoint.RotatedBy(radians * k);
|
||||
int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.UnitY * 30f + bombVelocity.SafeNormalize(Vector2.UnitY) * 15f, bombVelocity - upwardVelocity, type, damage, 0f, Main.myPlayer, -2f);
|
||||
Main.projectile[proj].timeLeft = BombTimeLeft;
|
||||
Main.projectile[proj].tileCollide = false;
|
||||
}
|
||||
NPC.localAI[1] += 1f;
|
||||
}
|
||||
|
||||
SoundEngine.PlaySound(SoundID.Item62, NPC.Center);
|
||||
CreateParticles(NPC, new Vector2(NPC.Center.X, NPC.Center.Y + 4f), 5);
|
||||
|
||||
if (NPC.localAI[0] >= totalBombSpreads)
|
||||
{
|
||||
NPC.ai[1] = 0f;
|
||||
NPC.ai[2] = 0f;
|
||||
NPC.localAI[3] = 0f;
|
||||
calamityGlobalNPC.newAI[0] = 0f;
|
||||
NPC.localAI[0] = 0f;
|
||||
NPC.SyncVanillaLocalAI();
|
||||
NPC.SyncExtraAI();
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateParticles(NPC npc, Vector2 position, int amountMultiplier = 1)
|
||||
{
|
||||
int firstDustCloudParticleAmount = 30 * amountMultiplier;
|
||||
int secondDustCloudParticleAmount = 20 * amountMultiplier;
|
||||
int goreAmount = 2 * amountMultiplier;
|
||||
|
||||
for (int dustIndex = 0; dustIndex < firstDustCloudParticleAmount; dustIndex++)
|
||||
{
|
||||
int dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Smoke, 0f, 0f, 100, default(Color), 1.5f);
|
||||
Main.dust[dust].velocity *= 1.4f;
|
||||
}
|
||||
|
||||
for (int dustIndex = 0; dustIndex < secondDustCloudParticleAmount; dustIndex++)
|
||||
{
|
||||
int dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Torch, 0f, 0f, 100, default(Color), 3.5f);
|
||||
Main.dust[dust].noGravity = true;
|
||||
Main.dust[dust].velocity *= 7f;
|
||||
dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Torch, 0f, 0f, 100, default(Color), 1.5f);
|
||||
Main.dust[dust].velocity *= 3f;
|
||||
}
|
||||
|
||||
for (int goreIndex = 0; goreIndex < goreAmount; goreIndex++)
|
||||
{
|
||||
float goreVelocityMultiplier = 0.4f;
|
||||
if (goreIndex >= goreAmount / 2)
|
||||
goreVelocityMultiplier = 0.8f;
|
||||
|
||||
int gore = Gore.NewGore(npc.GetSource_FromAI(), npc.Center, default(Vector2), Main.rand.Next(61, 64));
|
||||
Main.gore[gore].velocity *= goreVelocityMultiplier;
|
||||
Main.gore[gore].velocity.X += 1f;
|
||||
Main.gore[gore].velocity.Y += 1f;
|
||||
gore = Gore.NewGore(npc.GetSource_FromAI(), npc.Center, default(Vector2), Main.rand.Next(61, 64));
|
||||
Main.gore[gore].velocity *= goreVelocityMultiplier;
|
||||
Main.gore[gore].velocity.X -= 1f;
|
||||
Main.gore[gore].velocity.Y += 1f;
|
||||
gore = Gore.NewGore(npc.GetSource_FromAI(), npc.Center, default(Vector2), Main.rand.Next(61, 64));
|
||||
Main.gore[gore].velocity *= goreVelocityMultiplier;
|
||||
Main.gore[gore].velocity.X += 1f;
|
||||
Main.gore[gore].velocity.Y -= 1f;
|
||||
gore = Gore.NewGore(npc.GetSource_FromAI(), npc.Center, default(Vector2), Main.rand.Next(61, 64));
|
||||
Main.gore[gore].velocity *= goreVelocityMultiplier;
|
||||
Main.gore[gore].velocity.X -= 1f;
|
||||
Main.gore[gore].velocity.Y -= 1f;
|
||||
}
|
||||
}
|
||||
|
||||
public override void BossLoot(ref string name, ref int potionType) => potionType = ItemID.GreaterHealingPotion;
|
||||
|
||||
public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment)
|
||||
{
|
||||
NPC.lifeMax = (int)(NPC.lifeMax * 0.75f * balance * bossAdjustment);
|
||||
NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier());
|
||||
}
|
||||
|
||||
public override bool CheckActive() => false;
|
||||
|
||||
public override bool CheckDead()
|
||||
{
|
||||
// Kill the lead head if he's still alive when this head dies
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC nPC = Main.npc[i];
|
||||
if (nPC.active && nPC.type == NPCID.SkeletronPrime && nPC.life > 0)
|
||||
{
|
||||
nPC.life = 0;
|
||||
nPC.HitEffect();
|
||||
nPC.checkDead();
|
||||
nPC.active = false;
|
||||
nPC.netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void HitEffect(NPC.HitInfo hit)
|
||||
{
|
||||
if (NPC.life <= 0)
|
||||
{
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find<ModGore>("SkeletronPrime2_1").Type, NPC.scale);
|
||||
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find<ModGore>("SkeletronPrime2_2").Type, NPC.scale);
|
||||
|
||||
int gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64));
|
||||
Main.gore[gore].velocity *= 0.4f;
|
||||
Main.gore[gore].velocity.X += 1f;
|
||||
Main.gore[gore].velocity.Y += 1f;
|
||||
|
||||
gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64));
|
||||
Main.gore[gore].velocity *= 0.4f;
|
||||
Main.gore[gore].velocity.X -= 1f;
|
||||
Main.gore[gore].velocity.Y += 1f;
|
||||
|
||||
gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64));
|
||||
Main.gore[gore].velocity *= 0.4f;
|
||||
Main.gore[gore].velocity.X += 1f;
|
||||
Main.gore[gore].velocity.Y -= 1f;
|
||||
|
||||
gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64));
|
||||
Main.gore[gore].velocity *= 0.4f;
|
||||
Main.gore[gore].velocity.X -= 1f;
|
||||
Main.gore[gore].velocity.Y -= 1f;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Smoke, 0f, 0f, 100, default(Color), 1.5f);
|
||||
Main.dust[dust].velocity *= 1.4f;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, 0f, 0f, 100, default(Color), 2.5f);
|
||||
Main.dust[dust].noGravity = true;
|
||||
Main.dust[dust].velocity *= 5f;
|
||||
|
||||
dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, 0f, 0f, 100, default(Color), 1.5f);
|
||||
Main.dust[dust].velocity *= 3f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.5 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 506 B |
@@ -1062,7 +1062,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
|
||||
{
|
||||
bool bossRush = BossRushEvent.BossRushActive;
|
||||
bool death = CalamityWorld.death || bossRush;
|
||||
bool oblivionAlive = npc.ai[1] == 1f;
|
||||
|
||||
// Get a target
|
||||
if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active)
|
||||
@@ -1104,12 +1103,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
|
||||
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
if (death && !bossRush && npc.ai[1] == 0f)
|
||||
{
|
||||
if (Main.npc[i].active && (Main.npc[i].type == ModContent.NPCType<SkeletronPrime2>() || Main.npc[i].type == NPCID.SkeletronPrime))
|
||||
npc.ai[1] = 1f;
|
||||
}
|
||||
|
||||
if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type)
|
||||
{
|
||||
Vector2 otherProbeDist = Main.npc[i].Center - npc.Center;
|
||||
@@ -1202,7 +1195,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
|
||||
damage = (int)(damage * secondMechMultiplier);
|
||||
}
|
||||
|
||||
int totalProjectiles = oblivionAlive ? 2 : death ? 3 : 1;
|
||||
int totalProjectiles = death ? 3 : 1;
|
||||
Vector2 projectileVelocity = (targetData.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity;
|
||||
if (NPC.IsMechQueenUp)
|
||||
{
|
||||
|
||||
@@ -42,115 +42,37 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
// Spawn second head in Master Mode
|
||||
// The main head owns the Saw and the Laser in Master Mode
|
||||
if (death)
|
||||
{
|
||||
int head = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType<SkeletronPrime2>(), npc.whoAmI);
|
||||
Main.npc[head].ai[0] = npc.whoAmI;
|
||||
Main.npc[head].target = npc.target;
|
||||
Main.npc[head].netUpdate = true;
|
||||
npc.ai[0] = head;
|
||||
int arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeCannon, npc.whoAmI);
|
||||
Main.npc[arm].ai[0] = -1f;
|
||||
Main.npc[arm].ai[1] = npc.whoAmI;
|
||||
Main.npc[arm].target = npc.target;
|
||||
Main.npc[arm].netUpdate = true;
|
||||
|
||||
int arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeSaw, npc.whoAmI);
|
||||
Main.npc[arm].ai[0] = 1f;
|
||||
Main.npc[arm].ai[1] = npc.whoAmI;
|
||||
Main.npc[arm].target = npc.target;
|
||||
Main.npc[arm].netUpdate = true;
|
||||
arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeSaw, npc.whoAmI);
|
||||
Main.npc[arm].ai[0] = 1f;
|
||||
Main.npc[arm].ai[1] = npc.whoAmI;
|
||||
Main.npc[arm].target = npc.target;
|
||||
Main.npc[arm].netUpdate = true;
|
||||
|
||||
arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeLaser, npc.whoAmI);
|
||||
Main.npc[arm].ai[0] = 1f;
|
||||
Main.npc[arm].ai[1] = npc.whoAmI;
|
||||
Main.npc[arm].target = npc.target;
|
||||
Main.npc[arm].netUpdate = true;
|
||||
Main.npc[arm].ai[3] = 150f;
|
||||
arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeVice, npc.whoAmI);
|
||||
Main.npc[arm].ai[0] = -1f;
|
||||
Main.npc[arm].ai[1] = npc.whoAmI;
|
||||
Main.npc[arm].target = npc.target;
|
||||
Main.npc[arm].ai[3] = 150f;
|
||||
Main.npc[arm].netUpdate = true;
|
||||
|
||||
if (Main.netMode == NetmodeID.SinglePlayer)
|
||||
Main.NewText(Language.GetTextValue("Announcement.HasAwoken", Main.npc[head].TypeName), 175, 75);
|
||||
else if (Main.dedServ)
|
||||
ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", Main.npc[head].GetTypeNetName()), new Color(175, 75, 255));
|
||||
}
|
||||
else
|
||||
{
|
||||
int arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeCannon, npc.whoAmI);
|
||||
Main.npc[arm].ai[0] = -1f;
|
||||
Main.npc[arm].ai[1] = npc.whoAmI;
|
||||
Main.npc[arm].target = npc.target;
|
||||
Main.npc[arm].netUpdate = true;
|
||||
|
||||
arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeSaw, npc.whoAmI);
|
||||
Main.npc[arm].ai[0] = 1f;
|
||||
Main.npc[arm].ai[1] = npc.whoAmI;
|
||||
Main.npc[arm].target = npc.target;
|
||||
Main.npc[arm].netUpdate = true;
|
||||
|
||||
arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeVice, npc.whoAmI);
|
||||
Main.npc[arm].ai[0] = -1f;
|
||||
Main.npc[arm].ai[1] = npc.whoAmI;
|
||||
Main.npc[arm].target = npc.target;
|
||||
Main.npc[arm].ai[3] = 150f;
|
||||
Main.npc[arm].netUpdate = true;
|
||||
|
||||
arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeLaser, npc.whoAmI);
|
||||
Main.npc[arm].ai[0] = 1f;
|
||||
Main.npc[arm].ai[1] = npc.whoAmI;
|
||||
Main.npc[arm].target = npc.target;
|
||||
Main.npc[arm].netUpdate = true;
|
||||
Main.npc[arm].ai[3] = 150f;
|
||||
}
|
||||
arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeLaser, npc.whoAmI);
|
||||
Main.npc[arm].ai[0] = 1f;
|
||||
Main.npc[arm].ai[1] = npc.whoAmI;
|
||||
Main.npc[arm].target = npc.target;
|
||||
Main.npc[arm].netUpdate = true;
|
||||
Main.npc[arm].ai[3] = 150f;
|
||||
}
|
||||
|
||||
npc.netUpdate = true;
|
||||
npc.SyncExtraAI();
|
||||
}
|
||||
|
||||
if (death)
|
||||
{
|
||||
if (!Main.npc[(int)npc.ai[0]].active || Main.npc[(int)npc.ai[0]].aiStyle != NPCAIStyleID.SkeletronPrimeHead)
|
||||
{
|
||||
npc.life = 0;
|
||||
npc.HitEffect();
|
||||
npc.active = false;
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Link the HP of both heads
|
||||
if (npc.life > Main.npc[(int)npc.ai[0]].life)
|
||||
npc.life = Main.npc[(int)npc.ai[0]].life;
|
||||
|
||||
// Push away from the lead head if too close, pull closer if too far, if Mechdusa isn't real
|
||||
if (!NPC.IsMechQueenUp)
|
||||
{
|
||||
float pushVelocity = 0.25f;
|
||||
if (Vector2.Distance(npc.Center, Main.npc[(int)npc.ai[0]].Center) < 80f * npc.scale)
|
||||
{
|
||||
if (npc.position.X < Main.npc[(int)npc.ai[0]].position.X)
|
||||
npc.velocity.X -= pushVelocity;
|
||||
else
|
||||
npc.velocity.X += pushVelocity;
|
||||
|
||||
if (npc.position.Y < Main.npc[(int)npc.ai[0]].position.Y)
|
||||
npc.velocity.Y -= pushVelocity;
|
||||
else
|
||||
npc.velocity.Y += pushVelocity;
|
||||
}
|
||||
else if (Vector2.Distance(npc.Center, Main.npc[(int)npc.ai[0]].Center) > 240f * npc.scale)
|
||||
{
|
||||
if (npc.position.X < Main.npc[(int)npc.ai[0]].position.X)
|
||||
npc.velocity.X += pushVelocity;
|
||||
else
|
||||
npc.velocity.X -= pushVelocity;
|
||||
|
||||
if (npc.position.Y < Main.npc[(int)npc.ai[0]].position.Y)
|
||||
npc.velocity.Y += pushVelocity;
|
||||
else
|
||||
npc.velocity.Y -= pushVelocity;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if arms are alive
|
||||
bool cannonAlive = false;
|
||||
bool laserAlive = false;
|
||||
@@ -232,9 +154,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
|
||||
|
||||
bool normalLaserRotation = npc.localAI[1] % 2f == 0f;
|
||||
|
||||
// Prevents cheap hits
|
||||
bool canUseAttackInMaster = npc.position.Y < Main.player[npc.target].position.Y - 350f;
|
||||
|
||||
// Float near player
|
||||
if (npc.ai[1] == 0f || npc.ai[1] == 4f)
|
||||
{
|
||||
@@ -242,25 +161,16 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
|
||||
npc.damage = 0;
|
||||
|
||||
// Start other phases; if arms are dead, start with spin phase
|
||||
bool otherHeadChargingOrSpinning = Main.npc[(int)npc.ai[0]].ai[1] == 5f || Main.npc[(int)npc.ai[0]].ai[1] == 1f;
|
||||
if (phase2 || CalamityWorld.LegendaryMode || allArmsDead || death)
|
||||
if (phase2 || CalamityWorld.LegendaryMode || allArmsDead)
|
||||
{
|
||||
// Start spin phase after 1.5 seconds
|
||||
npc.ai[2] += phase3 ? 1.5f : 1f;
|
||||
if (npc.ai[2] >= (90f - (death ? 15f * (1f - lifeRatio) : 0f)) && (!otherHeadChargingOrSpinning || !death || phase3) && (canUseAttackInMaster || !death))
|
||||
if (npc.ai[2] >= (90f - (death ? 15f * (1f - lifeRatio) : 0f)))
|
||||
{
|
||||
bool shouldSpinAround = npc.ai[1] == 4f && npc.position.Y < Main.player[npc.target].position.Y - 320f &&
|
||||
Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 600f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 400f;
|
||||
|
||||
bool shouldCharge = death && !phase2 && !allArmsDead && !CalamityWorld.LegendaryMode;
|
||||
if (shouldCharge)
|
||||
{
|
||||
npc.ai[2] = 0f;
|
||||
npc.ai[1] = 1f;
|
||||
CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults);
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
else if (shouldSpinAround || npc.ai[1] != 4f)
|
||||
if (shouldSpinAround || npc.ai[1] != 4f)
|
||||
{
|
||||
if (shouldSpinAround)
|
||||
{
|
||||
@@ -698,8 +608,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
|
||||
npc.localAI[3] += 1f;
|
||||
if (Vector2.Distance(npc.Center, destination) < 80f || npc.ai[2] > 0f || npc.localAI[3] > 120f)
|
||||
{
|
||||
float missileSpawnDivisor = death ? 10f : 12f;
|
||||
float totalMissiles = death ? 12f : 10f;
|
||||
float missileSpawnDivisor = 12f;
|
||||
float totalMissiles = 10f;
|
||||
npc.ai[2] += 1f;
|
||||
if (npc.ai[2] % missileSpawnDivisor == 0f)
|
||||
{
|
||||
|
||||
@@ -2317,115 +2317,6 @@ namespace CalamityMod.Projectiles
|
||||
}
|
||||
}
|
||||
|
||||
else if (projectile.type == ProjectileID.BombSkeletronPrime && projectile.ai[0] < 0f && death)
|
||||
{
|
||||
int num = (int)(projectile.Center.X / 16f);
|
||||
int num2 = (int)(projectile.Center.Y / 16f);
|
||||
if (WorldGen.InWorld(num, num2) && projectile.tileCollide)
|
||||
{
|
||||
Tile tile = Main.tile[num, num2];
|
||||
if (tile != null && tile.HasTile && (TileID.Sets.Platforms[tile.TileType] || tile.TileType == TileID.PlanterBox))
|
||||
{
|
||||
projectile.Kill();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool deathModeSkeletronPrimeHomingBomb = projectile.ai[0] == -1f;
|
||||
bool deathModeSkeletronPrimeFallingBomb = projectile.ai[0] == -2f;
|
||||
|
||||
int target = 0;
|
||||
target = Player.FindClosest(projectile.Center, 1, 1);
|
||||
|
||||
if (projectile.Hitbox.Intersects(Main.player[target].Hitbox))
|
||||
{
|
||||
projectile.Kill();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (projectile.timeLeft < SkeletronPrime2.BombTimeLeft / 2 && projectile.timeLeft > 3)
|
||||
projectile.tileCollide = true;
|
||||
|
||||
if (deathModeSkeletronPrimeHomingBomb)
|
||||
{
|
||||
projectile.ai[1] += 1f;
|
||||
float homingStartTime = 20f;
|
||||
float homingEndTime = death ? 140f : 110f;
|
||||
|
||||
if (Vector2.Distance(projectile.Center, Main.player[target].Center) < 192f && projectile.ai[1] < homingEndTime)
|
||||
projectile.ai[1] = homingEndTime;
|
||||
|
||||
if (projectile.ai[1] < homingEndTime && projectile.ai[1] > homingStartTime)
|
||||
{
|
||||
float num134 = projectile.velocity.Length();
|
||||
Vector2 vector24 = Main.player[target].Center - projectile.Center;
|
||||
vector24.Normalize();
|
||||
vector24 *= num134;
|
||||
float inertia = death ? 25f : 30f;
|
||||
projectile.velocity = (projectile.velocity * (inertia - 1f) + vector24) / inertia;
|
||||
projectile.velocity.Normalize();
|
||||
projectile.velocity *= num134;
|
||||
}
|
||||
|
||||
float maxVelocity = death ? 18f : 15f;
|
||||
float acceleration = 1.02f;
|
||||
if (projectile.velocity.Length() < maxVelocity)
|
||||
projectile.velocity *= acceleration;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (projectile.velocity.Y > 10f)
|
||||
projectile.velocity.Y = 10f;
|
||||
}
|
||||
|
||||
if (projectile.localAI[0] == 0f)
|
||||
{
|
||||
projectile.localAI[0] = 1f;
|
||||
SoundEngine.PlaySound(SoundID.Item10, projectile.Center);
|
||||
}
|
||||
|
||||
projectile.frameCounter++;
|
||||
if (projectile.frameCounter > 3)
|
||||
{
|
||||
projectile.frame++;
|
||||
projectile.frameCounter = 0;
|
||||
}
|
||||
|
||||
if (projectile.frame > 1)
|
||||
projectile.frame = 0;
|
||||
|
||||
if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3)
|
||||
{
|
||||
projectile.tileCollide = false;
|
||||
projectile.ai[2] = 0f;
|
||||
projectile.alpha = 255;
|
||||
}
|
||||
else if (Main.rand.NextBool())
|
||||
{
|
||||
int num28 = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Smoke, 0f, 0f, 100);
|
||||
Main.dust[num28].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f;
|
||||
Main.dust[num28].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f;
|
||||
Main.dust[num28].noGravity = true;
|
||||
Main.dust[num28].position = projectile.Center + new Vector2(0f, -projectile.height / 2).RotatedBy(projectile.rotation) * 1.1f;
|
||||
int num29 = 6;
|
||||
Dust dust8 = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, num29, 0f, 0f, 100);
|
||||
dust8.scale = 1f + (float)Main.rand.Next(5) * 0.1f;
|
||||
dust8.noGravity = true;
|
||||
dust8.position = projectile.Center + new Vector2(0f, -projectile.height / 2 - 6).RotatedBy(projectile.rotation) * 1.1f;
|
||||
}
|
||||
|
||||
if (deathModeSkeletronPrimeFallingBomb)
|
||||
{
|
||||
projectile.ai[2] += 1f;
|
||||
if (projectile.ai[2] > 60f)
|
||||
projectile.velocity.Y += 0.2f;
|
||||
}
|
||||
|
||||
projectile.rotation += projectile.velocity.X * 0.1f;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
else if (projectile.type == ProjectileID.RocketSkeleton && projectile.ai[1] >= 1f)
|
||||
{
|
||||
bool primeCannonProjectile = projectile.ai[1] == 2f;
|
||||
@@ -3469,7 +3360,7 @@ namespace CalamityMod.Projectiles
|
||||
projectile.ai[0]--;
|
||||
|
||||
// Acceleration for certain lasers
|
||||
if ((projectile.type == ProjectileID.EyeLaser || projectile.type == ProjectileID.DeathLaser || projectile.type == ProjectileID.FrostBeam) && projectile.ai[0] == 1f)
|
||||
if ((projectile.type == ProjectileID.EyeLaser || projectile.type == ProjectileID.DeathLaser) && projectile.ai[0] == 1f)
|
||||
{
|
||||
if (projectile.velocity.Length() < AcceleratingBossLaserVelocityCap)
|
||||
projectile.velocity *= 1.0025f;
|
||||
@@ -4743,7 +4634,6 @@ namespace CalamityMod.Projectiles
|
||||
#region Pre Kill
|
||||
public override bool PreKill(Projectile projectile, int timeLeft)
|
||||
{
|
||||
bool masterRevSkeletronPrimeBomb = projectile.type == ProjectileID.BombSkeletronPrime && projectile.ai[0] < 0f && (CalamityWorld.death || BossRushEvent.BossRushActive);
|
||||
bool revQueenBeeBeeHive = projectile.type == ProjectileID.BeeHive && (CalamityWorld.revenge || BossRushEvent.BossRushActive) && (projectile.ai[2] == 1f || CalamityWorld.death);
|
||||
bool revGolemInferno = projectile.type == ProjectileID.InfernoHostileBolt && projectile.ai[2] > 0f;
|
||||
|
||||
@@ -4765,96 +4655,7 @@ namespace CalamityMod.Projectiles
|
||||
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
{
|
||||
if (masterRevSkeletronPrimeBomb)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item14, projectile.Center);
|
||||
projectile.position.X += projectile.width / 2;
|
||||
projectile.position.Y += projectile.height / 2;
|
||||
projectile.width = projectile.height = 22;
|
||||
projectile.position.X -= projectile.width / 2;
|
||||
projectile.position.Y -= projectile.height / 2;
|
||||
|
||||
for (int num951 = 0; num951 < 20; num951++)
|
||||
{
|
||||
int num952 = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Smoke, 0f, 0f, 100, default(Color), 1.5f);
|
||||
Dust dust2 = Main.dust[num952];
|
||||
dust2.velocity *= 1.4f;
|
||||
}
|
||||
|
||||
int num950 = 6;
|
||||
for (int num953 = 0; num953 < 10; num953++)
|
||||
{
|
||||
int num954 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num950, 0f, 0f, 100, default(Color), 2.5f);
|
||||
Main.dust[num954].noGravity = true;
|
||||
Dust dust2 = Main.dust[num954];
|
||||
dust2.velocity *= 5f;
|
||||
num954 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num950, 0f, 0f, 100, default(Color), 1.5f);
|
||||
dust2 = Main.dust[num954];
|
||||
dust2.velocity *= 3f;
|
||||
}
|
||||
|
||||
int num955 = Gore.NewGore(projectile.GetSource_FromAI(), projectile.position, default(Vector2), Main.rand.Next(61, 64));
|
||||
Gore gore2 = Main.gore[num955];
|
||||
gore2.velocity *= 0.4f;
|
||||
Main.gore[num955].velocity.X += 1f;
|
||||
Main.gore[num955].velocity.Y += 1f;
|
||||
num955 = Gore.NewGore(projectile.GetSource_FromAI(), projectile.position, default(Vector2), Main.rand.Next(61, 64));
|
||||
gore2 = Main.gore[num955];
|
||||
gore2.velocity *= 0.4f;
|
||||
Main.gore[num955].velocity.X -= 1f;
|
||||
Main.gore[num955].velocity.Y += 1f;
|
||||
num955 = Gore.NewGore(projectile.GetSource_FromAI(), projectile.position, default(Vector2), Main.rand.Next(61, 64));
|
||||
gore2 = Main.gore[num955];
|
||||
gore2.velocity *= 0.4f;
|
||||
Main.gore[num955].velocity.X += 1f;
|
||||
Main.gore[num955].velocity.Y -= 1f;
|
||||
num955 = Gore.NewGore(projectile.GetSource_FromAI(), projectile.position, default(Vector2), Main.rand.Next(61, 64));
|
||||
gore2 = Main.gore[num955];
|
||||
gore2.velocity *= 0.4f;
|
||||
Main.gore[num955].velocity.X -= 1f;
|
||||
Main.gore[num955].velocity.Y -= 1f;
|
||||
|
||||
Vector2 vector76 = projectile.position;
|
||||
projectile.position.X += projectile.width / 2;
|
||||
projectile.position.Y += projectile.height / 2;
|
||||
projectile.width = projectile.height = 128;
|
||||
projectile.position.X -= projectile.width / 2;
|
||||
projectile.position.Y -= projectile.height / 2;
|
||||
projectile.Damage();
|
||||
projectile.position = vector76;
|
||||
projectile.width = projectile.height = 22;
|
||||
|
||||
if (CalamityWorld.LegendaryMode && !Main.remixWorld)
|
||||
{
|
||||
int num1011 = 4;
|
||||
Vector2 center3 = projectile.position;
|
||||
int num1012 = num1011;
|
||||
int num1013 = num1011;
|
||||
int num1014 = (int)(center3.X / 16f - (float)num1012);
|
||||
int num1015 = (int)(center3.X / 16f + (float)num1012);
|
||||
int num1016 = (int)(center3.Y / 16f - (float)num1013);
|
||||
int num1017 = (int)(center3.Y / 16f + (float)num1013);
|
||||
if (num1014 < 0)
|
||||
num1014 = 0;
|
||||
|
||||
if (num1015 > Main.maxTilesX)
|
||||
num1015 = Main.maxTilesX;
|
||||
|
||||
if (num1016 < 0)
|
||||
num1016 = 0;
|
||||
|
||||
if (num1017 > Main.maxTilesY)
|
||||
num1017 = Main.maxTilesY;
|
||||
|
||||
bool wallSplode2 = projectile.ShouldWallExplode(center3, num1011, num1014, num1015, num1016, num1017);
|
||||
projectile.ExplodeTiles(center3, num1011, num1014, num1015, num1016, num1017, wallSplode2);
|
||||
}
|
||||
|
||||
if (Main.netMode != NetmodeID.SinglePlayer)
|
||||
NetMessage.SendData(MessageID.KillProjectile, -1, -1, null, projectile.identity, projectile.owner);
|
||||
}
|
||||
|
||||
else if (revQueenBeeBeeHive)
|
||||
if (revQueenBeeBeeHive)
|
||||
{
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
@@ -4920,7 +4721,7 @@ namespace CalamityMod.Projectiles
|
||||
}
|
||||
}
|
||||
|
||||
if (masterRevSkeletronPrimeBomb || revQueenBeeBeeHive || revGolemInferno)
|
||||
if (revQueenBeeBeeHive || revGolemInferno)
|
||||
{
|
||||
projectile.active = false;
|
||||
return false;
|
||||
|
||||
@@ -15,7 +15,6 @@ namespace CalamityMod.Systems.Collections
|
||||
List =
|
||||
[
|
||||
NPCID.SkeletronPrime,
|
||||
NPCType<SkeletronPrime2>(),
|
||||
NPCID.PrimeCannon,
|
||||
NPCID.PrimeLaser,
|
||||
NPCID.PrimeSaw,
|
||||
|
||||
@@ -104,7 +104,6 @@ namespace CalamityMod.Systems.Collections
|
||||
NPCType<KingSlimeJewelRuby>(),
|
||||
NPCType<KingSlimeJewelSapphire>(),
|
||||
NPCType<PlanterasFreeTentacle>(),
|
||||
NPCType<SkeletronPrime2>(),
|
||||
NPCType<PlagueHomingMissile>(),
|
||||
NPCType<PlagueMine>(),
|
||||
NPCType<ProfanedRocks>(),
|
||||
|
||||
@@ -76,7 +76,6 @@ namespace CalamityMod.Systems.Collections
|
||||
{ NPCID.Probe, 10000 },
|
||||
|
||||
{ NPCID.SkeletronPrime, 160000 }, // 30 seconds
|
||||
{ NPCType<SkeletronPrime2>(), 160000 },
|
||||
{ NPCID.PrimeVice, 54000 },
|
||||
{ NPCID.PrimeCannon, 45000 },
|
||||
{ NPCID.PrimeSaw, 45000 },
|
||||
|
||||
@@ -60,7 +60,6 @@ namespace CalamityMod.Systems.Collections
|
||||
NPCID.Retinazer,
|
||||
NPCID.Spazmatism,
|
||||
NPCID.SkeletronPrime,
|
||||
NPCType<SkeletronPrime2>(),
|
||||
NPCID.PrimeCannon,
|
||||
NPCID.PrimeSaw,
|
||||
NPCID.PrimeLaser,
|
||||
|
||||
Reference in new issue
Block a user