Example #1
0
    public static void longbeard_orc_slayer(EventArgs args)
    {
        GameArgs      game_args          = (GameArgs)args;
        Card          card_to_respond_to = game_args.relevant_card;
        Action <Card> the_action         = (Card enemy) => { game.deal_damage_to_enemy((EnemyCard)enemy, 1); };

        game.wait_for_response(card_to_respond_to: card_to_respond_to,
                               if_yes_with_card: the_action, what_to_do_after_responding: game_args.what_to_do_after_event_or_if_no_response);
    }
Example #2
0
    public static void old_forest_road(EventArgs args)
    {
        GameArgs      game_args          = (GameArgs)args;
        Card          card_to_respond_to = game_args.relevant_card;
        Action <Card> the_action         = (Card character) => { ((PlayerCard)character).ready(); };

        game.wait_for_response(card_to_respond_to: card_to_respond_to,
                               if_yes_with_card: the_action, what_to_do_after_responding: game_args.what_to_do_after_event_or_if_no_response);
    }
Example #3
0
    public static void grim_resolve(EventArgs args)
    {
        GameArgs   game_args  = (GameArgs)args;
        PlayerCard me         = (PlayerCard)game_args.relevant_card;               //TODO: make faramir pick a player, but for now theres only one player
        LOTRPlayer the_player = game_args.relevant_player;
        Action     the_action = () => { the_player.ready_all_exhausted_cards(); }; //TODO: technically just charcter but whatever

        game.execute_action(the_action);
    }
Example #4
0
    public static void snowbourn_scout(EventArgs args)
    {
        GameArgs      game_args          = (GameArgs)args;
        Card          card_to_respond_to = game_args.relevant_card;
        Action <Card> the_action         = (location) => { ((LocationCard)location).add_progress_token(); };

        game.wait_for_response(card_to_respond_to: card_to_respond_to,
                               if_yes_with_card: the_action, what_to_do_after_responding: game_args.what_to_do_after_event_or_if_no_response);
    }
Example #5
0
    public static void son_of_arnor(EventArgs args)
    {
        GameArgs      game_args          = (GameArgs)args;
        Card          card_to_respond_to = game_args.relevant_card;
        Action <Card> the_action         = (Card enemy) => { game.player_engage_enemy(game.get_cur_player(), (EnemyCard)enemy); };

        game.wait_for_response(card_to_respond_to: card_to_respond_to,
                               if_yes_with_card: the_action, what_to_do_after_responding: game_args.what_to_do_after_event_or_if_no_response);
    }
Example #6
0
    public static void theodred(EventArgs args)
    {
        GameArgs      game_args          = (GameArgs)args;
        Card          card_to_respond_to = game_args.relevant_card;
        Action <Card> theodreds_action   = (hero_chosen) => { ((LOTRHero)hero_chosen).add_resource_token(); };

        game.wait_for_response(card_to_respond_to: card_to_respond_to,
                               if_yes_with_card: theodreds_action, what_to_do_after_responding: game_args.what_to_do_after_event_or_if_no_response);
    }
Example #7
0
    public static void forest_gate(EventArgs args)
    {
        GameArgs game_args          = (GameArgs)args;
        Card     card_to_respond_to = game_args.relevant_card;
        Action   the_action         = () => { game.get_cur_player().draw_card(); game.get_cur_player().draw_card(); }; //put me in play

        game.wait_for_response(card_to_respond_to: card_to_respond_to,
                               if_yes: the_action, response_is_yes_no: true, what_to_do_after_responding: game_args.what_to_do_after_event_or_if_no_response);
    }
