I hate how things despawn in this game so much
This commit is contained in:
1 parent
636a2c6b00
commit
8940ff38cd
6 files changed
+44
-37
No files matched your search
@@ -742,8 +742,6 @@ namespace CalamityMod.NPCs.SlimeGod
|
||||
return newColor * NPC.Opacity;
|
||||
}
|
||||
|
||||
public override bool CheckActive() => NPC.ai[0] == 3f;
|
||||
|
||||
public override void HitEffect(NPC.HitInfo hit)
|
||||
{
|
||||
Color dustColor = Color.Crimson;
|
||||
|
||||
@@ -787,8 +787,6 @@ namespace CalamityMod.NPCs.SlimeGod
|
||||
return newColor * NPC.Opacity;
|
||||
}
|
||||
|
||||
public override bool CheckActive() => NPC.ai[0] == 4f;
|
||||
|
||||
public override void HitEffect(NPC.HitInfo hit)
|
||||
{
|
||||
Color dustColor = Color.Lavender;
|
||||
|
||||
@@ -100,6 +100,7 @@ namespace CalamityMod.NPCs.SlimeGod
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(slimesSpawned);
|
||||
writer.Write(buffedSlime);
|
||||
writer.Write(NPC.Opacity);
|
||||
for (int i = 0; i < 4; i++)
|
||||
@@ -108,6 +109,7 @@ namespace CalamityMod.NPCs.SlimeGod
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
slimesSpawned = reader.ReadBoolean();
|
||||
buffedSlime = reader.ReadInt32();
|
||||
NPC.Opacity = reader.ReadSingle();
|
||||
for (int i = 0; i < 4; i++)
|
||||
@@ -135,11 +137,14 @@ namespace CalamityMod.NPCs.SlimeGod
|
||||
|
||||
Player player = Main.player[NPC.target];
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient && !slimesSpawned)
|
||||
if (!slimesSpawned)
|
||||
{
|
||||
slimesSpawned = true;
|
||||
NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType<EbonianPaladin>());
|
||||
NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType<CrimulanPaladin>());
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType<EbonianPaladin>());
|
||||
NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType<CrimulanPaladin>());
|
||||
}
|
||||
}
|
||||
|
||||
// Enrage based on large slimes
|
||||
@@ -188,7 +193,7 @@ namespace CalamityMod.NPCs.SlimeGod
|
||||
bool phase2 = !purpleSlimeAlive || !redSlimeAlive;
|
||||
|
||||
// Vanish phase
|
||||
if (!purpleSlimeAlive && !redSlimeAlive)
|
||||
if ((!purpleSlimeAlive && !redSlimeAlive) || calamityGlobalNPC.newAI[3] == 1f || NPC.ai[3] == 1f)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
@@ -257,40 +262,53 @@ namespace CalamityMod.NPCs.SlimeGod
|
||||
Main.dust[slimyDust2].velocity *= 2f;
|
||||
}
|
||||
|
||||
// Let the player know that the Slime God isn't dead fr
|
||||
if (!DownedBossSystem.downedSlimeGod)
|
||||
if (calamityGlobalNPC.newAI[3] != 1f)
|
||||
{
|
||||
string key = "Mods.CalamityMod.Status.Boss.SlimeGodRun";
|
||||
Color messageColor = Color.Magenta;
|
||||
// Let the player know that the Slime God isn't dead fr
|
||||
if (!DownedBossSystem.downedSlimeGod)
|
||||
{
|
||||
string key = "Mods.CalamityMod.Status.Boss.SlimeGodRun";
|
||||
Color messageColor = Color.Magenta;
|
||||
|
||||
CalamityUtils.DisplayLocalizedText(key, messageColor);
|
||||
CalamityUtils.DisplayLocalizedText(key, messageColor);
|
||||
}
|
||||
|
||||
// Set Slime God to have interacted with all players
|
||||
for (int i = Main.maxPlayers - 1; i >= 0; i--)
|
||||
NPC.ApplyInteraction(i);
|
||||
|
||||
NPC.active = false;
|
||||
NPC.HitEffect();
|
||||
NPC.NPCLoot();
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
|
||||
// Set Slime God to have interacted with all players
|
||||
for (int i = Main.maxPlayers - 1; i >= 0; i--)
|
||||
else
|
||||
{
|
||||
NPC.ApplyInteraction(i);
|
||||
}
|
||||
for (int x = 0; x < Main.maxNPCs; x++)
|
||||
{
|
||||
if (Main.npc[x].type == ModContent.NPCType<EbonianPaladin>() || Main.npc[x].type == ModContent.NPCType<SplitEbonianPaladin>() ||
|
||||
Main.npc[x].type == ModContent.NPCType<CrimulanPaladin>() || Main.npc[x].type == ModContent.NPCType<SplitCrimulanPaladin>())
|
||||
{
|
||||
Main.npc[x].active = false;
|
||||
Main.npc[x].netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
NPC.active = false;
|
||||
NPC.HitEffect();
|
||||
NPC.NPCLoot();
|
||||
NPC.netUpdate = true;
|
||||
NPC.active = false;
|
||||
NPC.HitEffect();
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Despawn
|
||||
if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > (bossRush ? CalamityGlobalNPC.CatchUpDistance350Tiles : CalamityGlobalNPC.CatchUpDistance200Tiles) || calamityGlobalNPC.newAI[3] == 1f)
|
||||
if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > (bossRush ? CalamityGlobalNPC.CatchUpDistance350Tiles : CalamityGlobalNPC.CatchUpDistance200Tiles))
|
||||
{
|
||||
if (calamityGlobalNPC.newAI[3] != 1f)
|
||||
{
|
||||
NPC.TargetClosest(false);
|
||||
player = Main.player[NPC.target];
|
||||
}
|
||||
|
||||
if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > (bossRush ? CalamityGlobalNPC.CatchUpDistance350Tiles : CalamityGlobalNPC.CatchUpDistance200Tiles) || calamityGlobalNPC.newAI[3] == 1f)
|
||||
NPC.TargetClosest(false);
|
||||
player = Main.player[NPC.target];
|
||||
if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > (bossRush ? CalamityGlobalNPC.CatchUpDistance350Tiles : CalamityGlobalNPC.CatchUpDistance200Tiles))
|
||||
{
|
||||
if (NPC.velocity.Y < -3f)
|
||||
NPC.velocity.Y = -3f;
|
||||
|
||||
@@ -736,8 +736,6 @@ namespace CalamityMod.NPCs.SlimeGod
|
||||
npcLoot.Add(ItemID.Gel, 1, 32, 48);
|
||||
}
|
||||
|
||||
public override bool CheckActive() => NPC.ai[0] == 3f;
|
||||
|
||||
public override void HitEffect(NPC.HitInfo hit)
|
||||
{
|
||||
Color dustColor = Color.Crimson;
|
||||
|
||||
@@ -780,8 +780,6 @@ namespace CalamityMod.NPCs.SlimeGod
|
||||
npcLoot.Add(ItemID.Gel, 1, 32, 48);
|
||||
}
|
||||
|
||||
public override bool CheckActive() => NPC.ai[0] == 4f;
|
||||
|
||||
public override void HitEffect(NPC.HitInfo hit)
|
||||
{
|
||||
Color dustColor = Color.Lavender;
|
||||
|
||||
@@ -125,9 +125,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
|
||||
}
|
||||
}
|
||||
|
||||
// Distance from target
|
||||
float distance = Vector2.Distance(Main.player[npc.target].Center, npc.Center);
|
||||
|
||||
// Despawn
|
||||
if (npc.ai[1] != 3f)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user