Esempio n. 1
0
        public int Update(ArenaInfo enemyInfo, BattleLog.Result result)
        {
            DailyChallengeCount--;
            switch (result)
            {
            case BattleLog.Result.Win:
                ArenaRecord.Win++;
                break;

            case BattleLog.Result.Lose:
                ArenaRecord.Lose++;
                break;

            case BattleLog.Result.TimeOver:
                ArenaRecord.Draw++;
                return(0);

            default:
                throw new ArgumentOutOfRangeException(nameof(result), result, null);
            }

            var score =
                ArenaScoreHelper.GetScore(Score, enemyInfo.Score, result);

            Score           = Math.Max(1000, Score + score.challengerScore);
            enemyInfo.Score = Math.Max(1000, enemyInfo.Score + score.defenderScore);
            return(score.challengerScore);
        }
Esempio n. 2
0
        public int UpdateV3(AvatarState avatarState, ArenaInfo enemyInfo, BattleLog.Result result)
        {
            switch (result)
            {
            case BattleLog.Result.Win:
                ArenaRecord.Win++;
                break;

            case BattleLog.Result.Lose:
                ArenaRecord.Lose++;
                break;

            case BattleLog.Result.TimeOver:
                ArenaRecord.Draw++;
                return(0);

            default:
                throw new ArgumentOutOfRangeException(nameof(result), result, null);
            }

            var score      = ArenaScoreHelper.GetScoreV1(Score, enemyInfo.Score, result);
            var calculated = Score + score;
            var current    = Score;

            Score = Math.Max(1000, calculated);
            DailyChallengeCount--;
            ArmorId = avatarState.GetArmorId();
            Level   = avatarState.level;
            return(Score - current);
        }
Esempio n. 3
0
        public void GetScoreV1()
        {
            const int challengerRating = 10000;
            var       defenderRating   = challengerRating + Math.Abs(ArenaScoreHelper.DifferLowerLimit);
            var       score            = ArenaScoreHelper.GetScoreV1(challengerRating, defenderRating, Result.Win);

            Assert.Equal(ArenaScoreHelper.WinScoreMax, score);
            score = ArenaScoreHelper.GetScoreV1(challengerRating, defenderRating, Result.Lose);
            Assert.Equal(ArenaScoreHelper.LoseScoreMin, score);
            defenderRating++;
            score = ArenaScoreHelper.GetScoreV1(challengerRating, defenderRating, Result.Win);
            Assert.Equal(ArenaScoreHelper.WinScoreMax, score);
            score = ArenaScoreHelper.GetScoreV1(challengerRating, defenderRating, Result.Lose);
            Assert.Equal(ArenaScoreHelper.LoseScoreMin, score);

            defenderRating = challengerRating - Math.Abs(ArenaScoreHelper.DifferUpperLimit);
            score          = ArenaScoreHelper.GetScoreV1(challengerRating, defenderRating, Result.Win);
            Assert.Equal(ArenaScoreHelper.WinScoreMin, score);
            score = ArenaScoreHelper.GetScoreV1(challengerRating, defenderRating, Result.Lose);
            Assert.Equal(ArenaScoreHelper.LoseScoreMax, score);
            defenderRating--;
            score = ArenaScoreHelper.GetScoreV1(challengerRating, defenderRating, Result.Win);
            Assert.Equal(ArenaScoreHelper.WinScoreMin, score);
            score = ArenaScoreHelper.GetScoreV1(challengerRating, defenderRating, Result.Lose);
            Assert.Equal(ArenaScoreHelper.LoseScoreMax, score);
        }
Esempio n. 4
0
        public void GetScore(int challengerScore, int defenderScore, int win, int defenderLoseScore, int lose)
        {
            var result = ArenaScoreHelper.GetScore(challengerScore, defenderScore, Result.Win);

            Assert.Equal(win, result.challengerScore);
            Assert.Equal(defenderLoseScore, result.defenderScore);
            result = ArenaScoreHelper.GetScore(challengerScore, defenderScore, Result.Lose);
            Assert.Equal(lose, result.challengerScore);
        }
Esempio n. 5
0
 public void GetScoreV2(int challengerScore, int defenderScore, int win, int timeOver, int lose)
 {
     Assert.Equal(win, ArenaScoreHelper.GetScoreV2(challengerScore, defenderScore, Result.Win));
     Assert.Equal(timeOver, ArenaScoreHelper.GetScoreV2(challengerScore, defenderScore, Result.TimeOver));
     Assert.Equal(lose, ArenaScoreHelper.GetScoreV2(challengerScore, defenderScore, Result.Lose));
 }