My favorites | Sign in
Project Home Downloads Wiki Issues Source
Repository:
Checkout   Browse   Changes   Clones  
Changes to /Themes/_fallback/Scripts/04 Scoring.lua
ffb1c81cc739 vs. cc745a7337af Compare: vs.  Format:
Revision cc745a7337af
Go to: 
Project members, sign in to write a code review
/Themes/_fallback/Scripts/04 Scoring.lua   ffb1c81cc739 /Themes/_fallback/Scripts/04 Scoring.lua   cc745a7337af
1 --internals table 1 --internals table
2 local Shared = {}; 2 local Shared = {};
3 --Special Scoring types. 3 --Special Scoring types.
4 local r = {}; 4 local r = {};
5 local DisabledScoringModes = { '[SSC] Radar Master' }; 5 local DisabledScoringModes = { '[SSC] Radar Master' };
6 --the following metatable makes any missing value in a table 0 instead of nil. 6 --the following metatable makes any missing value in a table 0 instead of nil.
7 local ZeroIfNotFound = { __index = function() return 0 end; }; 7 local ZeroIfNotFound = { __index = function() return 0 end; };
8 8
9 -- Retrieve the amount of taps/holds/rolls involved. Used for some formulas. 9 -- Retrieve the amount of taps/holds/rolls involved. Used for some formulas.
10 function GetTotalItems(radars) 10 function GetTotalItems(radars)
11 local total = radars:GetValue('RadarCategory_TapsAndHolds') 11 local total = radars:GetValue('RadarCategory_TapsAndHolds')
12 total = total + radars:GetValue('RadarCategory_Holds') 12 total = total + radars:GetValue('RadarCategory_Holds')
13 total = total + radars:GetValue('RadarCategory_Rolls') 13 total = total + radars:GetValue('RadarCategory_Rolls')
14 -- [ja] Liftを加えると一部二重加算になるため除外する。 14 -- [ja] Liftを加えると一部二重加算になるため除外する。
15 -- total = total + radars:GetValue('RadarCategory_Lifts') 15 -- total = total + radars:GetValue('RadarCategory_Lifts')
16 16
17 -- [en] prevent divide by 0 17 -- [en] prevent divide by 0
18 -- [ja] 0除算対策(しなくても動作するけど満点になっちゃうんで) 18 -- [ja] 0除算対策(しなくても動作するけど満点になっちゃうんで)
19 return math.max(1,total); 19 return math.max(1,total);
20 end; 20 end;
21 21
22 -- Determine whether marvelous timing is to be considered. 22 -- Determine whether marvelous timing is to be considered.
23 function IsW1Allowed(tapScore) 23 function IsW1Allowed(tapScore)
24 return tapScore == 'TapNoteScore_W2' 24 return tapScore == 'TapNoteScore_W2'
25 and (PREFSMAN:GetPreference("AllowW1") ~= 'AllowW1_Never' 25 and (PREFSMAN:GetPreference("AllowW1") ~= 'AllowW1_Never'
26 or not (GAMESTATE:IsCourseMode() and 26 or not (GAMESTATE:IsCourseMode() and
27 PREFSMAN:GetPreference("AllowW1") == 'AllowW1_CoursesOnly')); 27 PREFSMAN:GetPreference("AllowW1") == 'AllowW1_CoursesOnly'));
28 end; 28 end;
29 29
30 -- Get the radar values directly. The individual steps aren't used much. 30 -- Get the radar values directly. The individual steps aren't used much.
31 function GetDirectRadar(player) 31 function GetDirectRadar(player)
32 return GAMESTATE:GetCurrentSteps(player):GetRadarValues(player); 32 return GAMESTATE:GetCurrentSteps(player):GetRadarValues(player);
33 end; 33 end;
34 34
35 ----------------------------------------------------------- 35 -----------------------------------------------------------
36 --StepMania 3.9 (Plus) Scorings by @803832 36 -- StepMania 3.9 (Plus) Scorings by @803832
37 --3.9 MAX2 37 -- 3.9 MAX2
38 --3.9 5TH 38 -- 3.9 5TH
39 --3.9Plus HYBRID 39 -- 3.9Plus HYBRID
40 --3.9Plus SN 40 -- 3.9Plus SN
41 --3.9Plus SN2 41 -- 3.9Plus SN2
42 -- note: 3.9Plus PIU Scoring cannot be implemented due to no NumTapsInRow 42 -- note: 3.9Plus PIU Scoring cannot be implemented due to no NumTapsInRow
43 -- in JudgmentMessage. This is fixed in hanubeki-modified-sm-ssc revision 6c7184e7df9a: 43 -- in JudgmentMessage. This is fixed in hanubeki-modified-sm-ssc revision 6c7184e7df9a:
44 -- http://code.google.com/r/hanubeki-modified-sm-ssc/source/detail?r=6c7184e7df9a3694649f965c2976859bb9e45963 44 -- http://code.google.com/r/hanubeki-modified-sm-ssc/source/detail?r=6c7184e7df9a3694649f965c2976859bb9e45963
45 ----------------------------------------------------------- 45 -----------------------------------------------------------
46 local function isW2OrAbove(tns) 46 local function isW2OrAbove(tns)
47 if tns == 'TapNoteScore_W1' or tns == 'TapNoteScore_W2' then 47 if tns == 'TapNoteScore_W1' or tns == 'TapNoteScore_W2' then
48 return true; 48 return true;
49 end; 49 end;
50 return false; 50 return false;
51 end 51 end
52 local sm3_Steps = {0,0}; 52 local sm3_Steps = {0,0};
53 local sm3_Score = {0,0}; 53 local sm3_Score = {0,0};
54 local sm3_CurMaxScore = {0,0}; 54 local sm3_CurMaxScore = {0,0};
55 local sm3_Combo = {0,0}; 55 local sm3_Combo = {0,0};
56 local sm3_CurMaxCombo = {0,0}; 56 local sm3_CurMaxCombo = {0,0};
57 local sm3_GradePoints = {0,0}; 57 local sm3_GradePoints = {0,0};
58 local sm3_Bonus = {0,0}; 58 local sm3_Bonus = {0,0};
59 local sm3_MaxBonus = {0,0}; 59 local sm3_MaxBonus = {0,0};
60 60
61 r["3.9 MAX2"] = function(params, pss) 61 r["3.9 MAX2"] = function(params, pss)
62 local multLookup = 62 local multLookup =
63 { 63 {
64 ['TapNoteScore_W1'] = 10, 64 ['TapNoteScore_W1'] = 10,
65 ['TapNoteScore_W2'] = GAMESTATE:ShowW1() and 9 or 10, 65 ['TapNoteScore_W2'] = GAMESTATE:ShowW1() and 9 or 10,
66 ['TapNoteScore_W3'] = 5 66 ['TapNoteScore_W3'] = 5
67 }; 67 };
68 setmetatable(multLookup, ZeroIfNotFound); 68 setmetatable(multLookup, ZeroIfNotFound);
69 local radarValues = GetDirectRadar(params.Player); 69 local radarValues = GetDirectRadar(params.Player);
70 local totalItems = GetTotalItems(radarValues); 70 local totalItems = GetTotalItems(radarValues);
71 -- 1+2+3+...+totalItems value/の値 71 -- 1+2+3+...+totalItems value/の値
72 local sTotal = (totalItems+1)*totalItems/2; 72 local sTotal = (totalItems+1)*totalItems/2;
73 local steps = GAMESTATE:GetCurrentSteps(params.Player); 73 local steps = GAMESTATE:GetCurrentSteps(params.Player);
74 local meter = steps:GetMeter(); 74 local meter = steps:GetMeter();
75 meter = clamp(meter,1,10); 75 meter = clamp(meter,1,10);
76 76
77 -- [ja] 満点を求める 77 -- [ja] 満点を求める
78 local length = 1; 78 local length = 1;
79 if (GAMESTATE:GetCurrentSong():IsMarathon()) then 79 if (GAMESTATE:GetCurrentSong():IsMarathon()) then
80 length = 3; 80 length = 3;
81 elseif (GAMESTATE:GetCurrentSong():IsLong()) then 81 elseif (GAMESTATE:GetCurrentSong():IsLong()) then
82 length = 2; 82 length = 2;
83 end; 83 end;
84 local baseScore = meter * 10000000 * length; 84 local baseScore = meter * 10000000 * length;
85 85
86 local sOne = baseScore/sTotal; 86 local sOne = baseScore/sTotal;
87 87
88 local p = (params.Player == 'PlayerNumber_P1') and 1 or 2; 88 local p = (params.Player == 'PlayerNumber_P1') and 1 or 2;
89 89
90 -- [ja] スコアが0の時に初期化 90 -- [ja] スコアが0の時に初期化
91 if pss:GetScore()==0 then 91 if pss:GetScore()==0 then
92 sm3_Steps[p] = 0; 92 sm3_Steps[p] = 0;
93 end; 93 end;
94 94
95 -- [ja] 現在のステップ数 95 -- [ja] 現在のステップ数
96 -- [ja] 地雷とHoldCheckpointsの場合は加算しない 96 -- [ja] 地雷とHoldCheckpointsの場合は加算しない
97 if params.TapNoteScore ~= "TapNoteScore_HitMine" and 97 if params.TapNoteScore ~= "TapNoteScore_HitMine" and
98 params.TapNoteScore ~= "TapNoteScore_AvoidMine" and 98 params.TapNoteScore ~= "TapNoteScore_AvoidMine" and
99 params.TapNoteScore ~= "TapNoteScore_CheckpointHit" and 99 params.TapNoteScore ~= "TapNoteScore_CheckpointHit" and
100 params.TapNoteScore ~= "TapNoteScore_CheckpointMiss" 100 params.TapNoteScore ~= "TapNoteScore_CheckpointMiss"
101 then 101 then
102 sm3_Steps[p]=sm3_Steps[p]+1; 102 sm3_Steps[p]=sm3_Steps[p]+1;
103 end; 103 end;
104 104
105 -- [en] current score 105 -- [en] current score
106 -- [ja] 今回加算するスコア(W1の時) 106 -- [ja] 今回加算するスコア(W1の時)
107 local vScore = sOne*sm3_Steps[p]; 107 local vScore = sOne*sm3_Steps[p];
108 pss:SetCurMaxScore(pss:GetCurMaxScore()+math.floor(vScore)); 108 pss:SetCurMaxScore(pss:GetCurMaxScore()+math.floor(vScore));
109 -- [ja] 判定によって加算量を変更 109 -- [ja] 判定によって加算量を変更
110 if (params.HoldNoteScore == 'HoldNoteScore_Held') then 110 if (params.HoldNoteScore == 'HoldNoteScore_Held') then
111 vScore = vScore; 111 vScore = vScore;
112 else 112 else
113 if (params.HoldNoteScore == 'HoldNoteScore_LetGo') then 113 if (params.HoldNoteScore == 'HoldNoteScore_LetGo') then
114 vScore = 0; 114 vScore = 0;
115 else 115 else
116 vScore = vScore*multLookup[params.TapNoteScore]/10; 116 vScore = vScore*multLookup[params.TapNoteScore]/10;
117 end; 117 end;
118 end; 118 end;
119 119
120 -- [ja] 落ちていた場合は入るスコアが減る 120 -- [ja] 落ちていた場合は入るスコアが減る
121 if (pss:GetFailed()) then 121 if (pss:GetFailed()) then
122 if (params.HoldNoteScore == 'HoldNoteScore_Held') then 122 if (params.HoldNoteScore == 'HoldNoteScore_Held') then
123 -- [ja] O.K.判定時は10点 123 -- [ja] O.K.判定時は10点
124 sm3_Score[p] = sm3_Score[p]+10; 124 sm3_Score[p] = sm3_Score[p]+10;
125 elseif (params.HoldNoteScore ~= 'HoldNoteScore_LetGo') then 125 elseif (params.HoldNoteScore ~= 'HoldNoteScore_LetGo') then
126 -- [ja] O.K.でもN.G.でもない場合のスコア: 126 -- [ja] O.K.でもN.G.でもない場合のスコア:
127 -- W1 (Marvelous): 10 127 -- W1 (Marvelous): 10
128 -- W2 (Perfect): 9 128 -- W2 (Perfect): 9
129 -- W3 (Great): 5 129 -- W3 (Great): 5
130 sm3_Score[p] = sm3_Score[p]+multLookup[params.TapNoteScore]; 130 sm3_Score[p] = sm3_Score[p]+multLookup[params.TapNoteScore];
131 end; 131 end;
132 132
133 -- [ja] 5点単位の処理がなぜかここでされる 133 -- [ja] 5点単位の処理がなぜかここでされる
134 if multLookup[params.TapNoteScore] > 0 then 134 if multLookup[params.TapNoteScore] > 0 then
135 sm3_Score[p] = math.floor((sm3_Score[p] + 2) / 5) * 5; 135 sm3_Score[p] = math.floor((sm3_Score[p] + 2) / 5) * 5;
136 end; 136 end;
137 else 137 else
138 pss:SetScore(pss:GetScore()+math.floor(vScore)); 138 pss:SetScore(pss:GetScore()+math.floor(vScore));
139 end; 139 end;
140 140
141 if (sm3_Steps[p] == totalItems and not pss:GetFailed()) then 141 if (sm3_Steps[p] == totalItems and not pss:GetFailed()) then
142 -- [ja] 最後の1ステップがW2以上の場合、端数を加算する 142 -- [ja] 最後の1ステップがW2以上の場合、端数を加算する
143 -- [ja] 端数は設定上の満点と最終ステップ時点での満点の差から求める 143 -- [ja] 端数は設定上の満点と最終ステップ時点での満点の差から求める
144 if (isW2OrAbove(params.TapNoteScore) or params.HoldNoteScore == 'HoldNoteScore_Held') then 144 if (isW2OrAbove(params.TapNoteScore) or params.HoldNoteScore == 'HoldNoteScore_Held') then
145 pss:SetScore(pss:GetScore()+(baseScore-pss:GetCurMaxScore())); 145 pss:SetScore(pss:GetScore()+(baseScore-pss:GetCurMaxScore()));
146 pss:SetCurMaxScore(pss:GetCurMaxScore()+(baseScore-pss:GetCurMaxScore())); 146 pss:SetCurMaxScore(pss:GetCurMaxScore()+(baseScore-pss:GetCurMaxScore()));
147 end; 147 end;
148 end; 148 end;
149 end; 149 end;
150 150
151 -- TODO: Don't add combo bonus if autoplay 151 -- TODO: Don't add combo bonus if autoplay
152 r["3.9 5TH"] = function(params, pss) 152 r["3.9 5TH"] = function(params, pss)
153 local multLookup = 153 local multLookup =
154 { 154 {
155 ['TapNoteScore_W1'] = 10, 155 ['TapNoteScore_W1'] = 10,
156 ['TapNoteScore_W2'] = GAMESTATE:ShowW1() and 9 or 10, 156 ['TapNoteScore_W2'] = GAMESTATE:ShowW1() and 9 or 10,
157 ['TapNoteScore_W3'] = 5 157 ['TapNoteScore_W3'] = 5
158 }; 158 };
159 setmetatable(multLookup, ZeroIfNotFound); 159 setmetatable(multLookup, ZeroIfNotFound);
160 local radarValues = GetDirectRadar(params.Player); 160 local radarValues = GetDirectRadar(params.Player);
161 local totalItems = GetTotalItems(radarValues); 161 local totalItems = GetTotalItems(radarValues);
162 -- 1+2+3+...+totalItems value/の値 162 -- 1+2+3+...+totalItems value/の値
163 local sTotal = (totalItems+1)*totalItems/2; 163 local sTotal = (totalItems+1)*totalItems/2;
164 local steps = GAMESTATE:GetCurrentSteps(params.Player); 164 local steps = GAMESTATE:GetCurrentSteps(params.Player);
165 local meter = steps:GetMeter(); 165 local meter = steps:GetMeter();
166 meter = clamp(meter,1,10); 166 meter = clamp(meter,1,10);
167 167
168 -- [ja] 満点を求める 168 -- [ja] 満点を求める
169 local length = 1; 169 local length = 1;
170 if (GAMESTATE:GetCurrentSong():IsMarathon()) then 170 if (GAMESTATE:GetCurrentSong():IsMarathon()) then
171 length = 3; 171 length = 3;
172 elseif (GAMESTATE:GetCurrentSong():IsLong()) then 172 elseif (GAMESTATE:GetCurrentSong():IsLong()) then
173 length = 2; 173 length = 2;
174 end; 174 end;
175 local baseScore = (meter * length + 1) * 5000000; 175 local baseScore = (meter * length + 1) * 5000000;
176 176
177 local sOne = baseScore/sTotal; 177 local sOne = baseScore/sTotal;
178 178
179 local p = (params.Player == 'PlayerNumber_P1') and 1 or 2; 179 local p = (params.Player == 'PlayerNumber_P1') and 1 or 2;
180 180
181 -- [ja] スコアが0の時に初期化 181 -- [ja] スコアが0の時に初期化
182 if pss:GetScore()==0 then 182 if pss:GetScore()==0 then
183 sm3_Steps[p] = 0; 183 sm3_Steps[p] = 0;
184 sm3_Score[p] = 0; 184 sm3_Score[p] = 0;
185 sm3_CurMaxScore[p] = 0; 185 sm3_CurMaxScore[p] = 0;
186 sm3_Combo[p] = 0; 186 sm3_Combo[p] = 0;
187 sm3_CurMaxCombo[p] = 0; 187 sm3_CurMaxCombo[p] = 0;
188 sm3_GradePoints[p] = 0; 188 sm3_GradePoints[p] = 0;
189 sm3_Bonus[p] = 0; 189 sm3_Bonus[p] = 0;
190 sm3_MaxBonus[p] = 0; 190 sm3_MaxBonus[p] = 0;
191 end; 191 end;
192 192
193 -- [ja] 現在のステップ数 193 -- [ja] 現在のステップ数
194 -- [ja] 地雷とHoldCheckpointsの場合は加算しない 194 -- [ja] 地雷とHoldCheckpointsの場合は加算しない
195 if params.TapNoteScore ~= "TapNoteScore_HitMine" and 195 if params.TapNoteScore ~= "TapNoteScore_HitMine" and
196 params.TapNoteScore ~= "TapNoteScore_AvoidMine" and 196 params.TapNoteScore ~= "TapNoteScore_AvoidMine" and
197 params.TapNoteScore ~= "TapNoteScore_CheckpointHit" and 197 params.TapNoteScore ~= "TapNoteScore_CheckpointHit" and
198 params.TapNoteScore ~= "TapNoteScore_CheckpointMiss" 198 params.TapNoteScore ~= "TapNoteScore_CheckpointMiss"
199 then 199 then
200 sm3_Steps[p]=sm3_Steps[p]+1; 200 sm3_Steps[p]=sm3_Steps[p]+1;
201 end; 201 end;
202 202
203 -- [en] current score 203 -- [en] current score
204 -- [ja] 今回加算するスコア(W1の時) 204 -- [ja] 今回加算するスコア(W1の時)
205 local vScore = sOne*sm3_Steps[p]; 205 local vScore = sOne*sm3_Steps[p];
206 sm3_CurMaxScore[p] = sm3_CurMaxScore[p]+math.floor(vScore); 206 sm3_CurMaxScore[p] = sm3_CurMaxScore[p]+math.floor(vScore);
207 207
208 -- [ja] グレードの計算は5THではなくMAX2方式 208 -- [ja] グレードの計算は5THではなくMAX2方式
209 local gradeWeightTable = { 209 local gradeWeightTable = {
210 ['TapNoteScore_W1'] = 2, 210 ['TapNoteScore_W1'] = 2,
211 ['TapNoteScore_W2'] = 2, 211 ['TapNoteScore_W2'] = 2,
212 ['TapNoteScore_W3'] = 1, 212 ['TapNoteScore_W3'] = 1,
213 ['TapNoteScore_W5'] = -4, 213 ['TapNoteScore_W5'] = -4,
214 ['TapNoteScore_Miss'] = -8, 214 ['TapNoteScore_Miss'] = -8,
215 }; 215 };
216 setmetatable(gradeWeightTable, ZeroIfNotFound); 216 setmetatable(gradeWeightTable, ZeroIfNotFound);
217 217
218 -- [ja] 判定によって加算量を変更 218 -- [ja] 判定によって加算量を変更
219 if (params.HoldNoteScore == 'HoldNoteScore_Held') then 219 if (params.HoldNoteScore == 'HoldNoteScore_Held') then
220 vScore = vScore; 220 vScore = vScore;
221 sm3_GradePoints[p] = sm3_GradePoints[p] + 6; 221 sm3_GradePoints[p] = sm3_GradePoints[p] + 6;
222 else 222 else
223 if (params.HoldNoteScore == 'HoldNoteScore_LetGo') then 223 if (params.HoldNoteScore == 'HoldNoteScore_LetGo') then
224 vScore = 0; 224 vScore = 0;
225 else 225 else
226 vScore = vScore*multLookup[params.TapNoteScore]/10; 226 vScore = vScore*multLookup[params.TapNoteScore]/10;
227 sm3_GradePoints[p] = sm3_GradePoints[p] + gradeWeightTable[params.TapNoteScore]; 227 sm3_GradePoints[p] = sm3_GradePoints[p] + gradeWeightTable[params.TapNoteScore];
228 end; 228 end;
229 end; 229 end;
230 230
231 -- [ja] コンボは自前で処理する 231 -- [ja] コンボは自前で処理する
232 if not params.HoldNoteScore then 232 if not params.HoldNoteScore then
233 if params.TapNoteScore == 'TapNoteScore_W1' or 233 if params.TapNoteScore == 'TapNoteScore_W1' or
234 params.TapNoteScore == 'TapNoteScore_W2' or 234 params.TapNoteScore == 'TapNoteScore_W2' or
235 ( 235 (
236 GAMESTATE:GetPlayMode() ~= 'PlayMode_Oni' and 236 GAMESTATE:GetPlayMode() ~= 'PlayMode_Oni' and
237 params.TapNoteScore == 'TapNoteScore_W3' 237 params.TapNoteScore == 'TapNoteScore_W3'
238 ) 238 )
239 then 239 then
240 sm3_Combo[p] = sm3_Combo[p] + 1; 240 sm3_Combo[p] = sm3_Combo[p] + 1;
241 -- [ja] 地雷とHoldCheckpointsの場合はリセットしない 241 -- [ja] 地雷とHoldCheckpointsの場合はリセットしない
242 elseif params.TapNoteScore ~= "TapNoteScore_HitMine" and 242 elseif params.TapNoteScore ~= "TapNoteScore_HitMine" and
243 params.TapNoteScore ~= "TapNoteScore_AvoidMine" and 243 params.TapNoteScore ~= "TapNoteScore_AvoidMine" and
244 params.TapNoteScore ~= "TapNoteScore_CheckpointHit" and 244 params.TapNoteScore ~= "TapNoteScore_CheckpointHit" and
245 params.TapNoteScore ~= "TapNoteScore_CheckpointMiss" 245 params.TapNoteScore ~= "TapNoteScore_CheckpointMiss"
246 then 246 then
247 sm3_Combo[p] = 0; 247 sm3_Combo[p] = 0;
248 end; 248 end;
249 sm3_CurMaxCombo[p] = sm3_CurMaxCombo[p] + 1; 249 sm3_CurMaxCombo[p] = sm3_CurMaxCombo[p] + 1;
250 end; 250 end;
251 251
252 local bonusTable = 252 local bonusTable =
253 { 253 {
254 ['TapNoteScore_W1'] = 55, 254 ['TapNoteScore_W1'] = 55,
255 ['TapNoteScore_W2'] = 55, 255 ['TapNoteScore_W2'] = 55,
256 ['TapNoteScore_W3'] = 33 256 ['TapNoteScore_W3'] = 33
257 }; 257 };
258 setmetatable(bonusTable, ZeroIfNotFound); 258 setmetatable(bonusTable, ZeroIfNotFound);
259 259
260 -- [ja] 落ちていた場合は入るスコアが減る 260 -- [ja] 落ちていた場合は入るスコアが減る
261 if (pss:GetFailed()) then 261 if (pss:GetFailed()) then
262 if (params.HoldNoteScore == 'HoldNoteScore_Held') then 262 if (params.HoldNoteScore == 'HoldNoteScore_Held') then
263 -- [ja] O.K.判定時は10点 263 -- [ja] O.K.判定時は10点
264 sm3_Score[p] = sm3_Score[p]+10; 264 sm3_Score[p] = sm3_Score[p]+10;
265 elseif (params.HoldNoteScore ~= 'HoldNoteScore_LetGo') then 265 elseif (params.HoldNoteScore ~= 'HoldNoteScore_LetGo') then
266 -- [ja] O.K.でもN.G.でもない場合のスコア: 266 -- [ja] O.K.でもN.G.でもない場合のスコア:
267 -- W1 (Marvelous): 10 267 -- W1 (Marvelous): 10
268 -- W2 (Perfect): 9 268 -- W2 (Perfect): 9
269 -- W3 (Great): 5 269 -- W3 (Great): 5
270 sm3_Score[p] = sm3_Score[p]+multLookup[params.TapNoteScore]; 270 sm3_Score[p] = sm3_Score[p]+multLookup[params.TapNoteScore];
271 end; 271 end;
272 272
273 -- [ja] 5点単位の処理がなぜかここでされる 273 -- [ja] 5点単位の処理がなぜかここでされる
274 if multLookup[params.TapNoteScore] > 0 then 274 if multLookup[params.TapNoteScore] > 0 then
275 sm3_Score[p] = math.floor((sm3_Score[p] + 2) / 5) * 5; 275 sm3_Score[p] = math.floor((sm3_Score[p] + 2) / 5) * 5;
276 end; 276 end;
277 else 277 else
278 sm3_Score[p] = sm3_Score[p]+math.floor(vScore); 278 sm3_Score[p] = sm3_Score[p]+math.floor(vScore);
279 if (params.HoldNoteScore == 'HoldNoteScore_Held') then 279 if (params.HoldNoteScore == 'HoldNoteScore_Held') then
280 sm3_Bonus[p] = sm3_Bonus[p]+55*sm3_Combo[p]; 280 sm3_Bonus[p] = sm3_Bonus[p]+55*sm3_Combo[p];
281 elseif (params.HoldNoteScore ~= 'HoldNoteScore_LetGo') then 281 elseif (params.HoldNoteScore ~= 'HoldNoteScore_LetGo') then
282 sm3_Bonus[p] = sm3_Bonus[p]+bonusTable[params.TapNoteScore]*sm3_Combo[p]; 282 sm3_Bonus[p] = sm3_Bonus[p]+bonusTable[params.TapNoteScore]*sm3_Combo[p];
283 end; 283 end;
284 sm3_MaxBonus[p] = sm3_MaxBonus[p]+55*sm3_CurMaxCombo[p]; 284 sm3_MaxBonus[p] = sm3_MaxBonus[p]+55*sm3_CurMaxCombo[p];
285 end; 285 end;
286 286
287 if (sm3_Steps[p] == totalItems and not pss:GetFailed()) then 287 if (sm3_Steps[p] == totalItems and not pss:GetFailed()) then
288 -- [ja] 最後の1ステップがW2以上の場合、端数を加算する 288 -- [ja] 最後の1ステップがW2以上の場合、端数を加算する
289 -- [ja] 端数は設定上の満点と最終ステップ時点での満点の差から求める 289 -- [ja] 端数は設定上の満点と最終ステップ時点での満点の差から求める
290 if (isW2OrAbove(params.TapNoteScore) or params.HoldNoteScore == 'HoldNoteScore_Held') then 290 if (isW2OrAbove(params.TapNoteScore) or params.HoldNoteScore == 'HoldNoteScore_Held') then
291 sm3_Score[p] = sm3_Score[p]+(baseScore-sm3_CurMaxScore[p]); 291 sm3_Score[p] = sm3_Score[p]+(baseScore-sm3_CurMaxScore[p]);
292 sm3_CurMaxScore[p] = sm3_CurMaxScore[p]+(baseScore-sm3_CurMaxScore[p]); 292 sm3_CurMaxScore[p] = sm3_CurMaxScore[p]+(baseScore-sm3_CurMaxScore[p]);
293 end; 293 end;
294 end; 294 end;
295 295
296 -- [ja] 5点単位の処理は5TH方式のみでされる 296 -- [ja] 5点単位の処理は5TH方式のみでされる
297 pss:SetScore(sm3_Score[p] - sm3_Score[p] % 5); 297 pss:SetScore(sm3_Score[p] - sm3_Score[p] % 5);
298 pss:SetCurMaxScore(sm3_CurMaxScore[p] - sm3_CurMaxScore[p] % 5); 298 pss:SetCurMaxScore(sm3_CurMaxScore[p] - sm3_CurMaxScore[p] % 5);
299 299
300 if (sm3_Steps[p] == totalItems and not pss:GetFailed()) then 300 if (sm3_Steps[p] == totalItems and not pss:GetFailed()) then
301 -- [ja] コンボボーナスとグレードボーナスを加算 301 -- [ja] コンボボーナスとグレードボーナスを加算
302 -- [ja] 本当はリザルト画面でやりたいんだけどね 302 -- [ja] 本当はリザルト画面でやりたいんだけどね
303 local totalTaps = radarValues:GetValue('RadarCategory_TapsAndHolds'); 303 local totalTaps = radarValues:GetValue('RadarCategory_TapsAndHolds');
304 local totalHolds = radarValues:GetValue('RadarCategory_Holds') + radarValues:GetValue('RadarCategory_Rolls'); 304 local totalHolds = radarValues:GetValue('RadarCategory_Holds') + radarValues:GetValue('RadarCategory_Rolls');
305 305
306 local gradeBonusTable = { 306 local gradeBonusTable = {
307 -- Threshold: sm3_GradePoints[p] / (totalTaps * 2 + totalHolds * 6) * 100 307 -- Threshold: sm3_GradePoints[p] / (totalTaps * 2 + totalHolds * 6) * 100
308 { Threshold = 100, Bonus = 10000000 }, 308 { Threshold = 100, Bonus = 10000000 },
309 { Threshold = 93, Bonus = 1000000 }, 309 { Threshold = 93, Bonus = 1000000 },
310 { Threshold = 80, Bonus = 100000 }, 310 { Threshold = 80, Bonus = 100000 },
311 { Threshold = 65, Bonus = 10000 }, 311 { Threshold = 65, Bonus = 10000 },
312 { Threshold = 45, Bonus = 1000 }, 312 { Threshold = 45, Bonus = 1000 },
313 -- [ja] 45%に達していない場合は100点とする 313 -- [ja] 45%に達していない場合は100点とする
314 }; 314 };
315 315
316 local gradeBonus = 100; 316 local gradeBonus = 100;
317 317
318 for i = 1,#gradeBonusTable do 318 for i = 1,#gradeBonusTable do
319 if (sm3_GradePoints[p] / (totalTaps * 2 + totalHolds * 6) * 100 >= gradeBonusTable[i].Threshold) then 319 if (sm3_GradePoints[p] / (totalTaps * 2 + totalHolds * 6) * 100 >= gradeBonusTable[i].Threshold) then
320 gradeBonus = gradeBonusTable[i].Bonus; 320 gradeBonus = gradeBonusTable[i].Bonus;
321 break; 321 break;
322 end; 322 end;
323 end; 323 end;
324 324
325 if pss:GetFailed() then 325 if pss:GetFailed() then
326 gradeBonus = 0; 326 gradeBonus = 0;
327 end; 327 end;
328 328
329 pss:SetScore(pss:GetScore()+sm3_Bonus[p]+gradeBonus); 329 pss:SetScore(pss:GetScore()+sm3_Bonus[p]+gradeBonus);
330 pss:SetCurMaxScore(pss:GetCurMaxScore()+sm3_MaxBonus[p]+10000000); 330 pss:SetCurMaxScore(pss:GetCurMaxScore()+sm3_MaxBonus[p]+10000000);
331 end; 331 end;
332 end; 332 end;
333 333
334 r["3.9Plus HYBRID"] = function(params, pss) 334 r["3.9Plus HYBRID"] = function(params, pss)
335 local multLookup = 335 local multLookup =
336 { 336 {
337 ['TapNoteScore_W1'] = 10, 337 ['TapNoteScore_W1'] = 10,
338 ['TapNoteScore_W2'] = GAMESTATE:ShowW1() and 9 or 10, 338 ['TapNoteScore_W2'] = GAMESTATE:ShowW1() and 9 or 10,
339 ['TapNoteScore_W3'] = 5 339 ['TapNoteScore_W3'] = 5
340 }; 340 };
341 setmetatable(multLookup, ZeroIfNotFound); 341 setmetatable(multLookup, ZeroIfNotFound);
342 local radarValues = GetDirectRadar(params.Player); 342 local radarValues = GetDirectRadar(params.Player);
343 local totalItems = GetTotalItems(radarValues); 343 local totalItems = GetTotalItems(radarValues);
344 -- 1+2+3+...+totalItems value/の値 344 -- 1+2+3+...+totalItems value/の値
345 local sTotal = (totalItems+1)*totalItems/2; 345 local sTotal = (totalItems+1)*totalItems/2;
346 local steps = GAMESTATE:GetCurrentSteps(params.Player); 346 local steps = GAMESTATE:GetCurrentSteps(params.Player);
347 local meter = steps:GetMeter(); 347 local meter = steps:GetMeter();
348 meter = clamp(meter,1,10); 348 meter = clamp(meter,1,10);
349 349
350 -- [ja] 満点を求める 350 -- [ja] 満点を求める
351 local length = 1; 351 local length = 1;
352 if (GAMESTATE:GetCurrentSong():IsMarathon()) then 352 if (GAMESTATE:GetCurrentSong():IsMarathon()) then
353 length = 3; 353 length = 3;
354 elseif (GAMESTATE:GetCurrentSong():IsLong()) then 354 elseif (GAMESTATE:GetCurrentSong():IsLong()) then
355 length = 2; 355 length = 2;
356 end; 356 end;
357 local baseScore = 100000000 * length; 357 local baseScore = 100000000 * length;
358 358
359 local sOne = baseScore/sTotal; 359 local sOne = baseScore/sTotal;
360 360
361 local p = (params.Player == 'PlayerNumber_P1') and 1 or 2; 361 local p = (params.Player == 'PlayerNumber_P1') and 1 or 2;
362 362
363 -- [ja] スコアが0の時に初期化 363 -- [ja] スコアが0の時に初期化
364 if pss:GetScore()==0 then 364 if pss:GetScore()==0 then
365 sm3_Steps[p] = 0; 365 sm3_Steps[p] = 0;
366 end; 366 end;
367 367
368 -- [ja] 現在のステップ数 368 -- [ja] 現在のステップ数
369 -- [ja] 地雷とHoldCheckpointsの場合は加算しない 369 -- [ja] 地雷とHoldCheckpointsの場合は加算しない
370 if params.TapNoteScore ~= "TapNoteScore_HitMine" and 370 if params.TapNoteScore ~= "TapNoteScore_HitMine" and
371 params.TapNoteScore ~= "TapNoteScore_AvoidMine" and 371 params.TapNoteScore ~= "TapNoteScore_AvoidMine" and
372 params.TapNoteScore ~= "TapNoteScore_CheckpointHit" and 372 params.TapNoteScore ~= "TapNoteScore_CheckpointHit" and
373 params.TapNoteScore ~= "TapNoteScore_CheckpointMiss" 373 params.TapNoteScore ~= "TapNoteScore_CheckpointMiss"
374 then 374 then
375 sm3_Steps[p]=sm3_Steps[p]+1; 375 sm3_Steps[p]=sm3_Steps[p]+1;
376 end; 376 end;
377 377
378 -- [en] current score 378 -- [en] current score
379 -- [ja] 今回加算するスコア(W1の時) 379 -- [ja] 今回加算するスコア(W1の時)
380 local vScore = sOne*sm3_Steps[p]; 380 local vScore = sOne*sm3_Steps[p];
381 pss:SetCurMaxScore(pss:GetCurMaxScore()+math.floor(vScore)); 381 pss:SetCurMaxScore(pss:GetCurMaxScore()+math.floor(vScore));
382 -- [ja] 判定によって加算量を変更 382 -- [ja] 判定によって加算量を変更
383 if (params.HoldNoteScore == 'HoldNoteScore_Held') then 383 if (params.HoldNoteScore == 'HoldNoteScore_Held') then
384 vScore = vScore; 384 vScore = vScore;
385 else 385 else
386 if (params.HoldNoteScore == 'HoldNoteScore_LetGo') then 386 if (params.HoldNoteScore == 'HoldNoteScore_LetGo') then
387 vScore = 0; 387 vScore = 0;
388 else 388 else
389 vScore = vScore*multLookup[params.TapNoteScore]/10; 389 vScore = vScore*multLookup[params.TapNoteScore]/10;
390 end; 390 end;
391 end; 391 end;
392 392
393 -- [ja] 落ちていた場合は入るスコアが減る 393 -- [ja] 落ちていた場合は入るスコアが減る
394 if (pss:GetFailed()) then 394 if (pss:GetFailed()) then
395 if (params.HoldNoteScore == 'HoldNoteScore_Held') then 395 if (params.HoldNoteScore == 'HoldNoteScore_Held') then
396 -- [ja] O.K.判定時は10点 396 -- [ja] O.K.判定時は10点
397 pss:SetScore(pss:GetScore()+10); 397 pss:SetScore(pss:GetScore()+10);
398 elseif (params.HoldNoteScore ~= 'HoldNoteScore_LetGo') then 398 elseif (params.HoldNoteScore ~= 'HoldNoteScore_LetGo') then
399 -- [ja] O.K.でもN.G.でもない場合のスコア: 399 -- [ja] O.K.でもN.G.でもない場合のスコア:
400 -- W1 (Marvelous): 10 400 -- W1 (Marvelous): 10
401 -- W2 (Perfect): 9 401 -- W2 (Perfect): 9
402 -- W3 (Great): 5 402 -- W3 (Great): 5
403 pss:SetScore(pss:GetScore()+multLookup[params.TapNoteScore]); 403 pss:SetScore(pss:GetScore()+multLookup[params.TapNoteScore]);
404 end; 404 end;
405 405
406 -- [ja] 5点単位の処理がなぜかここでされる 406 -- [ja] 5点単位の処理がなぜかここでされる
407 if multLookup[params.TapNoteScore] > 0 then 407 if multLookup[params.TapNoteScore] > 0 then
408 pss:SetScore(math.floor((pss:GetScore() + 2) / 5) * 5); 408 pss:SetScore(math.floor((pss:GetScore() + 2) / 5) * 5);
409 end; 409 end;
410 else 410 else
411 pss:SetScore(pss:GetScore()+math.floor(vScore)); 411 pss:SetScore(pss:GetScore()+math.floor(vScore));
412 end; 412 end;
413 413
414 if (sm3_Steps[p] == totalItems and not pss:GetFailed()) then 414 if (sm3_Steps[p] == totalItems and not pss:GetFailed()) then
415 -- [ja] 最後の1ステップがW2以上の場合、端数を加算する 415 -- [ja] 最後の1ステップがW2以上の場合、端数を加算する
416 -- [ja] 端数は設定上の満点と最終ステップ時点での満点の差から求める 416 -- [ja] 端数は設定上の満点と最終ステップ時点での満点の差から求める
417 if (isW2OrAbove(params.TapNoteScore) or params.HoldNoteScore == 'HoldNoteScore_Held') then 417 if (isW2OrAbove(params.TapNoteScore) or params.HoldNoteScore == 'HoldNoteScore_Held') then
418 pss:SetScore(pss:GetScore()+(baseScore-pss:GetCurMaxScore())); 418 pss:SetScore(pss:GetScore()+(baseScore-pss:GetCurMaxScore()));
419 pss:SetCurMaxScore(pss:GetCurMaxScore()+(baseScore-pss:GetCurMaxScore())); 419 pss:SetCurMaxScore(pss:GetCurMaxScore()+(baseScore-pss:GetCurMaxScore()));
420 end; 420 end;
421 end; 421 end;
422 end; 422 end;
423 423
424 r["3.9Plus SN"] = function(params, pss) 424 r["3.9Plus SN"] = function(params, pss)
425 local radarValues = GetDirectRadar(params.Player); 425 local radarValues = GetDirectRadar(params.Player);
426 local totalItems = GetTotalItems(radarValues); 426 local totalItems = GetTotalItems(radarValues);
427 427
428 -- [ja] 満点を求める 428 -- [ja] 満点を求める
429 local length = 1; 429 local length = 1;
430 if (GAMESTATE:GetCurrentSong():IsMarathon()) then 430 if (GAMESTATE:GetCurrentSong():IsMarathon()) then
431 length = 3; 431 length = 3;
432 elseif (GAMESTATE:GetCurrentSong():IsLong()) then 432 elseif (GAMESTATE:GetCurrentSong():IsLong()) then
433 length = 2; 433 length = 2;
434 end; 434 end;
435 local baseScore = 10000000 * length; 435 local baseScore = 10000000 * length;
436 436
437 -- [en] current score 437 -- [en] current score
438 -- [ja] 今回加算するスコア 438 -- [ja] 今回加算するスコア
439 local multLookup = 439 local multLookup =
440 { 440 {
441 ['TapNoteScore_W1'] = math.floor(baseScore / totalItems), 441 ['TapNoteScore_W1'] = math.floor(baseScore / totalItems),
442 ['TapNoteScore_W2'] = math.floor(baseScore / totalItems), 442 ['TapNoteScore_W2'] = math.floor(baseScore / totalItems),
443 ['TapNoteScore_W3'] = math.floor(math.floor(baseScore / 2) / totalItems) 443 ['TapNoteScore_W3'] = math.floor(math.floor(baseScore / 2) / totalItems)
444 }; 444 };
445 setmetatable(multLookup, ZeroIfNotFound); 445 setmetatable(multLookup, ZeroIfNotFound);
446 local vScore = multLookup[params.TapNoteScore]; 446 local vScore = multLookup[params.TapNoteScore];
447 pss:SetCurMaxScore(pss:GetCurMaxScore()+multLookup['TapNoteScore_W1']); 447 pss:SetCurMaxScore(pss:GetCurMaxScore()+multLookup['TapNoteScore_W1']);
448 448
449 -- [ja] 判定によって加算量を変更 449 -- [ja] 判定によって加算量を変更
450 if (params.HoldNoteScore == 'HoldNoteScore_Held') then 450 if (params.HoldNoteScore == 'HoldNoteScore_Held') then
451 vScore = multLookup['TapNoteScore_W1']; 451 vScore = multLookup['TapNoteScore_W1'];
452 elseif (params.HoldNoteScore == 'HoldNoteScore_LetGo') then 452 elseif (params.HoldNoteScore == 'HoldNoteScore_LetGo') then
453 vScore = 0; 453 vScore = 0;
454 end; 454 end;
455 455
456 -- [ja] 落ちていた場合は入るスコアが減る 456 -- [ja] 落ちていた場合は入るスコアが減る
457 if (not pss:GetFailed()) then 457 if (not pss:GetFailed()) then
458 pss:SetScore(pss:GetScore()+math.floor(vScore)); 458 pss:SetScore(pss:GetScore()+math.floor(vScore));
459 end; 459 end;
460 460
461 -- [ja] 端数の処理はされていないようだ 461 -- [ja] 端数の処理はされていないようだ
462 end; 462 end;
463 463
464 r["3.9Plus SN2"] = function(params, pss) 464 r["3.9Plus SN2"] = function(params, pss)
465 local radarValues = GetDirectRadar(params.Player); 465 local radarValues = GetDirectRadar(params.Player);
466 local totalItems = GetTotalItems(radarValues); 466 local totalItems = GetTotalItems(radarValues);
467 467
468 -- [ja] 満点を求める 468 -- [ja] 満点を求める
469 local length = 1; 469 local length = 1;
470 if (GAMESTATE:GetCurrentSong():IsMarathon()) then 470 if (GAMESTATE:GetCurrentSong():IsMarathon()) then
471 length = 3; 471 length = 3;
472 elseif (GAMESTATE:GetCurrentSong():IsLong()) then 472 elseif (GAMESTATE:GetCurrentSong():IsLong()) then
473 length = 2; 473 length = 2;
474 end; 474 end;
475 local baseScore = 1000000 * length; 475 local baseScore = 1000000 * length;
476 476
477 -- [en] current score 477 -- [en] current score
478 -- [ja] 今回加算するスコア 478 -- [ja] 今回加算するスコア
479 local multLookup = 479 local multLookup =
480 { 480 {
481 ['TapNoteScore_W1'] = math.floor(baseScore / totalItems), 481 ['TapNoteScore_W1'] = math.floor(baseScore / totalItems),
482 ['TapNoteScore_W2'] = math.floor(baseScore / totalItems) - 10, 482 ['TapNoteScore_W2'] = math.floor(baseScore / totalItems) - 10,
483 ['TapNoteScore_W3'] = math.floor(math.floor(baseScore / 2) / totalItems) - 10 483 ['TapNoteScore_W3'] = math.floor(math.floor(baseScore / 2) / totalItems) - 10
484 }; 484 };
485 setmetatable(multLookup, ZeroIfNotFound); 485 setmetatable(multLookup, ZeroIfNotFound);
486 local vScore = multLookup[params.TapNoteScore]; 486 local vScore = multLookup[params.TapNoteScore];
487 pss:SetCurMaxScore(pss:GetCurMaxScore()+multLookup['TapNoteScore_W1']); 487 pss:SetCurMaxScore(pss:GetCurMaxScore()+multLookup['TapNoteScore_W1']);
488 488
489 -- [ja] 判定によって加算量を変更 489 -- [ja] 判定によって加算量を変更
490 if (params.HoldNoteScore == 'HoldNoteScore_Held') then 490 if (params.HoldNoteScore == 'HoldNoteScore_Held') then
491 vScore = multLookup['TapNoteScore_W1']; 491 vScore = multLookup['TapNoteScore_W1'];
492 elseif (params.HoldNoteScore == 'HoldNoteScore_LetGo') then 492 elseif (params.HoldNoteScore == 'HoldNoteScore_LetGo') then
493 vScore = 0; 493 vScore = 0;
494 end; 494 end;
495 495
496 -- [ja] 落ちていた場合は入るスコアが減る 496 -- [ja] 落ちていた場合は入るスコアが減る
497 if (not pss:GetFailed()) then 497 if (not pss:GetFailed()) then
498 pss:SetScore(pss:GetScore()+math.floor(vScore)); 498 pss:SetScore(pss:GetScore()+math.floor(vScore));
499 end; 499 end;
500 500
501 -- [ja] 端数の処理はされていないようだ 501 -- [ja] 端数の処理はされていないようだ
502 end; 502 end;
503 503
504 ----------------------------------------------------------- 504 -----------------------------------------------------------
505 --Oldschool scoring, best described as a modified 4th mix scheme 505 -- Oldschool scoring, best described as a modified 4th mix
506 --with a little 1st mix influence 506 -- scheme with a little 1st mix influence
507 ----------------------------------------------------------- 507 -----------------------------------------------------------
508 r['Oldschool'] = function(params, pss) 508 r['Oldschool'] = function(params, pss)
509 local bestPoints = 999 509 local bestPoints = 999
510 local scoreLookupTable = 510 local scoreLookupTable =
511 { 511 {
512 ['TapNoteScore_W1']=999, 512 ['TapNoteScore_W1']=999,
513 ['TapNoteScore_W2']=IsW1Allowed('TapNoteScore_W2') and 888 or 999, 513 ['TapNoteScore_W2']=IsW1Allowed('TapNoteScore_W2') and 888 or 999,
514 ['TapNoteScore_W3']=777, 514 ['TapNoteScore_W3']=777,
515 ['TapNoteScore_W4']=555, 515 ['TapNoteScore_W4']=555,
516 ['TapNoteScore_W5']=111, 516 ['TapNoteScore_W5']=111,
517 }; 517 };
518 setmetatable(scoreLookupTable, ZeroIfNotFound); 518 setmetatable(scoreLookupTable, ZeroIfNotFound);
519 local comboBonusForThisStep = (pss:GetCurrentCombo()*111)^1.1; 519 local comboBonusForThisStep = (pss:GetCurrentCombo()*111)^1.1;
520 local capScore = 1000000000; 520 local capScore = 1000000000;
521 pss:SetCurMaxScore(capScore); --i don't really care about weird scoring modes -fsx 521 pss:SetCurMaxScore(capScore); --i don't really care about weird scoring modes -fsx
522 local pointsGot = comboBonusForThisStep + scoreLookupTable[params.TapNoteScore] + (params.HoldNoteScore == 'HoldNoteScore_Held' and 777 or 0); 522 local pointsGot = comboBonusForThisStep + scoreLookupTable[params.TapNoteScore] + (params.HoldNoteScore == 'HoldNoteScore_Held' and 777 or 0);
523 pss:SetScore(clamp(pss:GetScore()+pointsGot,0,capScore)); 523 pss:SetScore(clamp(pss:GetScore()+pointsGot,0,capScore));
524 end; 524 end;
525 525
526 ----------------------------------------------------------- 526 -----------------------------------------------------------
527 --DDR MAX2/Extreme(-esque) Scoring by @sakuraponila 527 -- DDR MAX2/Extreme(-esque) Scoring by @sakuraponila
528 ----------------------------------------------------------- 528 -----------------------------------------------------------
529 local ext_Steps = {0,0}; 529 local ext_Steps = {0,0};
530 r['DDR Extreme'] = function(params, pss) 530 r['DDR Extreme'] = function(params, pss)
531 local multLookup = 531 local multLookup =
532 { 532 {
533 ['TapNoteScore_W1'] = 10, 533 ['TapNoteScore_W1'] = 10,
534 ['TapNoteScore_W2'] = 9, 534 ['TapNoteScore_W2'] = 9,
535 ['TapNoteScore_W3'] = 5 535 ['TapNoteScore_W3'] = 5
536 }; 536 };
537 setmetatable(multLookup, ZeroIfNotFound); 537 setmetatable(multLookup, ZeroIfNotFound);
538 local steps = GAMESTATE:GetCurrentSteps(params.Player); 538 local steps = GAMESTATE:GetCurrentSteps(params.Player);
539 local radarValues = GetDirectRadar(params.Player); 539 local radarValues = GetDirectRadar(params.Player);
540 local totalItems = GetTotalItems(radarValues); 540 local totalItems = GetTotalItems(radarValues);
541 -- 1 + 2 + 3 + ... + totalItems value/の値 541 -- 1 + 2 + 3 + ... + totalItems value/の値
542 local sTotal = (totalItems + 1) * totalItems / 2; 542 local sTotal = (totalItems + 1) * totalItems / 2;
543 local meter = steps:GetMeter(); 543 local meter = steps:GetMeter();
544 if (steps:IsAnEdit()) then 544 if (steps:IsAnEdit()) then
545 meter = 5; 545 meter = 5;
546 else 546 else
547 meter = math.min(10,meter); 547 meter = math.min(10,meter);
548 end; 548 end;
549 -- [en] score for one step 549 -- [en] score for one step
550 -- [ja] 1ステップあたりのスコア 550 -- [ja] 1ステップあたりのスコア
551 local baseScore = meter * 1000000 551 local baseScore = meter * 1000000
552 if (GAMESTATE:GetCurrentSong():IsMarathon()) then 552 if (GAMESTATE:GetCurrentSong():IsMarathon()) then
553 baseScore = baseScore * 3; 553 baseScore = baseScore * 3;
554 elseif (GAMESTATE:GetCurrentSong():IsLong()) then 554 elseif (GAMESTATE:GetCurrentSong():IsLong()) then
555 baseScore = baseScore * 2; 555 baseScore = baseScore * 2;
556 end; 556 end;
557 local sOne = math.floor(baseScore / sTotal); 557 local sOne = math.floor(baseScore / sTotal);
558 -- [en] measures for 5 points of units 558 -- [en] measures for 5 points of units
559 -- [ja] 5点単位のための処置 559 -- [ja] 5点単位のための処置
560 sOne = sOne - sOne % 5; 560 sOne = sOne - sOne % 5;
561 -- [en] because fractions are added by the last step, get value 561 -- [en] because fractions are added by the last step, get value
562 -- [ja] 端数は最後の1ステップで加算するのでその値を取得 562 -- [ja] 端数は最後の1ステップで加算するのでその値を取得
563 local sLast = baseScore - (sOne * sTotal); 563 local sLast = baseScore - (sOne * sTotal);
564 564
565 local p = (params.Player == 'PlayerNumber_P1') and 1 or 2; 565 local p = (params.Player == 'PlayerNumber_P1') and 1 or 2;
566 -- [en] initialized when score is 0 566 -- [en] initialized when score is 0
567 -- [ja] スコアが0の時に初期化 567 -- [ja] スコアが0の時に初期化
568 if pss:GetScore() == 0 then 568 if pss:GetScore() == 0 then
569 ext_Steps[p] = 0; 569 ext_Steps[p] = 0;
570 end; 570 end;
571 -- [en] now step count 571 -- [en] now step count
572 -- [ja] 現在のステップ数 572 -- [ja] 現在のステップ数
573 ext_Steps[p] = ext_Steps[p] + 1; 573 ext_Steps[p] = ext_Steps[p] + 1;
574 -- [en] current score 574 -- [en] current score
575 -- [ja] 今回加算するスコア(W1の時) 575 -- [ja] 今回加算するスコア(W1の時)
576 local vScore = sOne * ext_Steps[p]; 576 local vScore = sOne * ext_Steps[p];
577 pss:SetCurMaxScore(pss:GetCurMaxScore() + vScore); 577 pss:SetCurMaxScore(pss:GetCurMaxScore() + vScore);
578 -- [ja] 判定によって加算量を変更 578 -- [ja] 判定によって加算量を変更
579 if (params.HoldNoteScore == 'HoldNoteScore_Held') then 579 if (params.HoldNoteScore == 'HoldNoteScore_Held') then
580 -- [ja] O.K.判定時は問答無用で満点 580 -- [ja] O.K.判定時は問答無用で満点
581 vScore = vScore; 581 vScore = vScore;
582 else 582 else
583 -- [ja] N.G.判定時は問答無用で0点 583 -- [ja] N.G.判定時は問答無用で0点
584 if (params.HoldNoteScore == 'HoldNoteScore_LetGo') then 584 if (params.HoldNoteScore == 'HoldNoteScore_LetGo') then
585 vScore = 0; 585 vScore = 0;
586 -- [en] non-long note scoring 586 -- [en] non-long note scoring
587 -- [ja] それ以外ということは、ロングノート以外の判定である 587 -- [ja] それ以外ということは、ロングノート以外の判定である
588 else 588 else
589 vScore = vScore * multLookup[params.TapNoteScore] / 10 589 vScore = vScore * multLookup[params.TapNoteScore] / 10
590 end; 590 end;
591 end; 591 end;
592 -- [en] measures for 5 points of units 592 -- [en] measures for 5 points of units
593 -- [ja] ここでも5点単位のための処置 593 -- [ja] ここでも5点単位のための処置
594 vScore = vScore - vScore % 5 594 vScore = vScore - vScore % 5
595 pss:SetScore(pss:GetScore() + vScore); 595 pss:SetScore(pss:GetScore() + vScore);
596 -- if one of the last step, add the fractions 596 -- if one of the last step, add the fractions
597 -- [ja] 最後の1ステップの場合、端数を加算する 597 -- [ja] 最後の1ステップの場合、端数を加算する
598 if ((vScore > 0) and (ext_Steps[p] == totalItems)) then 598 if ((vScore > 0) and (ext_Steps[p] == totalItems)) then
599 pss:SetScore(pss:GetScore() + sLast); 599 pss:SetScore(pss:GetScore() + sLast);
600 end; 600 end;
601 end; 601 end;
602 602
603 ----------------------------------------------------------- 603 -----------------------------------------------------------
604 --HYBRID Scoring, contributed by @waiei 604 -- HYBRID Scoring, contributed by @waiei
605 ----------------------------------------------------------- 605 -----------------------------------------------------------
606 local hyb_Steps={0,0}; 606 local hyb_Steps={0,0};
607 r['Hybrid'] = function(params, pss) 607 r['Hybrid'] = function(params, pss)
608 local multLookup = 608 local multLookup =
609 { 609 {
610 ['TapNoteScore_W1'] = 10, 610 ['TapNoteScore_W1'] = 10,
611 ['TapNoteScore_W2'] = 9, 611 ['TapNoteScore_W2'] = 9,
612 ['TapNoteScore_W3'] = 5 612 ['TapNoteScore_W3'] = 5
613 }; 613 };
614 setmetatable(multLookup, ZeroIfNotFound); 614 setmetatable(multLookup, ZeroIfNotFound);
615 local radarValues = GetDirectRadar(params.Player); 615 local radarValues = GetDirectRadar(params.Player);
616 local totalItems = GetTotalItems(radarValues); 616 local totalItems = GetTotalItems(radarValues);
617 -- 1+2+3+...+totalItems value/の値 617 -- 1+2+3+...+totalItems value/の値
618 local sTotal = (totalItems+1)*totalItems/2; 618 local sTotal = (totalItems+1)*totalItems/2;
619 -- [en] Score for one song 619 -- [en] Score for one song
620 -- [ja] 1ステップあたりのスコア 620 -- [ja] 1ステップあたりのスコア
621 local sOne = math.floor(100000000/sTotal); 621 local sOne = math.floor(100000000/sTotal);
622 -- [ja] 端数は最後の1ステップで加算するのでその値を取得 622 -- [ja] 端数は最後の1ステップで加算するのでその値を取得
623 local sLast = 100000000-(sOne*sTotal); 623 local sLast = 100000000-(sOne*sTotal);
624 624
625 local p = (params.Player == 'PlayerNumber_P1') and 1 or 2; 625 local p = (params.Player == 'PlayerNumber_P1') and 1 or 2;
626 626
627 -- [ja] スコアが0の時に初期化 627 -- [ja] スコアが0の時に初期化
628 if pss:GetScore()==0 then 628 if pss:GetScore()==0 then
629 hyb_Steps[p]=0; 629 hyb_Steps[p]=0;
630 end; 630 end;
631 631
632 -- [ja] 現在のステップ数 632 -- [ja] 現在のステップ数
633 hyb_Steps[p]=hyb_Steps[p]+1; 633 hyb_Steps[p]=hyb_Steps[p]+1;
634 -- [en] current score 634 -- [en] current score
635 -- [ja] 今回加算するスコア(W1の時) 635 -- [ja] 今回加算するスコア(W1の時)
636 local vScore = sOne*hyb_Steps[p]; 636 local vScore = sOne*hyb_Steps[p];
637 pss:SetCurMaxScore(pss:GetCurMaxScore()+vScore); 637 pss:SetCurMaxScore(pss:GetCurMaxScore()+vScore);
638 -- [ja] 判定によって加算量を変更 638 -- [ja] 判定によって加算量を変更
639 if (params.HoldNoteScore == 'HoldNoteScore_Held') then 639 if (params.HoldNoteScore == 'HoldNoteScore_Held') then
640 vScore = vScore; 640 vScore = vScore;
641 else 641 else
642 if (params.HoldNoteScore == 'HoldNoteScore_LetGo') then 642 if (params.HoldNoteScore == 'HoldNoteScore_LetGo') then
643 vScore = 0; 643 vScore = 0;
644 else 644 else
645 vScore = vScore*multLookup[params.TapNoteScore]/10; 645 vScore = vScore*multLookup[params.TapNoteScore]/10;
646 end; 646 end;
647 end; 647 end;
648 pss:SetScore(pss:GetScore()+vScore); 648 pss:SetScore(pss:GetScore()+vScore);
649 649
650 -- [ja] 最後の1ステップの場合、端数を加算する 650 -- [ja] 最後の1ステップの場合、端数を加算する
651 if ((vScore > 0) and (hyb_Steps[p] == totalItems)) then 651 if ((vScore > 0) and (hyb_Steps[p] == totalItems)) then
652 pss:SetScore(pss:GetScore()+sLast); 652 pss:SetScore(pss:GetScore()+sLast);
653 end; 653 end;
654 end; 654 end;
655 655
656 ----------------------------------------------------------- 656 -----------------------------------------------------------
657 --DDR SuperNOVA scoring (Use MARVELOUS) by @sakuraponila 657 -- DDR SuperNOVA scoring (Use MARVELOUS) by @sakuraponila
658 ----------------------------------------------------------- 658 -----------------------------------------------------------
659 local sntmp_Score = {0,0}; 659 local sntmp_Score = {0,0};
660 local sntmp_Steps = {0,0}; 660 local sntmp_Steps = {0,0};
661 r['DDR SuperNOVA'] = function(params, pss) 661 r['DDR SuperNOVA'] = function(params, pss)
662 local multLookup = 662 local multLookup =
663 { 663 {
664 ['TapNoteScore_W1'] = 3, 664 ['TapNoteScore_W1'] = 3,
665 ['TapNoteScore_W2'] = 2, 665 ['TapNoteScore_W2'] = 2,
666 ['TapNoteScore_W3'] = 1 666 ['TapNoteScore_W3'] = 1
667 }; 667 };
668 setmetatable(multLookup, ZeroIfNotFound); 668 setmetatable(multLookup, ZeroIfNotFound);
669 local radarValues = GetDirectRadar(params.Player); 669 local radarValues = GetDirectRadar(params.Player);
670 local totalItems = GetTotalItems(radarValues) 670 local totalItems = GetTotalItems(radarValues)
671 local p = (params.Player == 'PlayerNumber_P1') and 1 or 2; 671 local p = (params.Player == 'PlayerNumber_P1') and 1 or 2;
672 672
673 -- initialized when score is 0 673 -- initialized when score is 0
674 -- [ja] スコアが0の時に初期化 674 -- [ja] スコアが0の時に初期化
675 if pss:GetScore() == 0 then 675 if pss:GetScore() == 0 then
676 sntmp_Score[p] = 0; 676 sntmp_Score[p] = 0;
677 sntmp_Steps[p] = 0; 677 sntmp_Steps[p] = 0;
678 end; 678 end;
679 679
680 -- [ja] 判定によって加算量を変更 680 -- [ja] 判定によって加算量を変更
681 local maxAdd = 0; 681 local maxAdd = 0;
682 -- [ja] O.K.判定時は問答無用で満点 682 -- [ja] O.K.判定時は問答無用で満点
683 if params.HoldNoteScore == 'HoldNoteScore_Held' then 683 if params.HoldNoteScore == 'HoldNoteScore_Held' then
684 maxAdd = 3; 684 maxAdd = 3;
685 else 685 else
686 -- [ja] N.G.判定時は問答無用で0点 686 -- [ja] N.G.判定時は問答無用で0点
687 if params.HoldNoteScore == 'HoldNoteScore_LetGo' then 687 if params.HoldNoteScore == 'HoldNoteScore_LetGo' then
688 maxAdd = 0; 688 maxAdd = 0;
689 -- [ja] それ以外ということは、ロングノート以外の判定である 689 -- [ja] それ以外ということは、ロングノート以外の判定である
690 else 690 else
691 maxAdd = multLookup[params.TapNoteScore]; 691 maxAdd = multLookup[params.TapNoteScore];
692 end 692 end
693 end; 693 end;
694 sntmp_Score[p] = sntmp_Score[p] + maxAdd; 694 sntmp_Score[p] = sntmp_Score[p] + maxAdd;
695 695
696 -- [ja] 踏み踏みしたステップ数 696 -- [ja] 踏み踏みしたステップ数
697 sntmp_Steps[p] = sntmp_Steps[p] + 1; 697 sntmp_Steps[p] = sntmp_Steps[p] + 1;
698 -- [ja] 現時点での、All W1判定の時のスコア 698 -- [ja] 現時点での、All W1判定の時のスコア
699 pss:SetCurMaxScore(math.floor(10000000 * sntmp_Steps[p] / totalItems / 3)); 699 pss:SetCurMaxScore(math.floor(10000000 * sntmp_Steps[p] / totalItems / 3));
700 -- [ja] 計算して代入 700 -- [ja] 計算して代入
701 pss:SetScore(math.floor(10000000 * sntmp_Score[p] / totalItems / 3)); 701 pss:SetScore(math.floor(10000000 * sntmp_Score[p] / totalItems / 3));
702 end; 702 end;
703 703
704 ----------------------------------------------------------- 704 -----------------------------------------------------------
705 --DDR SuperNOVA 2 scoring by @waiei 705 -- DDR SuperNOVA 2 scoring by @waiei
706 ----------------------------------------------------------- 706 -----------------------------------------------------------
707 local sn2tmp_Sub={0,0}; 707 local sn2tmp_Sub={0,0};
708 local sn2tmp_Score={0,0}; 708 local sn2tmp_Score={0,0};
709 local sn2tmp_Steps={0,0}; 709 local sn2tmp_Steps={0,0};
710 r['DDR SuperNOVA 2'] = function(params, pss) 710 r['DDR SuperNOVA 2'] = function(params, pss)
711 local multLookup = 711 local multLookup =
712 { 712 {
713 ['TapNoteScore_W1'] = 10, 713 ['TapNoteScore_W1'] = 10,
714 ['TapNoteScore_W2'] = 10, 714 ['TapNoteScore_W2'] = 10,
715 ['TapNoteScore_W3'] = 5 715 ['TapNoteScore_W3'] = 5
716 }; 716 };
717 setmetatable(multLookup, ZeroIfNotFound); 717 setmetatable(multLookup, ZeroIfNotFound);
718 local radarValues = GetDirectRadar(params.Player); 718 local radarValues = GetDirectRadar(params.Player);
719 local totalItems = GetTotalItems(radarValues); 719 local totalItems = GetTotalItems(radarValues);
720 local p = (params.Player == 'PlayerNumber_P1') and 1 or 2; 720 local p = (params.Player == 'PlayerNumber_P1') and 1 or 2;
721 721
722 -- [ja] スコアが0の時に初期化 722 -- [ja] スコアが0の時に初期化
723 if pss:GetScore()==0 then 723 if pss:GetScore()==0 then
724 sn2tmp_Sub[p]=0; 724 sn2tmp_Sub[p]=0;
725 sn2tmp_Score[p]=0; 725 sn2tmp_Score[p]=0;
726 sn2tmp_Steps[p]=0; 726 sn2tmp_Steps[p]=0;
727 end; 727 end;
728 728
729 -- [ja] maxAdd は 加算する最高点を 10 とした時の値(つまり、10=100% / 5=50%) 729 -- [ja] maxAdd は 加算する最高点を 10 とした時の値(つまり、10=100% / 5=50%)
730 local maxAdd = 0; 730 local maxAdd = 0;
731 -- [ja] O.K.判定時は問答無用で満点 731 -- [ja] O.K.判定時は問答無用で満点
732 if params.HoldNoteScore == 'HoldNoteScore_Held' then 732 if params.HoldNoteScore == 'HoldNoteScore_Held' then
733 maxAdd = 10; 733 maxAdd = 10;
734 else 734 else
735 -- [ja] N.G.判定時は問答無用で0点 735 -- [ja] N.G.判定時は問答無用で0点
736 if params.HoldNoteScore == 'HoldNoteScore_LetGo' then 736 if params.HoldNoteScore == 'HoldNoteScore_LetGo' then
737 maxAdd = 0; 737 maxAdd = 0;
738 -- [ja] それ以外ということは、ロングノート以外の判定である 738 -- [ja] それ以外ということは、ロングノート以外の判定である
739 else 739 else
740 maxAdd = multLookup[params.TapNoteScore]; 740 maxAdd = multLookup[params.TapNoteScore];
741 if (params.TapNoteScore == 'TapNoteScore_W2') or (params.TapNoteScore=='TapNoteScore_W3') then 741 if (params.TapNoteScore == 'TapNoteScore_W2') or (params.TapNoteScore=='TapNoteScore_W3') then
742 -- [ja] W2とW3の数を記録 742 -- [ja] W2とW3の数を記録
743 sn2tmp_Sub[p]=sn2tmp_Sub[p]+1; 743 sn2tmp_Sub[p]=sn2tmp_Sub[p]+1;
744 end; 744 end;
745 end 745 end
746 end; 746 end;
747 sn2tmp_Score[p]=sn2tmp_Score[p]+maxAdd; 747 sn2tmp_Score[p]=sn2tmp_Score[p]+maxAdd;
748 -- [ja] 踏み踏みしたステップ数 748 -- [ja] 踏み踏みしたステップ数
749 sn2tmp_Steps[p]=sn2tmp_Steps[p]+1; 749 sn2tmp_Steps[p]=sn2tmp_Steps[p]+1;
750 -- [ja] 現時点での、All W1判定の時のスコア 750 -- [ja] 現時点での、All W1判定の時のスコア
751 pss:SetCurMaxScore(math.floor(10000*sn2tmp_Steps[p]/totalItems) * 10); 751 pss:SetCurMaxScore(math.floor(10000*sn2tmp_Steps[p]/totalItems) * 10);
752 752
753 -- [ja] 計算して代入 753 -- [ja] 計算して代入
754 pss:SetScore((math.floor(10000*sn2tmp_Score[p]/totalItems) * 10) - (sn2tmp_Sub[p]*10) ); 754 pss:SetScore((math.floor(10000*sn2tmp_Score[p]/totalItems) * 10) - (sn2tmp_Sub[p]*10) );
755 end; 755 end;
756 756
757 ----------------------------------------------------------- 757 -----------------------------------------------------------
758 --Radar Master (disabled; todo: get this working with StepMania 5) 758 -- Radar Master (disabled)
759 -- (todo: get this working with StepMania 5)
759 ----------------------------------------------------------- 760 -----------------------------------------------------------
760 r['[SSC] Radar Master'] = function(params, pss) 761 r['[SSC] Radar Master'] = function(params, pss)
761 local masterTable = { 762 local masterTable = {
762 ['RadarCategory_Stream'] = 0, 763 ['RadarCategory_Stream'] = 0,
763 ['RadarCategory_Voltage'] = 0, 764 ['RadarCategory_Voltage'] = 0,
764 ['RadarCategory_Air'] = 0, 765 ['RadarCategory_Air'] = 0,
765 ['RadarCategory_Freeze'] = 0, 766 ['RadarCategory_Freeze'] = 0,
766 ['RadarCategory_Chaos'] = 0 767 ['RadarCategory_Chaos'] = 0
767 }; 768 };
768 local totalRadar = 0; 769 local totalRadar = 0;
769 local finalScore = 0; 770 local finalScore = 0;
770 for k,v in pairs(masterTable) do 771 for k,v in pairs(masterTable) do
771 local firstRadar = GetDirectRadar(params.Player):GetValue(k); 772 local firstRadar = GetDirectRadar(params.Player):GetValue(k);
772 if firstRadar == 0 then 773 if firstRadar == 0 then
773 masterTable[k] = nil; 774 masterTable[k] = nil;
774 else 775 else
775 masterTable[k] = firstRadar; 776 masterTable[k] = firstRadar;
776 totalRadar = totalRadar + firstRadar; 777 totalRadar = totalRadar + firstRadar;
777 end; 778 end;
778 end; 779 end;
779 --two loops are needed because we need to calculate totalRadar 780 -- two loops are needed, because we need to calculate totalRadar
780 --to actually calculate any part of the score 781 -- to actually calculate any part of the score
781 for k,v in pairs(masterTable) do 782 for k,v in pairs(masterTable) do
782 local curPortion = pss:GetRadarActual():GetValue(k) / v; 783 local curPortion = pss:GetRadarActual():GetValue(k) / v;
783 finalScore = finalScore + curPortion*(500000000*(v/totalRadar)); 784 finalScore = finalScore + curPortion*(500000000*(v/totalRadar));
784 end; 785 end;
785 pss:SetScore(finalScore); 786 pss:SetScore(finalScore);
786 end; 787 end;
788
787 ------------------------------------------------------------ 789 ------------------------------------------------------------
788 --Marvelous Incorporated Grading System (or MIGS for short) 790 -- Marvelous Incorporated Grading System (or MIGS for short)
789 --basically like DP scoring with locked DP values 791 -- basically like DP scoring with locked DP values
790 ------------------------------------------------------------ 792 ------------------------------------------------------------
791 r['MIGS'] = function(params,pss) 793 r['MIGS'] = function(params,pss)
792 local curScore = 0; 794 local curScore = 0;
793 local tapScoreTable = 795 local tapScoreTable =
794 { 796 {
795 ['TapNoteScore_W1'] = 3, 797 ['TapNoteScore_W1'] = 3,
796 ['TapNoteScore_W2'] = 2, 798 ['TapNoteScore_W2'] = 2,
797 ['TapNoteScore_W3'] = 1, 799 ['TapNoteScore_W3'] = 1,
798 ['TapNoteScore_W5'] = -4, 800 ['TapNoteScore_W5'] = -4,
799 ['TapNoteScore_Miss'] = -8 801 ['TapNoteScore_Miss'] = -8
800 }; 802 };
801 for k,v in pairs(tapScoreTable) do 803 for k,v in pairs(tapScoreTable) do
802 curScore = curScore + ( pss:GetTapNoteScores(k) * v ); 804 curScore = curScore + ( pss:GetTapNoteScores(k) * v );
803 end; 805 end;
804 curScore = math.max(0,curScore + ( pss:GetHoldNoteScores('HoldNoteScore_Held') * 6 )); 806 curScore = math.max(0,curScore + ( pss:GetHoldNoteScores('HoldNoteScore_Held') * 6 ));
805 pss:SetScore(curScore); 807 pss:SetScore(curScore);
806 end; 808 end;
807 809
808 -------------------------------------------------------------- 810 --------------------------------------------------------------
809 --1bilDP scoring because I can. 811 -- 1bilDP scoring because I can.
810 -------------------------------------------------------------- 812 --------------------------------------------------------------
811 r['Billions DP']= function(params,pss) 813 r['Billions DP']= function(params,pss)
812 local poss = pss:GetPossibleDancePoints() 814 local poss = pss:GetPossibleDancePoints()
813 pss:SetScore(math.floor((pss:GetActualDancePoints()/poss)*1000000000)) 815 pss:SetScore(math.floor((pss:GetActualDancePoints()/poss)*1000000000))
814 pss:SetCurMaxScore(math.floor((pss:GetCurrentPossibleDancePoints()/poss)*1000000000)) 816 pss:SetCurMaxScore(math.floor((pss:GetCurrentPossibleDancePoints()/poss)*1000000000))
815 end 817 end
818
816 ------------------------------------------------------------------------------- 819 -------------------------------------------------------------------------------
817 -- Formulas end here. 820 -- Formulas end here.
821
818 for v in ivalues(DisabledScoringModes) do r[v] = nil end 822 for v in ivalues(DisabledScoringModes) do r[v] = nil end
819 Scoring = r; 823 Scoring = r;
820 824
821 function UserPrefScoringMode() 825 function UserPrefScoringMode()
822 local baseChoices = {} 826 local baseChoices = {}
823 for k,v in pairs(Scoring) do table.insert(baseChoices,k) end 827 for k,v in pairs(Scoring) do table.insert(baseChoices,k) end
824 if next(baseChoices) == nil then UndocumentedFeature "No scoring modes available" end 828 if next(baseChoices) == nil then UndocumentedFeature "No scoring modes available" end
825 local t = { 829 local t = {
826 Name = "UserPrefScoringMode"; 830 Name = "UserPrefScoringMode";
827 LayoutType = "ShowAllInRow"; 831 LayoutType = "ShowAllInRow";
828 SelectType = "SelectOne"; 832 SelectType = "SelectOne";
829 OneChoiceForAllPlayers = true; 833 OneChoiceForAllPlayers = true;
830 ExportOnChange = false; 834 ExportOnChange = false;
831 Choices = baseChoices; 835 Choices = baseChoices;
832 LoadSelections = function(self, list, pn) 836 LoadSelections = function(self, list, pn)
833 if ReadPrefFromFile("UserPrefScoringMode") ~= nil then 837 if ReadPrefFromFile("UserPrefScoringMode") ~= nil then
834 --Load the saved scoring mode from UserPrefs. 838 --Load the saved scoring mode from UserPrefs.
835 local theValue = ReadPrefFromFile("UserPrefScoringMode"); 839 local theValue = ReadPrefFromFile("UserPrefScoringMode");
836 local success = false; 840 local success = false;
837 --HACK: Preview 4 took out 1st and 4th scoring. Replace with a close equivalent. 841
838 if theValue == "DDR 1stMIX" or theValue == "DDR 4thMIX" then theValue = "Oldschool" end 842 --HACK: Preview 4 took out 1st and 4th scoring. Replace with a close equivalent.
839 --Search the list of scoring modes for the saved scoring mode. 843 if theValue == "DDR 1stMIX" or theValue == "DDR 4thMIX" then theValue = "Oldschool" end
840 for k,v in ipairs(baseChoices) do if v == theValue then list[k] = true success = true break end end; 844
841 --We couldn't find it, pick the first available scoring mode as a sane default. 845 --Search the list of scoring modes for the saved scoring mode.
846 for k,v in ipairs(baseChoices) do
847 if v == theValue then list[k] = true success = true break end
848 end;
849
850 --We couldn't find it, pick the first available scoring mode as a sane default.
842 if success == false then list[1] = true end; 851 if success == false then list[1] = true end;
843 else 852 else
844 WritePrefToFile("UserPrefScoringMode", baseChoices[1]); 853 WritePrefToFile("UserPrefScoringMode", baseChoices[1]);
845 list[1] = true; 854 list[1] = true;
846 end; 855 end;
847 end; 856 end;
848 SaveSelections = function(self, list, pn) 857 SaveSelections = function(self, list, pn)
849 for k,v in ipairs(list) do if v then WritePrefToFile("UserPrefScoringMode", baseChoices[k]) break end end; 858 for k,v in ipairs(list) do
859 if v then WritePrefToFile("UserPrefScoringMode", baseChoices[k]) break end
860 end;
850 end; 861 end;
851 }; 862 };
852 setmetatable( t, t ); 863 setmetatable( t, t );
853 return t; 864 return t;
854 end 865 end
Powered by Google Project Hosting