diff --git a/OshimaModules/Skills/战技/疾风步.cs b/OshimaModules/Skills/战技/疾风步.cs index 785ec0a..9528d69 100644 --- a/OshimaModules/Skills/战技/疾风步.cs +++ b/OshimaModules/Skills/战技/疾风步.cs @@ -57,7 +57,7 @@ namespace Oshima.FunGame.OshimaModules.Skills public override double AlterActualDamageAfterCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult, ref bool isEvaded, Dictionary totalDamageBonus) { - if (character == Skill.Character && 首次伤害) + if (character == Skill.Character && damageResult != DamageResult.Evaded && 首次伤害) { 首次伤害 = false; 破隐一击 = true; diff --git a/OshimaServers/Service/FunGameActionQueue.cs b/OshimaServers/Service/FunGameActionQueue.cs index a941b62..e7f8738 100644 --- a/OshimaServers/Service/FunGameActionQueue.cs +++ b/OshimaServers/Service/FunGameActionQueue.cs @@ -49,7 +49,18 @@ namespace Oshima.FunGame.OshimaServers.Service int maxRound = 999; // 随机回合奖励 - Dictionary> roundRewards = FunGameService.GenerateRoundRewards(maxRound); + Dictionary effects = []; + foreach (EffectID id in FunGameConstant.RoundRewards.Keys) + { + long effectID = (long)id; + bool isActive = false; + if (effectID > (long)EffectID.Active_Start) + { + isActive = true; + } + effects.Add(effectID, isActive); + } + actionQueue.InitRoundRewards(maxRound, 1, effects, id => FunGameConstant.RoundRewards[(EffectID)id]); int i = 1; while (i < maxRound) @@ -82,67 +93,11 @@ namespace Oshima.FunGame.OshimaServers.Service // 处理回合 if (characterToAct != null) { - // 获取回合奖励 - List skillRewards = []; - if (roundRewards.TryGetValue(i, out List? effectList) && effectList != null) - { - skillRewards = [.. effectList]; - } - WriteLine($"=== Round {i++} ==="); WriteLine($"现在是 [ {characterToAct} ] 的回合!"); - // 实际的回合奖励 - List realSkillRewards = []; - if (skillRewards.Count > 0) - { - foreach (Skill skill in skillRewards) - { - Dictionary effectArgs = []; - if (FunGameConstant.RoundRewards.TryGetValue((EffectID)skill.Id, out Dictionary? dict) && dict != null) - { - effectArgs = new(dict); - } - Dictionary args = new() - { - { "skill", skill }, - { "values", effectArgs } - }; - skill.GamingQueue = actionQueue; - skill.Effects.Add(Factory.OpenFactory.GetInstance(skill.Id, "", args)); - skill.Character = characterToAct; - skill.Level = 1; - actionQueue.LastRound.RoundRewards.Add(skill); - WriteLine($"[ {characterToAct} ] 获得了回合奖励!{skill.Description}".Trim()); - if (skill.IsActive) - { - actionQueue.LastRound.Targets.Add(characterToAct); - skill.OnSkillCasted(actionQueue, characterToAct, [characterToAct]); - } - else - { - characterToAct.Skills.Add(skill); - realSkillRewards.Add(skill); - } - } - } - bool isGameEnd = await actionQueue.ProcessTurnAsync(characterToAct); - if (realSkillRewards.Count > 0) - { - foreach (Skill skill in realSkillRewards) - { - foreach (Effect e in skill.Effects) - { - e.OnEffectLost(characterToAct); - characterToAct.Effects.Remove(e); - } - characterToAct.Skills.Remove(skill); - skill.Character = null; - } - } - if (isGameEnd) { Result.Add(_msg); @@ -308,7 +263,18 @@ namespace Oshima.FunGame.OshimaServers.Service int maxRound = 9999; // 随机回合奖励 - Dictionary> roundRewards = FunGameService.GenerateRoundRewards(maxRound); + Dictionary effects = []; + foreach (EffectID id in FunGameConstant.RoundRewards.Keys) + { + long effectID = (long)id; + bool isActive = false; + if (effectID > (long)EffectID.Active_Start) + { + isActive = true; + } + effects.Add(effectID, isActive); + } + actionQueue.InitRoundRewards(maxRound, 1, effects, id => FunGameConstant.RoundRewards[(EffectID)id]); int i = 1; while (i < maxRound) @@ -326,67 +292,11 @@ namespace Oshima.FunGame.OshimaServers.Service // 处理回合 if (characterToAct != null) { - // 获取回合奖励 - List skillRewards = []; - if (roundRewards.TryGetValue(i, out List? effectList) && effectList != null) - { - skillRewards = [.. effectList]; - } - WriteLine($"=== Round {i++} ==="); WriteLine("现在是 [ " + characterToAct + "(" + (actionQueue.GetTeam(characterToAct)?.Name ?? "") + ")" + " ] 的回合!"); - // 实际的回合奖励 - List realSkillRewards = []; - if (skillRewards.Count > 0) - { - foreach (Skill skill in skillRewards) - { - Dictionary effectArgs = []; - if (FunGameConstant.RoundRewards.TryGetValue((EffectID)skill.Id, out Dictionary? dict) && dict != null) - { - effectArgs = new(dict); - } - Dictionary args = new() - { - { "skill", skill }, - { "values", effectArgs } - }; - skill.GamingQueue = actionQueue; - skill.Effects.Add(Factory.OpenFactory.GetInstance(skill.Id, "", args)); - skill.Character = characterToAct; - skill.Level = 1; - actionQueue.LastRound.RoundRewards.Add(skill); - WriteLine($"[ {characterToAct} ] 获得了回合奖励!{skill.Description}".Trim()); - if (skill.IsActive) - { - actionQueue.LastRound.Targets.Add(characterToAct); - skill.OnSkillCasted(actionQueue, characterToAct, [characterToAct]); - } - else - { - characterToAct.Skills.Add(skill); - realSkillRewards.Add(skill); - } - } - } - bool isGameEnd = await actionQueue.ProcessTurnAsync(characterToAct); - if (realSkillRewards.Count > 0) - { - foreach (Skill skill in realSkillRewards) - { - foreach (Effect e in skill.Effects) - { - e.OnEffectLost(characterToAct); - characterToAct.Effects.Remove(e); - } - characterToAct.Skills.Remove(skill); - skill.Character = null; - } - } - if (isGameEnd) { Result.Add(_msg); diff --git a/OshimaServers/Service/FunGameConstant.cs b/OshimaServers/Service/FunGameConstant.cs index 8d2bac3..864a1cc 100644 --- a/OshimaServers/Service/FunGameConstant.cs +++ b/OshimaServers/Service/FunGameConstant.cs @@ -221,7 +221,7 @@ namespace Oshima.FunGame.OshimaServers.Service } }; - public static Dictionary> RoundRewards { get; } = new() + public static Dictionary> RoundRewards => new() { { EffectID.ExATK, diff --git a/OshimaServers/Service/FunGameSimulation.cs b/OshimaServers/Service/FunGameSimulation.cs index 5308bb9..b8f8cc1 100644 --- a/OshimaServers/Service/FunGameSimulation.cs +++ b/OshimaServers/Service/FunGameSimulation.cs @@ -213,7 +213,18 @@ namespace Oshima.FunGame.OshimaServers.Service int maxRound = isTeam ? 9999 : 999; // 随机回合奖励 - Dictionary> roundRewards = FunGameService.GenerateRoundRewards(maxRound); + Dictionary effects = []; + foreach (EffectID id in FunGameConstant.RoundRewards.Keys) + { + long effectID = (long)id; + bool isActive = false; + if (effectID > (long)EffectID.Active_Start) + { + isActive = true; + } + effects.Add(effectID, isActive); + } + actionQueue.InitRoundRewards(maxRound, 1, effects, id => FunGameConstant.RoundRewards[(EffectID)id]); int i = 1; while (i < maxRound) @@ -254,67 +265,11 @@ namespace Oshima.FunGame.OshimaServers.Service // 处理回合 if (characterToAct != null) { - // 获取回合奖励 - List skillRewards = []; - if (roundRewards.TryGetValue(i, out List? effectList) && effectList != null) - { - skillRewards = [.. effectList]; - } - WriteLine($"=== Round {i++} ==="); WriteLine("现在是 [ " + characterToAct + (isTeam ? "(" + (actionQueue.GetTeam(characterToAct)?.Name ?? "") + ")" : "") + " ] 的回合!"); - // 实际的回合奖励 - List realSkillRewards = []; - if (skillRewards.Count > 0) - { - foreach (Skill skill in skillRewards) - { - Dictionary effectArgs = []; - if (FunGameConstant.RoundRewards.TryGetValue((EffectID)skill.Id, out Dictionary? dict) && dict != null) - { - effectArgs = new(dict); - } - Dictionary args = new() - { - { "skill", skill }, - { "values", effectArgs } - }; - skill.GamingQueue = actionQueue; - skill.Effects.Add(Factory.OpenFactory.GetInstance(skill.Id, "", args)); - skill.Character = characterToAct; - skill.Level = 1; - actionQueue.LastRound.RoundRewards.Add(skill); - WriteLine($"[ {characterToAct} ] 获得了回合奖励!{skill.Description}".Trim()); - if (skill.IsActive) - { - actionQueue.LastRound.Targets.Add(characterToAct); - skill.OnSkillCasted(actionQueue, characterToAct, [characterToAct]); - } - else - { - characterToAct.Skills.Add(skill); - realSkillRewards.Add(skill); - } - } - } - bool isGameEnd = await actionQueue.ProcessTurnAsync(characterToAct); - if (realSkillRewards.Count > 0) - { - foreach (Skill skill in realSkillRewards) - { - foreach (Effect e in skill.Effects) - { - e.OnEffectLost(characterToAct); - characterToAct.Effects.Remove(e); - } - characterToAct.Skills.Remove(skill); - skill.Character = null; - } - } - if (isGameEnd) { result.Add(Msg);