食物相关更新

This commit is contained in:
ZouJin 2023-06-04 07:51:58 +10:00
parent 24e79cbc3e
commit be0e5e3e1e
14 changed files with 173 additions and 34 deletions

View File

@ -86,6 +86,7 @@ namespace VPet_Simulator.Core
public void FunctionSpend(double TimePass)
{
Core.Save.CleanChange();
Core.Save.StoreTake();
switch (State)
{
case WorkingState.Sleep:

View File

@ -40,6 +40,11 @@ namespace VPet_Simulator.Core
[Line(Type = LPSConvert.ConvertType.ToFloat)]
private double strength;
/// <summary>
/// 待补充的体力,随着时间缓慢加给桌宠
/// </summary>//让游戏更有游戏性
[Line(Type = LPSConvert.ConvertType.ToFloat)]
public double StoreStrength;
/// <summary>
/// 变化 体力
/// </summary>
public double ChangeStrength = 0;
@ -54,6 +59,11 @@ namespace VPet_Simulator.Core
public double StrengthFood { get => strengthFood; set => strengthFood = Math.Min(100, Math.Max(0, value)); }
[Line(Type = LPSConvert.ConvertType.ToFloat)]
private double strengthFood;
/// <summary>
/// 待补充的饱腹度,随着时间缓慢加给桌宠
/// </summary>//让游戏更有游戏性
[Line(Type = LPSConvert.ConvertType.ToFloat)]
public double StoreStrengthFood;
public void StrengthChangeFood(double value)
{
ChangeStrengthFood += value;
@ -71,6 +81,11 @@ namespace VPet_Simulator.Core
[Line(Type = LPSConvert.ConvertType.ToFloat)]
private double strengthDrink;
/// <summary>
/// 待补充的口渴度,随着时间缓慢加给桌宠
/// </summary>//让游戏更有游戏性
[Line(Type = LPSConvert.ConvertType.ToFloat)]
public double StoreStrengthDrink;
/// <summary>
/// 变化 口渴度
/// </summary>
public double ChangeStrengthDrink = 0;
@ -87,6 +102,11 @@ namespace VPet_Simulator.Core
[Line(Type = LPSConvert.ConvertType.ToFloat)]
private double feeling;
/// <summary>
/// 待补充的心情,随着时间缓慢加给桌宠
/// </summary>//让游戏更有游戏性
[Line(Type = LPSConvert.ConvertType.ToFloat)]
public double StoreFeeling;
/// <summary>
/// 变化 心情
/// </summary>
public double ChangeFeeling = 0;
@ -116,16 +136,63 @@ namespace VPet_Simulator.Core
/// </summary>
public void CleanChange(bool force = false)
{
if(--cleantick <= 0 || force)
if (--cleantick <= 0 || force)
{
ChangeStrength /= 2;
ChangeFeeling /= 2;
ChangeStrengthDrink /= 2;
ChangeStrengthFood /= 2;
cleantick = 10;
}
}
}
/// <summary>
/// 取回被储存的体力
/// </summary>
public void StoreTake()
{
StoreFeeling /= 2;
if (Math.Abs(StoreFeeling) < 1)
StoreFeeling = 0;
else
FeelingChange(StoreFeeling);
StoreStrength /= 2;
if (Math.Abs(StoreStrength) < 1)
StoreStrength = 0;
else
StrengthChange(StoreStrength);
StoreStrengthDrink /= 2;
if (Math.Abs(StoreStrengthDrink) < 1)
StoreStrengthDrink = 0;
else
StrengthChange(StoreStrengthDrink);
StoreStrengthFood /= 2;
if (Math.Abs(StoreStrengthFood) < 1)
StoreStrengthFood = 0;
else
StrengthChange(StoreStrengthFood);
}
public void EatFood(IFood food)
{
Exp += food.Exp;
var tmp = food.Strength / 2;
StrengthChange(tmp);
StoreStrength += tmp;
tmp = food.StrengthFood / 2;
StrengthChangeFood(tmp);
StoreStrengthFood += tmp;
tmp = food.StrengthDrink / 2;
StrengthChangeDrink(tmp);
StoreStrengthDrink += tmp;
tmp = food.Feeling / 2;
FeelingChange(tmp);
StoreFeeling += tmp;
Health += food.Health;
Likability += food.Likability;
}
/// <summary>
/// 宠物状态模式

View File

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VPet_Simulator.Core
{
public interface IFood
{
/// <summary>
/// 经验值
/// </summary>
int Exp { get; }
/// <summary>
/// 体力 0-100
/// </summary>
double Strength { get; }
/// <summary>
/// 饱腹度
/// </summary>
double StrengthFood { get; }
/// <summary>
/// 口渴度
/// </summary>
double StrengthDrink { get; }
/// <summary>
/// 心情
/// </summary>
double Feeling { get; }
/// <summary>
/// 健康
/// </summary>
double Health { get; }
/// <summary>
/// 好感度
/// </summary>
double Likability { get; }
}
}

View File

@ -71,13 +71,13 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="LinePutScript, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LinePutScript.1.8.0\lib\net462\LinePutScript.dll</HintPath>
<HintPath>..\packages\LinePutScript.1.8.1\lib\net462\LinePutScript.dll</HintPath>
</Reference>
<Reference Include="Panuon.WPF, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.1.0.1\lib\net462\Panuon.WPF.dll</HintPath>
</Reference>
<Reference Include="Panuon.WPF.UI, Version=1.1.11.8, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.UI.1.1.11.8\lib\net462\Panuon.WPF.UI.dll</HintPath>
<Reference Include="Panuon.WPF.UI, Version=1.1.11.10, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.UI.1.1.11.11\lib\net462\Panuon.WPF.UI.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
@ -153,6 +153,7 @@
<Compile Include="Handle\Function.cs" />
<Compile Include="Handle\GameCore.cs" />
<Compile Include="Handle\IController.cs" />
<Compile Include="Handle\IFood.cs" />
<Compile Include="Handle\PetLoader.cs" />
<Compile Include="Handle\GameSave.cs" />
<Compile Include="Properties\AssemblyInfo.cs">

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LinePutScript" version="1.8.0" targetFramework="net462" />
<package id="LinePutScript" version="1.8.1" targetFramework="net462" />
<package id="Panuon.WPF" version="1.0.1" targetFramework="net462" />
<package id="Panuon.WPF.UI" version="1.1.11.8" targetFramework="net462" />
<package id="Panuon.WPF.UI" version="1.1.11.11" targetFramework="net462" />
</packages>

View File

@ -0,0 +1,33 @@
using LinePutScript.Converter;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VPet_Simulator.Core;
namespace VPet_Simulator.Windows.Interface
{
public class Food : IFood
{
[Line]
public int Exp { get; set; }
[Line]
public double Strength { get; set; }
[Line]
public double StrengthFood { get; set; }
[Line]
public double StrengthDrink { get; set; }
[Line]
public double Feeling { get; set; }
[Line]
public double Health { get; set; }
[Line]
public double Likability { get; set; }
/// <summary>
/// 食物价格
/// </summary>
[Line]
public double Price { get; set; }
}
}

View File

@ -47,7 +47,7 @@ namespace VPet_Simulator.Windows.Interface
/// <summary>
/// 所有食物
/// </summary>
List<Item> Items { get; }
List<Food> Items { get; }
/// <summary>
/// 设置游戏缩放倍率
/// </summary>

View File

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VPet_Simulator.Windows.Interface
{
public class Item
{
}
}

View File

@ -1,4 +1,5 @@
using LinePutScript;
using LinePutScript.Dictionary;
using System;
using System.Windows;
@ -7,7 +8,7 @@ namespace VPet_Simulator.Windows.Interface
/// <summary>
/// 游戏设置
/// </summary>
public class Setting : LpsDocument
public class Setting : LPS_D
{
/// <summary>
/// 游戏设置
@ -30,7 +31,12 @@ namespace VPet_Simulator.Windows.Interface
allowmove = !this["gameconfig"].GetBool("allowmove");
smartmove = this["gameconfig"].GetBool("smartmove");
enablefunction = !this["gameconfig"].GetBool("enablefunction");
Statistics = this["statistics"];
}
/// <summary>
/// 统计数据信息
/// </summary>
public ILine Statistics;
//public Size WindowsSize
//{

View File

@ -89,13 +89,13 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="LinePutScript, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LinePutScript.1.8.0\lib\net462\LinePutScript.dll</HintPath>
<HintPath>..\packages\LinePutScript.1.8.1\lib\net462\LinePutScript.dll</HintPath>
</Reference>
<Reference Include="Panuon.WPF, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.1.0.1\lib\net462\Panuon.WPF.dll</HintPath>
</Reference>
<Reference Include="Panuon.WPF.UI, Version=1.1.11.8, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.UI.1.1.11.8\lib\net462\Panuon.WPF.UI.dll</HintPath>
<Reference Include="Panuon.WPF.UI, Version=1.1.11.10, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.UI.1.1.11.11\lib\net462\Panuon.WPF.UI.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
@ -112,7 +112,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="IMainWindow.cs" />
<Compile Include="Item.cs" />
<Compile Include="Food.cs" />
<Compile Include="MainPlugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Setting.cs" />

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LinePutScript" version="1.8.0" targetFramework="net462" />
<package id="LinePutScript" version="1.8.1" targetFramework="net462" />
<package id="Panuon.WPF" version="1.0.1" targetFramework="net462" />
<package id="Panuon.WPF.UI" version="1.1.11.8" targetFramework="net462" />
<package id="Panuon.WPF.UI" version="1.1.11.11" targetFramework="net462" />
</packages>

View File

@ -27,7 +27,7 @@ namespace VPet_Simulator.Windows
/// 所有三方插件
/// </summary>
public List<MainPlugin> Plugins { get; } = new List<MainPlugin>();
public List<Item> Items { get; } = new List<Item>();
public List<Food> Items { get; } = new List<Food>();
/// <summary>
/// 版本号
/// </summary>

View File

@ -79,7 +79,7 @@
<HintPath>..\packages\ChatGPT.API.Framework.1.0.3\lib\net462\ChatGPT.API.Framework.dll</HintPath>
</Reference>
<Reference Include="LinePutScript, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LinePutScript.1.8.0\lib\net48\LinePutScript.dll</HintPath>
<HintPath>..\packages\LinePutScript.1.8.1\lib\net48\LinePutScript.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
@ -87,8 +87,8 @@
<Reference Include="Panuon.WPF, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.1.0.1\lib\net48\Panuon.WPF.dll</HintPath>
</Reference>
<Reference Include="Panuon.WPF.UI, Version=1.1.11.8, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.UI.1.1.11.8\lib\net48\Panuon.WPF.UI.dll</HintPath>
<Reference Include="Panuon.WPF.UI, Version=1.1.11.10, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.UI.1.1.11.11\lib\net48\Panuon.WPF.UI.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />

View File

@ -3,8 +3,8 @@
<package id="ChatGPT.API.Framework" version="1.0.3" targetFramework="net48" />
<package id="Facepunch.Steamworks" version="2.3.3" targetFramework="net48" />
<package id="Facepunch.Steamworks.win32" version="2.3.3" targetFramework="net48" />
<package id="LinePutScript" version="1.8.0" targetFramework="net48" />
<package id="LinePutScript" version="1.8.1" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
<package id="Panuon.WPF" version="1.0.1" targetFramework="net48" />
<package id="Panuon.WPF.UI" version="1.1.11.8" targetFramework="net48" />
<package id="Panuon.WPF.UI" version="1.1.11.11" targetFramework="net48" />
</packages>