diff --git a/Api/Utility/GameModuleLoader.cs b/Api/Utility/GameModuleLoader.cs
index a82fdf4..e5596b3 100644
--- a/Api/Utility/GameModuleLoader.cs
+++ b/Api/Utility/GameModuleLoader.cs
@@ -59,6 +59,10 @@ namespace Milimoe.FunGame.Core.Api.Utility
if (runtime == FunGameInfo.FunGame.FunGame_Desktop)
{
AddonManager.LoadGameMaps(loader.Maps, otherobjs);
+ foreach (GameMap map in loader.Maps.Values.ToList())
+ {
+ map.AfterLoad(loader, otherobjs);
+ }
AddonManager.LoadGameModules(loader.Modules, loader.Characters, loader.Skills, loader.Items, delegates, otherobjs);
foreach (GameModule module in loader.Modules.Values.ToList())
{
@@ -71,6 +75,10 @@ namespace Milimoe.FunGame.Core.Api.Utility
else if (runtime == FunGameInfo.FunGame.FunGame_Server)
{
AddonManager.LoadGameMaps(loader.Maps, otherobjs);
+ foreach (GameMap map in loader.Maps.Values.ToList())
+ {
+ map.AfterLoad(loader, otherobjs);
+ }
AddonManager.LoadGameModulesForServer(loader.ModuleServers, loader.Characters, loader.Skills, loader.Items, delegates, otherobjs);
foreach (GameModuleServer server in loader.ModuleServers.Values.ToList())
{
diff --git a/Api/Utility/TaskScheduler.cs b/Api/Utility/TaskScheduler.cs
index f0daa42..159a624 100644
--- a/Api/Utility/TaskScheduler.cs
+++ b/Api/Utility/TaskScheduler.cs
@@ -35,11 +35,12 @@ namespace Milimoe.FunGame.Core.Api.Utility
///
///
///
- public void AddTask(string name, TimeSpan timeOfDay, Action action)
+ ///
+ public void AddTask(string name, TimeSpan timeOfDay, Action action, Action? error = null)
{
lock (_lock)
{
- ScheduledTask task = new(name, timeOfDay, action);
+ ScheduledTask task = new(name, timeOfDay, action, error);
if (DateTime.Now > DateTime.Today.Add(timeOfDay))
{
task.LastRun = DateTime.Today.Add(timeOfDay);
@@ -55,14 +56,15 @@ namespace Milimoe.FunGame.Core.Api.Utility
///
///
///
- public void AddRecurringTask(string name, TimeSpan interval, Action action, bool startNow = false)
+ ///
+ public void AddRecurringTask(string name, TimeSpan interval, Action action, bool startNow = false, Action? error = null)
{
lock (_lock)
{
DateTime now = DateTime.Now;
now = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second, 0);
DateTime nextRun = startNow ? now : now.Add(interval);
- RecurringTask recurringTask = new(name, interval, action)
+ RecurringTask recurringTask = new(name, interval, action, error)
{
NextRun = nextRun
};
@@ -185,6 +187,8 @@ namespace Milimoe.FunGame.Core.Api.Utility
catch (Exception ex)
{
task.Error = ex;
+ TXTHelper.AppendErrorLog(ex.ToString());
+ task.ErrorHandler?.Invoke(ex);
}
});
}
@@ -206,6 +210,8 @@ namespace Milimoe.FunGame.Core.Api.Utility
catch (Exception ex)
{
recurringTask.Error = ex;
+ TXTHelper.AppendErrorLog(ex.ToString());
+ recurringTask.ErrorHandler?.Invoke(ex);
}
});
}
diff --git a/Entity/Character/MagicResistance.cs b/Entity/Character/MagicResistance.cs
index ff23bbe..fb7c95b 100644
--- a/Entity/Character/MagicResistance.cs
+++ b/Entity/Character/MagicResistance.cs
@@ -46,12 +46,12 @@ namespace Milimoe.FunGame.Core.Entity
///
/// 紫宛魔法抗性
///
- public double Fleabane { get; set; } = 0;
+ public double Aster { get; set; } = 0;
///
/// 时空魔法抗性
///
- public double Particle { get; set; } = 0;
+ public double SpatioTemporal { get; set; } = 0;
///
/// 平均魔法抗性
@@ -60,7 +60,7 @@ namespace Milimoe.FunGame.Core.Entity
{
get
{
- double mdf = Calculation.Round4Digits((None + Starmark + PurityNatural + PurityContemporary + Bright + Shadow + Element + Fleabane + Particle) / 9) * 100;
+ double mdf = Calculation.Round4Digits((None + Starmark + PurityNatural + PurityContemporary + Bright + Shadow + Element + Aster + SpatioTemporal) / 9) * 100;
if (Calculation.IsApproximatelyZero(mdf)) mdf = 0;
return mdf;
}
@@ -83,8 +83,8 @@ namespace Milimoe.FunGame.Core.Entity
MagicType.Bright => Bright,
MagicType.Shadow => Shadow,
MagicType.Element => Element,
- MagicType.Fleabane => Fleabane,
- MagicType.Particle => Particle,
+ MagicType.Aster => Aster,
+ MagicType.SpatioTemporal => SpatioTemporal,
_ => None
};
}
@@ -110,11 +110,11 @@ namespace Milimoe.FunGame.Core.Entity
case MagicType.Element:
Element = value;
break;
- case MagicType.Fleabane:
- Fleabane = value;
+ case MagicType.Aster:
+ Aster = value;
break;
- case MagicType.Particle:
- Particle = value;
+ case MagicType.SpatioTemporal:
+ SpatioTemporal = value;
break;
default:
None = value;
@@ -133,8 +133,8 @@ namespace Milimoe.FunGame.Core.Entity
if (assignment)
{
None = value;
- Particle = value;
- Fleabane = value;
+ SpatioTemporal = value;
+ Aster = value;
Element = value;
Shadow = value;
Bright = value;
@@ -145,8 +145,8 @@ namespace Milimoe.FunGame.Core.Entity
else
{
None += value;
- Particle += value;
- Fleabane += value;
+ SpatioTemporal += value;
+ Aster += value;
Element += value;
Shadow += value;
Bright += value;
@@ -163,8 +163,8 @@ namespace Milimoe.FunGame.Core.Entity
public void AddAllValue(double value)
{
None += value;
- Particle += value;
- Fleabane += value;
+ SpatioTemporal += value;
+ Aster += value;
Element += value;
Shadow += value;
Bright += value;
@@ -188,8 +188,8 @@ namespace Milimoe.FunGame.Core.Entity
Bright = Bright,
Shadow = Shadow,
Element = Element,
- Fleabane = Fleabane,
- Particle = Particle
+ Aster = Aster,
+ SpatioTemporal = SpatioTemporal
};
}
}
diff --git a/Entity/Character/Shield.cs b/Entity/Character/Shield.cs
index 5fcfe44..8cc3654 100644
--- a/Entity/Character/Shield.cs
+++ b/Entity/Character/Shield.cs
@@ -50,12 +50,12 @@ namespace Milimoe.FunGame.Core.Entity
///
/// 紫宛护盾
///
- public double Fleabane { get; set; } = 0;
+ public double Aster { get; set; } = 0;
///
/// 时空护盾
///
- public double Particle { get; set; } = 0;
+ public double SpatioTemporal { get; set; } = 0;
///
/// 总计物理护盾
@@ -65,7 +65,7 @@ namespace Milimoe.FunGame.Core.Entity
///
/// 总计魔法护盾
///
- public double TotalMagicial => None + Starmark + PurityNatural + PurityContemporary + Bright + Shadow + Element + Fleabane + Particle;
+ public double TotalMagicial => None + Starmark + PurityNatural + PurityContemporary + Bright + Shadow + Element + Aster + SpatioTemporal;
///
/// 获取或设置护盾值
@@ -87,8 +87,8 @@ namespace Milimoe.FunGame.Core.Entity
MagicType.Bright => Bright,
MagicType.Shadow => Shadow,
MagicType.Element => Element,
- MagicType.Fleabane => Fleabane,
- MagicType.Particle => Particle,
+ MagicType.Aster => Aster,
+ MagicType.SpatioTemporal => SpatioTemporal,
_ => None
};
}
@@ -118,11 +118,11 @@ namespace Milimoe.FunGame.Core.Entity
case MagicType.Element:
Element = value;
break;
- case MagicType.Fleabane:
- Fleabane = value;
+ case MagicType.Aster:
+ Aster = value;
break;
- case MagicType.Particle:
- Particle = value;
+ case MagicType.SpatioTemporal:
+ SpatioTemporal = value;
break;
default:
None = value;
@@ -152,8 +152,8 @@ namespace Milimoe.FunGame.Core.Entity
Bright = Bright,
Shadow = Shadow,
Element = Element,
- Fleabane = Fleabane,
- Particle = Particle
+ Aster = Aster,
+ SpatioTemporal = SpatioTemporal
};
}
}
diff --git a/Entity/Character/Unit.cs b/Entity/Character/Unit.cs
index 5d7aded..ba229da 100644
--- a/Entity/Character/Unit.cs
+++ b/Entity/Character/Unit.cs
@@ -61,10 +61,7 @@ namespace Milimoe.FunGame.Core.Entity
builder.AppendLine($"攻击力:{ATK:0.##}" + (exATK != 0 ? $" [{BaseATK:0.##} {(exATK >= 0 ? "+" : "-")} {Math.Abs(exATK):0.##}]" : ""));
double exDEF = ExDEF + ExDEF2 + ExDEF3;
builder.AppendLine($"物理护甲:{DEF:0.##}" + (exDEF != 0 ? $" [{BaseDEF:0.##} {(exMP >= 0 ? "+" : "-")} {Math.Abs(exDEF):0.##}]" : "") + $" ({PDR * 100:0.##}%)");
- double mdf = Calculation.Round4Digits((MDF.None + MDF.Starmark + MDF.PurityNatural + MDF.PurityContemporary +
- MDF.Bright + MDF.Shadow + MDF.Element + MDF.Fleabane + MDF.Particle) / 9) * 100;
- if (Calculation.IsApproximatelyZero(mdf)) mdf = 0;
- builder.AppendLine($"魔法抗性:{mdf:0.##}%(平均)");
+ builder.AppendLine($"魔法抗性:{MDF.Avg:0.##}%(平均)");
double exSPD = AGI * GameplayEquilibriumConstant.AGItoSPDMultiplier + ExSPD;
builder.AppendLine($"行动速度:{SPD:0.##}" + (exSPD != 0 ? $" [{InitialSPD:0.##} {(exSPD >= 0 ? "+" : "-")} {Math.Abs(exSPD):0.##}]" : "") + $" ({ActionCoefficient * 100:0.##}%)");
builder.AppendLine($"生命回复:{HR:0.##}" + (ExHR != 0 ? $" [{InitialHR + STR * GameplayEquilibriumConstant.STRtoHRFactor:0.##} {(ExHR >= 0 ? "+" : "-")} {Math.Abs(ExHR):0.##}]" : ""));
@@ -187,10 +184,7 @@ namespace Milimoe.FunGame.Core.Entity
builder.AppendLine($"攻击力:{ATK:0.##}" + (exATK != 0 ? $" [{BaseATK:0.##} {(exATK >= 0 ? "+" : "-")} {Math.Abs(exATK):0.##}]" : ""));
double exDEF = ExDEF + ExDEF2 + ExDEF3;
builder.AppendLine($"物理护甲:{DEF:0.##}" + (exDEF != 0 ? $" [{BaseDEF:0.##} {(exMP >= 0 ? "+" : "-")} {Math.Abs(exDEF):0.##}]" : "") + $" ({PDR * 100:0.##}%)");
- double mdf = Calculation.Round4Digits((MDF.None + MDF.Starmark + MDF.PurityNatural + MDF.PurityContemporary +
- MDF.Bright + MDF.Shadow + MDF.Element + MDF.Fleabane + MDF.Particle) / 9) * 100;
- if (Calculation.IsApproximatelyZero(mdf)) mdf = 0;
- builder.AppendLine($"魔法抗性:{mdf:0.##}%(平均)");
+ builder.AppendLine($"魔法抗性:{MDF.Avg:0.##}%(平均)");
double exSPD = AGI * GameplayEquilibriumConstant.AGItoSPDMultiplier + ExSPD;
builder.AppendLine($"行动速度:{SPD:0.##}" + (exSPD != 0 ? $" [{InitialSPD:0.##} {(exSPD >= 0 ? "+" : "-")} {Math.Abs(exSPD):0.##}]" : "") + $" ({ActionCoefficient * 100:0.##}%)");
builder.AppendLine($"生命回复:{HR:0.##}" + (ExHR != 0 ? $" [{InitialHR + STR * GameplayEquilibriumConstant.STRtoHRFactor:0.##} {(ExHR >= 0 ? "+" : "-")} {Math.Abs(ExHR):0.##}]" : ""));
@@ -412,10 +406,7 @@ namespace Milimoe.FunGame.Core.Entity
builder.AppendLine($"攻击力:{ATK:0.##}" + (exATK != 0 ? $" [{BaseATK:0.##} {(exATK >= 0 ? "+" : "-")} {Math.Abs(exATK):0.##}]" : ""));
double exDEF = ExDEF + ExDEF2 + ExDEF3;
builder.AppendLine($"物理护甲:{DEF:0.##}" + (exDEF != 0 ? $" [{BaseDEF:0.##} {(exMP >= 0 ? "+" : "-")} {Math.Abs(exDEF):0.##}]" : "") + $" ({PDR * 100:0.##}%)");
- double mdf = Calculation.Round4Digits((MDF.None + MDF.Starmark + MDF.PurityNatural + MDF.PurityContemporary +
- MDF.Bright + MDF.Shadow + MDF.Element + MDF.Fleabane + MDF.Particle) / 9) * 100;
- if (Calculation.IsApproximatelyZero(mdf)) mdf = 0;
- builder.AppendLine($"魔法抗性:{mdf:0.##}%(平均)");
+ builder.AppendLine($"魔法抗性:{MDF.Avg:0.##}%(平均)");
double exSPD = AGI * GameplayEquilibriumConstant.AGItoSPDMultiplier + ExSPD;
builder.AppendLine($"行动速度:{SPD:0.##}" + (exSPD != 0 ? $" [{InitialSPD:0.##} {(exSPD >= 0 ? "+" : "-")} {Math.Abs(exSPD):0.##}]" : "") + $" ({ActionCoefficient * 100:0.##}%)");
builder.AppendLine($"生命回复:{HR:0.##}" + (ExHR != 0 ? $" [{InitialHR + STR * GameplayEquilibriumConstant.STRtoHRFactor:0.##} {(ExHR >= 0 ? "+" : "-")} {Math.Abs(ExHR):0.##}]" : ""));
diff --git a/FunGame.Core.csproj b/FunGame.Core.csproj
index 86c2ff2..340cad8 100644
--- a/FunGame.Core.csproj
+++ b/FunGame.Core.csproj
@@ -1,72 +1,54 @@
-
- Library
- net9.0
- enable
- enable
- bin\
- $(Author)
- Project Redbud
- 2.0.0
- 2.0.0
- bin
- FunGame Core
- Milimoe.$(MSBuildProjectName.Replace(" ", "_"))
- true
- $(MSBuildProjectName)
- True
-
- True
- ©2023-Present Project Redbud and Contributors.
- $(AssemblyName)
+
+ Library
+ net9.0
+ enable
+ enable
+ bin\
+ $(Author)
+ Project Redbud
+ 2.0.0
+ 2.0.0
+ bin
+ FunGame Core
+ Milimoe.$(MSBuildProjectName.Replace(" ", "_"))
+ true
+ $(MSBuildProjectName)
+ True
+
+ True
+ ©2023-Present Project Redbud and Contributors.
+ $(AssemblyName)
FunGame.Core: A C#.NET library for turn-based games.
game;turn-based;server;framework;dotnet;csharp;gamedev
- We are excited to introduce the official version 1.0.0. Here are the key changes from the last release candidate:
- - Fixed an issue of incorrect recording of non-damage assists. (1.0.0)
- - Fixed an issue where applying a control effect to an enemy mistakenly resulted in an assist for the character when that enemy killed a teammate. (1.0.0)
- - Removed the restriction of contributing 10% damage to get an assist. (1.0.0)
- - Fixed an issue where the skill always defaults to selecting enemies when there is no suitable target, which could cause the character to mistakenly apply a buff state to the enemy. (1.0.0)
- - Adjusted the basic reward and assist allocation rules for killing enemies. (1.0.0)
- - Added monetary compensation based on the level and economic difference between the killer/assister and the victim. (1.0.0)
- Update history of all release candidate versions:
- - Initial release candidate 1 (1.0.0-rc.1-0428)
- - Abstract ActionQueue as GamingQueue, and separate the original Mix / Team modes into two queue types: MixGamingQueue and TeamGamingQueue. (1.0.0-rc.1-0502)
- - In the Effect class, added ParentEffect and ForceHideInStatusBar properties for more precise control of the status bar display. (1.0.0-rc.1-0509)
- - Added helper methods IsTeammate and GetIsTeammateDictionary to GamingQueue and its interface IGamingQueue for determining if someone is a teammate. This facilitates the skill effects to determine whether the target is a teammate. (1.0.0-rc.1-0509)
- - Added more properties (such as Name, RealCD) to the ISkill interface. Both NormalAttack and Skill inherit from ISkill, thus implementing these properties, although some properties are not meaningful for NormalAttack. (1.0.0-rc.1-0509)
- - Added corresponding text for EffectTypes Lifesteal and GrievousWound. (1.0.0-rc.1-0509)
- - Added EffectTypes: WeakDispelling and StrongDispelling, representing DurativeWeak and DurativeStrong of DispelType. (1.0.0-rc.1-0509)
- - Added underlying processing support for continuous dispelling in the TimeLapse method. (1.0.0-rc.1-0509)
- - Fixed an issue where the effect's shield hook provided incorrect parameters. (1.0.0-rc.1-0509)
- - Fixed an issue where the result of pre-hooks for evade and critical hit checks always deferred to the result of the last effect. It should be that if any effect prevents the check, it is skipped. (1.0.0-rc.1-0509)
- - Added comments for some code. (1.0.0-rc.1-0509)
-
+ See github releases for details on the latest changes.
+
https://github.com/project-redbud/FunGame-Core
- https://github.com/project-redbud
- LGPL-3.0-or-later
- True
- README.md
- 2.0.0-dev
- $([System.DateTime]::Now.ToString("MMdd"))
-
+ https://github.com/project-redbud
+ LGPL-3.0-or-later
+ True
+ README.md
+ 2.0.0-dev
+ $([System.DateTime]::Now.ToString("MMdd"))
+
-
- embedded
- 1701;1702;CS1591;CS1587;IDE0130
-
+
+ embedded
+ 1701;1702;CS1591;CS1587;IDE0130
+
-
- embedded
- 1701;1702;CS1591;CS1587;IDE0130
-
+
+ embedded
+ 1701;1702;CS1591;CS1587;IDE0130
+
-
-
- True
- \
-
-
+
+
+ True
+ \
+
+
diff --git a/Library/Common/Addon/GameMap.cs b/Library/Common/Addon/GameMap.cs
index 52aa9ca..84bf570 100644
--- a/Library/Common/Addon/GameMap.cs
+++ b/Library/Common/Addon/GameMap.cs
@@ -1,3 +1,4 @@
+using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Interface.Addons;
namespace Milimoe.FunGame.Core.Library.Common.Addon
@@ -97,16 +98,14 @@ namespace Milimoe.FunGame.Core.Library.Common.Addon
}
}
}
- // 如果加载后需要执行代码,请重写AfterLoad方法
- AfterLoad();
}
return IsLoaded;
}
///
- /// 加载后需要做的事
+ /// 地图完全加载后需要做的事
///
- protected virtual void AfterLoad()
+ public virtual void AfterLoad(GameModuleLoader loader, params object[] args)
{
// override
}
diff --git a/Library/Common/Addon/GameModuleServer.cs b/Library/Common/Addon/GameModuleServer.cs
index b00422a..f465837 100644
--- a/Library/Common/Addon/GameModuleServer.cs
+++ b/Library/Common/Addon/GameModuleServer.cs
@@ -1,4 +1,5 @@
using System.Collections.Concurrent;
+using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Controller;
using Milimoe.FunGame.Core.Interface.Addons;
using Milimoe.FunGame.Core.Interface.Base;
@@ -149,7 +150,7 @@ namespace Milimoe.FunGame.Core.Library.Common.Addon
///
/// 模组完全加载后需要做的事
///
- public virtual void AfterLoad(params object[] args)
+ public virtual void AfterLoad(GameModuleLoader loader, params object[] args)
{
// override
}
diff --git a/Library/Common/Addon/Grid.cs b/Library/Common/Addon/Grid.cs
index 81d5c7d..96c771a 100644
--- a/Library/Common/Addon/Grid.cs
+++ b/Library/Common/Addon/Grid.cs
@@ -28,12 +28,12 @@ namespace Milimoe.FunGame.Core.Library.Common.Addon
///
/// 是谁站在这格子上?
///
- public Dictionary Characters { get; set; } = [];
+ public HashSet Characters { get; set; } = [];
///
- /// 此格子目前受到了什么影响?或者它有什么技能…
+ /// 此格子目前受到了什么影响?
///
- public Dictionary Skills { get; set; } = [];
+ public HashSet Effects { get; set; } = [];
///
/// 此格子呈现的颜色(默认为 )
diff --git a/Library/Common/JsonConverter/MagicResistanceConverter.cs b/Library/Common/JsonConverter/MagicResistanceConverter.cs
index b0d3a3d..8e05ac9 100644
--- a/Library/Common/JsonConverter/MagicResistanceConverter.cs
+++ b/Library/Common/JsonConverter/MagicResistanceConverter.cs
@@ -36,11 +36,11 @@ namespace Milimoe.FunGame.Core.Library.Common.JsonConverter
case nameof(MagicResistance.Element):
result.Element = reader.GetDouble();
break;
- case nameof(MagicResistance.Fleabane):
- result.Fleabane = reader.GetDouble();
+ case nameof(MagicResistance.Aster):
+ result.Aster = reader.GetDouble();
break;
- case nameof(MagicResistance.Particle):
- result.Particle = reader.GetDouble();
+ case nameof(MagicResistance.SpatioTemporal):
+ result.SpatioTemporal = reader.GetDouble();
break;
}
}
@@ -56,8 +56,8 @@ namespace Milimoe.FunGame.Core.Library.Common.JsonConverter
writer.WriteNumber(nameof(MagicResistance.Bright), value.Bright);
writer.WriteNumber(nameof(MagicResistance.Shadow), value.Shadow);
writer.WriteNumber(nameof(MagicResistance.Element), value.Element);
- writer.WriteNumber(nameof(MagicResistance.Fleabane), value.Fleabane);
- writer.WriteNumber(nameof(MagicResistance.Particle), value.Particle);
+ writer.WriteNumber(nameof(MagicResistance.Aster), value.Aster);
+ writer.WriteNumber(nameof(MagicResistance.SpatioTemporal), value.SpatioTemporal);
writer.WriteEndObject();
}
diff --git a/Library/Common/JsonConverter/ShieldConverter.cs b/Library/Common/JsonConverter/ShieldConverter.cs
index 5ce24b3..b105e6c 100644
--- a/Library/Common/JsonConverter/ShieldConverter.cs
+++ b/Library/Common/JsonConverter/ShieldConverter.cs
@@ -39,11 +39,11 @@ namespace Milimoe.FunGame.Core.Library.Common.JsonConverter
case nameof(Shield.Element):
result.Element = reader.GetDouble();
break;
- case nameof(Shield.Fleabane):
- result.Fleabane = reader.GetDouble();
+ case nameof(Shield.Aster):
+ result.Aster = reader.GetDouble();
break;
- case nameof(Shield.Particle):
- result.Particle = reader.GetDouble();
+ case nameof(Shield.SpatioTemporal):
+ result.SpatioTemporal = reader.GetDouble();
break;
}
}
@@ -60,8 +60,8 @@ namespace Milimoe.FunGame.Core.Library.Common.JsonConverter
writer.WriteNumber(nameof(Shield.Bright), value.Bright);
writer.WriteNumber(nameof(Shield.Shadow), value.Shadow);
writer.WriteNumber(nameof(Shield.Element), value.Element);
- writer.WriteNumber(nameof(Shield.Fleabane), value.Fleabane);
- writer.WriteNumber(nameof(Shield.Particle), value.Particle);
+ writer.WriteNumber(nameof(Shield.Aster), value.Aster);
+ writer.WriteNumber(nameof(Shield.SpatioTemporal), value.SpatioTemporal);
writer.WriteEndObject();
}
diff --git a/Library/Constant/ConstantSet.cs b/Library/Constant/ConstantSet.cs
index a85a488..db5a4fe 100644
--- a/Library/Constant/ConstantSet.cs
+++ b/Library/Constant/ConstantSet.cs
@@ -387,8 +387,8 @@ namespace Milimoe.FunGame.Core.Library.Constant
MagicType.Bright => "光魔法伤害",
MagicType.Shadow => "影魔法伤害",
MagicType.Element => "元素魔法伤害",
- MagicType.Fleabane => "紫宛魔法伤害",
- MagicType.Particle => "时空魔法伤害",
+ MagicType.Aster => "紫宛魔法伤害",
+ MagicType.SpatioTemporal => "时空魔法伤害",
_ => "魔法伤害",
};
}
@@ -397,14 +397,14 @@ namespace Milimoe.FunGame.Core.Library.Constant
{
return type switch
{
- MagicType.Starmark => "星痕抗性",
- MagicType.PurityNatural => "现代结晶抗性",
- MagicType.PurityContemporary => "纯粹结晶抗性",
- MagicType.Bright => "光抗性",
- MagicType.Shadow => "影抗性",
- MagicType.Element => "元素抗性",
- MagicType.Fleabane => "紫宛抗性",
- MagicType.Particle => "时空抗性",
+ MagicType.Starmark => "星痕魔法抗性",
+ MagicType.PurityNatural => "现代结晶魔法抗性",
+ MagicType.PurityContemporary => "纯粹结晶魔法抗性",
+ MagicType.Bright => "光魔法抗性",
+ MagicType.Shadow => "影魔法抗性",
+ MagicType.Element => "元素魔法抗性",
+ MagicType.Aster => "紫宛魔法抗性",
+ MagicType.SpatioTemporal => "时空魔法抗性",
_ => "魔法抗性",
};
}
diff --git a/Library/Constant/TypeEnum.cs b/Library/Constant/TypeEnum.cs
index 6ab2361..3e5d73a 100644
--- a/Library/Constant/TypeEnum.cs
+++ b/Library/Constant/TypeEnum.cs
@@ -627,8 +627,8 @@ namespace Milimoe.FunGame.Core.Library.Constant
Bright,
Shadow,
Element,
- Fleabane,
- Particle
+ Aster,
+ SpatioTemporal
}
public enum PrimaryAttribute
diff --git a/Model/GamingQueue.cs b/Model/GamingQueue.cs
index d193dbd..9d0d794 100644
--- a/Model/GamingQueue.cs
+++ b/Model/GamingQueue.cs
@@ -921,42 +921,25 @@ namespace Milimoe.FunGame.Core.Model
}
else if (type == CharacterActionType.PreCastSkill)
{
- // 预使用技能,即开始吟唱逻辑
- Skill? skill = await OnSelectSkillAsync(character, skills);
- if (skill is null && _charactersInAI.Contains(character) && skills.Count > 0)
+ if (character.CharacterState == CharacterState.NotActionable ||
+ character.CharacterState == CharacterState.ActionRestricted ||
+ character.CharacterState == CharacterState.BattleRestricted ||
+ character.CharacterState == CharacterState.SkillRestricted)
{
- skill = skills[Random.Shared.Next(skills.Count)];
+ WriteLine($"角色 [ {character} ] 状态为:{CharacterSet.GetCharacterState(character.CharacterState)},无法释放技能!");
}
- if (skill != null)
+ else
{
- // 吟唱前需要先选取目标
- if (skill.SkillType == SkillType.Magic)
+ // 预使用技能,即开始吟唱逻辑
+ Skill? skill = await OnSelectSkillAsync(character, skills);
+ if (skill is null && _charactersInAI.Contains(character) && skills.Count > 0)
{
- List targets = await SelectTargetsAsync(character, skill, enemys, teammates);
- if (targets.Count > 0)
- {
- // 免疫检定
- await CheckSkilledImmuneAsync(character, targets, skill);
-
- if (targets.Count > 0)
- {
- LastRound.Targets = [.. targets];
- decided = true;
-
- character.CharacterState = CharacterState.Casting;
- SkillTarget skillTarget = new(skill, targets);
- await OnCharacterPreCastSkillAsync(character, skillTarget);
-
- _castingSkills[character] = skillTarget;
- baseTime = skill.RealCastTime;
- skill.OnSkillCasting(this, character, targets);
- }
- }
+ skill = skills[Random.Shared.Next(skills.Count)];
}
- else
+ if (skill != null)
{
- // 只有魔法需要吟唱,战技和爆发技直接释放
- if (CheckCanCast(character, skill, out double cost))
+ // 吟唱前需要先选取目标
+ if (skill.SkillType == SkillType.Magic)
{
List targets = await SelectTargetsAsync(character, skill, enemys, teammates);
if (targets.Count > 0)
@@ -969,32 +952,59 @@ namespace Milimoe.FunGame.Core.Model
LastRound.Targets = [.. targets];
decided = true;
+ character.CharacterState = CharacterState.Casting;
SkillTarget skillTarget = new(skill, targets);
await OnCharacterPreCastSkillAsync(character, skillTarget);
+ _castingSkills[character] = skillTarget;
+ baseTime = skill.RealCastTime;
skill.OnSkillCasting(this, character, targets);
- skill.BeforeSkillCasted();
+ }
+ }
+ }
+ else
+ {
+ // 只有魔法需要吟唱,战技和爆发技直接释放
+ if (CheckCanCast(character, skill, out double cost))
+ {
+ List targets = await SelectTargetsAsync(character, skill, enemys, teammates);
+ if (targets.Count > 0)
+ {
+ // 免疫检定
+ await CheckSkilledImmuneAsync(character, targets, skill);
- character.EP -= cost;
- baseTime = skill.RealHardnessTime;
- skill.CurrentCD = skill.RealCD;
- skill.Enable = false;
- LastRound.SkillCost = $"{-cost:0.##} EP";
- WriteLine($"[ {character} ] 消耗了 {cost:0.##} 点能量,释放了{(skill.IsSuperSkill ? "爆发技" : "战技")} [ {skill.Name} ]!{(skill.Slogan != "" ? skill.Slogan : "")}");
-
- await OnCharacterCastSkillAsync(character, skillTarget, cost);
-
- skill.OnSkillCasted(this, character, targets);
- effects = [.. character.Effects.Where(e => e.IsInEffect)];
- foreach (Effect effect in effects)
+ if (targets.Count > 0)
{
- effect.AlterHardnessTimeAfterCastSkill(character, skill, ref baseTime, ref isCheckProtected);
+ LastRound.Targets = [.. targets];
+ decided = true;
+
+ SkillTarget skillTarget = new(skill, targets);
+ await OnCharacterPreCastSkillAsync(character, skillTarget);
+
+ skill.OnSkillCasting(this, character, targets);
+ skill.BeforeSkillCasted();
+
+ character.EP -= cost;
+ baseTime = skill.RealHardnessTime;
+ skill.CurrentCD = skill.RealCD;
+ skill.Enable = false;
+ LastRound.SkillCost = $"{-cost:0.##} EP";
+ WriteLine($"[ {character} ] 消耗了 {cost:0.##} 点能量,释放了{(skill.IsSuperSkill ? "爆发技" : "战技")} [ {skill.Name} ]!{(skill.Slogan != "" ? skill.Slogan : "")}");
+
+ await OnCharacterCastSkillAsync(character, skillTarget, cost);
+
+ skill.OnSkillCasted(this, character, targets);
+ effects = [.. character.Effects.Where(e => e.IsInEffect)];
+ foreach (Effect effect in effects)
+ {
+ effect.AlterHardnessTimeAfterCastSkill(character, skill, ref baseTime, ref isCheckProtected);
+ }
}
}
}
}
+ LastRound.Skill = skill;
}
- LastRound.Skill = skill;
}
}
else if (type == CharacterActionType.CastSkill)
@@ -1128,6 +1138,13 @@ namespace Milimoe.FunGame.Core.Model
else if (type == CharacterActionType.EndTurn)
{
baseTime = 3;
+ if (character.CharacterState == CharacterState.NotActionable ||
+ character.CharacterState == CharacterState.ActionRestricted ||
+ character.CharacterState == CharacterState.BattleRestricted)
+ {
+ baseTime += 5;
+ WriteLine($"角色 [ {character} ] 状态为:{CharacterSet.GetCharacterState(character.CharacterState)},放弃行动将额外获得 5 {GameplayEquilibriumConstant.InGameTime}硬直时间!");
+ }
decided = true;
WriteLine($"[ {character} ] 结束了回合!");
await OnCharacterDoNothingAsync(character);
diff --git a/Model/RecurringTask.cs b/Model/RecurringTask.cs
index 61ab15d..de08ff8 100644
--- a/Model/RecurringTask.cs
+++ b/Model/RecurringTask.cs
@@ -1,6 +1,6 @@
namespace Milimoe.FunGame.Core.Model
{
- public class RecurringTask(string name, TimeSpan interval, Action action)
+ public class RecurringTask(string name, TimeSpan interval, Action action, Action? error = null)
{
///
/// 任务名称
@@ -31,5 +31,10 @@
/// 最后一次运行时发生的错误
///
public Exception? Error { get; set; }
+
+ ///
+ /// 捕获异常后,触发的回调函数
+ ///
+ public Action? ErrorHandler { get; set; } = error;
}
}
diff --git a/Model/ScheduledTask.cs b/Model/ScheduledTask.cs
index 880e994..0aea74c 100644
--- a/Model/ScheduledTask.cs
+++ b/Model/ScheduledTask.cs
@@ -1,6 +1,6 @@
namespace Milimoe.FunGame.Core.Model
{
- public class ScheduledTask(string name, TimeSpan timeSpan, Action action)
+ public class ScheduledTask(string name, TimeSpan timeSpan, Action action, Action? error = null)
{
///
/// 任务名称
@@ -31,5 +31,10 @@
/// 最后一次运行时发生的错误
///
public Exception? Error { get; set; }
+
+ ///
+ /// 捕获异常后,触发的回调函数
+ ///
+ public Action? ErrorHandler { get; set; } = error;
}
}