Exemplo n.º 1
0
        protected override async Task OnMessageActivityAsync(ITurnContext <IMessageActivity> turnContext, CancellationToken cancellationToken)
        {
            var message = turnContext.Activity.Text.ToLower();

            if (message.Equals("imagen"))
            {
                await turnContext.SendActivityAsync(AttachmentCard.GetImageGIF(), cancellationToken);
            }

            else if (message.Equals("video"))
            {
                await turnContext.SendActivityAsync(AttachmentCard.GetVideo(), cancellationToken);
            }

            else if (message.Equals("audio"))
            {
                await turnContext.SendActivityAsync(AttachmentCard.GetAudio(), cancellationToken);
            }

            else if (message.Equals("documento"))
            {
                await turnContext.SendActivityAsync(AttachmentCard.GetDocumento(), cancellationToken);
            }

            else
            {
                await turnContext.SendActivityAsync("Opción no válida", cancellationToken : cancellationToken);
            }
        }
Exemplo n.º 2
0
    public void cur_player_discard_attachment(AttachmentCard attachment = null, bool all = false)
    {
        if (all)
        {
            foreach (PlayerCard hero in get_cur_player().get_heroes())
            {
                foreach (AttachmentCard a in hero.get_attachments())
                {
                    cur_player.discard_attachment(a);
                }
            }

            foreach (PlayerCard ally in get_cur_player().get_allies())
            {
                foreach (AttachmentCard a in ally.get_attachments())
                {
                    cur_player.discard_attachment(a);
                }
            } //TODO: fire events blahblah
        }
        else
        {
            cur_player.discard_attachment(attachment);
        }
    }
Exemplo n.º 3
0
    public static AttachmentCard STEWARD_OF_GONDOR()
    {
        var result = new AttachmentCard(card_name: "Steward of Gondor", cost: 2, sphere: LOTRGame.SPHERE_OF_INFLUENCE.LEADERSHIP,
                                        traits: new List <LOTRGame.TRAITS>()
        {
            LOTRGame.TRAITS.GONDOR, LOTRGame.TRAITS.TITLE
        },
                                        ability: "Attach to a hero. Attached hero gains the Gondor trait. Action: Exhaust Steward of Gondor to add 2 resources to attached hero's resource pool.",
                                        set: "???");
        List <Func <EventArgs, Card, bool> > its_me_criteria = new List <Func <EventArgs, Card, bool> >()
        {
            CardEnablers.card_is_me
        };

        result.respond_to_event(GameEvent.CARD_PLAYED_KEY,
                                PlayerCardResponses.action_maker(its_me_criteria, PlayerCardResponses.steward_of_gondor_enters, result));
        result.set_action_card();
        List <Func <EventArgs, Card, bool> > all_action_criteria = new List <Func <EventArgs, Card, bool> >()
        {
            CardEnablers.i_am_played, CardEnablers.i_am_not_exhausted
        };

        result.set_action_criteria(all_action_criteria);
        result.respond_to_event(GameEvent.ACTIVATED_ACTION,
                                PlayerCardResponses.action_maker(all_action_criteria, PlayerCardResponses.steward_of_gondor_action,
                                                                 result));
        return(result);
    }
        //Verifica si se ha recibido una actividad del usuario
        protected override async Task OnMessageActivityAsync(ITurnContext <IMessageActivity> turnContext, CancellationToken cancellationToken)
        {
            //return base.OnMessageActivityAsync(turnContext, cancellationToken);

            //Demo #1
            //var vMessage = turnContext.Activity.Text;
            //await turnContext.SendActivityAsync($"El Usuario dijo: { vMessage }", cancellationToken: cancellationToken);

            //Demo #2 y 3
            //await _dialog.RunAsync(
            //    turnContext,
            //    _conversationState.CreateProperty<DialogState>(nameof(DialogState)),
            //    cancellationToken);

            //Demo #4
            var vMessage = turnContext.Activity.Text.ToLower();

            if (vMessage.Equals("imagen"))
            {
                await turnContext.SendActivityAsync(AttachmentCard.GetImage(), cancellationToken);
            }
            else if (vMessage.Equals("imagengif"))
            {
                await turnContext.SendActivityAsync(AttachmentCard.GetImageGIF(), cancellationToken);
            }
            else if (vMessage.Equals("video"))
            {
                await turnContext.SendActivityAsync(AttachmentCard.GetVideo(), cancellationToken);
            }
            else if (vMessage.Equals("audio"))
            {
                await turnContext.SendActivityAsync(AttachmentCard.GetAudio(), cancellationToken);
            }
            else if (vMessage.Equals("documento"))
            {
                await turnContext.SendActivityAsync(AttachmentCard.GetDocumento(), cancellationToken);
            }
            else if (vMessage.Equals("cuentas"))
            {
                await turnContext.SendActivityAsync(AttachmentCard.GetAccount(), cancellationToken);
            }
            else if (vMessage.Equals("certificado"))
            {
                try
                {
                    await turnContext.SendActivityAsync(AttachmentCard.GetCertificate1(), cancellationToken);
                }
                catch (System.Exception ex)
                {
                    throw new System.Exception(ex.Message);
                }
            }
            else
            {
                await turnContext.SendActivityAsync("Opción no válida", cancellationToken : cancellationToken);
            }
        }
