public void TakeAction(IScopaPlayer player, ScopaEventHandler eventHandler) { if (player.IsPly) { PopulateActions(); Card selectedCard = player.SelectCard(); List <Card> selectedTrick = player.SelectTrick(selectedCard); CardActions actions = possibleActions[selectedCard]; if (actions.IsThrowable) { if (selectedTrick.Count == 0) { if (ThrowCard(selectedCard)) { eventHandler.CardThrown(selectedCard); } else { eventHandler.UnableToThrow(selectedCard); } } else { eventHandler.MustThrowCard(selectedCard); } } else { if (selectedTrick.Count > 0) { bool scopa; if (TakeTrick(selectedCard, selectedTrick, out scopa)) { eventHandler.TrickTaken(selectedCard, selectedTrick); } else { eventHandler.UnableToTakeTrick(selectedCard, selectedTrick); } if (scopa) { eventHandler.Scopa(selectedCard, selectedTrick); } } else { eventHandler.MustTakeTrick(selectedCard); } } } }
public void TakeAction(ScopaEventHandler eventHandler) { TakeAction(Current, eventHandler); }