Skip to content

Commit

Permalink
Fix incorrect revive conditions
Browse files Browse the repository at this point in the history
I broke the revive by checking the wrong timer condition. You could only
revive in the last 30 seconds, not before 🤦‍♂️

I also changed the revive logic to not allow reviving if you are already
in the top 3.
  • Loading branch information
DarkStoorM committed Sep 6, 2024
1 parent 82ed10b commit b715f7a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions JumpRoyale/src/Arena.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Godot;
Expand Down Expand Up @@ -584,7 +585,7 @@ private void OnRedemption(object sender, OnRewardRedeemedArgs e)

private void RedeemRevive(string displayName)
{
if (_timerOverlay.TimerSeconds > RevivePreventionCountdown)
if (_timerOverlay.TimerSeconds <= RevivePreventionCountdown)
{
return;
}
Expand All @@ -603,7 +604,16 @@ private void RedeemRevive(string displayName)
break;
}

string thirdHighestPlayerId = playersByHeight[2].Item1;
// Take user IDs of the top three players
List<string> topPlayers = playersByHeight.Take(3).Select(p => p.Item1).ToList();

// If the reviving player is already in the top 3, don't revive them
if (topPlayers.Contains(jumper.PlayerData.UserId))
{
break;
}

string thirdHighestPlayerId = topPlayers[2];
Jumper thirdHighestJumper = ActiveJumpers.Instance.GetById(thirdHighestPlayerId);

GD.Print("Reviving " + displayName);
Expand Down

0 comments on commit b715f7a

Please sign in to comment.