Class: Osu::DB::OsuScore

Inherits:
Score
  • Object
show all
Defined in:
lib/osu-db/score.rb

Overview

Score of Standard Mode

Instance Attribute Summary

Attributes inherited from Score

#beatmapcode, #combo, #datetime, #dummy, #game_mode, #geki, #katsu, #miss, #mods, #perfect, #score, #scorecode, #scoreid, #user, #x100, #x300, #x50

Instance Method Summary collapse

Methods inherited from Score

#initialize, #load

Constructor Details

This class inherits a constructor from Osu::DB::Score

Instance Method Details

#accuracyObject



76
77
78
# File 'lib/osu-db/score.rb', line 76

def accuracy
  (300 * x300 + 100 * x100 + 50 * x50) / (300.0 * hits)
end

#gradeObject



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/osu-db/score.rb', line 80

def grade
  if x300 == hits
    :SS # SS = 100% accuracy
  elsif 10 * x300 > 9 * hits && 100 * x50 < hits && miss == 0
    :S  # S = Over 90% 300s, less than 1% 50s and no miss.
  elsif 10 * x300 > 8 * hits && miss == 0 || 10 * x300 > 9 * hits
    :A  # A = Over 80% 300s and no miss OR over 90% 300s.
  elsif 10 * x300 > 7 * hits && miss == 0 || 10 * x300 > 8 * hits
    :B  # B = Over 70% 300s and no miss OR over 80% 300s.
  elsif 10 * x300 > 6 * hits
    :C  # C = Over 60% 300s.
  else
    :D
  end
end

#hitsObject



72
73
74
# File 'lib/osu-db/score.rb', line 72

def hits
  x300 + x100 + x50 + miss
end