Exemplo n.º 5
0
 public void discard_attachment(AttachmentCard attachment)
 {
     foreach (PlayerCard card in all_characters())
     {
         if (card.has_attachment(attachment))
         {
             card.discard_attachment(attachment);
             break;
         }
     }
 }
Exemplo n.º 6
0
        public void GetCost_Should_ReturnDash_When_CardIsCostCardAndHasNoCosts()
        {
            var card = new AttachmentCard {
                Cost = null
            };
            var viewModel = new CardsListViewModel();

            var result = viewModel.GetCost(card);

            result.Should().Be("-");
        }
Exemplo n.º 7
0
        public void GetIconClasses_Should_ReturnCorrectClasses_When_ClanIsCrane_And_TypeIsAttachment()
        {
            const string expected = "d-none d-sm-inline-block fa fa-fw fa-paperclip fg-dark-crane";
            var          card     = new AttachmentCard {
                Clan = Clan.Crane
            };
            var viewModel = new CardsListViewModel();

            var result = viewModel.GetIconClasses(card);

            result.Should().Be(expected);
        }
Exemplo n.º 8
0
        public void GetValues_Should_ReturnCorrectValues_When_CardIsAttachment()
        {
            const string militaryBonus  = "+2";
            const string politicalBonus = "-2";
            var          card           = new AttachmentCard {
                MilitaryBonus = militaryBonus, PoliticalBonus = politicalBonus
            };
            var viewModel = new CardsListViewModel();

            var result = viewModel.GetValues(card);

            result.Should().Be(militaryBonus + " / " + politicalBonus);
        }
Exemplo n.º 9
0
    public static bool i_am_played(EventArgs args, Card me)
    {
        GameArgs the_args = (GameArgs)args;

        if (me != null)
        {
            //Debug.Log("CHECKING FOR ME " + me.get_name());
        }

        LOTRPlayer        the_player = the_args.relevant_player;
        List <LOTRHero>   heroes     = the_player.get_heroes();
        List <PlayerCard> allies     = the_player.get_allies();

        foreach (var hero in heroes)
        {
            //Debug.Log("IS " + hero.get_name() + hero.get_uuid() + " ME " + me.get_name() + me.get_uuid());
            if (hero == me)
            {
                return(true);
            }

            if (((PlayerCard)me).is_attachment())
            {
                AttachmentCard attachment_me = (AttachmentCard)me;
                if (hero.has_attachment(attachment_me))
                {
                    return(true);
                }
            }
        }
        foreach (var ally in allies)
        {
            //Debug.Log("IS " + ally.get_name() + ally.get_uuid()  + " ME " + me.get_name()+ me.get_uuid());
            if (ally == me)
            {
                return(true);
            }
            if (((PlayerCard)me).is_attachment())
            {
                AttachmentCard attachment_me = (AttachmentCard)me;
                if (ally.has_attachment(attachment_me))
                {
                    return(true);
                }
            }
        }
        return(false);
    }
Exemplo n.º 10
0
    public static AttachmentCard CELEBRIANS_STONE()
    {
        var result = new AttachmentCard(card_name: "Celebrian's Stone", cost: 2, sphere: LOTRGame.SPHERE_OF_INFLUENCE.LEADERSHIP,
                                        traits: new List <LOTRGame.TRAITS>()
        {
            LOTRGame.TRAITS.ARTIFACT, LOTRGame.TRAITS.ITEM
        },
                                        ability: "Restricted.  Attach to a hero. Attached hero gains +2 Willpower. If attached hero is Aragorn, he also gains a Spirit resource icon.",
                                        set: "???", unique: true);
        List <Func <EventArgs, Card, bool> > its_me_criteria = new List <Func <EventArgs, Card, bool> >()
        {
            CardEnablers.card_is_me
        };

        result.respond_to_event(GameEvent.CARD_PLAYED_KEY,
                                PlayerCardResponses.action_maker(its_me_criteria, PlayerCardResponses.celebrians_stone_enters, result));
        return(result);
    }
