Example #1
0
        // Function from file: cards.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic     H = null;
            Playingcard P = null;


            if (A is Obj_Item_Weapon_Hand)
            {
                H = A;

                foreach (dynamic _a in Lang13.Enumerate(this.cards, typeof(Playingcard)))
                {
                    P = _a;

                    H.cards.Add(P);
                }
                H.update_icon();
                GlobalFuncs.qdel(this);
            }
            else
            {
                return(base.attackby((object)(A), (object)(user), _params, silent, replace_spent));
            }
            return(null);
        }
Example #2
0
        // Function from file: cards.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic     H = null;
            Playingcard P = null;


            if (A is Obj_Item_Weapon_Hand)
            {
                H = A;

                foreach (dynamic _a in Lang13.Enumerate(H.cards, typeof(Playingcard)))
                {
                    P = _a;

                    this.cards.Add(P);
                }
                GlobalFuncs.qdel(A);
                user.show_message("You place your cards on the bottom of the deck.");
            }
            else
            {
                return(base.attackby((object)(A), (object)(user), _params, silent, replace_spent));
            }
            return(null);
        }
Example #3
0
        // Function from file: cards.dm
        public override double examine(dynamic user = null)
        {
            double _default = 0;

            Playingcard card = null;

            _default = base.examine((object)(user));

            if ((!this.concealed || this.loc == Task13.User) && this.cards.len != 0)
            {
                Task13.User.show_message("It contains: ", 1);

                foreach (dynamic _a in Lang13.Enumerate(this.cards, typeof(Playingcard)))
                {
                    card = _a;

                    Task13.User.show_message("The " + card.name + ".", 1);
                }
            }
            return(_default);
        }
Example #4
0
        // Function from file: cards.dm
        public override bool update_icon(dynamic new_state = null, dynamic new_icon = null, int?new_px = null, int?new_py = null)
        {
            Playingcard P      = null;
            Image       I      = null;
            int         origin = 0;
            int         offset = 0;
            int         i      = 0;
            Image       I2     = null;
            Playingcard P2     = null;
            string      html   = null;
            Playingcard card   = null;


            if (!(this.cards.len != 0))
            {
                GlobalFuncs.qdel(this);
            }
            else
            {
                if (this.cards.len > 1)
                {
                    this.name = "hand of cards";
                    this.desc = "Some playing cards.";
                }
                else
                {
                    this.name = "a playing card";
                    this.desc = "A playing card.";
                }
                this.overlays.len = 0;

                if (this.cards.len == 1)
                {
                    P         = this.cards[1];
                    I         = new Image(this.icon, (this.concealed ? "card_back" : "" + P.card_icon));
                    I.pixel_x = I.pixel_x + Rand13.Int(10) + -5;
                    I.pixel_y = I.pixel_y + Rand13.Int(10) + -5;
                    this.overlays.Add(I);
                }
                else
                {
                    origin = -12;
                    offset = Num13.Floor(32 / this.cards.len);
                    i      = 0;

                    foreach (dynamic _a in Lang13.Enumerate(this.cards, typeof(Playingcard)))
                    {
                        P2 = _a;

                        I2         = new Image(this.icon, (this.concealed ? "card_back" : "" + P2.card_icon));
                        I2.pixel_x = origin + offset * i;
                        this.overlays.Add(I2);
                        i = i + 1;
                    }
                }
                html = "";

                foreach (dynamic _b in Lang13.Enumerate(this.cards, typeof(Playingcard)))
                {
                    card = _b;

                    html = html + new Txt("<a href=\"byond://?src=").Ref(this.hi).str("&action=play_card&card=").Ref(card).str("\" class=\"card ").item(card.suit).str(" ").item(card.number).str("\"></a>").ToString();
                }
                this.hi.updateContent("hand", html);
            }
            return(false);
        }
Example #5
0
        // Function from file: cards.dm
        public Obj_Item_Weapon_Deck(dynamic loc = null) : base((object)(loc))
        {
            string      color   = null;
            Playingcard card    = null;
            dynamic     suit    = null;
            dynamic     number  = null;
            dynamic     number2 = null;
            int?        i       = null;

            // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!;

            foreach (dynamic _c in Lang13.Enumerate(new ByTable(new object [] { "spades", "clubs", "diamonds", "hearts" })))
            {
                suit = _c;


                if (suit == "spades" || suit == "clubs")
                {
                    color = "black_";
                }
                else
                {
                    color = "red_";
                }

                foreach (dynamic _a in Lang13.Enumerate(new ByTable(new object [] { "ace", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten" })))
                {
                    number = _a;

                    card           = new Playingcard();
                    card.name      = "" + number + " of " + suit;
                    card.card_icon = "" + color + "num";
                    card.suit      = suit;
                    card.number    = number;
                    this.cards.Add(card);
                }

                foreach (dynamic _b in Lang13.Enumerate(new ByTable(new object [] { "jack", "queen", "king" })))
                {
                    number2 = _b;

                    card           = new Playingcard();
                    card.name      = "" + number2 + " of " + suit;
                    card.card_icon = "" + color + "col";
                    card.suit      = suit;
                    card.number    = number2;
                    this.cards.Add(card);
                }
            }
            i = null;
            i = 0;

            while ((i ?? 0) < 2)
            {
                card           = new Playingcard();
                card.name      = "joker";
                card.card_icon = "joker";
                card.suit      = "joker";
                card.number    = "";
                this.cards.Add(card);
                i++;
            }
            return;
        }