mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-04-23 20:49:33 +08:00
优化任务计划、更新游戏平衡常数、添加经验值显示等
This commit is contained in:
parent
a6d8b71829
commit
4f9a7b3ca7
@ -1,4 +1,5 @@
|
||||
using Milimoe.FunGame.Core.Model;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using Milimoe.FunGame.Core.Model;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Api.Utility
|
||||
{
|
||||
@ -33,7 +34,12 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
_tasks.Add(new ScheduledTask(name, timeOfDay, action));
|
||||
ScheduledTask task = new(name, timeOfDay, action);
|
||||
if (DateTime.Now > DateTime.Today.Add(timeOfDay))
|
||||
{
|
||||
task.LastRun = DateTime.Today.Add(timeOfDay);
|
||||
}
|
||||
_tasks.Add(task);
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,6 +78,83 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取任务计划上一次执行时间
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="recurring"></param>
|
||||
/// <returns></returns>
|
||||
public DateTime GetLastTime(string name, bool recurring = false)
|
||||
{
|
||||
if (!recurring)
|
||||
{
|
||||
if (_tasks.FirstOrDefault(t => t.Name == name) is ScheduledTask task && task.LastRun.HasValue)
|
||||
{
|
||||
return task.LastRun.Value;
|
||||
}
|
||||
else if (_recurringTasks.FirstOrDefault(t => t.Name == name) is RecurringTask recurringTask && recurringTask.LastRun.HasValue)
|
||||
{
|
||||
return recurringTask.LastRun.Value;
|
||||
}
|
||||
}
|
||||
else if (_recurringTasks.FirstOrDefault(t => t.Name == name) is RecurringTask recurringTask && recurringTask.LastRun.HasValue)
|
||||
{
|
||||
return recurringTask.LastRun.Value;
|
||||
}
|
||||
return DateTime.MinValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取任务计划下一次执行时间
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="recurring"></param>
|
||||
/// <returns></returns>
|
||||
public DateTime GetNextTime(string name, bool recurring = false)
|
||||
{
|
||||
if (!recurring)
|
||||
{
|
||||
if (_tasks.FirstOrDefault(t => t.Name == name) is ScheduledTask task)
|
||||
{
|
||||
DateTime today = DateTime.Today.Add(task.TimeOfDay);
|
||||
return task.IsTodayRun ? today.AddDays(1) : today;
|
||||
}
|
||||
else if (_recurringTasks.FirstOrDefault(t => t.Name == name) is RecurringTask recurringTask)
|
||||
{
|
||||
return recurringTask.NextRun;
|
||||
}
|
||||
}
|
||||
else if (_recurringTasks.FirstOrDefault(t => t.Name == name) is RecurringTask recurringTask)
|
||||
{
|
||||
return recurringTask.NextRun;
|
||||
}
|
||||
return DateTime.MaxValue;
|
||||
}
|
||||
|
||||
public string GetRunTimeInfo(string name)
|
||||
{
|
||||
DateTime last = GetLastTime(name);
|
||||
DateTime next = GetNextTime(name);
|
||||
string msg = "";
|
||||
if (last != DateTime.MinValue)
|
||||
{
|
||||
msg += $"上次运行时间:{last.ToString(General.GeneralDateTimeFormat)}\r\n";
|
||||
}
|
||||
if (next != DateTime.MaxValue)
|
||||
{
|
||||
msg += $"下次运行时间:{next.ToString(General.GeneralDateTimeFormat)}\r\n";
|
||||
}
|
||||
if (msg != "")
|
||||
{
|
||||
msg = $"任务计划:{name}\r\n{msg}";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"任务计划 {name} 不存在!";
|
||||
}
|
||||
return msg.Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行任务
|
||||
/// </summary>
|
||||
|
@ -69,31 +69,31 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Promotion > General.GameplayEquilibriumConstant.PromotionThresholdSUpperLimit)
|
||||
if (Promotion > General.GameplayEquilibriumConstant.PromotionsUpperLimit["S"])
|
||||
{
|
||||
return RoleRating.X;
|
||||
}
|
||||
else if (Promotion > General.GameplayEquilibriumConstant.PromotionThresholdAPlusUpperLimit && Promotion <= General.GameplayEquilibriumConstant.PromotionThresholdSUpperLimit)
|
||||
else if (Promotion > General.GameplayEquilibriumConstant.PromotionsUpperLimit["A+"] && Promotion <= General.GameplayEquilibriumConstant.PromotionsUpperLimit["S"])
|
||||
{
|
||||
return RoleRating.S;
|
||||
}
|
||||
else if (Promotion > General.GameplayEquilibriumConstant.PromotionThresholdAUpperLimit && Promotion <= General.GameplayEquilibriumConstant.PromotionThresholdAPlusUpperLimit)
|
||||
else if (Promotion > General.GameplayEquilibriumConstant.PromotionsUpperLimit["A"] && Promotion <= General.GameplayEquilibriumConstant.PromotionsUpperLimit["A+"])
|
||||
{
|
||||
return RoleRating.APlus;
|
||||
}
|
||||
else if (Promotion > General.GameplayEquilibriumConstant.PromotionThresholdBUpperLimit && Promotion <= General.GameplayEquilibriumConstant.PromotionThresholdAUpperLimit)
|
||||
else if (Promotion > General.GameplayEquilibriumConstant.PromotionsUpperLimit["B"] && Promotion <= General.GameplayEquilibriumConstant.PromotionsUpperLimit["A"])
|
||||
{
|
||||
return RoleRating.A;
|
||||
}
|
||||
else if (Promotion > General.GameplayEquilibriumConstant.PromotionThresholdCUpperLimit && Promotion <= General.GameplayEquilibriumConstant.PromotionThresholdBUpperLimit)
|
||||
else if (Promotion > General.GameplayEquilibriumConstant.PromotionsUpperLimit["C"] && Promotion <= General.GameplayEquilibriumConstant.PromotionsUpperLimit["B"])
|
||||
{
|
||||
return RoleRating.B;
|
||||
}
|
||||
else if (Promotion > General.GameplayEquilibriumConstant.PromotionThresholdDUpperLimit && Promotion <= General.GameplayEquilibriumConstant.PromotionThresholdCUpperLimit)
|
||||
else if (Promotion > General.GameplayEquilibriumConstant.PromotionsUpperLimit["D"] && Promotion <= General.GameplayEquilibriumConstant.PromotionsUpperLimit["C"])
|
||||
{
|
||||
return RoleRating.C;
|
||||
}
|
||||
else if (Promotion > General.GameplayEquilibriumConstant.PromotionThresholdEUpperLimit && Promotion <= General.GameplayEquilibriumConstant.PromotionThresholdDUpperLimit)
|
||||
else if (Promotion > General.GameplayEquilibriumConstant.PromotionsUpperLimit["E"] && Promotion <= General.GameplayEquilibriumConstant.PromotionsUpperLimit["D"])
|
||||
{
|
||||
return RoleRating.D;
|
||||
}
|
||||
@ -1215,11 +1215,16 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
/// 获取角色的详细信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string GetInfo(bool showUser = true, bool showGrowth = true)
|
||||
public string GetInfo(bool showUser = true, bool showGrowth = true, bool showEXP = false)
|
||||
{
|
||||
StringBuilder builder = new();
|
||||
|
||||
builder.AppendLine(showUser ? ToStringWithLevel() : ToStringWithLevelWithOutUser());
|
||||
if (showEXP)
|
||||
{
|
||||
builder.AppendLine($"等级:{Level} / {General.GameplayEquilibriumConstant.MaxLevel}");
|
||||
builder.AppendLine($"经验值:{EXP}{(Level > 0 && Level <= General.GameplayEquilibriumConstant.EXPUpperLimit.Keys.Max() ? " / " + General.GameplayEquilibriumConstant.EXPUpperLimit[Level] : "")}");
|
||||
}
|
||||
double exHP = ExHP + ExHP2 + ExHP3;
|
||||
builder.AppendLine($"生命值:{HP:0.##} / {MaxHP:0.##}" + (exHP != 0 ? $" [{BaseHP:0.##} {(exHP >= 0 ? "+" : "-")} {Math.Abs(exHP):0.##}]" : ""));
|
||||
double exMP = ExMP + ExMP2 + ExMP3;
|
||||
@ -1338,11 +1343,16 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
/// 获取角色的简略信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string GetSimpleInfo(bool showUser = true, bool showGrowth = true)
|
||||
public string GetSimpleInfo(bool showUser = true, bool showGrowth = true, bool showEXP = false)
|
||||
{
|
||||
StringBuilder builder = new();
|
||||
|
||||
builder.AppendLine(showUser ? ToStringWithLevel() : ToStringWithLevelWithOutUser());
|
||||
if (showEXP)
|
||||
{
|
||||
builder.AppendLine($"等级:{Level} / {General.GameplayEquilibriumConstant.MaxLevel}");
|
||||
builder.AppendLine($"经验值:{EXP}{(Level > 0 && Level <= General.GameplayEquilibriumConstant.EXPUpperLimit.Keys.Max() ? " / " + General.GameplayEquilibriumConstant.EXPUpperLimit[Level] : "")}");
|
||||
}
|
||||
double exHP = ExHP + ExHP2 + ExHP3;
|
||||
builder.AppendLine($"生命值:{HP:0.##} / {MaxHP:0.##}" + (exHP != 0 ? $" [{BaseHP:0.##} {(exHP >= 0 ? "+" : "-")} {Math.Abs(exHP):0.##}]" : ""));
|
||||
double exMP = ExMP + ExMP2 + ExMP3;
|
||||
@ -1586,8 +1596,10 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
EP = EP,
|
||||
InitialATK = InitialATK,
|
||||
ExATK2 = ExATK2,
|
||||
ExATKPercentage = ExATKPercentage,
|
||||
InitialDEF = InitialDEF,
|
||||
ExDEF2 = ExDEF2,
|
||||
ExDEFPercentage = ExDEFPercentage,
|
||||
MDF = MDF.Copy(),
|
||||
PhysicalPenetration = PhysicalPenetration,
|
||||
MagicalPenetration = MagicalPenetration,
|
||||
@ -1602,6 +1614,9 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
ExSTR = ExSTR,
|
||||
ExAGI = ExAGI,
|
||||
ExINT = ExINT,
|
||||
ExSTRPercentage = ExSTRPercentage,
|
||||
ExAGIPercentage = ExAGIPercentage,
|
||||
ExINTPercentage = ExINTPercentage,
|
||||
STRGrowth = STRGrowth,
|
||||
AGIGrowth = AGIGrowth,
|
||||
INTGrowth = INTGrowth,
|
||||
|
@ -684,7 +684,6 @@ namespace Milimoe.FunGame.Core.Model
|
||||
}
|
||||
else
|
||||
{
|
||||
decided = true;
|
||||
WriteLine("[ " + character + $" ] 完全行动不能!");
|
||||
type = CharacterActionType.None;
|
||||
}
|
||||
@ -995,19 +994,19 @@ namespace Milimoe.FunGame.Core.Model
|
||||
{
|
||||
character.HP += reallyReHP;
|
||||
character.MP += reallyReMP;
|
||||
WriteLine($"角色 {character.NickName} 回血:{recoveryHP:0.##} / 回蓝:{recoveryMP:0.##}");
|
||||
WriteLine($"角色 {character.Name} 回血:{recoveryHP:0.##} [{character.HP:0.##} / {character.MaxHP:0.##}] / 回蓝:{recoveryMP:0.##} [{character.MP:0.##} / {character.MaxMP:0.##}]");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (reallyReHP > 0)
|
||||
{
|
||||
character.HP += reallyReHP;
|
||||
WriteLine($"角色 {character.NickName} 回血:{recoveryHP:0.##}");
|
||||
WriteLine($"角色 {character.Name} 回血:{recoveryHP:0.##} [{character.HP:0.##} / {character.MaxHP:0.##}]");
|
||||
}
|
||||
if (reallyReMP > 0)
|
||||
{
|
||||
character.MP += reallyReMP;
|
||||
WriteLine($"角色 {character.NickName} 回蓝:{recoveryMP:0.##}");
|
||||
WriteLine($"角色 {character.Name} 回蓝:{recoveryMP:0.##} [{character.MP:0.##} / {character.MaxMP:0.##}]");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,42 +18,17 @@
|
||||
/// <summary>
|
||||
/// 晋升点数上限
|
||||
/// </summary>
|
||||
public int PromotionThresholdXUpperLimit { get; set; } = 999;
|
||||
|
||||
/// <summary>
|
||||
/// 角色评级 S 的晋升点数上限
|
||||
/// </summary>
|
||||
public int PromotionThresholdSUpperLimit { get; set; } = 998;
|
||||
|
||||
/// <summary>
|
||||
/// 角色评级 A+ 的晋升点数上限
|
||||
/// </summary>
|
||||
public int PromotionThresholdAPlusUpperLimit { get; set; } = 850;
|
||||
|
||||
/// <summary>
|
||||
/// 角色评级 A 的晋升点数上限
|
||||
/// </summary>
|
||||
public int PromotionThresholdAUpperLimit { get; set; } = 700;
|
||||
|
||||
/// <summary>
|
||||
/// 角色评级 B 的晋升点数上限
|
||||
/// </summary>
|
||||
public int PromotionThresholdBUpperLimit { get; set; } = 550;
|
||||
|
||||
/// <summary>
|
||||
/// 角色评级 C 的晋升点数上限
|
||||
/// </summary>
|
||||
public int PromotionThresholdCUpperLimit { get; set; } = 400;
|
||||
|
||||
/// <summary>
|
||||
/// 角色评级 D 的晋升点数上限
|
||||
/// </summary>
|
||||
public int PromotionThresholdDUpperLimit { get; set; } = 300;
|
||||
|
||||
/// <summary>
|
||||
/// 角色评级 E 的晋升点数上限
|
||||
/// </summary>
|
||||
public int PromotionThresholdEUpperLimit { get; set; } = 200;
|
||||
public Dictionary<string, int> PromotionsUpperLimit { get; set; } = new()
|
||||
{
|
||||
{ "X", 999 },
|
||||
{ "S", 998 },
|
||||
{ "A+", 850 },
|
||||
{ "A", 700 },
|
||||
{ "B", 550 },
|
||||
{ "C", 400 },
|
||||
{ "D", 300 },
|
||||
{ "E", 200 },
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 初始生命值
|
||||
@ -70,6 +45,11 @@
|
||||
/// </summary>
|
||||
public int MaxLevel { get; set; } = 60;
|
||||
|
||||
/// <summary>
|
||||
/// 经验值上限
|
||||
/// </summary>
|
||||
public Dictionary<int, double> EXPUpperLimit { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// 魔法最高等级
|
||||
/// </summary>
|
||||
|
Loading…
x
Reference in New Issue
Block a user