Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions BMConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ public class BMConfig : ModConfig
[Label("Disable Respawning during Boss Fights")]
public bool NoBossFightRespawn;

[DefaultValue(0)]
[Label("Additional time to respawn during boss fights")]
public int AddedBossFightRespawnTime;

[DefaultValue(true)]
[Label("Boss Death Cam")]
public bool DeathCam;
Expand Down
50 changes: 33 additions & 17 deletions BMPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class BMPlayer : ModPlayer
public bool teamLoaded = false;
public string teamChosen = GetInstance<BMConfig>().TeamToJoin;
public int team;

public override void OnEnterWorld(Player player)
{
base.OnEnterWorld(player);
Expand Down Expand Up @@ -69,28 +70,23 @@ public override void UpdateDead() //no boss fight respawn
{
if (BMConfig.Instance.NoBossFightRespawn)
{
bool flag = false;
for (int i = 0; i < Main.maxNPCs; i++)
if (BossAlive())
{
NPC npc = Main.npc[i];
if (npc.active && (npc.boss || npc.type == NPCID.EaterofWorldsHead))
{
Player bosstarget = Main.player[npc.target];
if (!bosstarget.active || bosstarget.dead)
{
break;
}
flag = true;
break;
}
player.respawnTimer++;
}
if (!flag)
}
}

public override void Kill(double damage, int hitDirection, bool pvp, string deathText)
{
if (BMConfig.Instance.AddedBossFightRespawnTime != 0)
{
if (BossAlive())
{
return;
player.respawnTimer += BMConfig.Instance.AddedBossFightRespawnTime;
}
player.respawnTimer++;
}
}
}

public override void SendClientChanges(ModPlayer localPlayer)
{
Expand All @@ -107,5 +103,25 @@ public override void SendClientChanges(ModPlayer localPlayer)
base.SendClientChanges(localPlayer);
}
}

public bool BossAlive()
{
bool flag = false;
for (int i = 0; i < Main.maxNPCs; i++)
{
NPC npc = Main.npc[i];
if (npc.active && (npc.boss || npc.type == NPCID.EaterofWorldsHead))
{
Player bosstarget = Main.player[npc.target];
if (!bosstarget.active || bosstarget.dead)
{
break;
}
flag = true;
break;
}
}
return flag;
}
}
}