From ed5701c31e373ab560d3592d92f0a59a79308e3f Mon Sep 17 00:00:00 2001 From: Flameshadowxeroshin Date: Sat, 16 Jun 2012 23:37:03 -0500 Subject: [PATCH] shuffle around scoring stuff a bit --- Themes/_fallback/Scripts/04 Scoring.lua | 63 ------------------- .../Scripts/05 NewScoringFrontend.lua | 59 ++++++++++++++++- 2 files changed, 58 insertions(+), 64 deletions(-) diff --git a/Themes/_fallback/Scripts/04 Scoring.lua b/Themes/_fallback/Scripts/04 Scoring.lua index 9a73fdb4c7..1637021c76 100644 --- a/Themes/_fallback/Scripts/04 Scoring.lua +++ b/Themes/_fallback/Scripts/04 Scoring.lua @@ -236,60 +236,6 @@ r['DDR SuperNOVA'] = function(params, pss) -- [ja] 計算して代入 pss:SetScore(math.floor(10000000 * sntmp_Score[p] / totalItems / 3)); end; - ------------------------------------------------------------ ---DDR SuperNOVA 2 scoring by @waiei ------------------------------------------------------------ -local sn2tmp_Sub={0,0}; -local sn2tmp_Score={0,0}; -local sn2tmp_Steps={0,0}; -r['DDR SuperNOVA 2'] = function(params, pss) - local multLookup = - { - ['TapNoteScore_W1'] = 10, - ['TapNoteScore_W2'] = 10, - ['TapNoteScore_W3'] = 5 - }; - setmetatable(multLookup, ZeroIfNotFound); - local radarValues = GetDirectRadar(params.Player); - local totalItems = GetTotalItems(radarValues); - local p = (params.Player == 'PlayerNumber_P1') and 1 or 2; - - -- [ja] スコアが0の時に初期化 - if pss:GetScore()==0 then - sn2tmp_Sub[p]=0; - sn2tmp_Score[p]=0; - sn2tmp_Steps[p]=0; - end; - - -- [ja] maxAdd は 加算する最高点を 10 とした時の値(つまり、10=100% / 5=50%) - local maxAdd = 0; - -- [ja] O.K.判定時は問答無用で満点 - if params.HoldNoteScore == 'HoldNoteScore_Held' then - maxAdd = 10; - else - -- [ja] N.G.判定時は問答無用で0点 - if params.HoldNoteScore == 'HoldNoteScore_LetGo' then - maxAdd = 0; - -- [ja] それ以外ということは、ロングノート以外の判定である - else - maxAdd = multLookup[params.TapNoteScore]; - if (params.TapNoteScore == 'TapNoteScore_W2') or (params.TapNoteScore=='TapNoteScore_W3') then - -- [ja] W2とW3の数を記録 - sn2tmp_Sub[p]=sn2tmp_Sub[p]+1; - end; - end - end; - sn2tmp_Score[p]=sn2tmp_Score[p]+maxAdd; - -- [ja] 踏み踏みしたステップ数 - sn2tmp_Steps[p]=sn2tmp_Steps[p]+1; - -- [ja] 現時点での、All W1判定の時のスコア - pss:SetCurMaxScore(math.floor(10000*sn2tmp_Steps[p]/totalItems) * 10); - - -- [ja] 計算して代入 - pss:SetScore((math.floor(10000*sn2tmp_Score[p]/totalItems) * 10) - (sn2tmp_Sub[p]*10) ); -end; - ----------------------------------------------------------- --Radar Master (disabled; todo: get this working with StepMania 5) ----------------------------------------------------------- @@ -340,15 +286,6 @@ r['MIGS'] = function(params,pss) curScore = math.max(0,curScore + ( pss:GetHoldNoteScores('HoldNoteScore_Held') * 6 )); pss:SetScore(curScore); end; - --------------------------------------------------------------- ---1bilDP scoring because I can. --------------------------------------------------------------- -r['Billions DP']= function(params,pss) - local poss = pss:GetPossibleDancePoints() - pss:SetScore(math.floor((pss:GetActualDancePoints()/poss)*1000000000)) - pss:SetCurMaxScore(math.floor((pss:GetCurrentPossibleDancePoints()/poss)*1000000000)) -end ------------------------------------------------------------------------------- -- Formulas end here. for v in ivalues(DisabledScoringModes) do r[v] = nil end diff --git a/Themes/_fallback/Scripts/05 NewScoringFrontend.lua b/Themes/_fallback/Scripts/05 NewScoringFrontend.lua index 2814230a93..eb45d02da1 100644 --- a/Themes/_fallback/Scripts/05 NewScoringFrontend.lua +++ b/Themes/_fallback/Scripts/05 NewScoringFrontend.lua @@ -28,7 +28,9 @@ function GetDirectRadar(player) return GAMESTATE:GetCurrentSteps(player):GetRadarValues(player) end ---The code here is an example of native modes. +--[[---------------------------------------------------------------------------- +Scoring modes begin here. +--]]---------------------------------------------------------------------------- --[[There are three operation modes: init mode: The JudgmentCommand is invalid in this mode. @@ -129,6 +131,61 @@ score=score+math.floor((actradar:GetValue(k)/thispossradar)*(thispossradar*v)) return score,bestscore end +ScoringModes["DDR SuperNOVA 2"]=function(judge,pss,player,mode) + local function dTransform(number) + return 10*math.round(number/10) + end + local curScore=0 + local curMaxScore=0 + local tnsMultiplier={ + TapNoteScore_W1=1, + TapNoteScore_W2=1, + TapNoteScore_W3=0.5, + TapNoteScore_AvoidMine=1} + local subtract10Points = { + TapNoteScore_W2=IsW1Allowed('TapNoteScore_W2'), + TapNoteScore_W3=true} + setmetatable(tnsMultiplier, ZeroIfNotFound) + local radar = pss:GetRadarPossible() + local stepScore = 1000000/math.max(radar:GetValue('RadarCategory_TapsAndHolds')+ + radar:GetValue('RadarCategory_Mines')+ + radar:GetValue('RadarCategory_Holds')+ + radar:GetValue('RadarCategory_Rolls'),1) + --this is how one activates ScoringEngine2's built-in filter system. + judge,pss,player,mode=coroutine.yield({{'TapNoteScore_None','TapNoteScore_CheckpointHit','TapNoteScore_CheckpointMiss'},{"HoldNoteScore_None"}}) + local mineWasHit=false + while mode=="update" do + if judge.TapNoteScore:find("Mine") then mineWasHit == true end + curScore=curScore+(stepScore*(not judge.HoldNoteScore and tnsMultiplier[judge.TapNoteScore] - + (subtract10Points[judge.TapNoteScore] and 10 or 0) or + (judge.HoldNoteScore=='HoldNoteScore_Held' and 1 or 0))) + curMaxScore=curMaxScore+stepScore + judge,pss,player,mode=coroutine.yield(dTransform(curScore),dTransform(curMaxScore)) + end + --We might not always be able to register mines in gameplay. Add the scores after gameplay if we couldn't. + if not mineWasHit and radar:GetValue('RadarCategory_Mines')~=0 then + curMaxScore=curMaxScore+(stepScore*radar:GetValue('RadarCategory_Mines')) + curScore=curScore+(stepScore*pss:GetRadarActual():GetValue('RadarCategory_Miines')) + end + return dTransform(curScore),dTransform(curMaxScore) +end + +ScoringModes["Billions DP"]=function(judge,pss,player,mode) + local possibleDP=pss:GetPossibleDancePoints() + possibleDP=possibleDP>0 and possibleDP or 1 + local curScore = 0 + local curMaxScore = 0 + while true do + judge,pss,player,mode=coroutine.yield(curScore,curMaxScore) + curScore = (pss:GetActualDancePoints()/possibleDP)*1000000000 + curMaxScore = (pss:GetCurrentPossibleDancePoints/possibleDP)*1000000000 + if mode=="finalize" then return curScore,curMaxScore end + end +end + +--[[---------------------------------------------------------------------------- +Scoring modes end here. +--]]---------------------------------------------------------------------------- for k,v in pairs(Scoring) do if ScoringModes[k] == nil then ScoringModes[k] = CreateOldScoringShim(k)