Formula

CommonFun.CalcTeamPwsScore

``````function CommonFun.CalcTeamPwsScore(winteam_ave, loseteam_ave, winmax, losemax, selfscore, iswin, extrascore)
local user_score = 0
local winscore = 0
local losescore = 0
if selfscore < 500 then
winscore = 100
losescore = 50
elseif selfscore < 1200 then
winscore = 100
losescore = 20
elseif selfscore < 2000 then
winscore = 100
losescore = 0
elseif selfscore < 2600 then
winscore = 100
losescore = -30
elseif selfscore < 3000 then
winscore = 100
losescore = -70
else
winscore = 100
losescore = -120
end
local selfscore0 = selfscore
if 3000 <= winteam_ave then
winteam_ave = winteam_ave + (winteam_ave - 3000) * 9
end
if 3000 <= loseteam_ave then
loseteam_ave = loseteam_ave + (loseteam_ave - 3000) * 9
end
if 3000 <= selfscore0 then
selfscore = selfscore0 + (selfscore0 - 3000) * 9
end
if iswin == true then
local a = loseteam_ave - winteam_ave
local b = selfscore - winteam_ave + 100
local c = 1
local grouppara = 1
if 50 >= math.abs(a) then
a = 1
end
if b <= -250 then
b = -250
end
local avepara = 0.1 * math.sin(math.min(math.abs(a), 400) * math.pi / 800) * math.abs(a) / a
if math.abs(b) > 150 then
grouppara = 1 / math.tan((math.min(math.abs(b), 480) - 0.1) / 1000 * math.pi) * ((math.min(math.abs(b), 480) - 0.1) / 1000 * math.pi)
end
if 500 < b then
c = (1000 - math.min(1000, b)) / 1000
end
user_score = math.max((1.1 + avepara) * (0.2 * c + 0.8 * grouppara) * winscore, 1)
end
if iswin == false then
if selfscore < 1200 then
local a = winteam_ave - loseteam_ave
local b = selfscore - loseteam_ave + 100
if 50 >= math.abs(a) then
a = 1
end
if b <= -250 then
b = -250
end
local grouppara = 1
local avepara = 0.1 * math.sin(math.min(math.abs(a), 400) * math.pi / 800) * math.abs(a) / a
if math.abs(b) > 150 then
grouppara = 1 / math.tan((math.min(math.abs(b), 480) - 0.1) / 1000 * math.pi) * ((math.min(math.abs(b), 480) - 0.1) / 1000 * math.pi)
end
user_score = math.max((1.1 + avepara) * (0.2 + 0.8 * grouppara) * losescore, 1)
elseif 1200 <= selfscore then
local a = winteam_ave - loseteam_ave
local b = selfscore - loseteam_ave + 100
if 50 >= math.abs(a) then
a = 1
end
if b <= -250 then
b = -250
end
local grouppara = 0.25
local avepara = -0.1 * math.sin(math.min(math.abs(a), 400) * math.pi / 800) * math.abs(a) / a
if 150 < b then
grouppara = 0.75 * math.sin(math.min(math.abs(b), 480) * math.pi / 1000) * math.abs(b) / b
end
if b < -150 then
grouppara = 0.25 * math.sin(math.min(math.abs(b), 480) * math.pi / 1000) * math.abs(b) / b
end
user_score = math.min((0.9 + avepara) * (0.75 + grouppara) * losescore, -1)
end
end
if 3000 <= user_score + selfscore + extrascore then
user_score = 3000 + (user_score + selfscore + extrascore - 3000) / 10 - selfscore0
else
user_score = user_score + selfscore + extrascore - selfscore0
end
return user_score
end
``````