Coin payment premium 12%

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ZHU MINCHAOandClaude Sonnet 5.5 committed 2026-11-03 18:11:20 +08:00
1 parent adda3a4e3a
commit c9dd900b16
3 files changed
+6 -4

No files matched your search

+2 -2
View File
@@ -33,11 +33,11 @@ namespace Decentralized.Domain
} }
} }
/// <summary>收款:返回收到的币数。heatPct 是物品的赃物热度(0–100)。</summary> /// <summary>收款:返回收到的币数。heatPct 是物品的赃物热度(0–100)。多付的溢价是顾客给的额外收入,不带污点。</summary>
public static double Receive(Wallet w, string asset, double credits, double price, double heatPct) public static double Receive(Wallet w, string asset, double credits, double price, double heatPct)
{ {
if (credits <= 0 || price <= 0) return 0; if (credits <= 0 || price <= 0) return 0;
double qty = credits / price; double qty = credits * (1 + Tuning.CoinPayPremium) / price; // 溢价只加在币数上,污点与成本仍按货值算
w.Add(asset, qty); w.Add(asset, qty);
w.Taint += credits * Math.Max(0, Math.Min(100, heatPct)) / 100.0; w.Taint += credits * Math.Max(0, Math.Min(100, heatPct)) / 100.0;
w.Basis += credits; w.Basis += credits;
+2
View File
@@ -65,6 +65,8 @@ namespace Decentralized.Domain
public const int MixerMaxRounds = 5, MixerSanctionDays = 5; public const int MixerMaxRounds = 5, MixerSanctionDays = 5;
/// <summary>各派系顾客用币付款的概率。</summary> /// <summary>各派系顾客用币付款的概率。</summary>
public const double CoinPayCrc = 0.30, CoinPayCrt = 0.50, CoinPayCra = 0.50, CoinPayPsc = 0.25; public const double CoinPayCrc = 0.30, CoinPayCrt = 0.50, CoinPayCra = 0.50, CoinPayPsc = 0.25;
/// <summary>用币付款的溢价:顾客多付的比例,补偿持币的污点与兑出的手续费。</summary>
public const double CoinPayPremium = 0.12;
/// <summary>单个金融违规事件记入的罪证上限。</summary> /// <summary>单个金融违规事件记入的罪证上限。</summary>
public const double CrimeEventCap = 400; public const double CrimeEventCap = 400;
+2 -2
View File
@@ -493,8 +493,8 @@ internal static class Program
var w = new Wallet { Address = "t" }; var w = new Wallet { Address = "t" };
Check(CoinPayment.AssetFor("FACTION_BLACK_MARKET") == Assets.CRT && CoinPayment.AssetFor("FACTION_SECURITY") == null, "派系对应的币"); Check(CoinPayment.AssetFor("FACTION_BLACK_MARKET") == Assets.CRT && CoinPayment.AssetFor("FACTION_SECURITY") == null, "派系对应的币");
double q = CoinPayment.Receive(w, Assets.CRT, 200, 0.5, 40); double q = CoinPayment.Receive(w, Assets.CRT, 200, 0.5, 40);
Check(Near(q, 400, 1e-9) && Near(w.Get(Assets.CRT), 400, 1e-9), "按币价换算数量"); Check(Near(q, 400 * (1 + Tuning.CoinPayPremium), 1e-9) && Near(w.Get(Assets.CRT), q, 1e-9), "按币价换算数量,含溢价");
Check(Near(w.Taint, 80, 1e-9) && Near(w.Basis, 200, 1e-9), "污点 = 货值 × 热度%,成本 = 货值"); Check(Near(w.Taint, 80, 1e-9) && Near(w.Basis, 200, 1e-9), "污点 = 货值 × 热度%,成本 = 货值(溢价不带污点)");
Check(CoinPayment.Receive(w, Assets.CRC, 0, 1, 10) == 0, "零金额不收"); Check(CoinPayment.Receive(w, Assets.CRC, 0, 1, 10) == 0, "零金额不收");
}); });