mirror of
https://github.com/milimoe/FunGame-Testing.git
synced 2025-04-21 11:49:34 +08:00
使用新版随机回合奖励
This commit is contained in:
parent
11fe82ea71
commit
aca9210128
@ -22,8 +22,8 @@ im.Load();
|
|||||||
FunGameService.InitFunGame();
|
FunGameService.InitFunGame();
|
||||||
FunGameSimulation.InitFunGameSimulation();
|
FunGameSimulation.InitFunGameSimulation();
|
||||||
|
|
||||||
List<string> strings = await Milimoe.FunGame.Testing.Tests.FunGameSimulation.StartGame(true, false);
|
await Milimoe.FunGame.Testing.Tests.FunGameSimulation.StartGame(true, false);
|
||||||
strings.ForEach(Console.WriteLine);
|
//strings.ForEach(Console.WriteLine);
|
||||||
|
|
||||||
//_ = new Milimoe.FunGame.Testing.Tests.ActivityExample();
|
//_ = new Milimoe.FunGame.Testing.Tests.ActivityExample();
|
||||||
|
|
||||||
|
@ -99,7 +99,9 @@ namespace Milimoe.FunGame.Testing.Tests
|
|||||||
if (int.TryParse(input, out int id) && characters.FirstOrDefault(c => c.Id == id) is Character c)
|
if (int.TryParse(input, out int id) && characters.FirstOrDefault(c => c.Id == id) is Character c)
|
||||||
{
|
{
|
||||||
player = c;
|
player = c;
|
||||||
Console.WriteLine($"选择了 [ {player} ]!");
|
Console.WriteLine($"选择了 [ {player} ]!\r\n{player.GetInfo()}");
|
||||||
|
Console.WriteLine($"按任意键继续. . .");
|
||||||
|
Console.ReadKey();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,7 +181,18 @@ namespace Milimoe.FunGame.Testing.Tests
|
|||||||
int maxRound = 999;
|
int maxRound = 999;
|
||||||
|
|
||||||
// 随机回合奖励
|
// 随机回合奖励
|
||||||
Dictionary<int, List<Skill>> roundRewards = FunGameService.GenerateRoundRewards(maxRound);
|
Dictionary<long, bool> 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;
|
int i = 1;
|
||||||
while (i < maxRound)
|
while (i < maxRound)
|
||||||
@ -212,67 +225,11 @@ namespace Milimoe.FunGame.Testing.Tests
|
|||||||
// 处理回合
|
// 处理回合
|
||||||
if (characterToAct != null)
|
if (characterToAct != null)
|
||||||
{
|
{
|
||||||
// 获取回合奖励
|
|
||||||
List<Skill> skillRewards = [];
|
|
||||||
if (roundRewards.TryGetValue(i, out List<Skill>? effectList) && effectList != null)
|
|
||||||
{
|
|
||||||
skillRewards = [.. effectList];
|
|
||||||
}
|
|
||||||
|
|
||||||
WriteLine($"=== Round {i++} ===");
|
WriteLine($"=== Round {i++} ===");
|
||||||
WriteLine("现在是 [ " + characterToAct + " ] 的回合!");
|
WriteLine("现在是 [ " + characterToAct + " ] 的回合!");
|
||||||
|
|
||||||
// 实际的回合奖励
|
|
||||||
List<Skill> realSkillRewards = [];
|
|
||||||
if (skillRewards.Count > 0)
|
|
||||||
{
|
|
||||||
foreach (Skill skill in skillRewards)
|
|
||||||
{
|
|
||||||
Dictionary<string, object> effectArgs = [];
|
|
||||||
if (FunGameConstant.RoundRewards.TryGetValue((EffectID)skill.Id, out Dictionary<string, object>? dict) && dict != null)
|
|
||||||
{
|
|
||||||
effectArgs = new(dict);
|
|
||||||
}
|
|
||||||
Dictionary<string, object> args = new()
|
|
||||||
{
|
|
||||||
{ "skill", skill },
|
|
||||||
{ "values", effectArgs }
|
|
||||||
};
|
|
||||||
skill.GamingQueue = actionQueue;
|
|
||||||
skill.Effects.Add(Factory.OpenFactory.GetInstance<Effect>(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);
|
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)
|
if (isGameEnd)
|
||||||
{
|
{
|
||||||
result.Add(Msg);
|
result.Add(Msg);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user