2023-09-10 14:03:47 +00:00
|
|
|
|
using LinePutScript.Localization.WPF;
|
|
|
|
|
using System;
|
2023-08-25 21:23:30 +00:00
|
|
|
|
using System.Collections.Generic;
|
2023-09-10 14:03:47 +00:00
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.IO;
|
2023-08-25 21:23:30 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2023-09-10 14:03:47 +00:00
|
|
|
|
using System.Windows;
|
2023-09-27 07:13:48 +00:00
|
|
|
|
using VPet_Simulator.Core;
|
2023-08-25 21:23:30 +00:00
|
|
|
|
using static VPet_Simulator.Core.GraphHelper;
|
|
|
|
|
|
|
|
|
|
namespace VPet_Simulator.Windows.Interface
|
|
|
|
|
{
|
|
|
|
|
public static class ExtensionFunction
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 判断这个工作是否超模
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="work">工作</param>
|
|
|
|
|
/// <returns>是否超模</returns>
|
2023-08-25 22:08:13 +00:00
|
|
|
|
public static bool IsOverLoad(this Work work)
|
2023-08-25 21:23:30 +00:00
|
|
|
|
{//判断这个工作是否超模
|
2023-09-17 15:49:08 +00:00
|
|
|
|
if (work.FinishBonus < 0)
|
2023-09-17 05:58:31 +00:00
|
|
|
|
return true;
|
2023-08-31 14:18:38 +00:00
|
|
|
|
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) *
|
2023-09-27 07:13:48 +00:00
|
|
|
|
(Math.Pow(work.LevelLimit / 2 + 1, 0.5) / 4 + 1) - 0.5;
|
2023-08-25 21:23:30 +00:00
|
|
|
|
var get = (work.MoneyBase + work.MoneyLevel * 10) * (work.MoneyLevel + 1) * (1 + work.FinishBonus / 2);
|
2023-08-31 14:18:38 +00:00
|
|
|
|
if (work.Type != Work.WorkType.Work)
|
2023-08-25 21:23:30 +00:00
|
|
|
|
{
|
|
|
|
|
get /= 12;//经验值换算
|
|
|
|
|
}
|
|
|
|
|
var rel = get / spend;
|
2023-09-12 05:15:22 +00:00
|
|
|
|
if (rel < 0)
|
|
|
|
|
return true;
|
2023-09-13 10:06:43 +00:00
|
|
|
|
if (Math.Abs(get) > (work.LevelLimit + 4) * 6) //等级获取速率限制
|
2023-09-13 09:29:45 +00:00
|
|
|
|
return true;
|
2023-08-25 21:23:30 +00:00
|
|
|
|
return rel > 2; // 推荐rel为1.0-1.4之间 超过2.0就是超模
|
|
|
|
|
}
|
2023-09-27 07:13:48 +00:00
|
|
|
|
|
|
|
|
|
public static string FoodToDescription(this IFood food)
|
|
|
|
|
{
|
|
|
|
|
var dic = new List<Tuple<string, double, string>>()
|
|
|
|
|
{
|
|
|
|
|
new Tuple<string, double, string>(LocalizeCore.Translate("经验值"), food.Exp, ValueToPlusPlus(food.Exp, 1 / 4, 5)),
|
|
|
|
|
new Tuple<string, double, string>(LocalizeCore.Translate("饱腹度"),food.StrengthFood, ValueToPlusPlus(food.StrengthFood, 1 / 2, 5)) ,
|
|
|
|
|
new Tuple<string, double, string>(LocalizeCore.Translate("口渴度"), food.StrengthDrink, ValueToPlusPlus(food.StrengthDrink, 1 / 2.5, 5)),
|
|
|
|
|
new Tuple<string, double, string>(LocalizeCore.Translate("体力"),food.Strength, ValueToPlusPlus(food.Strength, 1 / 4, 5)),
|
|
|
|
|
new Tuple<string, double, string>(LocalizeCore.Translate("心情"), food.Feeling, ValueToPlusPlus(food.Feeling, 1 / 3, 5)),
|
|
|
|
|
new Tuple<string, double, string>(LocalizeCore.Translate("健康"),food.Health, ValueToPlusPlus(food.Health, 1, 5)) ,
|
|
|
|
|
new Tuple<string, double, string>(LocalizeCore.Translate("好感度"),food.Likability, ValueToPlusPlus(food.Likability, 1.5, 5))
|
|
|
|
|
};
|
|
|
|
|
var dic2 = dic.Where(kv => kv.Item2 != 0)
|
|
|
|
|
.Select(x => x.Item1 + x.Item3);
|
|
|
|
|
return string.Join("\n", dic2);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 把值变成++
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="value">值</param>
|
|
|
|
|
/// <param name="magnification">倍率</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static string ValueToPlusPlus(double value, double magnification, int max = 10)
|
|
|
|
|
{
|
|
|
|
|
int v = (int)Math.Abs(value);
|
|
|
|
|
v = (int)(Math.Pow(v, magnification));
|
|
|
|
|
v = Math.Min(Math.Max(v, 0), max);
|
|
|
|
|
if (value < 0)
|
|
|
|
|
return new string('-', v);
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
return new string('+', v);
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-25 21:23:30 +00:00
|
|
|
|
}
|
2023-09-10 14:03:47 +00:00
|
|
|
|
public static class ExtensionValue
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 当前运行目录
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static string BaseDirectory = new FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).DirectoryName;
|
|
|
|
|
}
|
2023-09-27 07:13:48 +00:00
|
|
|
|
|
2023-08-25 21:23:30 +00:00
|
|
|
|
}
|