统一work的get和spend算法

This commit is contained in:
ZouJin 2023-11-13 22:34:57 +08:00
parent eb662e4c59
commit 183a1659f5
3 changed files with 28 additions and 21 deletions

View File

@ -19,18 +19,12 @@ namespace VPet_Simulator.Windows.Interface
/// </summary>
public static readonly int[] WorkCalLevel = new int[] { 1, 5, 10, 20, 30, 40, 50, 75, 100, 200 };
/// <summary>
/// 判断这个工作是否超模
/// 工作获取效率
/// </summary>
/// <param name="work">工作</param>
/// <returns>是否超模</returns>
public static bool IsOverLoad(this Work work)
{//判断这个工作是否超模
if (work.FinishBonus < 0)
return true;
var spend = ((work.StrengthFood >= 0 ? 1 : -1) * Math.Pow(work.StrengthFood * 2 + 1, 2) / 6 +
(work.StrengthDrink >= 0 ? 1 : -1) * Math.Pow(work.StrengthDrink * 2 + 1, 2) / 9 +
(work.Feeling >= 0 ? 1 : -1) * Math.Pow((work.Type == Work.WorkType.Play ? -1 : 1) * work.Feeling * 2 + 1, 2) / 12) *
(Math.Pow(work.LevelLimit / 2 + 1, 0.5) / 4 + 1) - 0.5;
/// <returns>工作获取效率</returns>
public static double Get(this Work work)
{
double get = 0;
foreach (var lv in WorkCalLevel)
{
@ -41,6 +35,27 @@ namespace VPet_Simulator.Windows.Interface
{
get /= 12;//经验值换算
}
return get;
}
public static double Spend(this Work work)
{
var spend = ((work.StrengthFood >= 0 ? 1 : -1) * Math.Pow(work.StrengthFood * 2 + 1, 2) / 6 +
(work.StrengthDrink >= 0 ? 1 : -1) * Math.Pow(work.StrengthDrink * 2 + 1, 2) / 9 +
(work.Feeling >= 0 ? 1 : -1) * Math.Pow((work.Type == Work.WorkType.Play ? -1 : 1) * work.Feeling * 2 + 1, 2) / 12) *
(Math.Pow(work.LevelLimit / 2 + 1, 0.5) / 4 + 1) - 0.5;
return spend;
}
/// <summary>
/// 判断这个工作是否超模
/// </summary>
/// <param name="work">工作</param>
/// <returns>是否超模</returns>
public static bool IsOverLoad(this Work work)
{//判断这个工作是否超模
if (work.FinishBonus < 0)
return true;
var spend = work.Spend();
var get = work.Get();
var rel = get / spend;
if (rel < 0)
return true;

View File

@ -982,16 +982,8 @@ namespace VPet_Simulator.Windows
//看看是否超模
if (HashCheck && work.IsOverLoad())
{
var spend = ((work.StrengthFood >= 0 ? 1 : -1) * Math.Pow(work.StrengthFood * 2 + 1, 2) / 6 +
(work.StrengthDrink >= 0 ? 1 : -1) * Math.Pow(work.StrengthDrink * 2 + 1, 2) / 9 +
(work.Feeling >= 0 ? 1 : -1) * Math.Pow((work.Type == Work.WorkType.Play ? -1 : 1) * work.Feeling * 2 + 1, 2) / 12) *
(Math.Pow(work.LevelLimit / 2 + 1, 0.5) / 4 + 1) - 0.5;
double get = 0;
foreach (var lv in WorkCalLevel)
{
get += (work.MoneyBase + Math.Sqrt(lv) * work.MoneyLevel) * (1 + work.FinishBonus / 2);
}
get /= WorkCalLevel.Length;
double spend = work.Spend();
double get = work.Get();
var rel = get / spend;
if (MessageBoxX.Show("当前工作数据属性超模,是否继续工作?\n超模工作可能会导致游戏发生不可预料的错误\n超模工作不影响大部分成就解锁\n当前数据比率 {0:f2} 推荐=0.5<0.75\n盈利速度:{1:f0} 推荐<{2}"
.Translate(rel, get, (work.LevelLimit + 4) * 3), "超模工作提醒".Translate(), MessageBoxButton.YesNo) != MessageBoxResult.Yes)

View File

@ -8,7 +8,7 @@ work:|Type#Work:|Name#清屏:|MoneyBase#16:|MoneyLevel#1.2:|Graph#workclean:|Str
work:|Type#Work:|Name#直播:|MoneyBase#30:|MoneyLevel#2.5:|Graph#worktwo:|StrengthFood#4.5:|StrengthDrink#8.5:|Feeling#3:|Time#180:|FinishBonus#0.25:|LevelLimit#20:|BorderBrush#000000:|Background#413d39:|ButtonBackground#322e2b:|ButtonForeground#FFFFFF:|Foreground#ccbdad:|Left#113:|Top#315:|Width#280:|
work:|Type#Study:|Name#学习:|MoneyBase#40:|MoneyLevel#3.5:|Graph#study:|StrengthFood#1.5:|StrengthDrink#2:|Feeling#3:|Time#45:|FinishBonus#0.2:|BorderBrush#000000:|Background#413d39:|ButtonBackground#322e2b:|ButtonForeground#FFFFFF:|Foreground#ccbdad:|Left#113:|Top#315:|Width#280:|
work:|Type#Study:|Name#研究:|MoneyBase#78:|MoneyLevel#10:|Graph#studytwo:|StrengthFood#1.5:|StrengthDrink#3.5:|Feeling#4:|Time#75:|FinishBonus#0.4:|BorderBrush#000000:|Background#413d39:|ButtonBackground#322e2b:|LevelLimit#15:|ButtonForeground#FFFFFF:|Foreground#ccbdad:|Left#113:|Top#315:|Width#280:|
work:|Type#Play:|Name#玩游戏:|MoneyBase#20:|MoneyLevel#2.4:|Graph#playone:|StrengthFood#1:|StrengthDrink#0.5:|Feeling#4:|Time#30:|FinishBonus#0.2:|BorderBrush#000000:|Background#413d39:|ButtonBackground#322e2b:|ButtonForeground#FFFFFF:|Foreground#ccbdad:|Left#113:|Top#315:|Width#280:|
work:|Type#Play:|Name#玩游戏:|MoneyBase#20:|MoneyLevel#2.9:|Graph#playone:|StrengthFood#1:|StrengthDrink#0.5:|Feeling#4:|Time#30:|FinishBonus#0.2:|BorderBrush#000000:|Background#413d39:|ButtonBackground#322e2b:|ButtonForeground#FFFFFF:|Foreground#ccbdad:|Left#113:|Top#315:|Width#280:|
work:|Type#Play:|Name#删错误:|MoneyBase#20:|MoneyLevel#3:|Graph#removeobject:|StrengthFood#0.5:|StrengthDrink#0.5:|Feeling#4:|Time#60:|FinishBonus#0.25:|BorderBrush#000000:|Background#413d39:|ButtonBackground#322e2b:|ButtonForeground#FFFFFF:|Foreground#ccbdad:|Left#113:|Top#315:|Width#280:|LevelLimit#6:|
move:|graph#climb.left:|LocateType#Left:|LocateLength#145:|TriggerLeft#100:|TriggerTop#200:|TriggerType#65:|CheckType#64:|CheckTop#100:|SpeedY#-10:|Distance#7:|ModeType#14:|
move:|graph#climb.left:|LocateType#Left:|LocateLength#145:|TriggerLeft#100:|TriggerBottom#200:|TriggerType#129:|CheckType#128:|CheckBottom#100:|SpeedY#10:|Distance#7:|ModeType#14:|