Exemple #1
0
        // Function from file: borghydro.dm
        public override bool attack(dynamic M = null, dynamic user = null, bool?def_zone = null)
        {
            Reagents R        = null;
            double?  fraction = null;
            dynamic  trans    = null;

            R = this.reagent_list[this.mode];

            if (!Lang13.Bool(R.total_volume))
            {
                user.WriteMsg("<span class='notice'>The injector is empty.</span>");
                return(false);
            }

            if (!(M is Mob_Living_Carbon))
            {
                return(false);
            }

            if (Lang13.Bool(R.total_volume) && ((Mob_Living)M).can_inject(user, true, this.bypass_protection))
            {
                M.WriteMsg("<span class='warning'>You feel a tiny prick!</span>");
                user.WriteMsg("<span class='notice'>You inject " + M + " with the injector.</span>");
                fraction = Num13.MinInt(((int)((this.amount_per_transfer_from_this ?? 0) / (R.total_volume ?? 0))), 1);
                R.reaction(M, GlobalVars.INJECT, fraction);

                if (Lang13.Bool(M.reagents))
                {
                    trans = R.trans_to(M, this.amount_per_transfer_from_this);
                    user.WriteMsg(new Txt("<span class='notice'>").item(trans).str(" unit").s().str(" injected.  ").item(R.total_volume).str(" unit").s().str(" remaining.</span>").ToString());
                }
            }
            return(false);
        }
Exemple #2
0
        // Function from file: borghydro.dm
        public override bool afterattack(dynamic target = null, dynamic user = null, bool?proximity_flag = null, string click_parameters = null)
        {
            Reagents R     = null;
            dynamic  trans = null;


            if (!(proximity_flag == true))
            {
                return(false);
            }
            else if (Lang13.Bool(((Ent_Static)target).is_open_container()) && Lang13.Bool(target.reagents))
            {
                R = this.reagent_list[this.mode];

                if (!Lang13.Bool(R.total_volume))
                {
                    user.WriteMsg("<span class='warning'>" + this + " is currently out of this ingredient! Please allow some time for the synthesizer to produce more.</span>");
                    return(false);
                }

                if ((target.reagents.total_volume ?? 0) >= Convert.ToDouble(target.reagents.maximum_volume))
                {
                    user.WriteMsg("<span class='notice'>" + target + " is full.</span>");
                    return(false);
                }
                trans = R.trans_to(target, this.amount_per_transfer_from_this);
                user.WriteMsg(new Txt("<span class='notice'>You transfer ").item(trans).str(" unit").s().str(" of the solution to ").item(target).str(".</span>").ToString());
            }
            return(false);
        }