public Player(PlayerSide _side, ChoiceHandler _choiceHandler, Game _game) { game = _game; Side = _side; ChoiceHandler = _choiceHandler; SummationDeck = new SummationDeckHolder(); Hand = new HandHolder(); PerformedMulligan = false; }
public bool PlayAsAction(Game game, Player choosingPlayer, ChoiceHandler choiceHandler) { bool isSummation = game.CurState.StateType == GameState.GameStateType.Summation; int modValue = (choosingPlayer.Side == Player.PlayerSide.Prosecution) ? 1 : -1; List <BoardObject> choices = game.FindBO( (BoardObject bo) => { return((bo.Properties.Contains(Property.Track) && ((bo.Properties.Contains(Property.Jury) && bo.Properties.Contains(Property.Sway)) || (!isSummation && bo.Properties.Contains(Property.Aspect)))) && ((Track)bo).CanModifyByAction(modValue)); }).ToList(); int actionPtsForState = isSummation ? 2 : Template.ActionPts; BoardChoices boardChoices; choiceHandler.ChooseBoardObjects(choices, HTUtility.GenActionValidateChoicesFunc(actionPtsForState, null), HTUtility.GenActionFilterChoicesFunc(actionPtsForState, null), HTUtility.GenActionChoicesCompleteFunc(actionPtsForState, null), game, choosingPlayer, "Select usage for " + actionPtsForState + " action points", out boardChoices); if (boardChoices.NotCancelled) { string str = ""; foreach (BoardObject bo in boardChoices.SelectedObjs.Keys) { str += bo + " modified by " + modValue * boardChoices.SelectedObjs[bo] + "\n"; if (bo.GetType() == typeof(AspectTrack)) { ((AspectTrack)bo).ModTrackByAction(modValue * boardChoices.SelectedObjs[bo]); } else { ((Track)bo).AddToValue(modValue * boardChoices.SelectedObjs[bo]); } } FileLogger.Instance.Log(str); } return(boardChoices.NotCancelled); }
public bool PlayAsEvent(Game game, Player choosingPlayer, int idx, ChoiceHandler choiceHandler) { GameState.GameStateType curStateType = game.CurState.StateType; CardTemplate.CardChoice cardChoice = null; CardTemplate.CardEffect cardEffect = null; if (curStateType == GameState.GameStateType.JurySelection) { cardChoice = Template.SelectionEvents[idx].CardChoice; cardEffect = Template.SelectionEvents[idx].CardEffect; } else if (curStateType == GameState.GameStateType.TrialInChief) { cardChoice = Template.TrialEvents[idx].CardChoice; cardEffect = Template.TrialEvents[idx].CardEffect; } else if (curStateType == GameState.GameStateType.Summation) { cardChoice = Template.SummationEvents[idx].CardChoice; cardEffect = Template.SummationEvents[idx].CardEffect; } System.Diagnostics.Debug.Assert(cardChoice != null && cardEffect != null, "Card choice or card effect is null. Should never happen"); BoardChoices choices = cardChoice(game, choosingPlayer, choiceHandler); if (choices.NotCancelled) { FileLogger.Instance.Log(choices.ToStringForEvent()); cardEffect(game, choosingPlayer, choices); } return(choices.NotCancelled); }
protected bool handleMomentOfInsightChoice(Player.PlayerSide[] supportedSides, Game game, Player choosingPlayer, ChoiceHandler choiceHandler, out BoardChoices.MomentOfInsightInfo moiInfo) { moiInfo = new BoardChoices.MomentOfInsightInfo(); if (!supportedSides.Contains(choosingPlayer.Side)) { moiInfo.Use = BoardChoices.MomentOfInsightInfo.MomentOfInsightUse.NotChosen; return(true); } return(choiceHandler.ChooseMomentOfInsightUse(game, choosingPlayer, out moiInfo)); }
protected BoardChoices doNothingChoice(Game game, Player choosingPlayer, ChoiceHandler choiceHandler) { BoardChoices choices = new BoardChoices(); return(choices); }