Exemplo n.º 1
0
        // Function from file: shooting_range.dm
        public override dynamic bullet_act(dynamic P = null, dynamic def_zone = null)
        {
            double?p_x       = null;
            double?p_y       = null;
            int    decaltype = 0;
            Icon   C         = null;
            Image  I         = null;

            p_x       = (P.p_x ?? 0) + Convert.ToDouble(Rand13.Pick(new object [] { 0, 0, 0, 0, 0, -1, 1 }));
            p_y       = (P.p_y ?? 0) + Convert.ToDouble(Rand13.Pick(new object [] { 0, 0, 0, 0, 0, -1, 1 }));
            decaltype = 1;

            if (Lang13.Bool(P.IsInstanceOfType(typeof(Obj_Item_Projectile_Bullet))))
            {
                decaltype = 2;
            }
            C = new Icon(this.icon, this.icon_state);

            if (Lang13.Bool(C.GetPixel(p_x, p_y)) && P.original == this && this.overlays.len <= 35)
            {
                this.hp -= Convert.ToDouble(P.damage);

                if (this.hp <= 0)
                {
                    this.visible_message("<span class='danger'>" + this + " breaks into tiny pieces and collapses!</span>");
                    GlobalFuncs.qdel(this);
                }
                I         = new Image("icons/effects/effects.dmi", null, "scorch", 3.5);
                I.pixel_x = ((int)((p_x ?? 0) - 1));
                I.pixel_y = ((int)((p_y ?? 0) - 1));

                if (decaltype == 1)
                {
                    ((dynamic)I).dir = Rand13.Pick(new object [] { GlobalVars.NORTH, GlobalVars.SOUTH, GlobalVars.EAST, GlobalVars.WEST });

                    if (Convert.ToDouble(P.damage) >= 20 || P is Obj_Item_Projectile_Beam_Practice)
                    {
                        ((dynamic)I).dir = Rand13.Pick(new object [] { GlobalVars.NORTH, GlobalVars.SOUTH, GlobalVars.EAST, GlobalVars.WEST });
                    }
                    else
                    {
                        I.icon_state = "light_scorch";
                    }
                }
                else
                {
                    I.icon_state = "dent";
                }
                this.overlays.Add(I);
                return(null);
            }
            return(-1);
        }
Exemplo n.º 2
0
        // Function from file: artstuff.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            ByTable click_params   = null;
            double? pixX           = null;
            double? pixY           = null;
            Icon    masterpiece    = null;
            string  thePix         = null;
            Icon    Ico            = null;
            string  theOriginalPix = null;
            dynamic C = null;

            click_params = String13.ParseUrlParams(_params);
            pixX         = String13.ParseNumber(click_params["icon-x"]);
            pixY         = String13.ParseNumber(click_params["icon-y"]);

            if (!(click_params != null) || !Lang13.Bool(click_params["icon-x"]) || !Lang13.Bool(click_params["icon-y"]))
            {
                return(null);
            }

            if (A is Obj_Item_Weapon_Soap || A is Obj_Item_Weapon_ReagentContainers_Glass_Rag)
            {
                masterpiece = new Icon(this.icon, this.icon_state);
                thePix      = masterpiece.GetPixel(pixX, pixY);
                Ico         = this.getGlobalBackup();

                if (!(Ico != null))
                {
                    GlobalFuncs.qdel(masterpiece);
                    return(null);
                }
                theOriginalPix = Ico.GetPixel(pixX, pixY);

                if (thePix != theOriginalPix)
                {
                    this.DrawPixelOn(theOriginalPix, pixX, pixY);
                }
                GlobalFuncs.qdel(masterpiece);
                return(null);
            }

            if (A is Obj_Item_Toy_Crayon)
            {
                C = A;
                this.DrawPixelOn(C.paint_color, pixX, pixY);
                return(null);
            }
            base.attackby((object)(A), (object)(user), _params, silent, replace_spent);
            return(null);
        }