コード例 #1
0
        // Function from file: toys.dm
        public override dynamic attack_hand(dynamic a = null, bool?b = null, bool?c = null)
        {
            dynamic choice = null;
            Obj_Item_Toy_Cards_Singlecard H = null;
            Obj_Item_Toy_Cards_Deck       O = null;


            if (Lang13.Bool(a.lying))
            {
                return(null);
            }
            choice = null;

            if (this.cards.len == 0)
            {
                this.icon_state = "deck_" + this.deckstyle + "_empty";
                a.WriteMsg("<span class='warning'>There are no more cards to draw!</span>");
                return(null);
            }
            H = new Obj_Item_Toy_Cards_Singlecard(a.loc);

            if (this.holo != null)
            {
                this.holo.spawned += H;
            }
            choice       = this.cards[1];
            H.cardname   = choice;
            H.parentdeck = this;
            O            = this;
            H.apply_card_vars(H, O);
            this.cards -= choice;
            H.pickup(a);
            ((Mob)a).put_in_hands(H);
            ((Ent_Static)a).visible_message("" + a + " draws a card from the deck.", "<span class='notice'>You draw a card from the deck.</span>");

            if (this.cards.len > 26)
            {
                this.icon_state = "deck_" + this.deckstyle + "_full";
            }
            else if (this.cards.len > 10)
            {
                this.icon_state = "deck_" + this.deckstyle + "_half";
            }
            else if (this.cards.len > 1)
            {
                this.icon_state = "deck_" + this.deckstyle + "_low";
            }
            return(null);
        }
コード例 #2
0
        // Function from file: toys.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            Mob cardUser = null;
            Obj_Item_Toy_Cards_Cardhand O = null;
            dynamic choice = null;
            Obj_Item_Toy_Cards_Singlecard C = null;
            Obj_Item_Toy_Cards_Singlecard N = null;


            if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc))))
            {
                return(null);
            }

            if (Task13.User.stat != 0 || !(Task13.User is Mob_Living_Carbon_Human) || !Task13.User.canmove)
            {
                return(null);
            }
            cardUser = Task13.User;
            O        = this;

            if (Lang13.Bool(href_list["pick"]))
            {
                if (cardUser.get_item_by_slot(4) == this || cardUser.get_item_by_slot(5) == this)
                {
                    choice = href_list["pick"];
                    C      = new Obj_Item_Toy_Cards_Singlecard(cardUser.loc);
                    this.currenthand.Remove(choice);
                    C.parentdeck = this.parentdeck;
                    C.cardname   = choice;
                    C.apply_card_vars(C, O);
                    C.pickup(cardUser);
                    cardUser.put_in_hands(C);
                    cardUser.visible_message(new Txt("<span class='notice'>").item(cardUser).str(" draws a card from ").his_her_its_their().str(" hand.</span>").ToString(), "<span class='notice'>You take the " + C.cardname + " from your hand.</span>");
                    this.interact(cardUser);

                    if (this.currenthand.len < 3)
                    {
                        this.icon_state = "" + this.deckstyle + "_hand2";
                    }
                    else if (this.currenthand.len < 4)
                    {
                        this.icon_state = "" + this.deckstyle + "_hand3";
                    }
                    else if (this.currenthand.len < 5)
                    {
                        this.icon_state = "" + this.deckstyle + "_hand4";
                    }

                    if (this.currenthand.len == 1)
                    {
                        N            = new Obj_Item_Toy_Cards_Singlecard(this.loc);
                        N.parentdeck = this.parentdeck;
                        N.cardname   = this.currenthand[1];
                        N.apply_card_vars(N, O);
                        cardUser.unEquip(this);
                        N.pickup(cardUser);
                        cardUser.put_in_hands(N);
                        cardUser.WriteMsg("<span class='notice'>You also take " + this.currenthand[1] + " and hold it.</span>");
                        Interface13.Browse(cardUser, null, "window=cardhand");
                        GlobalFuncs.qdel(this);
                    }
                }
                return(null);
            }
            return(null);
        }