mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
超模食物/物品检查
This commit is contained in:
parent
b7c85fde74
commit
e9333b3c6c
@ -151,14 +151,18 @@ namespace VPet_Simulator.Windows.Interface
|
||||
public string Image;
|
||||
private bool? isoverload = null;
|
||||
/// <summary>
|
||||
/// 当前物品推荐价格
|
||||
/// </summary>
|
||||
public double RealPrice => ((Exp / 4 + Strength / 5 + StrengthDrink / 3 + StrengthFood / 2 + Feeling / 6) / 3 + Health + Likability * 10);
|
||||
/// <summary>
|
||||
/// 该食物是否超模
|
||||
/// </summary>
|
||||
public bool IsOverLoad()
|
||||
{
|
||||
if (isoverload == null)
|
||||
{
|
||||
double realp = ((Exp / 4 + Strength / 5 + StrengthDrink / 3 + StrengthFood / 2 + Feeling / 6) / 3 + Health + Likability * 5);
|
||||
isoverload = Price > realp * 1.3 || Price < realp * 0.7;//30%容错
|
||||
double relp = RealPrice;
|
||||
isoverload = Price > (relp + 10) * 1.3;// || Price < (relp - 10) * 0.7;//30%容错
|
||||
}
|
||||
return isoverload.Value;
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ namespace VPet_Simulator.Windows
|
||||
if (food.Count == 0)
|
||||
return;
|
||||
var item = food[Function.Rnd.Next(food.Count)];
|
||||
Core.Save.Money -= item.Price * 1.2;
|
||||
Core.Save.Money -= item.Price * 0.2;
|
||||
TakeItem(item);
|
||||
Main.Display(GraphType.Eat, item.ImageSource, Main.DisplayToNomal);
|
||||
}
|
||||
@ -267,7 +267,7 @@ namespace VPet_Simulator.Windows
|
||||
if (food.Count == 0)
|
||||
return;
|
||||
var item = food[Function.Rnd.Next(food.Count)];
|
||||
Core.Save.Money -= item.Price * 1.2;
|
||||
Core.Save.Money -= item.Price * 0.2;
|
||||
TakeItem(item);
|
||||
Main.Display(GraphType.Drink, item.ImageSource, Main.DisplayToNomal);
|
||||
}
|
||||
|
@ -208,6 +208,17 @@ namespace VPet_Simulator.Windows
|
||||
, "金钱不足".Translate());
|
||||
return;
|
||||
}
|
||||
//看看是否超模
|
||||
if (mw.HashCheck && item.IsOverLoad())
|
||||
{
|
||||
if (MessageBoxX.Show("当前食物/物品属性超模,是否继续使用?\n使用超模食物可能会导致游戏发生不可预料的错误\n使用超模食物不影响大部分成就解锁\n本物品推荐价格为{0:f0}"
|
||||
.Translate(item.RealPrice), "超模食物/物品使用提醒".Translate(), MessageBoxButton.YesNo) != MessageBoxResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
mw.HashCheck = false;
|
||||
}
|
||||
|
||||
mw.TakeItem(item);
|
||||
}
|
||||
if (showeatanm)
|
||||
|
Loading…
Reference in New Issue
Block a user