private void EachPlayerCollectsResources() { var infos = new List <CollectingResourceInfo>(); foreach (var player in Game.Players) { foreach (var resourceful in player.CardsInPlay.OfType <ICharacterInPlay>().Where(x => x.Card is IResourcefulCard)) { var state = new CollectingResources(Game, resourceful, 1); var effect = new CollectingResourcesEffect(Game, state); infos.Add(new CollectingResourceInfo(effect, state)); } } foreach (var player in Game.Players) { foreach (var card in player.CardsInPlay.Where(x => x.HasEffect <IDuringCollectingResources>())) { foreach (var duringCollectingResourcesEffect in card.BaseCard.Text.Effects.OfType <IDuringCollectingResources>()) { foreach (var info in infos) { duringCollectingResourcesEffect.DuringCollectingResource(info.State); } } } } foreach (var info in infos) { var handle = info.Effect.GetHandle(Game); Game.AddEffect(info.Effect); Game.TriggerEffect(handle); } }
private void EachPlayerCollectsResources() { var infos = new List<CollectingResourceInfo>(); foreach (var player in Game.Players) { foreach (var resourceful in player.CardsInPlay.OfType<ICharacterInPlay>().Where(x => x.Card is IResourcefulCard)) { var state = new CollectingResources(Game, resourceful, 1); var effect = new CollectingResourcesEffect(Game, state); infos.Add(new CollectingResourceInfo(effect, state)); } } foreach (var player in Game.Players) { foreach (var card in player.CardsInPlay.Where(x => x.HasEffect<IDuringCollectingResources>())) { foreach (var duringCollectingResourcesEffect in card.BaseCard.Text.Effects.OfType<IDuringCollectingResources>()) { foreach (var info in infos) { duringCollectingResourcesEffect.DuringCollectingResource(info.State); } } } } foreach (var info in infos) { var handle = info.Effect.GetHandle(Game); Game.AddEffect(info.Effect); Game.TriggerEffect(handle); } }
public CollectingResourceInfo(CollectingResourcesEffect effect, CollectingResources state) { this.effect = effect; this.state = state; }