Skip to content

Commit

Permalink
calculate misc mora earned
Browse files Browse the repository at this point in the history
  • Loading branch information
qhy040404 committed Dec 3, 2024
1 parent 14d2f4b commit 9411493
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,27 @@ namespace Snap.Hutao.Model.Metadata.Item;

internal sealed class MaterialDropDistribution
{
public static readonly MaterialDropDistribution Nine = new(9, 60000D, 122500D, 10.12, 16.708, 3, 2.4);
public static readonly MaterialDropDistribution Eight = new(8, 60000D, 122500D, 10.12, 16.708, 2.56, 2.4);
public static readonly MaterialDropDistribution Seven = new(7, 60000D, 122500D, 10.12, 16.708, 2.56, 2.1);
public static readonly MaterialDropDistribution Six = new(6, 60000D, 122500D, 10.12, 16.708, 2.2, 1.55);
public static readonly MaterialDropDistribution Five = new(5, 52000D, 102500D, 7.8, 16.708, 2.2, 1D);
public static readonly MaterialDropDistribution Nine = new(9, 60000D, 122500D, 10.12, 2375D, 16.708, 2200D, 3D, 6000D, 2.4, 8100D);
public static readonly MaterialDropDistribution Eight = new(8, 60000D, 122500D, 10.12, 2375D, 16.708, 2200D, 2.56, 6000D, 2.4, 8100D);
public static readonly MaterialDropDistribution Seven = new(7, 60000D, 122500D, 10.12, 2375D, 16.708, 2200D, 2.56, 5200D, 2.1, 8100D);
public static readonly MaterialDropDistribution Six = new(6, 60000D, 122500D, 10.12, 2375D, 16.708, 2200D, 2.2, 4725D, 1.55, 8000D);
public static readonly MaterialDropDistribution Five = new(5, 52000D, 102500D, 7.8, 2050D, 16.708, 2200D, 2.2, 4450D, 1D, 7600D);

private MaterialDropDistribution(int worldLevel, double blossomOfWealth, double blossomOfRevelation, double talentBooks, double weaponAscension, double normalBoss, double weeklyBoss)
public static readonly double MoraPerResin = 50D;

private MaterialDropDistribution(int worldLevel, double blossomOfWealth, double blossomOfRevelation, double talentBooks, double talentBooksMora, double weaponAscension, double weaponAscensionMora, double normalBoss, double normalBossMora, double weeklyBoss, double weeklyBossMora)
{
WorldLevel = worldLevel;
BlossomOfWealth = blossomOfWealth;
BlossomOfWealth = blossomOfWealth + (20 * MoraPerResin);
BlossomOfRevelation = blossomOfRevelation;
TalentBooks = talentBooks;
TalentBooksMora = talentBooksMora;
WeaponAscension = weaponAscension;
WeaponAscensionMora = weaponAscensionMora;
NormalBoss = normalBoss;
NormalBossMora = normalBossMora;
WeeklyBoss = weeklyBoss;
WeeklyBossMora = weeklyBossMora;
}

public static ImmutableArray<MaterialDropDistribution> Distributions { get; } = [Five, Six, Seven, Eight, Nine];
Expand All @@ -34,9 +40,17 @@ private MaterialDropDistribution(int worldLevel, double blossomOfWealth, double

public double TalentBooks { get; }

public double TalentBooksMora { get; }

public double WeaponAscension { get; }

public double WeaponAscensionMora { get; }

public double NormalBoss { get; }

public double NormalBossMora { get; }

public double WeeklyBoss { get; }

public double WeeklyBossMora { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ public async ValueTask<ResinStatistics> GetResinStatisticsAsync(ObservableCollec
targetStatisticsItem.RawItemCount += AlchemyCrafting.UnWeighted(orangeItems, purpleItems, blueItems, greenItems);
}

statistics.RefreshBlossomOfWealth();
return statistics;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ public MaterialDropDistribution SelectedDropDistribution
set
{
field = value;
BlossomOfWealth.SelectedDropDistribution = value;
BlossomOfRevelation.SelectedDropDistribution = value;
TalentAscension.SelectedDropDistribution = value;
WeaponAscension.SelectedDropDistribution = value;
NormalBoss.SelectedDropDistribution = value;
WeeklyBoss.SelectedDropDistribution = value;

RefreshBlossomOfWealth();
BlossomOfWealth.SelectedDropDistribution = value;
}
}

Expand All @@ -43,4 +45,13 @@ public MaterialDropDistribution SelectedDropDistribution
public ResinStatisticsItem NormalBoss { get; } = new(SH.ViewModelCultivationResinStatisticsNormalBossTitle, ResinStatisticsItemKind.NormalBoss, 40, false);

public ResinStatisticsItem WeeklyBoss { get; } = new(SH.ViewModelCultivationResinStatisticsWeeklyBossTitle, ResinStatisticsItemKind.WeeklyBoss, 60, false);

public void RefreshBlossomOfWealth()
{
BlossomOfWealth.MiscMoraEarned = BlossomOfRevelation.Mora +
TalentAscension.Mora +
WeaponAscension.Mora +
NormalBoss.Mora +
WeeklyBoss.Mora;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,15 @@ public MaterialDropDistribution SelectedDropDistribution

public double RawItemCount { get; set; }

/// <summary>
/// ONLY BlossomOfWealth has value.
/// </summary>
public double MiscMoraEarned { get; set; }

[UsedImplicitly]
public bool HasData
{
get => RawItemCount > 0D;
get => ItemCount > 0D;
}

public int TotalResin
Expand Down Expand Up @@ -79,7 +84,34 @@ internal int RawTimes
_ => throw HutaoException.NotSupported(),
};

return (int)Math.Ceiling(RawItemCount / expectation);
return (int)Math.Ceiling(ItemCount / expectation);
}
}

internal double Mora
{
get
{
if (kind is ResinStatisticsItemKind.BlossomOfWealth)
{
throw HutaoException.NotSupported();
}

double expectation = kind switch
{
ResinStatisticsItemKind.TalentAscension => SelectedDropDistribution.TalentBooksMora,
ResinStatisticsItemKind.WeaponAscension => SelectedDropDistribution.WeaponAscensionMora,
ResinStatisticsItemKind.NormalBoss => SelectedDropDistribution.NormalBossMora,
ResinStatisticsItemKind.WeeklyBoss => SelectedDropDistribution.WeeklyBossMora,
_ => 0D,
};

return (RawTimes * expectation) + (TotalResin * MaterialDropDistribution.MoraPerResin);
}
}

internal double ItemCount
{
get => RawItemCount - MiscMoraEarned;
}
}

0 comments on commit 9411493

Please sign in to comment.