diff --git a/src/main/java/cc/sukazyo/sekai_scores/ScoreBase.java b/src/main/java/cc/sukazyo/sekai_scores/ScoreBase.java new file mode 100644 index 0000000..0fe170b --- /dev/null +++ b/src/main/java/cc/sukazyo/sekai_scores/ScoreBase.java @@ -0,0 +1,57 @@ +package cc.sukazyo.sekai_scores; + +/** + * 由于数据定义了好长所以数据定义被独立出来了,看下面的引用. + * @see ScoreBaseData + */ +public class ScoreBase extends ScoreBaseData { + + public ScoreBase (int perfect, int great, int good, int bad, int miss, int fast, int slow, int flick, int combo) { super(perfect, great, good, bad, miss, fast, slow, flick, combo); } + public ScoreBase (int perfect, int great, int good, int bad, int miss) { super(perfect, great, good, bad, miss); } + public ScoreBase (int perfect, int great, int good, int bad, int miss, int fast, int slow, int flick) { super(perfect, great, good, bad, miss, fast, slow, flick); } + public ScoreBase (int perfect, int great, int good, int bad, int miss, int combo) { super(perfect, great, good, bad, miss, combo); } + + /** + * calculate the skill score of this score. + *
+ * the skill score means the scoring system used in the Project Sekai Championship (プロジェクトセカイ Championship) + * and the in-game RANK-MATCH mod. + *
+ * the score calculated by the following simple rule:
+ * PERFECT: +3
+ * GREAT: +2
+ * GOOD: +1
+ * BAD, MISS: +0
+ * @return the skill score of this gameplay.
+ */
+ public int calculateSkillScore () {
+ return perfect()*3 + great()*2 + good();
+ }
+
+ /**
+ * calculate the skill score of the gameplay map.
+ *
+ * the skill score means the scoring system used in the Project Sekai Championship (プロジェクトセカイ Championship) + * and the in-game RANK-MATCH mod. + *
+ * the score calculated by the following simple rule:
+ * PERFECT: +3
+ * GREAT: +2
+ * GOOD: +1
+ * BAD, MISS: +0
+ *
+ * so, this return value means just the note count * 3. + * @return the skill score of the gameplay map. + */ + public int calculateTheoreticalSkillScore () { + return noteCount() * 3; + } + + /** + * @return the note count of the gameplay map. + */ + public int noteCount () { + return perfect() + great() + good() + bad() + miss(); + } + +} diff --git a/src/main/java/cc/sukazyo/sekai_scores/ScoreBaseData.java b/src/main/java/cc/sukazyo/sekai_scores/ScoreBaseData.java new file mode 100644 index 0000000..8342dc8 --- /dev/null +++ b/src/main/java/cc/sukazyo/sekai_scores/ScoreBaseData.java @@ -0,0 +1,186 @@ +package cc.sukazyo.sekai_scores; + +import javax.annotation.CheckForSigned; +import javax.annotation.Nonnegative; + +/** + * 因为单写完数据感觉就太长了于是把数据模型独立出来了让本来的类里能好好写工具方法. + * @see ScoreBase + */ +public class ScoreBaseData { + + public static final int NULL = -1; + + @Nonnegative private final int notePerfect; + @Nonnegative private final int noteGreat; + @Nonnegative private final int noteGood; + @Nonnegative private final int noteBad; + @Nonnegative private final int noteMiss; + + @CheckForSigned private final int judgeFast; + @CheckForSigned private final int judgeSlow; + @CheckForSigned private final int judgeFlick; + + @CheckForSigned private final int combo; + + public ScoreBaseData ( + int perfect, int great, int good, int bad, int miss, + int fast, int slow, int flick, int combo + ) { + this.notePerfect = perfect; + this.noteGreat = great; + this.noteGood = good; + this.noteBad = bad; + this.noteMiss = miss; + this.judgeFast = fast; + this.judgeSlow = slow; + this.judgeFlick = flick; + this.combo = combo; + } + + public ScoreBaseData (int perfect, int great, int good, int bad, int miss) { + this(perfect, great, good, bad, miss, NULL, NULL, NULL, NULL); + } + + public ScoreBaseData (int perfect, int great, int good, int bad, int miss, int fast, int slow, int flick) { + this(perfect, great, good, bad, miss, fast, slow, flick, NULL); + } + + public ScoreBaseData (int perfect, int great, int good, int bad, int miss, int combo) { + this(perfect, great, good, bad, miss, NULL, NULL, NULL, combo); + } + + /** + * the count of PERFECT in the score. + *
+ * it must exist and means the PERFECT displayed in the final score page. + *
+ * dut to some card_skill, the number may be not exactly ture score. + * @return the exact PERFECT count. + */ + @Nonnegative + public int perfect() { + return notePerfect; + } + + /** + * the count of GREAT in the score. + *
+ * it must exist and means the GREAT displayed in the final score page. + *
+ * dut to some card_skill, the number may be not exactly ture score. + * @return the exact GREAT count. + */ + @Nonnegative + public int great() { + return noteGreat; + } + + /** + * the count of GOOD in the score. + *
+ * it must exist and means the GOOD displayed in the final score page. + *
+ * dut to some card_skill, the number may be not exactly ture score. + * @return the exact GOOD count. + */ + @Nonnegative + public int good() { + return noteGood; + } + + /** + * the count of BAD in the score. + *
+ * it must exist and means the BAD displayed in the final score page. + *
+ * dut to some card_skill, the number may be not exactly ture score. + * @return the exact BAD count. + */ + @Nonnegative + public int bad() { + return noteBad; + } + + /** + * the count of MISS in the score. + *
+ * it must exist and means the MISS displayed in the final score page. + *
+ * dut to some card_skill, the number may be not exactly ture score. + * @return the exact MISS count. + */ + @Nonnegative + public int miss() { + return noteMiss; + } + + /** + * the count of FAST judgement during gameplay. + *
+ * it may return {@code -1} that means this score missed the value. + * due to the pjsekai doesn't have fast/slow/flick counting while gameplay, + * or the data just missed recording. + *
+ * and the number of it sums with {@link #slow()} & {@link #slow()} must be equals with the sum of + * {@link #great()} & {@link #good()} & {@link #miss()}, + *
+ * dut to some card_skill, the number may be not exactly ture score. + * @return the count of FAST judgement, or {@code -1} means missing data. + */ + @CheckForSigned + public int fast() { + return judgeFast; + } + + /** + * the count of SLOW judgement during gameplay. + *
+ * it may return {@code -1} that means this score missed the value. + * due to the pjsekai doesn't have fast/slow/flick counting while gameplay, + * or the data just missed recording. + *
+ * and the number of it sums with {@link #fast()} & {@link #flick()} must be equals with the sum of + * {@link #great()} & {@link #good()} & {@link #miss()}, + *
+ * dut to some card_skill, the number may be not exactly ture score. + * @return the count of SLOW judgement, or {@code -1} means missing data. + */ + @CheckForSigned + public int slow() { + return judgeSlow; + } + + /** + * the count of FLICK judgement during gameplay. + *
+ * it may return {@code -1} that means this score missed the value. + * due to the pjsekai doesn't have fast/slow/flick counting while gameplay, + * or the data just missed recording. + *
+ * and the number of it sums with {@link #fast()} & {@link #slow()} must be equals with the sum of + * {@link #great()} & {@link #good()} & {@link #miss()}, + *
+ * and it must be less than {@link #great()} + *
+ * dut to some card_skill, the number may be not exactly ture score. + * @return the count of FLICK judgement, or {@code -1} means missing data. + */ + @CheckForSigned + public int flick() { + return judgeFlick; + } + + /** + * the count of Max COMBO in final score. + *
+ * it may return {@code -1} that means this score missed the value. + * maybe due to the data missed recording. + * @return the final Max COMBO, or {@code -1} means missing this data. + */ + @CheckForSigned + public int combo() { + return combo; + } + +}