Exemplo n.º 1
0
    public bool action_playable(EventArgs args)
    {
        //Debug.Log(action_criteria + " "+ get_name());
        if (has_action && action_criteria != null)
        {
            GameArgs game_args     = (GameArgs)args;
            Card     relevant_card = this;
            LOTRGame game          = game_args.g;
            bool     playable      = true;
            foreach (var criteria in action_criteria)
            {
                playable = playable && criteria(game_args, relevant_card);
            }
            if (playable && game.is_allowing_actions())
            {
                //Debug.Log(get_name() + " IS ACTION PLAYABLE");
                return(true);
            }
            else
            {
                // Debug.Log("NO(T PLAYABLE");
            }
        }

        return(false);
    }
Exemplo n.º 2
0
 public GameArgs(Card c       = null, int?i = null, Action a = null, LOTRGame game = null,
                 LOTRPlayer p = null, bool?attack_undefended = null, Card secondary_card = null)
 {
     relevant_card = c;
     relevant_int  = i;
     what_to_do_after_event_or_if_no_response = a;
     g = game;
     relevant_player        = p;
     this.attack_undefended = attack_undefended;
     this.secondary_card    = secondary_card;
 }
Exemplo n.º 3
0
    public static LocationCard GREAT_FOREST_WEB()
    {
        LocationCard the_card = new LocationCard("Great Forest Web",
                                                 2, 2, "Travel: Each player must exhaust 1 hero he controls to travel here."
                                                 , "SPIDER", new List <LOTRGame.TRAITS>()
        {
            LOTRGame.TRAITS.FOREST
        }, "");
        Func <GameArgs, bool> criteria = (GameArgs args) =>
        {
            LOTRGame game = args.g;
            foreach (var player in game.get_players())
            {
                bool has_ready_character = false;
                foreach (var card in player.get_heroes())
                {
                    if (!card.is_exhausted())
                    {
                        has_ready_character = true;
                        break;
                    }
                }

                if (!has_ready_character)
                {
                    foreach (var card in player.get_allies())
                    {
                        if (!card.is_exhausted())
                        {
                            has_ready_character = true;
                            break;
                        }
                    }
                }

                if (!has_ready_character)
                {
                    return(false);
                }
            }
            return(true);
        };

        the_card.set_travel_criteria(criteria);
        List <Func <EventArgs, Card, bool> > card_played_criteria = new List <Func <EventArgs, Card, bool> >()
        {
            CardEnablers.card_is_me
        };

        the_card.respond_to_event(GameEvent.LOCATION_TRAVELED,
                                  PlayerCardResponses.action_maker(card_played_criteria, EnemyCardResponses.great_forest_web, the_card, valid_targets: CardEnablers.valid_targets_player_characters_ready));
        return(the_card);
    }
Exemplo n.º 4
0
 public LOTRGameEventHandler(LOTRGame game)
 {
     this.game      = game;
     events_to_fire = new List <GameEventBundle>();
 }
Exemplo n.º 5
0
 public static void set_game(LOTRGame g)
 {
     game = g;
 }