kill count excludes self kill

This commit is contained in:
Gurge44 committed 2025-12-14 12:51:46 +01:00
1 parent c2bef8f212
commit 53cb868ffb
4 files changed
+5 -5

No files matched your search

+2 -2
View File
@@ -410,9 +410,9 @@ public class PlayerState(byte playerId)
return IsDead && RealKiller.TimeStamp != DateTime.MinValue ? RealKiller.ID : byte.MaxValue;
}
public int GetKillCount(bool excludeSelfKill = false)
public int GetKillCount()
{
return Main.PlayerStates.Values.Count(state => !(excludeSelfKill && state.PlayerId == PlayerId) && state.GetRealKiller() == PlayerId);
return Main.PlayerStates.Values.Count(state => state.PlayerId != PlayerId && state.GetRealKiller() == PlayerId);
}
}
+1 -1
View File
@@ -52,7 +52,7 @@ public class ClockBlocker : RoleBase
private int GetAddedTime()
{
return !Main.PlayerStates.TryGetValue(ClockBlockerId, out PlayerState state) || (state.IsDead && !CountAddedTimeAfterDeath.GetBool()) ? 0 : EmergencyCooldownIncreasePerKill.GetInt() * state.GetKillCount(true);
return !Main.PlayerStates.TryGetValue(ClockBlockerId, out PlayerState state) || (state.IsDead && !CountAddedTimeAfterDeath.GetBool()) ? 0 : EmergencyCooldownIncreasePerKill.GetInt() * state.GetKillCount();
}
public static int GetTotalTime(int originalTime)
+1 -1
View File
@@ -63,7 +63,7 @@ public class Mercenary : RoleBase
private static bool HasKilled(PlayerControl pc)
{
return pc != null && pc.Is(CustomRoles.Mercenary) && pc.IsAlive() && (Main.PlayerStates[pc.PlayerId].GetKillCount(true) > 0 || !WaitFor1Kill.GetBool());
return pc != null && pc.Is(CustomRoles.Mercenary) && pc.IsAlive() && (Main.PlayerStates[pc.PlayerId].GetKillCount() > 0 || !WaitFor1Kill.GetBool());
}
public override bool OnCheckMurder(PlayerControl killer, PlayerControl target)
+1 -1
View File
@@ -57,7 +57,7 @@ public class TimeThief : RoleBase
private static int StolenTime(byte id)
{
return PlayerIdList.Contains(id) && (Utils.GetPlayerById(id).IsAlive() || !ReturnStolenTimeUponDeath.GetBool())
? DecreaseMeetingTime.GetInt() * Main.PlayerStates[id].GetKillCount(true)
? DecreaseMeetingTime.GetInt() * Main.PlayerStates[id].GetKillCount()
: 0;
}