新增腻味程度:吃多了会腻

This commit is contained in:
ZouJin 2023-08-11 12:48:04 +10:00
parent 3c30895d4d
commit 55142c5ab6
2 changed files with 29 additions and 24 deletions

View File

@ -103,6 +103,7 @@ namespace VPet_Simulator.Windows.Interface
[Line(ignoreCase: true)]
public string Desc { get; set; }
private string desc = null;
private string descs = null;
/// <summary>
/// 描述(ToBetterBuy)
/// </summary>
@ -126,26 +127,7 @@ namespace VPet_Simulator.Windows.Interface
sb.Append("好感度".Translate() + ":\t").Append(Likability > 0 ? "+" : "").Append(Likability.ToString("f2"));
desc = sb.ToString();
}
DateTime now = DateTime.Now;
DateTime eattime = imw.Set.PetData.GetDateTime("buytime_" + Name, now);
string descs;
if (eattime <= now)
{
if (Type == FoodType.Meal || Type == FoodType.Snack || Type == FoodType.Drink)
descs = "喜好度".Translate();
else
descs = "有效度".Translate();
descs += ":\t100%";
}
else
{
if (Type == FoodType.Meal || Type == FoodType.Snack || Type == FoodType.Drink)
descs = "喜好度".Translate();
else
descs = "有效度".Translate();
descs += Math.Max(0.5, 1 - Math.Pow((eattime - now).TotalHours, 2) * 0.01).ToString("p0");
descs += "\t\t" + "恢复".Translate() + ":\t" + (eattime).ToString("MM/dd HH");
}
return desc + '\n' + descs + '\n' + Desc.Translate();
}
}
@ -163,7 +145,6 @@ namespace VPet_Simulator.Windows.Interface
[Line(ignoreCase: true)]
public string Image;
private IMainWindow imw;
/// <summary>
/// 加载物品图片
@ -172,7 +153,30 @@ namespace VPet_Simulator.Windows.Interface
{
ImageSource = imw.ImageSources.FindImage(Image ?? Name, "food");
Star = imw.Set["betterbuy"]["star"].GetInfos().Contains(Name);
this.imw = imw;
LoadEatTimeSource(imw);
}
public void LoadEatTimeSource(IMainWindow imw)
{
DateTime now = DateTime.Now;
DateTime eattime = imw.Set.PetData.GetDateTime("buytime_" + Name, now);
string descs;
if (eattime <= now)
{
if (Type == FoodType.Meal || Type == FoodType.Snack || Type == FoodType.Drink)
descs = "喜好度".Translate();
else
descs = "有效度".Translate();
descs += ":\t100%";
}
else
{
if (Type == FoodType.Meal || Type == FoodType.Snack || Type == FoodType.Drink)
descs = "喜好度".Translate();
else
descs = "有效度".Translate();
descs += ":\t" + Math.Max(0.5, 1 - Math.Pow((eattime - now).TotalHours, 2) * 0.01).ToString("p0");
descs += "\t\t" + "恢复".Translate() + ":\t" + (eattime).ToString("MM/dd HH");
}
}
}
}

View File

@ -189,11 +189,12 @@ namespace VPet_Simulator.Windows
eattimes = (eattime - now).TotalHours;
}
//开始加点
mw.Core.Save.EatFood(item, Math.Max(0.5, 1 - Math.Sqrt(eattimes) * 0.01));
mw.Core.Save.EatFood(item, Math.Max(0.5, 1 - Math.Pow(eattimes, 2) * 0.01));
//吃腻了
eattimes += 2;
mw.Set.PetData.SetDateTime("buytime_" + item.Name, now.AddHours(eattimes));
//通知
item.LoadEatTimeSource(mw);
item.NotifyOfPropertyChange("Eattime");
mw.Core.Save.Money -= item.Price;
@ -224,7 +225,7 @@ namespace VPet_Simulator.Windows
mw.Set.Statistics[(gdbe)"stat_bb_gift"] += item.Price;
break;
}
}
if (!_puswitch.IsChecked.Value)
TryClose();