Example #8
0
    public static EventHandler action_maker(List <Func <EventArgs, Card, bool> > list_of_criteria, Action <EventArgs> do_effect, Card relevant_card, Func <List <Card> > valid_targets = null,
                                            bool fires_on_other_cards = false)
    {
        Action <object, EventArgs> a = (object o, EventArgs args) =>
        {
            GameArgs game_args = (GameArgs)args;
            Card     the_card  = game_args.relevant_card;
            if (relevant_card == the_card || fires_on_other_cards)
            {
                Debug.Log("ITSAME " + relevant_card.get_name());
                bool all_criteria_valid = true;
                foreach (var criteria in list_of_criteria)
                {
                    all_criteria_valid = all_criteria_valid && criteria(game_args, relevant_card);
                }
                Debug.Log(" is all criteria valid? " + all_criteria_valid +
                          " whgat about null targets? " + (valid_targets == null || valid_targets().Count > 0) +
                          " how about the relevant card being me or firing " + (relevant_card == the_card || fires_on_other_cards));

                if (all_criteria_valid && (valid_targets == null || valid_targets().Count > 0) &&
                    (relevant_card == the_card || fires_on_other_cards)) //only card played can be played
                {
                    Debug.Log("I am responding " + relevant_card.get_name());
                    if (fires_on_other_cards)
                    {
                        game_args.secondary_card = relevant_card;
                    }
                    do_effect(game_args);
                    if (valid_targets != null && valid_targets().Count > 0)
                    {
                        game.set_valid_response_target(valid_targets());
                    }
                }
                else
                {
                    Debug.Log("I did not respond " + relevant_card.get_name());
                    if (game_args.what_to_do_after_event_or_if_no_response != null)
                    {
                        Debug.Log("there is a callback" + relevant_card.get_name());
                        //game_args.what_to_do_after_event_or_if_no_response();
                    }
                    else
                    {
                        Debug.Log("WJHY ARE ITHRE NOTHIGN TO DO AFTER");
                    }
                }
            }
            else
            {
                Debug.Log("The card " + the_card.get_name() + " is not me " + relevant_card.get_name() + " so i do not care");
            }
        };
        EventHandler e2 = (object o, EventArgs args) => a(o, args);

        return(e2);
    }
Example #9
0
    public static void shadow_card_test(EventArgs args)
    {
        GameArgs game_args = (GameArgs)args;

        Debug.Log("SOMG SHADOW CARD FOR " + game_args.relevant_card.get_name());
        if (game_args.what_to_do_after_event_or_if_no_response != null)
        {
            game_args.what_to_do_after_event_or_if_no_response();
        }
    }
Example #10
0
    public static void brok_ironfist(EventArgs args)
    {
        GameArgs   game_args          = (GameArgs)args;
        Card       card_to_respond_to = game_args.relevant_card;
        PlayerCard me         = (PlayerCard)game_args.relevant_card;
        Action     the_action = () => { game.get_cur_player().play_card(me); }; //put me in play

        game.wait_for_response(card_to_respond_to: card_to_respond_to,
                               if_yes: the_action, response_is_yes_no: true, what_to_do_after_responding: game_args.what_to_do_after_event_or_if_no_response);
    }
Example #11
0
    public static void prompt_reply_from_hand(EventArgs args)
    {
        GameArgs   game_args          = (GameArgs)args;
        Card       card_to_respond_to = game_args.relevant_card;
        PlayerCard actual_card        = (PlayerCard)game_args.secondary_card;
        Action     the_action         = () => { game.action_played(card: actual_card); };

        game.wait_for_response(card_to_respond_to: card_to_respond_to,
                               if_yes: the_action, response_is_yes_no: true, what_to_do_after_responding: game_args.what_to_do_after_event_or_if_no_response, times_to_respond: 2);
    }
Example #12
0
    public static void ever_vigilant(EventArgs args)
    {
        GameArgs      game_args          = (GameArgs)args;
        Card          card_to_respond_to = game_args.relevant_card;
        PlayerCard    the_card           = (PlayerCard)game_args.relevant_card;
        Action <Card> the_action         = (ally_chosen) => { ((PlayerCard)ally_chosen).ready(); };

        game.wait_for_forced_response(card_to_respond_to: card_to_respond_to,
                                      after_responding_with_card: the_action, what_to_do_after_responding: game_args.what_to_do_after_event_or_if_no_response);
    }
