Fix cult win conditions
This commit is contained in:
@@ -130,6 +130,7 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
|
|||||||
|
|
||||||
while (querry.MoveNext(out _, out var cultRuleComponent, out _))
|
while (querry.MoveNext(out _, out var cultRuleComponent, out _))
|
||||||
{
|
{
|
||||||
|
var cultists = 0;
|
||||||
foreach (var cultistComponent in cultRuleComponent.Cultists)
|
foreach (var cultistComponent in cultRuleComponent.Cultists)
|
||||||
{
|
{
|
||||||
var owner = cultistComponent.Owner;
|
var owner = cultistComponent.Owner;
|
||||||
@@ -138,9 +139,14 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
|
|||||||
|
|
||||||
if (_mobStateSystem.IsAlive(owner, mobState))
|
if (_mobStateSystem.IsAlive(owner, mobState))
|
||||||
{
|
{
|
||||||
aliveCultistsCount++;
|
cultists++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cultists == 0)
|
||||||
|
cultRuleComponent.WinCondition = CultWinCondition.CultFailure;
|
||||||
|
|
||||||
|
aliveCultistsCount += cultists;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aliveCultistsCount == 0)
|
if (aliveCultistsCount == 0)
|
||||||
@@ -470,6 +476,13 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
|
|||||||
|
|
||||||
private void OnNarsieSummon(CultNarsieSummoned ev)
|
private void OnNarsieSummon(CultNarsieSummoned ev)
|
||||||
{
|
{
|
||||||
|
foreach (var rule in EntityQuery<CultRuleComponent>())
|
||||||
|
{
|
||||||
|
rule.WinCondition = CultWinCondition.CultWin;
|
||||||
|
}
|
||||||
|
|
||||||
|
_roundEndSystem.EndRound();
|
||||||
|
|
||||||
var query = EntityQuery<MobStateComponent, MindContainerComponent, CultistComponent>().ToList();
|
var query = EntityQuery<MobStateComponent, MindContainerComponent, CultistComponent>().ToList();
|
||||||
|
|
||||||
foreach (var (mobState, mindContainer, _) in query)
|
foreach (var (mobState, mindContainer, _) in query)
|
||||||
@@ -484,7 +497,5 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
|
|||||||
|
|
||||||
_bodySystem.GibBody(mobState.Owner);
|
_bodySystem.GibBody(mobState.Owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
_roundEndSystem.EndRound();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user