Fix points on replayed rounds
This commit is contained in:
parent
1978768a5d
commit
3073897ce2
@ -6,7 +6,7 @@ local settings = {
|
||||
JackpotMax = 2500,
|
||||
JackpotMultiplier = 1.1,
|
||||
MinimumRounds = 5,
|
||||
EndroundPoints = 50, -- Points to give at the end of the round (Jackpot gets added to the points the players get)
|
||||
EndroundPoints = 10, -- Points to give at the end of the round (Jackpot gets added to the points the players get)
|
||||
ZombiePointsFactor = 0.5, -- Factor of points zombies get of the points payout after round end
|
||||
LosePointReduction = 0.85 -- Factor of points that gets taken away from players who lost
|
||||
}
|
||||
@ -58,7 +58,7 @@ end
|
||||
local function postStatistics(mapParams, timesPlayed, freqMult, zombiePercentCalcMap)
|
||||
PrintMessage(HUD_PRINTTALK,"This map has been played "..timesPlayed.." times with humans winning "..(mapParams.TimesWon).." times.("..(math.Round((mapParams.TimesWon/timesPlayed)*100)).."%)")
|
||||
PrintMessage(HUD_PRINTTALK,"Zombies were playing this map for "..math.Round(zombiePercentCalcMap * 100).."% of the time.")
|
||||
PrintMessage(HUD_PRINTTALK,"frequency multiplier for this map is "..freqMult..". Play maps infrequently for a higher value!")
|
||||
PrintMessage(HUD_PRINTTALK,"frequency multiplier for this map is "..math.Round(freqMult, 2)..". Play maps infrequently for a higher value!")
|
||||
PrintMessage(HUD_PRINTTALK,"Special boost for this map is "..(mapParams.Boost)..". Tell an admin if you think it should be changed!")
|
||||
PrintMessage(HUD_PRINTTALK,"Map jackpot is now "..(mapParams.Jackpot)..".")
|
||||
end
|
||||
@ -80,7 +80,10 @@ hook.Add("PostEndRound", "pointsave_givedapoints", function(winner)
|
||||
|
||||
timer.Simple(0, function()
|
||||
print("point bonus hook")
|
||||
local zombiePercentCalcMap = (zombieIntervalCounter / totalIntervalCounter)
|
||||
local zombiePercentCalcMap = 1
|
||||
if totalIntervalCounter > 0 then
|
||||
zombiePercentCalcMap = (zombieIntervalCounter / totalIntervalCounter)
|
||||
end
|
||||
local timesPlayed = mapParams.TimesWon + mapParams.TimesLost
|
||||
local freqMult = 1 / math.pow(math.Max(timesPlayed, 10) / 10, 0.2) + 1
|
||||
|
||||
@ -125,11 +128,13 @@ hook.Add("PostEndRound", "pointsave_givedapoints", function(winner)
|
||||
|
||||
-- Calculate points to give
|
||||
local pointsToGive
|
||||
local jackpot = 0
|
||||
|
||||
if winner == TEAM_HUMAN then
|
||||
local finalMultiply = (mapParams.Boost * freqMult * (mapParams.TimesLost / timesPlayed) * zombiePercentCalcMap)
|
||||
PrintMessage(HUD_PRINTTALK, "Congratulations, you won the jackpot of "..mapParams.Jackpot.." for winning this round")
|
||||
pointsToGive = math.Round((settings.EndroundPoints * finalMultiply) + mapParams.Jackpot)
|
||||
PrintMessage(HUD_PRINTTALK, "Congratulations, every survivor won the jackpot of "..mapParams.Jackpot.." for winning this round")
|
||||
pointsToGive = math.Round((settings.EndroundPoints * finalMultiply))
|
||||
jackpot = mapParams.Jackpot
|
||||
mapParams.Jackpot = settings.JackpotStart
|
||||
else
|
||||
local finalMultiply = (mapParams.Boost * (mapParams.TimesWon / timesPlayed) * zombiePercentCalcMap)
|
||||
@ -141,12 +146,13 @@ hook.Add("PostEndRound", "pointsave_givedapoints", function(winner)
|
||||
-- Give or take points, and output messages for each player
|
||||
for k, ply in pairs(player.GetAll()) do
|
||||
local pointsToGivePly
|
||||
local points = ply:GetPoints()
|
||||
local points = math.Round(ply:GetSavedPoints())
|
||||
-- Calculate points to give for each player (Depending on if the round was lost or won)
|
||||
if ply:Team() == TEAM_HUMAN then
|
||||
pointsToGivePly = math.Round(pointsToGive)
|
||||
points = math.Round(ply:GetPoints())
|
||||
pointsToGivePly = math.Round(pointsToGive + jackpot)
|
||||
else
|
||||
pointsToGivePly = math.Round(pointsToGive * settings.ZombiePointsFactor) - points * settings.LosePointReduction
|
||||
pointsToGivePly = math.Round(pointsToGive * settings.ZombiePointsFactor - points * settings.LosePointReduction)
|
||||
end
|
||||
-- Limit pointsToGivePly
|
||||
if points + pointsToGivePly < 0 then pointsToGivePly = -points end
|
||||
|
Loading…
Reference in New Issue
Block a user