Example #13
0
    public static void forest_spider_forced(EventArgs args)
    {
        GameArgs  game_args  = (GameArgs)args;
        EnemyCard me         = (EnemyCard)game_args.relevant_card;
        Action    the_action = () =>
        {
            me.add_flag(LOTRAbility.ABILITY_FLAGS.FOREST_SPIDER);
        };

        game.execute_action(the_action);
    }
Example #14
0
    public static void chieftan_ufthak_forced(EventArgs args)
    {
        GameArgs  game_args  = (GameArgs)args;
        EnemyCard me         = (EnemyCard)game_args.relevant_card;
        Action    the_action = () =>
        {
            me.add_resource_tokens();
        };

        game.execute_action(the_action);
    }
Example #15
0
    public static void aragorn(EventArgs args)
    {
        GameArgs game_args           = (GameArgs)args;
        Card     card_to_respond_to  = game_args.relevant_card;
        Card     character_committed = game_args.relevant_card;
        LOTRHero aragorn             = (LOTRHero)character_committed;
        Action   aragorns_action     = () => { aragorn.pay_resource(); aragorn.unexhaust(); };

        game.wait_for_response(card_to_respond_to: card_to_respond_to,
                               if_yes: aragorns_action, response_is_yes_no: true, what_to_do_after_responding: game_args.what_to_do_after_event_or_if_no_response);
    }
Example #16
0
    public static void gandalf_reduce_threat(EventArgs args)
    {
        GameArgs   game_args  = (GameArgs)args;
        LOTRPlayer player     = game_args.relevant_player;
        Action     the_action = () =>
        {
            player.increase_threat(-5);
        };

        game.execute_action(the_action);
    }
Example #17
0
    public void fire_game_event(object key, GameArgs args)
    {
        Debug.Log("FIRIGN " + GameEvent.EVENT_DICT[key]);

        EventHandler e =
            (EventHandler)GameEvent.listEventDelegates[key];
        GameEventBundle this_bundle = new GameEventBundle(key, args, e, args.what_to_do_after_event_or_if_no_response, false);

        events_to_fire.Add(this_bundle);
        execute_event(this_bundle);
    }
Example #18
0
    public static void black_forest_bats(EventArgs args)
    {
        GameArgs      game_args          = (GameArgs)args;
        Card          card_to_respond_to = game_args.relevant_card;
        Action <Card> the_action         = (card_chosen) =>
        {
            ((PlayerCard)card_chosen).uncommit();
        };

        game.wait_for_forced_response(card_to_respond_to: card_to_respond_to,
                                      after_responding_with_card: the_action, what_to_do_after_responding: game_args.what_to_do_after_event_or_if_no_response);
    }
Example #19
0
    public static void dol_guldur_orcs(EventArgs args)
    {
        GameArgs      game_args          = (GameArgs)args;
        Card          card_to_respond_to = game_args.relevant_card;
        Action <Card> the_action         = (card_chosen) =>
        {
            ((PlayerCard)card_chosen).take_damage(2);
        };

        game.wait_for_forced_response(card_to_respond_to: card_to_respond_to,
                                      after_responding_with_card: the_action, what_to_do_after_responding: game_args.what_to_do_after_event_or_if_no_response);
    }
Example #20
0
 private void RefreshArgs(EnumEditor editor, GameArgs args, GameArgs blacklistArgs = GameArgs.None)
 {
     editor.ClearDisabledItems();
     foreach (GameArgs r in Enum.GetValues(typeof(GameArgs)))
     {
         if ((blacklistArgs & r) != 0)
         {
             editor.Disable(r.ToString());
         }
     }
     editor.Value = args;
 }
Example #21
0
    public static void gandalf_played(EventArgs args)
    {
        GameArgs   game_args  = (GameArgs)args;
        PlayerCard the_card   = (PlayerCard)game_args.relevant_card;
        Action     the_action = () =>
        {
            game.show_options(3);
            game.wait_for_forced_response(card_to_respond_to: the_card, what_to_do_after_responding: game_args.what_to_do_after_event_or_if_no_response);
        };

        game.execute_action(the_action);
    }
