protected int GetBonus(RhythmBallType ballType) { if (RhythmBallType.DoubleClick == ballType || RhythmBallType.DoubleLongPress == ballType || RhythmBallType.BevelBL == ballType || RhythmBallType.BevelTR == ballType) { return(15); } else { return(10); } }
void AnalysisRoundNote(Dictionary <int, string> roundNote) { int longPressCount = 0; int batterCount = 0; int endCount = 0; foreach (KeyValuePair <int, string> kvp in roundNote) { CRhythmRoundInfo roundInfo = new CRhythmRoundInfo(); roundInfo.RoundNO = kvp.Key; string stringNote = kvp.Value; for (int index = 0; index < stringNote.Length; ++index) { RhythmBallType ballType = (RhythmBallType)int.Parse(stringNote.Substring(index, 1)); if (IsBallValid(ballType) || ballType == RhythmBallType.Begin || ballType == RhythmBallType.End) { roundInfo.BallList.Add(ballType); if (ballType == RhythmBallType.End) { endCount++; } else if (ballType == RhythmBallType.LongPress) { longPressCount++; } else if (ballType == RhythmBallType.Batter) { batterCount++; } } else { DebugLog.Write("CRhythmStageInfo.AnalysisRoundNote Error: Ball type = " + ballType.ToString(), LogLevel.ERROR); } } RoundInfoList.Add(roundInfo); } if (longPressCount + batterCount != endCount) { DebugLog.Write("CRhythmStageInfo.AnalysisRoundNote Error: stage(" + mMusicFile + ") " + "LongPressCount(" + longPressCount + ") + BatterCount(" + batterCount + ") != EndCount(" + endCount + ")", LogLevel.ERROR); } }
public int MaxScore() { int combo = 0; int ret = 0; RhythmBallType prevBallType = RhythmBallType.Begin; foreach (CRhythmRoundInfo rinfo in RoundInfoList) { foreach (RhythmBallType ball in rinfo.BallList) { if (RhythmBallType.Begin == ball) { continue; } combo++; RhythmBallType ballRealType = ball; if (RhythmBallType.End == ballRealType) { ballRealType = prevBallType; } if (!IsBallValid(ballRealType)) { continue; // 错误的文件格式 } prevBallType = ball; int comboLevel = (combo > 100 ? 10 : combo / 10); int rankScore = GetRankBaseScore(ballRealType, BeatResultRank.Perfect); int thisScore = rankScore + rankScore * comboLevel * GetBonus(ballRealType) / 100; ret += thisScore; } } return(ret); }
private int GetRankBaseScore(RhythmBallType ballType, BeatResultRank rank) { int[] arrScoreDefault = { 0, // miss 250, // bad 300, // good 400, // cool 500, // perfect }; int[] arrScoreDoubleClick = { 0, // miss 300, // bad 400, // good 600, // cool 800, // perfect }; int[] arrScoreBevelTR = { 0, // miss 300, // bad 400, // good 500, // cool 600, // perfect }; int[] arrScoreBevelBL = { 0, // miss 300, // bad 400, // good 500, // cool 600, // perfect }; int[] arrScoreDoubleLongPress = { 0, // miss 300, // bad 400, // good 600, // cool 800, // perfect }; int[] arrScoreBatter = { 0, // miss 300, // bad 400, // good 600, // cool 800, // perfect }; switch (ballType) { case RhythmBallType.DoubleClick: return(arrScoreDoubleClick[(int)rank - 1]); case RhythmBallType.BevelTR: return(arrScoreBevelTR[(int)rank - 1]); case RhythmBallType.BevelBL: return(arrScoreBevelBL[(int)rank - 1]); case RhythmBallType.DoubleLongPress: return(arrScoreDoubleLongPress[(int)rank - 1]); case RhythmBallType.Batter: return(arrScoreBatter[(int)rank - 1]); default: return(arrScoreDefault[(int)rank - 1]); } }
bool IsBallValid(RhythmBallType nBallType) { return(nBallType > RhythmBallType.Begin && nBallType < RhythmBallType.End && nBallType != RhythmBallType.SlideByArc && nBallType != RhythmBallType.DoubleLongPress); // 去除SlideByArc和DoubleLongPress的两种Ball,降低模式难度 2017-08-03 }