Ejemplo n.º 1
0
        protected CardEffectPair genAttorneyTrialAddSwayEffectPair(int infoIdx)
        {
            return(new CardEffectPair(
                       (Game game, Player choosingPlayer, ChoiceHandler choiceHandler) =>
            {
                List <BoardObject> bos = game.FindBO(
                    (BoardObject bo) =>
                {
                    return
                    bo.Properties.Contains(Property.Sway) &&
                    bo.Properties.Contains(Property.Track) &&
                    bo.Properties.Contains(Property.Jury);
                });

                BoardChoices boardChoices;
                choiceHandler.ChooseBoardObjects(
                    bos,
                    (Dictionary <BoardObject, int> selected) =>
                {
                    int actionPtsLeft = ActionPts - HTUtility.CalcActionPtUsage(selected);
                    return (actionPtsLeft >= 0);
                },
                    (List <BoardObject> choicesLeft, Dictionary <BoardObject, int> selected) =>
                {
                    return choicesLeft.FindAll(t =>
                                               (choosingPlayer.Side == Player.PlayerSide.Prosecution) ? !((SwayTrack)t).IsLockedByProsecution : !((SwayTrack)t).IsLockedByDefense);
                },
                    (Dictionary <BoardObject, int> selected) =>
                {
                    int actionPtsLeft = ActionPts - HTUtility.CalcActionPtUsage(selected);
                    return (actionPtsLeft == 0);
                },
                    game,
                    choosingPlayer,
                    this.CardInfo.TrialInChiefInfos[infoIdx].Description,
                    out boardChoices);

                return boardChoices;
            },
                       (Game game, Player choosingPlayer, BoardChoices boardChoices) =>
            {
                int sideMod = (choosingPlayer.Side == Player.PlayerSide.Prosecution) ? 1 : -1;
                foreach (KeyValuePair <BoardObject, int> kv in boardChoices.SelectedObjs)
                {
                    SwayTrack track = (SwayTrack)kv.Key;
                    track.AddToValue(sideMod * kv.Value);
                }
            }));
        }
Ejemplo n.º 2
0
        protected CardEffectPair genAttorneySummationClearSwayEffectPair(int infoIdx)
        {
            return(new CardEffectPair(
                       (Game game, Player choosingPlayer, ChoiceHandler choiceHandler) =>
            {
                List <BoardObject> bos = game.FindBO(
                    (BoardObject bo) =>
                {
                    return bo.Properties.Contains(Property.Sway) &&
                    bo.Properties.Contains(Property.Track) &&
                    bo.Properties.Contains(Property.Jury);
                });

                BoardChoices boardChoices;
                choiceHandler.ChooseBoardObjects(
                    bos,
                    (Dictionary <BoardObject, int> selected) => { return true; },
                    (List <BoardObject> choicesLeft, Dictionary <BoardObject, int> selected) => { return choicesLeft; },
                    (Dictionary <BoardObject, int> selected) =>
                {
                    return selected.Count == 1;
                },
                    game,
                    choosingPlayer,
                    this.CardInfo.SummationInfos[infoIdx].Description,
                    out boardChoices);

                return boardChoices;
            },
                       (Game game, Player choosingPlayer, BoardChoices boardChoices) =>
            {
                SwayTrack track = (SwayTrack)boardChoices.SelectedObjs.Keys.First();
                track.ResetValue();
                track.AddToValue((choosingPlayer.Side == Player.PlayerSide.Prosecution) ? 1 : -1);
            }));
        }