scoring fixes from A.C/@waiei and @sakuraponila, sourced from http://www47.atwiki.jp/waiei/pages/21.html

This commit is contained in:
AJ Kelly
2011-10-06 15:38:19 -05:00
parent f91e85c53e
commit 0f40af9446
4 changed files with 167 additions and 120 deletions
+139 -101
View File
@@ -11,7 +11,14 @@ function GetTotalItems(radars)
local total = radars:GetValue('RadarCategory_TapsAndHolds')
total = total + radars:GetValue('RadarCategory_Holds')
total = total + radars:GetValue('RadarCategory_Rolls')
total = total + radars:GetValue('RadarCategory_Lifts')
-- [ja] Liftを加えると一部二重加算になるため除外する。
-- total = total + radars:GetValue('RadarCategory_Lifts')
-- [en] prevent divide by 0
-- [ja] 0除算対策(しなくても動作するけど満点になっちゃうんで)
if total <= 0 then
total = 1
end;
return total
end;
@@ -49,8 +56,8 @@ r['DDR 1stMIX'] = function(params, pss)
local localScore = bScore * multLookup[params.TapNoteScore];
pss:SetCurMaxScore(clamp(pss:GetCurMaxScore()+(bestScore),0,capScore));
pss:SetScore(clamp(pss:GetScore()+(localScore),0,capScore));
end;
-----------------------------------------------------------
--DDR 4th Mix/Extra Mix/Konamix/GB3/DDRPC Scoring
-----------------------------------------------------------
@@ -72,18 +79,24 @@ r['DDR 4thMIX'] = function(params, pss)
local localCombo = localPoints and comboBonusForThisStep or 0;
pss:SetScore(clamp(pss:GetScore()+localPoints+localCombo,0,capScore));
end;
-----------------------------------------------------------
--DDR MAX2/Extreme Scoring
--DDR MAX2/Extreme(-esque) Scoring by @sakuraponila
-----------------------------------------------------------
local ext_Steps = {0,0};
r['DDR Extreme'] = function(params, pss)
local judgmentBase = {
local multLookup =
{
['TapNoteScore_W1'] = 10,
['TapNoteScore_W2'] = 9,
['TapNoteScore_W3'] = 5
};
setmetatable(judgmentBase, ZeroIfNotFound);
setmetatable(multLookup, ZeroIfNotFound);
local steps = GAMESTATE:GetCurrentSteps(params.Player);
local radarValues = steps:GetRadarValues(params.Player);
local radarValues = GetDirectRadar(params.Player);
local totalItems = GetTotalItems(radarValues);
-- 1 + 2 + 3 + ... + totalItems value/の値
local sTotal = (totalItems + 1) * totalItems / 2;
local meter = steps:GetMeter();
if (steps:IsAnEdit()) then
meter = 5;
@@ -92,39 +105,62 @@ r['DDR Extreme'] = function(params, pss)
elseif (meter > 10) then
meter = 10;
end;
local baseScore = meter * 1000000;
-- [en] score for one step
-- [ja] 1ステップあたりのスコア
local baseScore = meter * 1000000
if (GAMESTATE:GetCurrentSong():IsMarathon()) then
baseScore = baseScore * 3;
elseif (GAMESTATE:GetCurrentSong():IsLong()) then
baseScore = baseScore * 2;
end;
local totalItems = GetTotalItems(radarValues);
local singleStep = (1 + totalItems) * totalItems / 2;
if (not Shared.CurrentStep) then
Shared.CurrentStep = {};
Shared.CurrentStep["P1"] = 0;
Shared.CurrentStep["P2"] = 0;
end;
local pn = PlayerNumberToString(params.Player);
Shared.CurrentStep[pn] = Shared.CurrentStep[pn] + 1;
local stepValue = math.floor(baseScore /singleStep);
local stepLast = stepValue * Shared.CurrentStep[pn];
pss:SetCurMaxScore(pss:GetCurMaxScore() +
(stepLast * judgmentBase['TapNoteScore_W1']));
local judgeScore = 0;
if (params.HoldNoteScore == 'HoldNoteScore_Held') then
judgeScore = judgmentBase['TapNoteScore_W1'];
local sOne = math.floor(baseScore / sTotal);
-- [en] measures for 5 points of units
-- [ja] 5点単位のための処置
sOne = sOne - sOne % 5;
-- [en] because fractions are added by the last step, get value
-- [ja] 端数は最後の1ステップで加算するのでその値を取得
local sLast = baseScore - (sOne * sTotal);
local p;
if params.Player == 'PlayerNumber_P1' then
p = 1;
else
judgeScore = judgmentBase[params.TapNoteScore];
if (IsW1Allowed(params.TapNoteScore)) then
judgeScore = judgmentBase['TapNoteScore_W1'];
p = 2;
end;
-- [en] initialized when score is 0
-- [ja] スコアが0の時に初期化
if pss:GetScore() == 0 then
ext_Steps[p] = 0;
end;
-- [en] now step count
-- [ja] 現在のステップ数
ext_Steps[p] = ext_Steps[p] + 1;
-- [en] current score
-- [ja] 今回加算するスコア(W1の時)
local vScore = sOne * ext_Steps[p];
pss:SetCurMaxScore(pss:GetCurMaxScore() + vScore);
-- [ja] 判定によって加算量を変更
if (params.HoldNoteScore == 'HoldNoteScore_Held') then
-- [ja] O.K.判定時は問答無用で満点
vScore = vScore;
else
-- [ja] N.G.判定時は問答無用で0点
if (params.HoldNoteScore == 'HoldNoteScore_LetGo') then
vScore = 0;
-- [en] non-long note scoring
-- [ja] それ以外ということは、ロングノート以外の判定である
else
vScore = vScore * multLookup[params.TapNoteScore] / 10
end;
end;
local stepScore = judgeScore * stepLast;
pss:SetScore(pss:GetScore() + stepScore);
if (Shared.CurrentStep[pn] >= totalItems) then -- Just in case.
-- TODO: Implement the bonus for the last step?
Shared.CurrentStep[pn] = 0; -- Reset for the next song.
-- [en] measures for 5 points of units
-- [ja] ここでも5点単位のための処置
vScore = vScore - vScore % 5
pss:SetScore(pss:GetScore() + vScore);
-- if one of the last step, add the fractions
-- [ja] 最後の1ステップの場合、端数を加算する
if ((vScore > 0) and (ext_Steps[p] == totalItems)) then
pss:SetScore(pss:GetScore() + sLast);
end;
end;
@@ -141,8 +177,7 @@ r['HYBRID'] = function(params, pss)
};
setmetatable(multLookup, ZeroIfNotFound);
local radarValues = GetDirectRadar(params.Player);
-- [ja] GetTotalItems(radarValues) に Liftも含まれているので 引いておく
local totalItems = GetTotalItems(radarValues) - radarValues:GetValue('RadarCategory_Lifts');
local totalItems = GetTotalItems(radarValues);
-- 1+2+3+...+totalItems value/の値
local sTotal = (totalItems+1)*totalItems/2;
-- [en] Score for one song
@@ -151,9 +186,13 @@ r['HYBRID'] = function(params, pss)
-- [ja] 端数は最後の1ステップで加算するのでその値を取得
local sLast = 100000000-(sOne*sTotal);
local p = (params.Player == 'PlayerNumber_P1') and 1 or 2
local p;
if params.Player=='PlayerNumber_P1' then
p=1;
else
p=2;
end;
-- [en] Initialize score if 0.
-- [ja] スコアが0の時に初期化
if pss:GetScore()==0 then
hyb_Steps[p]=0;
@@ -184,26 +223,81 @@ r['HYBRID'] = function(params, pss)
end;
-----------------------------------------------------------
--DDR SuperNOVA(-esque) scoring
--DDR SuperNOVA scoring (Use MARVELOUS) by @sakuraponila
-----------------------------------------------------------
local sntmp_Score = {0,0};
local sntmp_Steps = {0,0};
r['DDR SuperNOVA'] = function(params, pss)
local multLookup =
{
['TapNoteScore_W1'] = 3,
['TapNoteScore_W2'] = 2,
['TapNoteScore_W3'] = 1
};
setmetatable(multLookup, ZeroIfNotFound);
local radarValues = GetDirectRadar(params.Player);
local totalItems = GetTotalItems(radarValues)
local p;
if params.Player == 'PlayerNumber_P1' then
p = 1;
else
p = 2;
end;
-- initialized when score is 0
-- [ja] スコアが0の時に初期化
if pss:GetScore() == 0 then
sntmp_Score[p] = 0;
sntmp_Steps[p] = 0;
end;
-- [ja] 判定によって加算量を変更
local maxAdd = 0;
-- [ja] O.K.判定時は問答無用で満点
if params.HoldNoteScore == 'HoldNoteScore_Held' then
maxAdd = 3;
else
-- [ja] N.G.判定時は問答無用で0点
if params.HoldNoteScore == 'HoldNoteScore_LetGo' then
maxAdd = 0;
-- [ja] それ以外ということは、ロングノート以外の判定である
else
maxAdd = multLookup[params.TapNoteScore];
end
end;
sntmp_Score[p] = sntmp_Score[p] + maxAdd;
-- [ja] 踏み踏みしたステップ数
sntmp_Steps[p] = sntmp_Steps[p] + 1;
-- [ja] 現時点での、All W1判定の時のスコア
pss:SetCurMaxScore(math.floor(10000000 * sntmp_Steps[p] / totalItems / 3));
-- [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'] = function(params, pss)
r['DDR SuperNOVA 2'] = function(params, pss)
local multLookup =
{
['TapNoteScore_W1'] = 1,
['TapNoteScore_W2'] = 1,
['TapNoteScore_W3'] = 0.5
['TapNoteScore_W1'] = 10,
['TapNoteScore_W2'] = 10,
['TapNoteScore_W3'] = 5
};
setmetatable(multLookup, ZeroIfNotFound);
local radarValues = GetDirectRadar(params.Player);
local totalItems = GetTotalItems(radarValues);
local p;
if params.Player=='PlayerNumber_P1' then
p=1;
else
p=2;
end;
if totalItems < 0 then totalItems = 1; end
local p = (params.Player == 'PlayerNumber_P1') and 1 or 2
-- [en] Initialize score if 0.
-- [ja] スコアが0の時に初期化
if pss:GetScore()==0 then
sn2tmp_Sub[p]=0;
@@ -213,7 +307,6 @@ r['DDR SuperNOVA'] = function(params, pss)
-- [ja] maxAdd は 加算する最高点を 10 とした時の値(つまり、10=100% / 5=50%
local maxAdd = 0;
-- [ja] O.K.判定時は問答無用で満点
if params.HoldNoteScore == 'HoldNoteScore_Held' then
maxAdd = 10;
@@ -229,7 +322,7 @@ r['DDR SuperNOVA'] = function(params, pss)
sn2tmp_Sub[p]=sn2tmp_Sub[p]+1;
end;
end
end
end;
sn2tmp_Score[p]=sn2tmp_Score[p]+maxAdd;
-- [ja] 踏み踏みしたステップ数
sn2tmp_Steps[p]=sn2tmp_Steps[p]+1;
@@ -239,62 +332,7 @@ r['DDR SuperNOVA'] = function(params, pss)
-- [ja] 計算して代入
pss:SetScore((math.floor(10000*sn2tmp_Score[p]/totalItems) * 10) - (sn2tmp_Sub[p]*10) );
end;
-----------------------------------------------------------
--DDR SuperNOVA 2(-esque) scoring
-----------------------------------------------------------
local sn2tmp_Sub=0;
local sn2tmp_Score=0;
local sn2tmp_Steps=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);
-- [ja] GetTotalItems(radarValues) に Liftも含まれているので 引いておく
local totalItems = GetTotalItems(radarValues) - radarValues:GetValue('RadarCategory_Lifts');
-- [ja] 0除算対策(しなくても動作するけど満点になっちゃうんで)
if totalItems <= 0 then
totalItems=1
end;
-- [ja] スコアが0の時に初期化
if pss:GetScore() == 0 then
sn2tmp_Sub=0;
sn2tmp_Score=0;
sn2tmp_Steps=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=sn2tmp_Sub+1;
end;
end
end;
sn2tmp_Score=sn2tmp_Score+maxAdd;
-- [ja] 踏み踏みしたステップ数
sn2tmp_Steps=sn2tmp_Steps+1;
-- [ja] 現時点での、All W1判定の時のスコア
pss:SetCurMaxScore(math.floor(10000*sn2tmp_Steps/totalItems) * 10);
-- [ja] 計算して代入
pss:SetScore((math.floor(10000*sn2tmp_Score/totalItems) * 10) - (sn2tmp_Sub*10) );
end;
-----------------------------------------------------------
--Radar Master (disabled; todo: get this working with StepMania 5)
-----------------------------------------------------------