针对选项说话的范围限制

This commit is contained in:
ZouJin 2023-09-26 01:13:17 +08:00
parent e879041e90
commit 5df1c6fc27
2 changed files with 50 additions and 24 deletions

View File

@ -142,30 +142,33 @@ namespace VPet_Simulator.Windows.Interface
transText = value;
}
}
/// <summary>
/// 检查部分状态是否满足需求
/// </summary>之所以不是全部的,是因为挨个取效率太差了
public virtual bool CheckState(Main m)
public virtual bool CheckState(GameSave save)
{
if (m.Core.Save.Likability < LikeMin || m.Core.Save.Likability > LikeMax)
if (save.Likability < LikeMin || save.Likability > LikeMax)
return false;
if (m.Core.Save.Health < HealthMin || m.Core.Save.Health > HealthMax)
if (save.Health < HealthMin || save.Health > HealthMax)
return false;
if (m.Core.Save.Level < LevelMin || m.Core.Save.Level > LevelMax)
if (save.Level < LevelMin || save.Level > LevelMax)
return false;
if (m.Core.Save.Money < MoneyMin || m.Core.Save.Money > MoneyMax)
if (save.Money < MoneyMin || save.Money > MoneyMax)
return false;
if (m.Core.Save.StrengthFood < FoodMin || m.Core.Save.StrengthFood > FoodMax)
if (save.StrengthFood < FoodMin || save.StrengthFood > FoodMax)
return false;
if (m.Core.Save.StrengthDrink < DrinkMin || m.Core.Save.StrengthDrink > DrinkMax)
if (save.StrengthDrink < DrinkMin || save.StrengthDrink > DrinkMax)
return false;
if (m.Core.Save.Feeling < FeelMin || m.Core.Save.Feeling > FeelMax)
if (save.Feeling < FeelMin || save.Feeling > FeelMax)
return false;
if (m.Core.Save.Strength < StrengthMin || m.Core.Save.Strength > StrengthMax)
if (save.Strength < StrengthMin || save.Strength > StrengthMax)
return false;
return true;
}
/// <summary>
/// 检查部分状态是否满足需求
/// </summary>之所以不是全部的,是因为挨个取效率太差了
public virtual bool CheckState(Main m) => CheckState(m.Core.Save);
/// <summary>
/// 将文本转换成实际值

View File

@ -403,20 +403,7 @@ namespace VPet_Simulator.Windows
else//新玩家,默认设置为
Set["CGPT"][(gstr)"type"] = "LB";
//加载数据合理化:食物
if (!Set["gameconfig"].GetBool("noAutoCal"))
{
foreach (Food f in Foods)
{
if (f.IsOverLoad())
{
f.Price = Math.Max((int)f.RealPrice, 1);
f.isoverload = false;
}
}
}
await Dispatcher.InvokeAsync(new Action(() => LoadingText.Content = "尝试加载游戏MOD".Translate()));
//当前桌宠动画
@ -445,6 +432,42 @@ namespace VPet_Simulator.Windows
//如果加载存档失败了,试试加载备份,如果没备份,就新建一个
LoadLatestSave(petloader.PetName);
//加载数据合理化:食物
if (!Set["gameconfig"].GetBool("noAutoCal"))
{
foreach (Food f in Foods)
{
if (f.IsOverLoad())
{
f.Price = Math.Max((int)f.RealPrice, 1);
f.isoverload = false;
}
}
//var food = new Food();
foreach (var selet in SelectTexts)
{
selet.Exp = Math.Max(Math.Min(selet.Exp, 1000), -1000);
//food.Exp += selet.Exp;
selet.Feeling = Math.Max(Math.Min(selet.Feeling, 1000), -1000);
//food.Feeling += selet.Feeling;
selet.Health = Math.Max(Math.Min(selet.Feeling, 100), -100);
//food.Health += selet.Health;
selet.Likability = Math.Max(Math.Min(selet.Likability, 50), -50);
//food.Likability += selet.Likability;
selet.Money = Math.Max(Math.Min(selet.Money, 1000), -1000);
//food.Price -= selet.Money;
selet.Strength = Math.Max(Math.Min(selet.Strength, 1000), -1000);
//food.Strength += selet.Strength;
selet.StrengthDrink = Math.Max(Math.Min(selet.StrengthDrink, 1000), -1000);
//food.StrengthDrink += selet.StrengthDrink;
selet.StrengthFood = Math.Max(Math.Min(selet.StrengthFood, 1000), -1000);
//food.StrengthFood += selet.StrengthFood;
}
//if (food.IsOverLoad())
//{
// MessageBox.Show(food.RealPrice.ToString());
//}
}
AutoSaveTimer.Elapsed += AutoSaveTimer_Elapsed;