예제 #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);
        }