Guest User

3.9 (Plus) のスコア方式仮 (04 Scoring.lua用)

a guest
Feb 18th, 2012
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 12.19 KB | None | 0 0
  1. -----------------------------------------------------------
  2. --StepMania 3.9 (Plus) Scorings by @803832
  3. --3.9 MAX2
  4. --3.9 5TH
  5. --3.9Plus HYBRID
  6. --3.9Plus SN
  7. --3.9Plus SN2
  8. -----------------------------------------------------------
  9. local function isW2OrAbove(tns)
  10.     if tns == 'TapNoteScore_W1' or
  11.        tns == 'TapNoteScore_W2' then
  12.         return true;
  13.     end;
  14.     return false;
  15. end
  16.  
  17. local sm3_Steps = {0,0};
  18. local sm3_Score = {0,0};
  19. local sm3_CurMaxScore = {0,0};
  20. local sm3_Bonus = {0,0};
  21.  
  22. r["3.9 MAX2"] = function(params, pss)
  23.     local multLookup =
  24.     {
  25.         ['TapNoteScore_W1'] = 10,
  26.         ['TapNoteScore_W2'] = GAMESTATE:ShowW1() and 9 or 10,
  27.         ['TapNoteScore_W3'] = 5
  28.     };
  29.     setmetatable(multLookup, ZeroIfNotFound);
  30.     local radarValues = GetDirectRadar(params.Player);
  31.     local totalItems = GetTotalItems(radarValues);
  32.     -- 1+2+3+...+totalItems value/の値
  33.     local sTotal = (totalItems+1)*totalItems/2;
  34.     local steps = GAMESTATE:GetCurrentSteps(params.Player);
  35.     local meter = steps:GetMeter();
  36.     meter = clamp(meter,1,10);
  37.  
  38.     -- [ja] 満点を求める
  39.     local length = 1;
  40.     if (GAMESTATE:GetCurrentSong():IsMarathon()) then
  41.         length = 2;
  42.     elseif (GAMESTATE:GetCurrentSong():IsLong()) then
  43.         length = 3;
  44.     end;
  45.     local baseScore = meter * 10000000 * length;
  46.  
  47.     local sOne = baseScore/sTotal;
  48.  
  49.     local p = (params.Player == 'PlayerNumber_P1') and 1 or 2;
  50.  
  51.     -- [ja] スコアが0の時に初期化
  52.     if pss:GetScore()==0 then
  53.         sm3_Steps[p] = 0;
  54.     end;
  55.  
  56.     -- [ja] 現在のステップ数
  57.     sm3_Steps[p]=sm3_Steps[p]+1;
  58.     -- [en] current score
  59.     -- [ja] 今回加算するスコア(W1の時)
  60.     local vScore = sOne*sm3_Steps[p];
  61.     pss:SetCurMaxScore(pss:GetCurMaxScore()+math.floor(vScore));
  62.     -- [ja] 判定によって加算量を変更
  63.     if (params.HoldNoteScore == 'HoldNoteScore_Held') then
  64.         vScore = vScore;
  65.     else
  66.         if (params.HoldNoteScore == 'HoldNoteScore_LetGo') then
  67.             vScore = 0;
  68.         else
  69.             vScore = vScore*multLookup[params.TapNoteScore]/10;
  70.         end;
  71.     end;
  72.  
  73.     -- [ja] 落ちていた場合は入るスコアが減る
  74.     if (pss:GetFailed()) then
  75.         if (params.HoldNoteScore == 'HoldNoteScore_Held') then
  76.             -- [ja] O.K.判定時は10点
  77.             pss:SetScore(pss:GetScore()+10);
  78.         elseif (params.HoldNoteScore ~= 'HoldNoteScore_LetGo') then
  79.             -- [ja] O.K.でもN.G.でもない場合のスコア:
  80.             -- W1 (Marvelous): 10
  81.             -- W2 (Perfect):    9
  82.             -- W3 (Great):      5
  83.             pss:SetScore(pss:GetScore()+multLookup[params.TapNoteScore]);
  84.             -- [ja] 5点単位の処理がなぜかここでされる
  85.             if multLookup[params.TapNoteScore] > 0 then
  86.                 pss:SetScore(math.floor((pss:GetScore() + 2) / 5) * 5);
  87.             end;
  88.         end;
  89.     else
  90.         pss:SetScore(pss:GetScore()+math.floor(vScore));
  91.     end;
  92.  
  93.     if (sm3_Steps[p] == totalItems and not pss:GetFailed()) then
  94.         -- [ja] 最後の1ステップがW2以上の場合、端数を加算する
  95.         -- [ja] 端数は設定上の満点と最終ステップ時点での満点の差から求める
  96.         if (isW2OrAbove(params.TapNoteScore) or params.HoldNoteScore == 'HoldNoteScore_Held') then
  97.             pss:SetScore(pss:GetScore()+(baseScore-pss:GetCurMaxScore()));
  98.             pss:SetCurMaxScore(pss:GetCurMaxScore()+(baseScore-pss:GetCurMaxScore()));
  99.         end;
  100.     end;
  101. end;
  102.  
  103. r["3.9 5TH"] = function(params, pss)
  104.     local multLookup =
  105.     {
  106.         ['TapNoteScore_W1'] = 10,
  107.         ['TapNoteScore_W2'] = GAMESTATE:ShowW1() and 9 or 10,
  108.         ['TapNoteScore_W3'] = 5
  109.     };
  110.     setmetatable(multLookup, ZeroIfNotFound);
  111.     local radarValues = GetDirectRadar(params.Player);
  112.     local totalItems = GetTotalItems(radarValues);
  113.     -- 1+2+3+...+totalItems value/の値
  114.     local sTotal = (totalItems+1)*totalItems/2;
  115.     local steps = GAMESTATE:GetCurrentSteps(params.Player);
  116.     local meter = steps:GetMeter();
  117.     meter = clamp(meter,1,10);
  118.  
  119.     -- [ja] 満点を求める
  120.     local length = 1;
  121.     if (GAMESTATE:GetCurrentSong():IsMarathon()) then
  122.         length = 2;
  123.     elseif (GAMESTATE:GetCurrentSong():IsLong()) then
  124.         length = 3;
  125.     end;
  126.     local baseScore = (meter * length + 1) * 5000000;
  127.  
  128.     local sOne = baseScore/sTotal;
  129.  
  130.     local p = (params.Player == 'PlayerNumber_P1') and 1 or 2;
  131.  
  132.     -- [ja] スコアが0の時に初期化
  133.     if pss:GetScore()==0 then
  134.         sm3_Steps[p] = 0;
  135.         sm3_Bonus[p] = 0;
  136.         sm3_Score[p] = 0;
  137.         sm3_CurMaxScore[p] = 0;
  138.     end;
  139.  
  140.     -- [ja] 現在のステップ数
  141.     sm3_Steps[p]=sm3_Steps[p]+1;
  142.     -- [en] current score
  143.     -- [ja] 今回加算するスコア(W1の時)
  144.     local vScore = sOne*sm3_Steps[p];
  145.     sm3_CurMaxScore[p] = sm3_CurMaxScore[p]+math.floor(vScore);
  146.     -- [ja] 判定によって加算量を変更
  147.     if (params.HoldNoteScore == 'HoldNoteScore_Held') then
  148.         vScore = vScore;
  149.     else
  150.         if (params.HoldNoteScore == 'HoldNoteScore_LetGo') then
  151.             vScore = 0;
  152.         else
  153.             vScore = vScore*multLookup[params.TapNoteScore]/10;
  154.         end;
  155.     end;
  156.  
  157.     local bonusTable =
  158.     {
  159.         ['TapNoteScore_W1'] = 55,
  160.         ['TapNoteScore_W2'] = 55,
  161.         ['TapNoteScore_W3'] = 33
  162.     };
  163.     setmetatable(bonusTable, ZeroIfNotFound);
  164.  
  165.     -- [ja] 落ちていた場合は入るスコアが減る
  166.     if (pss:GetFailed()) then
  167.         if (params.HoldNoteScore == 'HoldNoteScore_Held') then
  168.             -- [ja] O.K.判定時は10点
  169.             sm3_Score[p] = sm3_Score[p]+10;
  170.         elseif (params.HoldNoteScore ~= 'HoldNoteScore_LetGo') then
  171.             -- [ja] O.K.でもN.G.でもない場合のスコア:
  172.             -- W1 (Marvelous): 10
  173.             -- W2 (Perfect):    9
  174.             -- W3 (Great):      5
  175.             sm3_Score[p] = sm3_Score[p]+multLookup[params.TapNoteScore];
  176.             -- [ja] 5点単位の処理がなぜかここでされる
  177.             if multLookup[params.TapNoteScore] > 0 then
  178.                 sm3_Score[p] = math.floor((sm3_Score[p] + 2) / 5) * 5;
  179.             end;
  180.         end;
  181.     else
  182.         sm3_Score[p] = sm3_Score[p]+math.floor(vScore);
  183.         sm3_Bonus[p] = sm3_Bonus[p]+multLookup[params.TapNoteScore]*pss:GetCurrentCombo();
  184.     end;
  185.  
  186.     if (sm3_Steps[p] == totalItems and not pss:GetFailed()) then
  187.         -- [ja] 最後の1ステップがW2以上の場合、端数を加算する
  188.         -- [ja] 端数は設定上の満点と最終ステップ時点での満点の差から求める
  189.         if (isW2OrAbove(params.TapNoteScore) or params.HoldNoteScore == 'HoldNoteScore_Held') then
  190.             sm3_Score[p] = sm3_Score[p]+(baseScore-sm3_CurMaxScore[p]);
  191.             sm3_CurMaxScore[p] = sm3_CurMaxScore[p]+(baseScore-sm3_CurMaxScore[p]);
  192.         end;
  193.  
  194.         -- [ja] コンボボーナスとグレードボーナスを加算
  195.         sm3_Score[p] = sm3_Score[p]+sm3_Bonus[p];
  196.         sm3_CurMaxScore[p] = sm3_CurMaxScore[p]+totalItems*sTotal;
  197.  
  198.         local gradeBonusTable = {
  199.             ['Grade_Tier01'] = 10000000,
  200.             ['Grade_Tier02'] = 10000000,
  201.             ['Grade_Tier03'] = 1000000,
  202.             ['Grade_Tier04'] = 100000,
  203.             ['Grade_Tier05'] = 10000,
  204.             ['Grade_Tier06'] = 1000,
  205.             ['Grade_Tier07'] = 100,
  206.         };
  207.         setmetatable(gradeBonusTable, ZeroIfNotFound);
  208.  
  209.         sm3_Score[p] = sm3_Score[p]+gradeBonusTable[pss:GetGrade()];
  210.         sm3_CurMaxScore[p] = sm3_CurMaxScore[p]+10000000;
  211.     end;
  212.  
  213.     -- [ja] 5点単位の処理は5TH方式のみでされる
  214.     pss:SetScore(sm3_Score[p] - sm3_Score[p] % 5);
  215.     pss:SetCurMaxScore(sm3_CurMaxScore[p] - sm3_CurMaxScore[p] % 5);
  216. end;
  217.  
  218. r["3.9Plus HYBRID"] = function(params, pss)
  219.     local multLookup =
  220.     {
  221.         ['TapNoteScore_W1'] = 10,
  222.         ['TapNoteScore_W2'] = GAMESTATE:ShowW1() and 9 or 10,
  223.         ['TapNoteScore_W3'] = 5
  224.     };
  225.     setmetatable(multLookup, ZeroIfNotFound);
  226.     local radarValues = GetDirectRadar(params.Player);
  227.     local totalItems = GetTotalItems(radarValues);
  228.     -- 1+2+3+...+totalItems value/の値
  229.     local sTotal = (totalItems+1)*totalItems/2;
  230.     local steps = GAMESTATE:GetCurrentSteps(params.Player);
  231.     local meter = steps:GetMeter();
  232.     meter = clamp(meter,1,10);
  233.  
  234.     -- [ja] 満点を求める
  235.     local length = 1;
  236.     if (GAMESTATE:GetCurrentSong():IsMarathon()) then
  237.         length = 2;
  238.     elseif (GAMESTATE:GetCurrentSong():IsLong()) then
  239.         length = 3;
  240.     end;
  241.     local baseScore = 100000000 * length;
  242.  
  243.     local sOne = baseScore/sTotal;
  244.  
  245.     local p = (params.Player == 'PlayerNumber_P1') and 1 or 2;
  246.  
  247.     -- [ja] スコアが0の時に初期化
  248.     if pss:GetScore()==0 then
  249.         sm3_Steps[p] = 0;
  250.     end;
  251.  
  252.     -- [ja] 現在のステップ数
  253.     sm3_Steps[p]=sm3_Steps[p]+1;
  254.     -- [en] current score
  255.     -- [ja] 今回加算するスコア(W1の時)
  256.     local vScore = sOne*sm3_Steps[p];
  257.     pss:SetCurMaxScore(pss:GetCurMaxScore()+math.floor(vScore));
  258.     -- [ja] 判定によって加算量を変更
  259.     if (params.HoldNoteScore == 'HoldNoteScore_Held') then
  260.         vScore = vScore;
  261.     else
  262.         if (params.HoldNoteScore == 'HoldNoteScore_LetGo') then
  263.             vScore = 0;
  264.         else
  265.             vScore = vScore*multLookup[params.TapNoteScore]/10;
  266.         end;
  267.     end;
  268.  
  269.     -- [ja] 落ちていた場合は入るスコアが減る
  270.     if (pss:GetFailed()) then
  271.         if (params.HoldNoteScore == 'HoldNoteScore_Held') then
  272.             -- [ja] O.K.判定時は10点
  273.             pss:SetScore(pss:GetScore()+10);
  274.         elseif (params.HoldNoteScore ~= 'HoldNoteScore_LetGo') then
  275.             -- [ja] O.K.でもN.G.でもない場合のスコア:
  276.             -- W1 (Marvelous): 10
  277.             -- W2 (Perfect):    9
  278.             -- W3 (Great):      5
  279.             pss:SetScore(pss:GetScore()+multLookup[params.TapNoteScore]);
  280.             -- [ja] 5点単位の処理がなぜかここでされる
  281.             if multLookup[params.TapNoteScore] > 0 then
  282.                 pss:SetScore(math.floor((pss:GetScore() + 2) / 5) * 5);
  283.             end;
  284.         end;
  285.     else
  286.         pss:SetScore(pss:GetScore()+math.floor(vScore));
  287.     end;
  288.  
  289.     if (sm3_Steps[p] == totalItems and not pss:GetFailed()) then
  290.         -- [ja] 最後の1ステップがW2以上の場合、端数を加算する
  291.         -- [ja] 端数は設定上の満点と最終ステップ時点での満点の差から求める
  292.         if (isW2OrAbove(params.TapNoteScore) or params.HoldNoteScore == 'HoldNoteScore_Held') then
  293.             pss:SetScore(pss:GetScore()+(baseScore-pss:GetCurMaxScore()));
  294.             pss:SetCurMaxScore(pss:GetCurMaxScore()+(baseScore-pss:GetCurMaxScore()));
  295.         end;
  296.     end;
  297. end;
  298.  
  299. r["3.9Plus SN"] = function(params, pss)
  300.     local radarValues = GetDirectRadar(params.Player);
  301.     local totalItems = GetTotalItems(radarValues);
  302.  
  303.     -- [ja] 満点を求める
  304.     local length = 1;
  305.     if (GAMESTATE:GetCurrentSong():IsMarathon()) then
  306.         length = 2;
  307.     elseif (GAMESTATE:GetCurrentSong():IsLong()) then
  308.         length = 3;
  309.     end;
  310.     local baseScore = 10000000 * length;
  311.  
  312.     -- [en] current score
  313.     -- [ja] 今回加算するスコア
  314.     local multLookup =
  315.     {
  316.         ['TapNoteScore_W1'] = math.floor(baseScore / totalItems),
  317.         ['TapNoteScore_W2'] = math.floor(baseScore / totalItems),
  318.         ['TapNoteScore_W3'] = math.floor(math.floor(baseScore / 2) / totalItems)
  319.     };
  320.     setmetatable(multLookup, ZeroIfNotFound);
  321.     local vScore = multLookup[params.TapNoteScore];
  322.     pss:SetCurMaxScore(pss:GetCurMaxScore()+multLookup['TapNoteScore_W1']);
  323.  
  324.     -- [ja] 判定によって加算量を変更
  325.     if (params.HoldNoteScore == 'HoldNoteScore_Held') then
  326.         vScore = multLookup['TapNoteScore_W1'];
  327.     elseif (params.HoldNoteScore == 'HoldNoteScore_LetGo') then
  328.         vScore = 0;
  329.     end;
  330.  
  331.     -- [ja] 落ちていた場合は入るスコアが減る
  332.     if (not pss:GetFailed()) then
  333.         pss:SetScore(pss:GetScore()+math.floor(vScore));
  334.     end;
  335.  
  336.     -- [ja] 端数の処理はされていないようだ
  337. end;
  338.  
  339. r["3.9Plus SN2"] = function(params, pss)
  340.     local radarValues = GetDirectRadar(params.Player);
  341.     local totalItems = GetTotalItems(radarValues);
  342.  
  343.     -- [ja] 満点を求める
  344.     local length = 1;
  345.     if (GAMESTATE:GetCurrentSong():IsMarathon()) then
  346.         length = 2;
  347.     elseif (GAMESTATE:GetCurrentSong():IsLong()) then
  348.         length = 3;
  349.     end;
  350.     local baseScore = 1000000 * length;
  351.  
  352.     -- [en] current score
  353.     -- [ja] 今回加算するスコア
  354.     local multLookup =
  355.     {
  356.         ['TapNoteScore_W1'] = math.floor(baseScore / totalItems),
  357.         ['TapNoteScore_W2'] = math.floor(baseScore / totalItems) - 10,
  358.         ['TapNoteScore_W3'] = math.floor(math.floor(baseScore / 2) / totalItems) - 10
  359.     };
  360.     setmetatable(multLookup, ZeroIfNotFound);
  361.     local vScore = multLookup[params.TapNoteScore];
  362.     pss:SetCurMaxScore(pss:GetCurMaxScore()+multLookup['TapNoteScore_W1']);
  363.  
  364.     -- [ja] 判定によって加算量を変更
  365.     if (params.HoldNoteScore == 'HoldNoteScore_Held') then
  366.         vScore = multLookup['TapNoteScore_W1'];
  367.     elseif (params.HoldNoteScore == 'HoldNoteScore_LetGo') then
  368.         vScore = 0;
  369.     end;
  370.  
  371.     -- [ja] 落ちていた場合は入るスコアが減る
  372.     if (not pss:GetFailed()) then
  373.         pss:SetScore(pss:GetScore()+math.floor(vScore));
  374.     end;
  375.  
  376.     -- [ja] 端数の処理はされていないようだ
  377. end;
  378.  
  379. -- 3.9Plus PIU Scoring cannot be implemented due to no NumTapsInRow in JudgmentMessage
Advertisement
Add Comment
Please, Sign In to add comment