Example #22
0
    public static void gloin(EventArgs args)
    {
        GameArgs game_args          = (GameArgs)args;
        Card     card_to_respond_to = game_args.relevant_card;
        Card     character_damaged  = game_args.relevant_card;
        int?     amt_damaged        = game_args.relevant_int;
        LOTRHero gloin         = (LOTRHero)character_damaged;
        Action   gloins_action = () => { gloin.add_resource_token(amt_damaged.Value); };

        game.wait_for_response(card_to_respond_to: card_to_respond_to,
                               if_yes: gloins_action, response_is_yes_no: true, what_to_do_after_responding: game_args.what_to_do_after_event_or_if_no_response);
    }
Example #23
0
    public static void gandalf_draw_3(EventArgs args)
    {
        GameArgs   game_args  = (GameArgs)args;
        LOTRPlayer player     = game_args.relevant_player;
        Action     the_action = () =>
        {
            player.draw_card();
            player.draw_card();
            player.draw_card();
        };

        game.execute_action(the_action);
    }
Example #24
0
    public static void eyes_of_the_forest(EventArgs args)
    {
        GameArgs game_args  = (GameArgs)args;
        Action   the_action = () =>
        {
            foreach (var player in game.get_players())
            {
                player.discard_all_cards(type: "EVENT");
            }
        };

        game.execute_action(the_action);
    }
Example #25
0
        private string GetGameArgs(GameArgs args)
        {
            List <string> result = new List <string>();

            foreach (GameArgs r in Enum.GetValues(typeof(GameArgs)))
            {
                if ((args & r) != 0)
                {
                    result.Add($"/{r.ToString().ToUpper()}");
                }
            }
            return(string.Join(" ", result.ToArray()));
        }
Example #26
0
        public async Task Terminate()
        {
            try
            {
                var gameArgs = new GameArgs(App.GameId, App.UserId, App.MinesBoomId);

                await _apiClient.TerminateMinesBoom(gameArgs);
            }
            catch (System.Exception)
            {
                // ignored
            }
        }
Example #27
0
        public async Task TerminateMinesBoom(GameArgs gameArgs)
        {
            var uri = new Uri(_baseAddress + "/games/terminate");

            var message = new HttpRequestMessage(HttpMethod.Post, uri)
            {
                Content = new StringContent(JsonConvert.SerializeObject(gameArgs), Encoding.UTF8, "application/json")
            };

            AddHeader(message, gameArgs.UserId.ToString());

            await GetResponse <MinesboomSelectionResponse>(message);
        }
Example #28
0
    public static bool has_exhausted_allies(EventArgs args, Card me)
    {
        GameArgs   the_args   = (GameArgs)args;
        LOTRPlayer the_player = the_args.relevant_player;

        foreach (var card in the_player.get_allies())
        {
            if (card.is_exhausted())     //TODO: or engaged with another player
            {
                return(true);
            }
        }
        return(false);
    }
Example #29
0
    public static void necromancers_pass(EventArgs args)
    {
        GameArgs game_args  = (GameArgs)args;
        Action   the_action = () =>
        {
            LOTRPlayer the_player = game_args.relevant_player;
            Random     rnd        = new Random();
            the_player.discard_card_at_index(rnd.Next(the_player.get_cards_in_hand().Count));
            the_player.discard_card_at_index(rnd.Next(the_player.get_cards_in_hand().Count));
        };

        game.execute_action(the_action);
        game_args.what_to_do_after_event_or_if_no_response();
    }
Example #30
0
    public static void great_forest_web(EventArgs args)
    {
        GameArgs      game_args          = (GameArgs)args;
        Card          card_to_respond_to = game_args.relevant_card;
        Action <Card> the_action         = (Card c) =>
        {
            PlayerCard card_exhusted = (PlayerCard)c;
            card_exhusted.exhaust();
        };

        game.wait_for_forced_response(card_to_respond_to: card_to_respond_to,
                                      after_responding_with_card: the_action,
                                      what_to_do_after_responding: game_args.what_to_do_after_event_or_if_no_response);
    }