写死的数字进 Tuning;手册剧情联动等用占位符
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d28ca4e50c
commit
548d104b5b
7 files changed
+20
-13
No files matched your search
@@ -34,12 +34,12 @@ namespace Decentralized.Domain
|
||||
/// <summary>玩家作为卖家的好评(%):影响成交速度;卖假卡被看穿会下降,每笔成交回升一点。</summary>
|
||||
public int Rating = Tuning.BmRatingStart;
|
||||
|
||||
/// <summary>期望成交天数:倍率 ≤0.9 一天,1.0 两天,1.8 十四天,之间插值(0.9–1.0 线性,1.0 以上指数)。</summary>
|
||||
/// <summary>期望成交天数:倍率不高于 BmSellFastMult 取 BmSellDaysFast,BmSellDay1Mult 取 BmSellDays1,BmSellMax 取 BmSellDaysMax,之间插值(快档到一档线性,一档以上指数)。</summary>
|
||||
public static double ExpectedDays(double m)
|
||||
{
|
||||
if (m <= 0.9) return Tuning.BmSellDaysFast;
|
||||
if (m < 1.0) return Tuning.BmSellDaysFast + (m - 0.9) / 0.1 * (Tuning.BmSellDays1 - Tuning.BmSellDaysFast);
|
||||
return Tuning.BmSellDays1 * Math.Pow(Tuning.BmSellDaysMax / Tuning.BmSellDays1, (m - 1.0) / (Tuning.BmSellMax - 1.0));
|
||||
if (m <= Tuning.BmSellFastMult) return Tuning.BmSellDaysFast;
|
||||
if (m < Tuning.BmSellDay1Mult) return Tuning.BmSellDaysFast + (m - Tuning.BmSellFastMult) / (Tuning.BmSellDay1Mult - Tuning.BmSellFastMult) * (Tuning.BmSellDays1 - Tuning.BmSellDaysFast);
|
||||
return Tuning.BmSellDays1 * Math.Pow(Tuning.BmSellDaysMax / Tuning.BmSellDays1, (m - Tuning.BmSellDay1Mult) / (Tuning.BmSellMax - Tuning.BmSellDay1Mult));
|
||||
}
|
||||
|
||||
private static double T(double m) => Math.Max(0, Math.Min(1, (m - Tuning.BmSellMin) / (Tuning.BmSellMax - Tuning.BmSellMin)));
|
||||
|
||||
@@ -33,9 +33,9 @@ namespace Decentralized.Domain
|
||||
double ratio = taint / amount;
|
||||
double big = Tuning.AmlBigRents * rent, cum = Tuning.AmlCumRents * rent;
|
||||
double p = 0;
|
||||
if (ratio >= Tuning.AmlTaintRatio) p += ratio * 1.5;
|
||||
p += Math.Max(0, (amount - big) / big) * 0.2;
|
||||
p += Math.Max(0, (recentTotal + amount - cum) / cum) * 0.2;
|
||||
if (ratio >= Tuning.AmlTaintRatio) p += ratio * Tuning.AmlTaintMult;
|
||||
p += Math.Max(0, (amount - big) / big) * Tuning.AmlExcessWeight;
|
||||
p += Math.Max(0, (recentTotal + amount - cum) / cum) * Tuning.AmlExcessWeight;
|
||||
if (fromMixerOrFlagged) p += Tuning.AmlMixerBonus;
|
||||
return Math.Min(Tuning.AmlMaxChance, p);
|
||||
}
|
||||
|
||||
@@ -63,6 +63,8 @@ namespace Decentralized.Domain
|
||||
|
||||
// 合规出金与 AML(阈值以当前房租为单位)
|
||||
public const double AmlBigRents = 5, AmlCumRents = 15;
|
||||
/// <summary>出金审查命中概率:污点占比达标后每占一分加 AmlTaintMult 倍;超出单笔 / 累计额度的部分按 AmlExcessWeight 加。</summary>
|
||||
public const double AmlTaintMult = 1.5, AmlExcessWeight = 0.2;
|
||||
public const int AmlWindowDays = 7;
|
||||
public const double AmlTaintRatio = 0.10, AmlHeavyRatio = 0.30, AmlMixerBonus = 0.30, AmlMaxChance = 0.9;
|
||||
public const double TaxRate = 0.08;
|
||||
@@ -116,6 +118,8 @@ namespace Decentralized.Domain
|
||||
/// <summary>玩家上架出售:标价倍率范围(相对参考价)、上架费、改价费、成交抽成、成交后货款托管天数、假卡被买家看穿的概率;
|
||||
/// 倍率 ≤0.9 / 1.0 / 1.8 时的期望成交天数(之间插值);货款带污点的概率与比例随倍率从下限涨到上限;卖家好评的初始值、看穿一次扣的点数、同时上架的件数上限。</summary>
|
||||
public const double BmListFee = 0.05, BmRepriceFee = 0.02, BmCommission = 0.08, BmSellMin = 0.6, BmSellMax = 1.8, BmFakeDetect = 0.5;
|
||||
/// <summary>出售成交天数的倍率界线:不高于 BmSellFastMult 倍用 BmSellDaysFast 天,BmSellDay1Mult 倍用 BmSellDays1 天,之间线性,再往上指数到 BmSellMax。</summary>
|
||||
public const double BmSellFastMult = 0.9, BmSellDay1Mult = 1.0;
|
||||
public const double BmSellDaysFast = 1, BmSellDays1 = 2, BmSellDaysMax = 14;
|
||||
public const double BmSaleTaintChanceMin = 0.2, BmSaleTaintChanceMax = 0.9, BmSaleTaintRatioMin = 0.2, BmSaleTaintRatioMax = 0.8;
|
||||
public const int BmSaleHold = 3, BmRatingStart = 90, BmRatingFakeLoss = 10, BmMaxListings = 10;
|
||||
|
||||
@@ -8,17 +8,17 @@ namespace Decentralized.Domain
|
||||
/// <summary>
|
||||
/// 文本里的数值占位符:<c>{Name}</c>、<c>{Name:%}</c>、<c>{Name[2]:%}</c>,也可以走嵌套类 <c>{Section.Name}</c>。
|
||||
/// 手册等说明文字不直接写数字,渲染时从 <see cref="Tuning"/> 取值,数值一改文字跟着变。
|
||||
/// <c>%</c> 把小数按百分比显示(0.03 → 3%);不带格式时去掉多余的零。
|
||||
/// <c>%</c> 把小数按百分比显示(0.03 → 3%),<c>+%</c> 把倍数显示成涨幅(1.2 → 20%);不带格式时去掉多余的零。
|
||||
/// </summary>
|
||||
public static class TuningText
|
||||
{
|
||||
private static readonly Regex Placeholder = new Regex(@"\{([A-Za-z0-9_.]+)(?:\[(\d+)\])?(?::(%))?\}", RegexOptions.Compiled);
|
||||
private static readonly Regex Placeholder = new Regex(@"\{([A-Za-z0-9_.]+)(?:\[(\d+)\])?(?::(\+?%))?\}", RegexOptions.Compiled);
|
||||
|
||||
public static string Render(string text)
|
||||
{
|
||||
if (string.IsNullOrEmpty(text)) return text;
|
||||
return Placeholder.Replace(text, m => TryValue(m.Groups[1].Value, m.Groups[2].Success ? int.Parse(m.Groups[2].Value) : -1, out var v)
|
||||
? Format(v, m.Groups[3].Success)
|
||||
? Format(v, m.Groups[3].Value)
|
||||
: m.Value);
|
||||
}
|
||||
|
||||
@@ -31,8 +31,10 @@ namespace Decentralized.Domain
|
||||
return bad;
|
||||
}
|
||||
|
||||
private static string Format(double v, bool percent)
|
||||
private static string Format(double v, string format)
|
||||
{
|
||||
bool percent = format == "%" || format == "+%";
|
||||
if (format == "+%") v -= 1; // 倍数 1.2 → 20%
|
||||
if (percent) v *= 100;
|
||||
return Math.Round(v, 4).ToString("0.####", CultureInfo.InvariantCulture) + (percent ? "%" : "");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user