Skip to content

Commit

Permalink
- fixed bug with exo duration being used fully even on early exit, th…
Browse files Browse the repository at this point in the history
…ank you Braia!
  • Loading branch information
mfoltz committed Dec 3, 2024
1 parent 7ecaa4c commit 7daca30
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Patches/ScriptSpawnServerPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ internal static class ScriptSpawnServerPatch

static readonly PrefabGUID ExoFormBuff = new(-31099041);
static readonly PrefabGUID InCombatBuff = new(581443919);
static readonly PrefabGUID MutantFromBiteBuff = new(-491525099);
static readonly PrefabGUID MutantFromBiteBloodBuff = new(-491525099);

static readonly PrefabGUID FallenAngelDeathBuff = new(-1934189109);
static readonly PrefabGUID FallenAngelDespawnBuff = new(1476380301);
Expand Down Expand Up @@ -93,7 +93,7 @@ static void OnUpdatePrefix(ScriptSpawnServer __instance)
if (playerClass.Equals(PlayerClass.DeathMage) && entity.GetBuffTarget().TryGetPlayer(out player))
{
List<PrefabGUID> perks = ConfigUtilities.ParseConfigIntegerString(ClassBuffMap[playerClass]).Select(x => new PrefabGUID(x)).ToList();
int indexOfBuff = perks.IndexOf(MutantFromBiteBuff);
int indexOfBuff = perks.IndexOf(MutantFromBiteBloodBuff);

if (indexOfBuff != -1)
{
Expand Down
8 changes: 7 additions & 1 deletion Utilities/ExoFormUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public static IEnumerator ExoFormCountdown(Entity buffEntity, Entity playerEntit
yield return new WaitForSeconds(countdownDelay);

float countdown = 5f;
bool fullDuration = false;

// Wait until there are 5 seconds left
while (buffEntity.Exists() && countdown > 0f)
Expand All @@ -115,9 +116,14 @@ public static IEnumerator ExoFormCountdown(Entity buffEntity, Entity playerEntit

countdown--;
yield return SecondDelay;

if (countdown == 0f)
{
fullDuration = true; // Mark as used full duration
}
}

UpdateFullExoFormChargeUsed(playerEntity.GetSteamId());
if (fullDuration) UpdateFullExoFormChargeUsed(playerEntity.GetSteamId());
}
public static void UpdateExoFormChargeStored(ulong steamId)
{
Expand Down

0 comments on commit 7daca30

Please sign in to comment.