2023-05-09 10:33:33 +00:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2019-01-24 08:43:03 +00:00
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
2023-05-09 10:33:33 +00:00
|
|
|
using System;
|
|
|
|
using osu.Game.Rulesets.Catch.Objects;
|
|
|
|
using osu.Game.Rulesets.Judgements;
|
2017-04-18 07:05:58 +00:00
|
|
|
using osu.Game.Rulesets.Scoring;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
2017-04-18 07:05:58 +00:00
|
|
|
namespace osu.Game.Rulesets.Catch.Scoring
|
2017-03-16 03:40:35 +00:00
|
|
|
{
|
2019-12-11 08:25:06 +00:00
|
|
|
public partial class CatchScoreProcessor : ScoreProcessor
|
2017-03-16 03:40:35 +00:00
|
|
|
{
|
2023-05-09 10:33:33 +00:00
|
|
|
private const int combo_cap = 200;
|
|
|
|
private const double combo_base = 4;
|
|
|
|
|
|
|
|
protected override double ClassicScoreMultiplier => 28;
|
|
|
|
|
|
|
|
private double tinyDropletScale;
|
|
|
|
|
|
|
|
private int maximumTinyDroplets;
|
|
|
|
private int hitTinyDroplets;
|
|
|
|
|
|
|
|
public CatchScoreProcessor(Ruleset ruleset)
|
|
|
|
: base(ruleset)
|
2022-03-14 06:51:10 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-05-09 10:33:33 +00:00
|
|
|
protected override double ComputeTotalScore()
|
|
|
|
{
|
|
|
|
double fruitHitsRatio = maximumTinyDroplets == 0 ? 0 : (double)hitTinyDroplets / maximumTinyDroplets;
|
|
|
|
|
|
|
|
const int tiny_droplets_portion = 400000;
|
|
|
|
|
2023-05-09 11:00:14 +00:00
|
|
|
return (
|
|
|
|
((1000000 - tiny_droplets_portion) + tiny_droplets_portion * (1 - tinyDropletScale)) * ComboPortion / MaxComboPortion +
|
|
|
|
tiny_droplets_portion * tinyDropletScale * fruitHitsRatio +
|
|
|
|
BonusPortion
|
|
|
|
) * ScoreMultiplier;
|
2023-05-09 10:33:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override void AddScoreChange(JudgementResult result)
|
|
|
|
{
|
|
|
|
var change = computeScoreChange(result);
|
|
|
|
ComboPortion += change.combo;
|
|
|
|
BonusPortion += change.bonus;
|
|
|
|
hitTinyDroplets += change.tinyDropletHits;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void RemoveScoreChange(JudgementResult result)
|
|
|
|
{
|
|
|
|
var change = computeScoreChange(result);
|
|
|
|
ComboPortion -= change.combo;
|
|
|
|
BonusPortion -= change.bonus;
|
|
|
|
hitTinyDroplets -= change.tinyDropletHits;
|
|
|
|
}
|
|
|
|
|
|
|
|
private (double combo, double bonus, int tinyDropletHits) computeScoreChange(JudgementResult result)
|
|
|
|
{
|
|
|
|
if (result.HitObject is TinyDroplet)
|
|
|
|
return (0, 0, 1);
|
|
|
|
|
|
|
|
if (result.Type.IsBonus())
|
|
|
|
return (0, Judgement.ToNumericResult(result.Type), 0);
|
|
|
|
|
|
|
|
return (Judgement.ToNumericResult(result.Type) * Math.Min(Math.Max(0.5, Math.Log(result.ComboAtJudgement, combo_base)), Math.Log(combo_cap, combo_base)), 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void Reset(bool storeResults)
|
|
|
|
{
|
|
|
|
base.Reset(storeResults);
|
|
|
|
|
|
|
|
if (storeResults)
|
|
|
|
{
|
|
|
|
maximumTinyDroplets = hitTinyDroplets;
|
|
|
|
|
|
|
|
if (maximumTinyDroplets + MaxBasicJudgements == 0)
|
|
|
|
tinyDropletScale = 0;
|
|
|
|
else
|
|
|
|
tinyDropletScale = (double)maximumTinyDroplets / (maximumTinyDroplets + MaxBasicJudgements);
|
|
|
|
}
|
|
|
|
|
|
|
|
hitTinyDroplets = 0;
|
|
|
|
}
|
2017-03-16 03:40:35 +00:00
|
|
|
}
|
|
|
|
}
|