mirror of
https://github.com/Eyre-S/sekai-scores.git
synced 2024-11-25 04:27:43 +08:00
add ScoreBase model (for basic note judge & combo count) with a RANK-MATCH score calculator.
This commit is contained in:
parent
f51fbab745
commit
ac9d0a0266
57
src/main/java/cc/sukazyo/sekai_scores/ScoreBase.java
Normal file
57
src/main/java/cc/sukazyo/sekai_scores/ScoreBase.java
Normal file
@ -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.
|
||||||
|
* <p>
|
||||||
|
* the skill score means the scoring system used in the Project Sekai Championship (プロジェクトセカイ Championship)
|
||||||
|
* and the in-game RANK-MATCH mod.
|
||||||
|
* <p>
|
||||||
|
* the score calculated by the following simple rule:<br/>
|
||||||
|
* PERFECT: +3<br/>
|
||||||
|
* GREAT: +2<br/>
|
||||||
|
* GOOD: +1<br/>
|
||||||
|
* 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.
|
||||||
|
* <p>
|
||||||
|
* the skill score means the scoring system used in the Project Sekai Championship (プロジェクトセカイ Championship)
|
||||||
|
* and the in-game RANK-MATCH mod.
|
||||||
|
* <p>
|
||||||
|
* the score calculated by the following simple rule:<br/>
|
||||||
|
* PERFECT: +3<br/>
|
||||||
|
* GREAT: +2<br/>
|
||||||
|
* GOOD: +1<br/>
|
||||||
|
* BAD, MISS: +0
|
||||||
|
* <p>
|
||||||
|
* 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
186
src/main/java/cc/sukazyo/sekai_scores/ScoreBaseData.java
Normal file
186
src/main/java/cc/sukazyo/sekai_scores/ScoreBaseData.java
Normal file
@ -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.
|
||||||
|
* <p>
|
||||||
|
* it must exist and means the PERFECT displayed in the final score page.
|
||||||
|
* <p>
|
||||||
|
* 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.
|
||||||
|
* <p>
|
||||||
|
* it must exist and means the GREAT displayed in the final score page.
|
||||||
|
* <p>
|
||||||
|
* 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.
|
||||||
|
* <p>
|
||||||
|
* it must exist and means the GOOD displayed in the final score page.
|
||||||
|
* <p>
|
||||||
|
* 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.
|
||||||
|
* <p>
|
||||||
|
* it must exist and means the BAD displayed in the final score page.
|
||||||
|
* <p>
|
||||||
|
* 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.
|
||||||
|
* <p>
|
||||||
|
* it must exist and means the MISS displayed in the final score page.
|
||||||
|
* <p>
|
||||||
|
* 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.
|
||||||
|
* <p>
|
||||||
|
* 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.
|
||||||
|
* <p>
|
||||||
|
* and the number of it sums with {@link #slow()} & {@link #slow()} must be equals with the sum of
|
||||||
|
* {@link #great()} & {@link #good()} & {@link #miss()},
|
||||||
|
* <p>
|
||||||
|
* 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.
|
||||||
|
* <p>
|
||||||
|
* 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.
|
||||||
|
* <p>
|
||||||
|
* and the number of it sums with {@link #fast()} & {@link #flick()} must be equals with the sum of
|
||||||
|
* {@link #great()} & {@link #good()} & {@link #miss()},
|
||||||
|
* <p>
|
||||||
|
* 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.
|
||||||
|
* <p>
|
||||||
|
* 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.
|
||||||
|
* <p>
|
||||||
|
* and the number of it sums with {@link #fast()} & {@link #slow()} must be equals with the sum of
|
||||||
|
* {@link #great()} & {@link #good()} & {@link #miss()},
|
||||||
|
* <p>
|
||||||
|
* and it must be less than {@link #great()}
|
||||||
|
* <p>
|
||||||
|
* 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.
|
||||||
|
* <p>
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user