Formula

CommonFun.CalcTeamPwsScore

formula.lua
1function CommonFun.CalcTeamPwsScore(winteam_ave, loseteam_ave, winmax, losemax, selfscore, iswin, extrascore, delta_server_ave)
2  local user_score = 0
3  local winscore = 0
4  local losescore = 0
5  if selfscore < 500 then
6    winscore = 100
7    losescore = 50
8  elseif selfscore < 1200 then
9    winscore = 100
10    losescore = 20
11  elseif selfscore < 2000 then
12    winscore = 100
13    losescore = 0
14  elseif selfscore < 2600 then
15    winscore = 100
16    losescore = -30
17  elseif selfscore < 3000 then
18    winscore = 100
19    losescore = -70
20  else
21    winscore = 100
22    losescore = -120
23  end
24  local selfscore0 = selfscore
25  if 3000 <= winteam_ave then
26    winteam_ave = winteam_ave + (winteam_ave - 3000) * 9
27  end
28  if 3000 <= loseteam_ave then
29    loseteam_ave = loseteam_ave + (loseteam_ave - 3000) * 9
30  end
31  if 3000 <= selfscore0 then
32    selfscore = selfscore0 + (selfscore0 - 3000) * 9
33  end
34  local serverdiff = 0
35  if delta_server_ave < 0 then
36    local ave = math.abs(delta_server_ave)
37    serverdiff = 0.0052 * math.pow(ave, 3) - 0.086 * math.pow(ave, 2) + 0.491 * ave - 0.0276
38  end
39  if serverdiff < 0 then
40    serverdiff = 0
41  end
42  if iswin == true then
43    local a = loseteam_ave - winteam_ave
44    local b = selfscore - winteam_ave + 100
45    local c = 1
46    local grouppara = 1
47    if 50 >= math.abs(a) then
48      a = 1
49    end
50    if b <= -250 then
51      b = -250
52    end
53    local avepara = 0.1 * math.sin(math.min(math.abs(a), 400) * math.pi / 800) * math.abs(a) / a
54    if math.abs(b) > 150 then
55      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)
56    end
57    if 500 < b then
58      c = (1000 - math.min(1000, b)) / 1000
59    end
60    user_score = math.max((1.1 + avepara) * (0.2 * c + 0.8 * grouppara) * winscore * (1 + serverdiff * 0.1), 1)
61  end
62  if iswin == false then
63    if selfscore < 2000 then
64      local a = winteam_ave - loseteam_ave
65      local b = selfscore - loseteam_ave + 100
66      if 50 >= math.abs(a) then
67        a = 1
68      end
69      if b <= -250 then
70        b = -250
71      end
72      local grouppara = 1
73      local avepara = 0.1 * math.sin(math.min(math.abs(a), 400) * math.pi / 800) * math.abs(a) / a
74      if math.abs(b) > 150 then
75        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)
76      end
77      user_score = math.max((1.1 + avepara) * (0.2 + 0.8 * grouppara) * losescore * (1 + serverdiff * 0.25), 1)
78    elseif 2000 <= selfscore then
79      local a = winteam_ave - loseteam_ave
80      local b = selfscore - loseteam_ave + 100
81      if 50 >= math.abs(a) then
82        a = 1
83      end
84      if b <= -250 then
85        b = -250
86      end
87      local grouppara = 0.25
88      local avepara = -0.1 * math.sin(math.min(math.abs(a), 400) * math.pi / 800) * math.abs(a) / a
89      if 50 < a then
90        avepara = -(2.0E-4 * math.pow(a / 100, 5) - 0.0052 * math.pow(a / 100, 4) + 0.0417 * math.pow(a / 100, 3) - 0.1106 * math.pow(a / 100, 2) + 0.1406 * a / 100 - 0.0037)
91      end
92      if 150 < b then
93        grouppara = 0.75 * math.sin(math.min(math.abs(b), 480) * math.pi / 1000) * math.abs(b) / b
94      end
95      if b < -150 then
96        grouppara = 0.25 * math.sin(math.min(math.abs(b), 480) * math.pi / 1000) * math.abs(b) / b
97      end
98      user_score = math.min((1 + avepara) * (0.75 + grouppara) * losescore * (1 - serverdiff * 0.25), -1)
99    end
100  end
101  if 3000 <= user_score + selfscore + extrascore then
102    user_score = 3000 + (user_score + selfscore + extrascore - 3000) / 10 - selfscore0
103  else
104    user_score = user_score + selfscore + extrascore - selfscore0
105  end
106  return user_score
107end
Formula Graph

Connected Archive Data

See which cards, equipment, headwears, buffs, and other archived records connect to this formula.

Loading graph filters

CommonFun.CalcTeamPwsScore

commonfun-calcteampwsscore

Nodes

0

Edges

0

Related Nodes

Select at least one node type.