修复问题和添加测试

This commit is contained in:
milimoe 2026-01-24 04:42:16 +08:00
parent 3e2f753499
commit d99bf28600
Signed by: milimoe
GPG Key ID: 9554D37E4B8991D0
5 changed files with 15 additions and 10 deletions

View File

@ -56,7 +56,10 @@ namespace Oshima.FunGame.OshimaModules.Effects.PassiveEffects
forceAction = true;
if (_targetCharacter.HP > 0)
{
return CharacterActionType.NormalAttack;
pNormalAttack = 1;
canUseItem = false;
canCastSkill = false;
return CharacterActionType.None;
}
// 如果目标已死亡,则放弃本回合行动,并在回合结束后自动移除愤怒状态
RemainDuration = 0;

View File

@ -125,7 +125,8 @@ namespace Oshima.FunGame.OshimaModules.Skills
{ "熵核", },
{ "守护", }
},
DefaultChoice = Random.Shared.Next() % 2 == 0 ? "熵核" : "守护"
DefaultChoice = Random.Shared.Next() % 2 == 0 ? "熵核" : "守护",
CanCancel = false
});
if (response.Choices.Count > 0)
{

View File

@ -1,3 +1,4 @@
using System.Collections.Concurrent;
using System.Text;
using Milimoe.FunGame.Core.Api.Transmittal;
using Milimoe.FunGame.Core.Api.Utility;
@ -18,15 +19,15 @@ namespace Oshima.FunGame.OshimaServers.Service
{
public class FunGameService
{
public static Dictionary<long, List<string>> UserExploreCharacterCache { get; } = [];
public static Dictionary<long, List<string>> UserExploreItemCache { get; } = [];
public static Dictionary<long, List<string>> UserExploreEventCache { get; } = [];
public static ConcurrentDictionary<long, List<string>> UserExploreCharacterCache { get; } = [];
public static ConcurrentDictionary<long, List<string>> UserExploreItemCache { get; } = [];
public static ConcurrentDictionary<long, List<string>> UserExploreEventCache { get; } = [];
public static HashSet<Activity> Activities { get; } = [];
public static List<string> ActivitiesCharacterCache { get; } = [];
public static List<string> ActivitiesItemCache { get; } = [];
public static List<string> ActivitiesEventCache { get; } = [];
public static Dictionary<long, HashSet<string>> UserNotice { get; } = [];
public static Dictionary<int, Character> Bosses { get; } = [];
public static ConcurrentDictionary<long, HashSet<string>> UserNotice { get; } = [];
public static ConcurrentDictionary<int, Character> Bosses { get; } = [];
public static ServerPluginLoader? ServerPluginLoader { get; set; } = null;
public static WebAPIPluginLoader? WebAPIPluginLoader { get; set; } = null;
public static EntityModuleConfig<NoticeModel> Notices { get; } = new("notices", "notice");

View File

@ -4131,7 +4131,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
if (boss2.HP <= 0)
{
FunGameService.Bosses.Remove(bossIndex);
FunGameService.Bosses.Remove(bossIndex, out _);
double gained = boss.Level;
user.Inventory.Materials += gained;
msgs.Add($"恭喜你击败了 Boss获得 {gained:0.##} {General.GameplayEquilibriumConstant.InGameMaterial}奖励!");
@ -4401,7 +4401,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
if (boss2.HP <= 0)
{
FunGameService.Bosses.Remove(bossIndex);
FunGameService.Bosses.Remove(bossIndex, out _);
double gained = boss.Level;
user.Inventory.Materials += gained;
msgs.Add($"恭喜你击败了 Boss获得 {gained:0.##} {General.GameplayEquilibriumConstant.InGameMaterial}奖励!");

View File

@ -47,7 +47,7 @@ namespace Oshima.FunGame.WebAPI.Services
}
if (msg.UseNotice && msg.FunGameUID > 0 && FunGameService.UserNotice.TryGetValue(msg.FunGameUID, out HashSet<string>? msgs) && msgs != null)
{
FunGameService.UserNotice.Remove(msg.FunGameUID);
FunGameService.UserNotice.Remove(msg.FunGameUID, out _);
await SendAsync(msg, "离线未读信箱", $"☆--- 离线未读信箱 ---☆\r\n{string.Join("\r\n", msgs)}", msgType, null, 5);
}
}