mirror of
https://github.com/OatmealDome/Rotationator.git
synced 2026-04-24 23:26:55 -05:00
Program: Fix an issue where PickGachiRule can end up in a state where no rules in the pool are valid
This commit is contained in:
parent
8a34971659
commit
67d6a7c545
|
|
@ -357,7 +357,7 @@ VersusRule PickGachiRule(GambitStageInfo stageInfo, GambitStageInfo lastStageInf
|
|||
pool.AddRange(defaultGachiRulePool);
|
||||
}
|
||||
|
||||
return GetRandomElementFromPool(pool, rule =>
|
||||
bool IsRuleValid(VersusRule rule)
|
||||
{
|
||||
if (nextPhaseOverride != null)
|
||||
{
|
||||
|
|
@ -366,9 +366,26 @@ VersusRule PickGachiRule(GambitStageInfo stageInfo, GambitStageInfo lastStageInf
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return rule != lastStageInfo.Rule;
|
||||
}, random);
|
||||
}
|
||||
|
||||
if (pool.All(r => !IsRuleValid(r)))
|
||||
{
|
||||
List<VersusRule> forbiddenRules = new List<VersusRule>()
|
||||
{
|
||||
lastStageInfo.Rule
|
||||
};
|
||||
|
||||
if (nextPhaseOverride != null)
|
||||
{
|
||||
forbiddenRules.Add(nextPhaseOverride.GachiRule);
|
||||
}
|
||||
|
||||
pool = defaultGachiRulePool.Except(forbiddenRules).ToList();
|
||||
}
|
||||
|
||||
return GetRandomElementFromPool(pool, IsRuleValid, random);
|
||||
}
|
||||
|
||||
int PickStage(GambitVersusPhase phase, GambitVersusPhase lastPhase, OverridePhase? nextPhaseOverride, VersusRule rule,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user