diff --git a/Themes/_fallback/Scripts/04 Scoring.lua b/Themes/_fallback/Scripts/04 Scoring.lua index afdd8d2d54..d851bd19d2 100644 --- a/Themes/_fallback/Scripts/04 Scoring.lua +++ b/Themes/_fallback/Scripts/04 Scoring.lua @@ -52,7 +52,11 @@ end local sm3_Steps = {0,0}; local sm3_Score = {0,0}; local sm3_CurMaxScore = {0,0}; +local sm3_Combo = {0,0}; +local sm3_CurMaxCombo = {0,0}; +local sm3_GradePoints = {0,0}; local sm3_Bonus = {0,0}; +local sm3_MaxBonus = {0,0}; r["3.9 MAX2"] = function(params, pss) local multLookup = @@ -70,13 +74,12 @@ r["3.9 MAX2"] = function(params, pss) local meter = steps:GetMeter(); meter = clamp(meter,1,10); - -- [en] check song length and multiply accordingly. -- [ja] 満点を求める local length = 1; if (GAMESTATE:GetCurrentSong():IsMarathon()) then - length = 2; - elseif (GAMESTATE:GetCurrentSong():IsLong()) then length = 3; + elseif (GAMESTATE:GetCurrentSong():IsLong()) then + length = 2; end; local baseScore = meter * 10000000 * length; @@ -89,9 +92,16 @@ r["3.9 MAX2"] = function(params, pss) sm3_Steps[p] = 0; end; - -- [en] current number of steps -- [ja] 現在のステップ数 - sm3_Steps[p]=sm3_Steps[p]+1; + -- [ja] 地雷とHoldCheckpointsの場合は加算しない + if params.TapNoteScore ~= "TapNoteScore_HitMine" and + params.TapNoteScore ~= "TapNoteScore_AvoidMine" and + params.TapNoteScore ~= "TapNoteScore_CheckpointHit" and + params.TapNoteScore ~= "TapNoteScore_CheckpointMiss" + then + sm3_Steps[p]=sm3_Steps[p]+1; + end; + -- [en] current score -- [ja] 今回加算するスコア(W1の時) local vScore = sOne*sm3_Steps[p]; @@ -111,17 +121,18 @@ r["3.9 MAX2"] = function(params, pss) if (pss:GetFailed()) then if (params.HoldNoteScore == 'HoldNoteScore_Held') then -- [ja] O.K.判定時は10点 - pss:SetScore(pss:GetScore()+10); + sm3_Score[p] = sm3_Score[p]+10; elseif (params.HoldNoteScore ~= 'HoldNoteScore_LetGo') then -- [ja] O.K.でもN.G.でもない場合のスコア: -- W1 (Marvelous): 10 -- W2 (Perfect): 9 -- W3 (Great): 5 - pss:SetScore(pss:GetScore()+multLookup[params.TapNoteScore]); - -- [ja] 5点単位の処理がなぜかここでされる - if multLookup[params.TapNoteScore] > 0 then - pss:SetScore(math.floor((pss:GetScore() + 2) / 5) * 5); - end; + sm3_Score[p] = sm3_Score[p]+multLookup[params.TapNoteScore]; + end; + + -- [ja] 5点単位の処理がなぜかここでされる + if multLookup[params.TapNoteScore] > 0 then + sm3_Score[p] = math.floor((sm3_Score[p] + 2) / 5) * 5; end; else pss:SetScore(pss:GetScore()+math.floor(vScore)); @@ -137,6 +148,7 @@ r["3.9 MAX2"] = function(params, pss) end; end; +-- TODO: Don't add combo bonus if autoplay r["3.9 5TH"] = function(params, pss) local multLookup = { @@ -156,9 +168,9 @@ r["3.9 5TH"] = function(params, pss) -- [ja] 満点を求める local length = 1; if (GAMESTATE:GetCurrentSong():IsMarathon()) then - length = 2; - elseif (GAMESTATE:GetCurrentSong():IsLong()) then length = 3; + elseif (GAMESTATE:GetCurrentSong():IsLong()) then + length = 2; end; local baseScore = (meter * length + 1) * 5000000; @@ -169,28 +181,74 @@ r["3.9 5TH"] = function(params, pss) -- [ja] スコアが0の時に初期化 if pss:GetScore()==0 then sm3_Steps[p] = 0; - sm3_Bonus[p] = 0; sm3_Score[p] = 0; sm3_CurMaxScore[p] = 0; + sm3_Combo[p] = 0; + sm3_CurMaxCombo[p] = 0; + sm3_GradePoints[p] = 0; + sm3_Bonus[p] = 0; + sm3_MaxBonus[p] = 0; end; -- [ja] 現在のステップ数 - sm3_Steps[p]=sm3_Steps[p]+1; + -- [ja] 地雷とHoldCheckpointsの場合は加算しない + if params.TapNoteScore ~= "TapNoteScore_HitMine" and + params.TapNoteScore ~= "TapNoteScore_AvoidMine" and + params.TapNoteScore ~= "TapNoteScore_CheckpointHit" and + params.TapNoteScore ~= "TapNoteScore_CheckpointMiss" + then + sm3_Steps[p]=sm3_Steps[p]+1; + end; + -- [en] current score -- [ja] 今回加算するスコア(W1の時) local vScore = sOne*sm3_Steps[p]; sm3_CurMaxScore[p] = sm3_CurMaxScore[p]+math.floor(vScore); + + -- [ja] グレードの計算は5THではなくMAX2方式 + local gradeWeightTable = { + ['TapNoteScore_W1'] = 2, + ['TapNoteScore_W2'] = 2, + ['TapNoteScore_W3'] = 1, + ['TapNoteScore_W5'] = -4, + ['TapNoteScore_Miss'] = -8, + }; + setmetatable(gradeWeightTable, ZeroIfNotFound); + -- [ja] 判定によって加算量を変更 if (params.HoldNoteScore == 'HoldNoteScore_Held') then vScore = vScore; + sm3_GradePoints[p] = sm3_GradePoints[p] + 6; else if (params.HoldNoteScore == 'HoldNoteScore_LetGo') then vScore = 0; else vScore = vScore*multLookup[params.TapNoteScore]/10; + sm3_GradePoints[p] = sm3_GradePoints[p] + gradeWeightTable[params.TapNoteScore]; end; end; + -- [ja] コンボは自前で処理する + if not params.HoldNoteScore then + if params.TapNoteScore == 'TapNoteScore_W1' or + params.TapNoteScore == 'TapNoteScore_W2' or + ( + GAMESTATE:GetPlayMode() ~= 'PlayMode_Oni' and + params.TapNoteScore == 'TapNoteScore_W3' + ) + then + sm3_Combo[p] = sm3_Combo[p] + 1; + -- [ja] 地雷とHoldCheckpointsの場合はリセットしない + elseif params.TapNoteScore ~= "TapNoteScore_HitMine" and + params.TapNoteScore ~= "TapNoteScore_AvoidMine" and + params.TapNoteScore ~= "TapNoteScore_CheckpointHit" and + params.TapNoteScore ~= "TapNoteScore_CheckpointMiss" + then + sm3_Combo[p] = 0; + end; + sm3_CurMaxCombo[p] = sm3_CurMaxCombo[p] + 1; + end; + local bonusTable = { ['TapNoteScore_W1'] = 55, @@ -210,14 +268,20 @@ r["3.9 5TH"] = function(params, pss) -- W2 (Perfect): 9 -- W3 (Great): 5 sm3_Score[p] = sm3_Score[p]+multLookup[params.TapNoteScore]; - -- [ja] 5点単位の処理がなぜかここでされる - if multLookup[params.TapNoteScore] > 0 then - sm3_Score[p] = math.floor((sm3_Score[p] + 2) / 5) * 5; - end; + end; + + -- [ja] 5点単位の処理がなぜかここでされる + if multLookup[params.TapNoteScore] > 0 then + sm3_Score[p] = math.floor((sm3_Score[p] + 2) / 5) * 5; end; else sm3_Score[p] = sm3_Score[p]+math.floor(vScore); - sm3_Bonus[p] = sm3_Bonus[p]+multLookup[params.TapNoteScore]*pss:GetCurrentCombo(); + if (params.HoldNoteScore == 'HoldNoteScore_Held') then + sm3_Bonus[p] = sm3_Bonus[p]+55*sm3_Combo[p]; + elseif (params.HoldNoteScore ~= 'HoldNoteScore_LetGo') then + sm3_Bonus[p] = sm3_Bonus[p]+bonusTable[params.TapNoteScore]*sm3_Combo[p]; + end; + sm3_MaxBonus[p] = sm3_MaxBonus[p]+55*sm3_CurMaxCombo[p]; end; if (sm3_Steps[p] == totalItems and not pss:GetFailed()) then @@ -227,29 +291,44 @@ r["3.9 5TH"] = function(params, pss) sm3_Score[p] = sm3_Score[p]+(baseScore-sm3_CurMaxScore[p]); sm3_CurMaxScore[p] = sm3_CurMaxScore[p]+(baseScore-sm3_CurMaxScore[p]); end; - - -- [ja] コンボボーナスとグレードボーナスを加算 - sm3_Score[p] = sm3_Score[p]+sm3_Bonus[p]; - sm3_CurMaxScore[p] = sm3_CurMaxScore[p]+totalItems*sTotal; - - local gradeBonusTable = { - ['Grade_Tier01'] = 10000000, - ['Grade_Tier02'] = 10000000, - ['Grade_Tier03'] = 1000000, - ['Grade_Tier04'] = 100000, - ['Grade_Tier05'] = 10000, - ['Grade_Tier06'] = 1000, - ['Grade_Tier07'] = 100, - }; - setmetatable(gradeBonusTable, ZeroIfNotFound); - - sm3_Score[p] = sm3_Score[p]+gradeBonusTable[pss:GetGrade()]; - sm3_CurMaxScore[p] = sm3_CurMaxScore[p]+10000000; end; -- [ja] 5点単位の処理は5TH方式のみでされる pss:SetScore(sm3_Score[p] - sm3_Score[p] % 5); pss:SetCurMaxScore(sm3_CurMaxScore[p] - sm3_CurMaxScore[p] % 5); + + if (sm3_Steps[p] == totalItems and not pss:GetFailed()) then + -- [ja] コンボボーナスとグレードボーナスを加算 + -- [ja] 本当はリザルト画面でやりたいんだけどね + local totalTaps = radarValues:GetValue('RadarCategory_TapsAndHolds'); + local totalHolds = radarValues:GetValue('RadarCategory_Holds') + radarValues:GetValue('RadarCategory_Rolls'); + + local gradeBonusTable = { + -- Threshold: sm3_GradePoints[p] / (totalTaps * 2 + totalHolds * 6) * 100 + { Threshold = 100, Bonus = 10000000 }, + { Threshold = 93, Bonus = 1000000 }, + { Threshold = 80, Bonus = 100000 }, + { Threshold = 65, Bonus = 10000 }, + { Threshold = 45, Bonus = 1000 }, + -- [ja] 45%に達していない場合は100点とする + }; + + local gradeBonus = 100; + + for i = 1,#gradeBonusTable do + if (sm3_GradePoints[p] / (totalTaps * 2 + totalHolds * 6) * 100 >= gradeBonusTable[i].Threshold) then + gradeBonus = gradeBonusTable[i].Bonus; + break; + end; + end; + + if pss:GetFailed() then + gradeBonus = 0; + end; + + pss:SetScore(pss:GetScore()+sm3_Bonus[p]+gradeBonus); + pss:SetCurMaxScore(pss:GetCurMaxScore()+sm3_MaxBonus[p]+10000000); + end; end; r["3.9Plus HYBRID"] = function(params, pss) @@ -271,9 +350,9 @@ r["3.9Plus HYBRID"] = function(params, pss) -- [ja] 満点を求める local length = 1; if (GAMESTATE:GetCurrentSong():IsMarathon()) then - length = 2; - elseif (GAMESTATE:GetCurrentSong():IsLong()) then length = 3; + elseif (GAMESTATE:GetCurrentSong():IsLong()) then + length = 2; end; local baseScore = 100000000 * length; @@ -287,7 +366,15 @@ r["3.9Plus HYBRID"] = function(params, pss) end; -- [ja] 現在のステップ数 - sm3_Steps[p]=sm3_Steps[p]+1; + -- [ja] 地雷とHoldCheckpointsの場合は加算しない + if params.TapNoteScore ~= "TapNoteScore_HitMine" and + params.TapNoteScore ~= "TapNoteScore_AvoidMine" and + params.TapNoteScore ~= "TapNoteScore_CheckpointHit" and + params.TapNoteScore ~= "TapNoteScore_CheckpointMiss" + then + sm3_Steps[p]=sm3_Steps[p]+1; + end; + -- [en] current score -- [ja] 今回加算するスコア(W1の時) local vScore = sOne*sm3_Steps[p]; @@ -314,10 +401,11 @@ r["3.9Plus HYBRID"] = function(params, pss) -- W2 (Perfect): 9 -- W3 (Great): 5 pss:SetScore(pss:GetScore()+multLookup[params.TapNoteScore]); - -- [ja] 5点単位の処理がなぜかここでされる - if multLookup[params.TapNoteScore] > 0 then - pss:SetScore(math.floor((pss:GetScore() + 2) / 5) * 5); - end; + end; + + -- [ja] 5点単位の処理がなぜかここでされる + if multLookup[params.TapNoteScore] > 0 then + pss:SetScore(math.floor((pss:GetScore() + 2) / 5) * 5); end; else pss:SetScore(pss:GetScore()+math.floor(vScore)); @@ -340,9 +428,9 @@ r["3.9Plus SN"] = function(params, pss) -- [ja] 満点を求める local length = 1; if (GAMESTATE:GetCurrentSong():IsMarathon()) then - length = 2; - elseif (GAMESTATE:GetCurrentSong():IsLong()) then length = 3; + elseif (GAMESTATE:GetCurrentSong():IsLong()) then + length = 2; end; local baseScore = 10000000 * length; @@ -380,9 +468,9 @@ r["3.9Plus SN2"] = function(params, pss) -- [ja] 満点を求める local length = 1; if (GAMESTATE:GetCurrentSong():IsMarathon()) then - length = 2; - elseif (GAMESTATE:GetCurrentSong():IsLong()) then length = 3; + elseif (GAMESTATE:GetCurrentSong():IsLong()) then + length = 2; end; local baseScore = 1000000 * length;