Exemplo n.º 11
0
        protected override async Task OnMessageActivityAsync(ITurnContext <IMessageActivity> turnContext, CancellationToken cancellationToken)
        {
            var vMessage = turnContext.Activity.Text.ToLower();

            if (vMessage.Equals("imagen"))
            {
                await turnContext.SendActivityAsync(AttachmentCard.GetImage(), cancellationToken);
            }
            else if (vMessage.Equals("imagengif"))
            {
                await turnContext.SendActivityAsync(AttachmentCard.GetImageGIF(), cancellationToken);
            }
            else if (vMessage.Equals("video"))
            {
                await turnContext.SendActivityAsync(AttachmentCard.GetVideo(), cancellationToken);
            }
            else if (vMessage.Equals("audio"))
            {
                await turnContext.SendActivityAsync(AttachmentCard.GetAudio(), cancellationToken);
            }
            else if (vMessage.Equals("documento"))
            {
                await turnContext.SendActivityAsync(AttachmentCard.GetDocumento(), cancellationToken);
            }
            else if (vMessage.Equals("cuentas"))
            {
                await turnContext.SendActivityAsync(AttachmentCard.GetAccount(), cancellationToken);
            }
            else if (vMessage.Equals("certificado"))
            {
                try
                {
                    await turnContext.SendActivityAsync(AttachmentCard.GetCertificate1(), cancellationToken);
                }
                catch (System.Exception ex)
                {
                    throw new System.Exception(ex.Message);
                }
            }
            else
            {
                await turnContext.SendActivityAsync("Opción no válida", cancellationToken : cancellationToken);
            }
        }
Exemplo n.º 12
0
    public static void celebrians_stone_enters(EventArgs args)
    {
        GameArgs       game_args  = (GameArgs)args;
        AttachmentCard the_card   = (AttachmentCard)game_args.relevant_card;
        Action         the_action = () =>
        {
            foreach (LOTRPlayer player in game.get_players())
            {
                foreach (PlayerCard character in player.all_characters())
                {
                    if (character.has_attachment(the_card))
                    {
                        character.add_flag(LOTRAbility.ABILITY_FLAGS.CELEBRIANS_STONE);
                    }
                }
            }
        };

        game.execute_action(the_action);
    }
Exemplo n.º 13
0
    public static void steward_of_gondor_enters(EventArgs args)
    {
        GameArgs       game_args  = (GameArgs)args;
        AttachmentCard the_card   = (AttachmentCard)game_args.relevant_card;
        Action         the_action = () =>
        {
            foreach (LOTRPlayer player in game.get_players())
            {
                foreach (PlayerCard character in player.all_characters())
                {
                    if (character.has_attachment(the_card))
                    {
                        character.add_trait(LOTRGame.TRAITS.GONDOR);
                    }
                }
            }
        };

        game.execute_action(the_action);
    }
Exemplo n.º 14
0
    public static void steward_of_gondor_action(EventArgs args)
    {
        GameArgs       game_args = (GameArgs)args;
        AttachmentCard the_card  = (AttachmentCard)game_args.relevant_card;

        Action the_action = () =>
        {
            foreach (LOTRPlayer player in game.get_players())
            {
                foreach (LOTRHero character in player.get_heroes())
                {
                    if (character.has_attachment(the_card))
                    {
                        the_card.exhaust();
                        character.add_resource_token(2);
                        break;
                    }
                }
            }
        };

        game.execute_action(the_action);
    }
Exemplo n.º 15
0
 public void discard_attachment(AttachmentCard attachment)
 {
     if (has_attachment(attachment))
     {
         for (var i = 0; i < my_attachments.Count; i++)
         {
             if (my_attachments[i] == attachment)
             {
                 //maybe do an event whatever
                 if (attachment.get_name() == AttachmentCard.STEWARD_OF_GONDOR().get_name())
                 {
                     remove_trait(LOTRGame.TRAITS.GONDOR);
                 }
                 if (attachment.get_name() == AttachmentCard.CELEBRIANS_STONE().get_name())
                 {
                     remove_flag(LOTRAbility.ABILITY_FLAGS.CELEBRIANS_STONE);
                 }
                 my_attachments.RemoveAt(i);
                 break;
             }
         }
     }
 }
Exemplo n.º 16
0
 public void add_attachment(AttachmentCard attachment)
 {
     my_attachments.Add(attachment);
 }
Exemplo n.º 17
0
 public bool has_attachment(AttachmentCard attachment)
 {
     return(my_attachments.Contains(attachment));
 }