Esempio n. 1
0
        // Function from file: constructs.dm
        public override bool attack_animal(Mob_Living user = null)
        {
            if (user is Mob_Living_SimpleAnimal_Hostile_Construct_Builder)
            {
                if (Convert.ToDouble(this.health) < Convert.ToDouble(this.maxHealth))
                {
                    this.adjustHealth(-5);

                    if (this != user)
                    {
                        this.Beam(user, "sendbeam", "icons/effects/effects.dmi", 4);
                        user.visible_message(new Txt("<span class='danger'>").item(user).str(" repairs some of ").the(this).str("<b>").item().str("'s</b> dents.</span>").ToString(), "<span class='cult'>You repair some of <b>" + this + "'s</b> dents, leaving <b>" + this + "</b> at <b>" + this.health + "/" + this.maxHealth + "</b> health.</span>");
                    }
                    else
                    {
                        user.visible_message("<span class='danger'>" + user + " repairs some of its own dents.</span>", "<span class='cult'>You repair some of your own dents, leaving you at <b>" + user.health + "/" + user.maxHealth + "</b> health.</span>");
                    }
                }
                else if (this != user)
                {
                    user.WriteMsg("<span class='cult'>You cannot repair <b>" + this + "'s</b> dents, as it has none!</span>");
                }
                else
                {
                    user.WriteMsg("<span class='cult'>You cannot repair your own dents, as you have none!</span>");
                }
            }
            else if (this != user)
            {
                base.attack_animal(user);
            }
            return(false);
        }
Esempio n. 2
0
        // Function from file: shadowling_abilities.dm
        public override bool cast(dynamic targets = null, dynamic thearea = null, dynamic user = null)
        {
            thearea = thearea ?? Task13.User;

            Mob_Living target = null;
            Mob_Living M      = null;


            foreach (dynamic _a in Lang13.Enumerate(targets, typeof(Mob_Living)))
            {
                target = _a;


                if (!(target is Mob_Living_Carbon_Human))
                {
                    thearea.WriteMsg("<span class='warning'>You may only glare at humans!</span>");
                    this.revert_cast();
                    return(false);
                }

                if (!this.shadowling_check(thearea))
                {
                    this.revert_cast();
                    return(false);
                }

                if (target.stat != 0)
                {
                    thearea.WriteMsg("<span class='warning'>" + target + " must be conscious!</span>");
                    this.revert_cast();
                    return(false);
                }

                if (GlobalFuncs.is_shadow_or_thrall(target))
                {
                    thearea.WriteMsg("<span class='warning'>You cannot glare at allies!</span>");
                    this.revert_cast();
                    return(false);
                }
                M = target;
                ((Ent_Static)thearea).visible_message("<span class='warning'><b>" + thearea + "'s eyes flash a blinding red!</b></span>");
                target.visible_message("<span class='danger'>" + target + " freezes in place, their eyes glazing over...</span>");

                if (Map13.GetDistance(target, thearea) <= 1)
                {
                    target.WriteMsg("<span class='userdanger'>Your gaze is forcibly drawn into " + thearea + "'s eyes, and you are mesmerized by the heavenly lights...</span>");
                }
                else
                {
                    target.WriteMsg("<span class='userdanger'>Red lights suddenly dance in your vision, and you are mesmerized by their heavenly beauty...</span>");
                }
                target.Stun(10);
                ((dynamic)M).silent += 10;
            }
            return(false);
        }
        // Function from file: flashbang.dm
        public void bang(dynamic T = null, Mob_Living M = null)
        {
            bool ear_safety = false;
            int  distance   = 0;

            M.show_message("<span class='warning'>BANG</span>", 2);
            GlobalFuncs.playsound(this.loc, "sound/weapons/flashbang.ogg", 100, 1);
            ear_safety = M.check_ear_prot();
            distance   = Num13.MaxInt(1, Map13.GetDistance(this, T));

            if (M.weakeyes)
            {
                M.visible_message("<span class='disarm'><b>" + M + "</b> screams and collapses!</span>");
                M.WriteMsg("<span class='userdanger'><font size=3>AAAAGH!</font></span>");
                M.Weaken(15);
                M.Stun(15);
                M.adjust_eye_damage(8);
            }

            if (M.flash_eyes(null, null, true))
            {
                M.Stun(Num13.MaxInt(((int)(10 / distance)), 3));
                M.Weaken(Num13.MaxInt(((int)(10 / distance)), 3));
            }

            if (this.loc == M || this.loc == M.loc)
            {
                M.Stun(10);
                M.Weaken(10);
            }

            if (!ear_safety)
            {
                M.WriteMsg(new Sound("sound/weapons/flash_ring.ogg", false, true, 0, 100));
                M.Stun(Num13.MaxInt(((int)(10 / distance)), 3));
                M.Weaken(Num13.MaxInt(((int)(10 / distance)), 3));
                M.setEarDamage(M.ear_damage + Rand13.Int(0, 5), Num13.MaxInt(((int)(M.ear_deaf ?? 0)), 15));

                if (M.ear_damage >= 15)
                {
                    M.WriteMsg("<span class='warning'>Your ears start to ring badly!</span>");

                    if (Rand13.PercentChance(M.ear_damage - 10 + 5))
                    {
                        M.WriteMsg("<span class='warning'>You can't hear anything!</span>");
                        M.disabilities |= 4;
                    }
                }
                else if (M.ear_damage >= 5)
                {
                    M.WriteMsg("<span class='warning'>Your ears start to ring!</span>");
                }
            }
            return;
        }
Esempio n. 4
0
        // Function from file: species_types.dm
        public override void spec_life(Mob_Living H = null)
        {
            Reagent_Toxin_Slimejelly S = null;


            if (H.stat == 2)
            {
                return;
            }

            if (!H.reagents.get_reagent_amount("slimejelly"))
            {
                if (this.recently_changed)
                {
                    H.reagents.add_reagent("slimejelly", 80);
                    this.recently_changed = false;
                }
                else
                {
                    H.reagents.add_reagent("slimejelly", 5);
                    H.adjustBruteLoss(5);
                    H.WriteMsg("<span class='danger'>You feel empty!</span>");
                }
            }

            foreach (dynamic _a in Lang13.Enumerate(H.reagents.reagent_list, typeof(Reagent_Toxin_Slimejelly)))
            {
                S = _a;


                if (S.volume < 100)
                {
                    if (H.nutrition >= 150)
                    {
                        H.reagents.add_reagent("slimejelly", 0.5);
                        H.nutrition -= 2.5;
                    }
                }

                if (S.volume < 50)
                {
                    if (Rand13.PercentChance(5))
                    {
                        H.WriteMsg("<span class='danger'>You feel drained!</span>");
                    }
                }

                if (S.volume < 10)
                {
                    H.losebreath++;
                }
            }
            return;
        }
Esempio n. 5
0
        public void smite(  )
        {
            bool       has_smitten = false;
            Mob_Living L           = null;


            if (!this.ability_cost(40, false, true))
            {
                return;
            }

            if (!(Map13.FetchInRange(this.god_nexus, 7) != null))
            {
                this.WriteMsg("You lack the strength to smite this far from your nexus.");
                return;
            }
            has_smitten = false;

            foreach (dynamic _a in Lang13.Enumerate(GlobalFuncs.get_turf(this), typeof(Mob_Living)))
            {
                L = _a;

                L.adjustFireLoss(20);
                L.adjustBruteLoss(20);
                L.WriteMsg("<span class='danger'><B>You feel the wrath of " + this.name + "!<B></span>");
                has_smitten = true;
            }

            if (has_smitten)
            {
                this.add_faith(-40);
            }
            return;
        }
Esempio n. 6
0
        // Function from file: shapeshift.dm
        public void Shapeshift(Mob_Living caster = null)
        {
            Mob_Living M     = null;
            dynamic    shape = null;


            foreach (dynamic _a in Lang13.Enumerate(caster, typeof(Mob_Living)))
            {
                M = _a;


                if ((M.status_flags & 4096) != 0)
                {
                    caster.WriteMsg("<span class='warning'>You're already shapeshifted!</span>");
                    return;
                }
            }
            shape                = Lang13.Call(this.shapeshift_type, caster.loc);
            caster.loc           = shape;
            caster.status_flags |= 4096;
            this.current_shapes.Or(shape);
            this.current_casters.Or(caster);
            this.clothes_req = 0;
            this.human_req   = 0;
            caster.mind.transfer_to(shape);
            return;
        }
Esempio n. 7
0
        // Function from file: venus_human_trap.dm
        public override bool handle_automated_action(  )
        {
            Mob_Living L  = null;
            dynamic    B  = null;
            Mob_Living L2 = null;


            if (base.handle_automated_action())
            {
                foreach (dynamic _a in Lang13.Enumerate(this.grasping, typeof(Mob_Living)))
                {
                    L = _a;


                    if (L.stat == 2)
                    {
                        B = this.grasping[L];

                        if (Lang13.Bool(B))
                        {
                            B.End();
                        }
                        this.grasping.Remove(L);
                    }

                    if (L.Adjacent(this))
                    {
                        L.attack_animal(this);
                    }
                    else if (Rand13.PercentChance(this.grasp_pull_chance))
                    {
                        this.dir = Map13.GetDistance(this, L);
                        Map13.Step(L, Map13.GetDistance(L, this));
                        L.Weaken(3);
                    }
                }

                if (this.grasping.len < this.max_grasps)
                {
                    foreach (dynamic _b in Lang13.Enumerate(Map13.FetchInRange(this, this.grasp_range), typeof(Mob_Living)))
                    {
                        L2 = _b;


                        if (L2 == this || this.faction_check(L2))
                        {
                            continue;
                        }

                        if (!this.grasping.Contains(L2) && L2 != this.target && Rand13.PercentChance(this.grasp_chance))
                        {
                            L2.WriteMsg(new Txt("<span class='userdanger'>").the(this).item().str(" has you entangled!</span>").ToString());
                            this.grasping[L2] = this.Beam(L2, "vine", "icons/effects/spacevines.dmi", Double.PositiveInfinity, 5, typeof(Obj_Effect_Ebeam_Vine));
                            break;
                        }
                    }
                }
            }
            return(false);
        }
Esempio n. 8
0
        // Function from file: revenant_abilities.dm
        public override bool cast(dynamic targets = null, dynamic thearea = null, dynamic user = null)
        {
            thearea = thearea ?? Task13.User;

            Mob_Living M   = null;
            string     msg = null;


            foreach (dynamic _a in Lang13.Enumerate(targets, typeof(Mob_Living)))
            {
                M = _a;

                Task13.Schedule(0, (Task13.Closure)(() => {
                    msg = GlobalFuncs.stripped_input(Task13.User, "What do you wish to tell " + M + "?", null, "");

                    if (!Lang13.Bool(msg))
                    {
                        this.charge_counter = this.charge_max;
                        return;
                    }
                    GlobalFuncs.log_say("RevenantTransmit: " + GlobalFuncs.key_name(thearea) + "->" + GlobalFuncs.key_name(M) + " : " + msg);
                    thearea.WriteMsg("<span class='revennotice'><b>You transmit to " + M + ":</b> " + msg + "</span>");
                    M.WriteMsg("<span class='revennotice'><b>An alien voice resonates from all around...</b></span><i> " + msg + "</I>");
                    return;
                }));
            }
            return(false);
        }
Esempio n. 9
0
        // Function from file: slime_extracts.dm
        public override void on_reaction(Reagents holder = null, double?created_volume = null)
        {
            dynamic    T = null;
            Mob_Living M = null;

            GlobalFuncs.feedback_add_details("slime_cores_used", "" + this.type);
            T = GlobalFuncs.get_turf(holder.my_atom);
            ((Ent_Static)T).visible_message("<span class='danger'>The slime extract begins to vibrate adorably !</span>");
            Task13.Schedule(50, (Task13.Closure)(() => {
                if (holder != null && Lang13.Bool(holder.my_atom))
                {
                    GlobalFuncs.playsound(GlobalFuncs.get_turf(holder.my_atom), "sound/effects/phasein.ogg", 100, 1);

                    foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInRange(7, GlobalFuncs.get_turf(holder.my_atom)), typeof(Mob_Living)))
                    {
                        M = _a;

                        M.bodytemperature -= 240;
                        M.WriteMsg("<span class='notice'>You feel a chill!</span>");
                    }
                }
                return;
            }));
            return;
        }
Esempio n. 10
0
        // Function from file: walls_reinforced.dm
        public override bool attack_animal(Mob_Living user = null)
        {
            user.changeNext_move(8);
            user.do_attack_animation(this);

            if (Convert.ToInt32(((dynamic)user).environment_smash) == 3)
            {
                this.dismantle_wall(true);
                GlobalFuncs.playsound(this, "sound/effects/meteorimpact.ogg", 100, 1);
                user.WriteMsg("<span class='notice'>You smash through the wall.</span>");
            }
            else
            {
                user.WriteMsg("<span class='warning'>This wall is far too strong for you to destroy.</span>");
            }
            return(false);
        }
Esempio n. 11
0
 // Function from file: mutations.dm
 public override void on_life(Mob_Living owner = null)
 {
     if (Convert.ToDouble(owner.health) < 0)
     {
         this.on_losing(owner);
         owner.WriteMsg("<span class='danger'>You suddenly feel very weak.</span>");
     }
     return;
 }
Esempio n. 12
0
 // Function from file: weather.dm
 public virtual void storm_act(Mob_Living L = null)
 {
     if (Rand13.PercentChance(30))
     {
         L.WriteMsg("You're buffeted by the storm!");
         L.adjustBruteLoss(1);
     }
     return;
 }
Esempio n. 13
0
        // Function from file: shriek.dm
        public override dynamic sting_action(Mob user = null, Ent_Static target = null)
        {
            Mob_Living          M = null;
            Obj_Machinery_Light L = null;


            foreach (dynamic _a in Lang13.Enumerate(GlobalFuncs.get_hearers_in_view(4, user), typeof(Mob_Living)))
            {
                M = _a;


                if (M is Mob_Living_Carbon)
                {
                    if (!(M.mind != null) || !(M.mind.changeling != null))
                    {
                        M.adjustEarDamage(0, 30);
                        M.confused += 25;
                        M.Jitter(50);
                    }
                    else
                    {
                        M.WriteMsg(new Sound("sound/effects/screech.ogg"));
                    }
                }

                if (M is Mob_Living_Silicon)
                {
                    M.WriteMsg(new Sound("sound/weapons/flash.ogg"));
                    M.Weaken(Rand13.Int(5, 10));
                }
            }

            foreach (dynamic _b in Lang13.Enumerate(Map13.FetchInRange(user, 4), typeof(Obj_Machinery_Light)))
            {
                L = _b;

                L.on = true;
                L.broken();
            }
            GlobalFuncs.feedback_add_details("changeling_powers", "RS");
            return(1);
        }
        // Function from file: absorb.dm
        public override dynamic sting_action(Mob user = null, Ent_Static target = null)
        {
            dynamic           G          = null;
            Mob_Living        target2    = null;
            Changeling        changeling = null;
            Mob_Dead_Observer ghost      = null;

            G          = user.get_active_hand();
            target2    = G.affecting;
            changeling = user.mind.changeling;
            user.WriteMsg("<span class='notice'>We tighen our grip. We must hold still....</span>");
            target2.do_jitter_animation(500);
            ((Mob_Living)user).do_jitter_animation(500);

            if (!GlobalFuncs.do_mob(user, target2, 20))
            {
                user.WriteMsg("<span class='warning'>The body swap has been interrupted!</span>");
                return(null);
            }
            target2.WriteMsg("<span class='userdanger'>" + user + " tightens their grip as a painful sensation invades your body.</span>");

            if (!changeling.has_dna(((dynamic)target2).dna))
            {
                changeling.add_new_profile(target2, user);
            }
            changeling.remove_profile(user);
            ghost = target2.ghostize(false);
            user.mind.transfer_to(target2);

            if (ghost != null)
            {
                ghost.mind.transfer_to(user);

                if (Lang13.Bool(ghost.key))
                {
                    user.key = ghost.key;
                }
            }
            user.Paralyse(2);
            target2.WriteMsg("<span class='warning'>Our genes cry out as we swap our " + user + " form for " + target2 + ".</span>");
            return(null);
        }
Esempio n. 15
0
 // Function from file: species_types.dm
 public override bool handle_chemicals(dynamic chem = null, Mob_Living H = null)
 {
     if (chem.id == "mutationtoxin")
     {
         H.WriteMsg("<span class='danger'>Your flesh rapidly mutates!</span>");
         H.set_species(typeof(Species_Jelly_Slime));
         H.reagents.del_reagent(chem.type);
         H.faction |= "slime";
         return(true);
     }
     return(false);
 }
Esempio n. 16
0
        // Function from file: shadowling.dm
        public override void spec_life(Mob_Living H = null)
        {
            double     light_amount = 0;
            Ent_Static T            = null;


            if (!H.weakeyes)
            {
                H.weakeyes = true;
            }
            light_amount = 0;
            H.nutrition  = 450;

            if (H.loc is Tile)
            {
                T            = H.loc;
                light_amount = ((Tile)T).get_lumcount();

                if (light_amount > 4 && !(H.incorporeal_move != 0))
                {
                    H.take_overall_damage(0, 7);

                    if (H.stat != 2)
                    {
                        H.WriteMsg("<span class='userdanger'>The light burns you!</span>");
                        H.WriteMsg("sound/weapons/sear.ogg");
                    }
                }
                else if (light_amount < 2)
                {
                    H.heal_overall_damage(5, 5);
                    H.adjustToxLoss(-5);
                    H.adjustBrainLoss(-25);
                    H.adjustCloneLoss(-1);
                    H.SetWeakened(0);
                    H.SetStunned(0);
                }
            }
            return;
        }
Esempio n. 17
0
        // Function from file: effects_foam.dm
        public override bool attack_animal(Mob_Living user = null)
        {
            user.changeNext_move(8);
            user.do_attack_animation(this);

            if (Convert.ToDouble(((dynamic)user).environment_smash) >= 1)
            {
                user.do_attack_animation(this);
                user.WriteMsg("<span class='notice'>You smash apart the foam wall.</span>");
                GlobalFuncs.qdel(this);
                return(false);
            }
            return(false);
        }
Esempio n. 18
0
        // Function from file: walls.dm
        public override bool attack_animal(Mob_Living user = null)
        {
            user.changeNext_move(8);
            user.do_attack_animation(this);

            if (Convert.ToDouble(((dynamic)user).environment_smash) >= 2)
            {
                GlobalFuncs.playsound(this, "sound/effects/meteorimpact.ogg", 100, 1);
                user.WriteMsg("<span class='notice'>You smash through the wall.</span>");
                this.dismantle_wall(true);
                return(false);
            }
            return(false);
        }
Esempio n. 19
0
        // Function from file: lighting.dm
        public override bool attack_animal(Mob_Living user = null)
        {
            if (Lang13.Bool(((dynamic)user).melee_damage_upper) == false)
            {
                return(false);
            }

            if (this.status == 1 || this.status == 2)
            {
                user.WriteMsg("<span class='danger'>That object is useless to you.</span>");
                return(false);
            }
            else if (this.status == 0 || this.status == 3)
            {
                user.do_attack_animation(this);
                this.visible_message("<span class='danger'>" + user.name + " smashed the light!</span>", "<span class='italics'>You hear a tinkle of breaking glass.</span>");
                this.broken();
            }
            return(false);
        }
Esempio n. 20
0
        // Function from file: portable_turret.dm
        public override bool attack_animal(Mob_Living user = null)
        {
            user.changeNext_move(8);
            user.do_attack_animation(this);

            if (Lang13.Bool(((dynamic)user).melee_damage_upper) == false || ((dynamic)user).melee_damage_type != "brute" && ((dynamic)user).melee_damage_type != "fire")
            {
                return(false);
            }

            if (!((this.stat & 1) != 0))
            {
                this.visible_message("<span class='danger'>" + user + " " + ((dynamic)user).attacktext + " " + this + "!</span>");
                GlobalFuncs.add_logs(user, this, "attacked");
                this.take_damage(((dynamic)user).melee_damage_upper);
            }
            else
            {
                user.WriteMsg("<span class='danger'>That object is useless to you.</span>");
            }
            return(false);
        }
Esempio n. 21
0
        // Function from file: Malf_Modules.dm
        public void detonate(int?z_level = null)
        {
            z_level = z_level ?? 1;

            dynamic    M = null;
            Mob_Living L = null;
            dynamic    T = null;


            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.player_list))
            {
                M = _a;

                M.WriteMsg("sound/machines/Alarm.ogg");
            }
            Task13.Sleep(100);

            foreach (dynamic _b in Lang13.Enumerate(GlobalVars.mob_list, typeof(Mob_Living)))
            {
                L = _b;

                T = GlobalFuncs.get_turf(L);

                if (Lang13.IntNullable(T.z) != z_level)
                {
                    continue;
                }

                if (L is Mob_Living_Silicon)
                {
                    continue;
                }
                L.WriteMsg("<span class='danger'><B>The blast wave from the " + this + " tears you atom from atom!</B></span>");
                L.dust();
            }
            Game13.WriteMsg("<B>The AI cleansed the station of life with the doomsday device!</B>");
            GlobalVars.ticker.force_ending = 1;
            return;
        }
Esempio n. 22
0
        // Function from file: species_types.dm
        public override void spec_life(Mob_Living H = null)
        {
            Action_Innate_SplitBody  S  = null;
            Reagent_Toxin_Slimejelly S2 = null;


            if (this.recently_changed)
            {
                S = new Action_Innate_SplitBody();
                S.Grant(H);
            }

            foreach (dynamic _a in Lang13.Enumerate(H.reagents.reagent_list, typeof(Reagent_Toxin_Slimejelly)))
            {
                S2 = _a;


                if (S2.volume >= 200)
                {
                    if (Rand13.PercentChance(5))
                    {
                        H.WriteMsg("<span class='notice'>You feel very bloated!</span>");
                    }
                }

                if (S2.volume < 200)
                {
                    if (H.nutrition >= 450)
                    {
                        H.reagents.add_reagent("slimejelly", 0.5);
                        H.nutrition -= 2.5;
                    }
                }
            }
            base.spec_life(H);
            return;
        }
        // Function from file: aid.dm
        public override bool start(  )
        {
            Mob_Living L = null;
            bool       spell_improved     = false;
            Obj_Effect_ProcHolder_Spell S = null;


            foreach (dynamic _b in Lang13.Enumerate(GlobalVars.mob_list, typeof(Mob_Living)))
            {
                L = _b;


                if (L.mind != null && L.mind.spell_list.len != 0)
                {
                    spell_improved = false;

                    foreach (dynamic _a in Lang13.Enumerate(L.mind.spell_list, typeof(Obj_Effect_ProcHolder_Spell)))
                    {
                        S = _a;


                        if (Lang13.Bool(S.clothes_req))
                        {
                            S.clothes_req  = 0;
                            spell_improved = true;
                        }
                    }

                    if (spell_improved)
                    {
                        L.WriteMsg("<span class='notice'>You suddenly feel like you never needed those garish robes in the first place...</span>");
                    }
                }
            }
            return(false);
        }
Esempio n. 24
0
        // Function from file: aid.dm
        public override bool start(  )
        {
            Mob_Living L = null;
            Obj_Effect_ProcHolder_Spell S = null;


            foreach (dynamic _c in Lang13.Enumerate(GlobalVars.mob_list, typeof(Mob_Living)))
            {
                L = _c;


                if (L.mind != null && L.mind.spell_list.len != 0)
                {
                    foreach (dynamic _b in Lang13.Enumerate(L.mind.spell_list, typeof(Obj_Effect_ProcHolder_Spell)))
                    {
                        S = _b;

                        S.name = Lang13.Initial(S, "name");
                        S.spell_level++;

                        if (S.spell_level >= 6 || S.charge_max <= 0)
                        {
                            continue;
                        }

                        if (S.level_max <= 0)
                        {
                            continue;
                        }
                        S.charge_max = Num13.Floor(Convert.ToDouble(Lang13.Initial(S, "charge_max") - S.spell_level * Convert.ToDouble(Lang13.Initial(S, "charge_max") - S.cooldown_min) / S.level_max));

                        if (S.charge_max < S.charge_counter)
                        {
                            S.charge_counter = S.charge_max;
                        }

                        switch ((int)(S.spell_level))
                        {
                        case 1:
                            S.name = "Efficient " + S.name;
                            break;

                        case 2:
                            S.name = "Quickened " + S.name;
                            break;

                        case 3:
                            S.name = "Free " + S.name;
                            break;

                        case 4:
                            S.name = "Instant " + S.name;
                            break;

                        case 5:
                            S.name = "Ludicrous " + S.name;
                            break;
                        }
                    }
                    L.WriteMsg("<span class='notice'>You suddenly feel more competent with your casting!</span>");
                }
            }
            return(false);
        }
Esempio n. 25
0
        // Function from file: summonitem.dm
        public override bool cast(dynamic targets = null, dynamic thearea = null, dynamic user = null)
        {
            thearea = thearea ?? Task13.User;

            Mob_Living L                  = null;
            ByTable    hand_items         = null;
            bool       butterfingers      = false;
            string     message            = null;
            Obj        item               = null;
            Ent_Static item_to_retrive    = null;
            int        infinite_recursion = 0;
            Ent_Static organ              = null;
            Ent_Static M                  = null;
            Ent_Static C                  = null;
            Ent_Static P                  = null;


            foreach (dynamic _b in Lang13.Enumerate(targets, typeof(Mob_Living)))
            {
                L = _b;

                hand_items    = new ByTable(new object [] { L.get_active_hand(), L.get_inactive_hand() });
                butterfingers = false;
                message       = null;

                if (!(this.marked_item != null))
                {
                    message = "<span class='notice'>";

                    foreach (dynamic _a in Lang13.Enumerate(hand_items, typeof(Obj)))
                    {
                        item = _a;


                        if (Lang13.Bool(item.flags.Contains(128)))
                        {
                            continue;
                        }

                        if (Lang13.Bool(item.flags.Contains(2)))
                        {
                            message += "Though it feels redundant, ";
                        }
                        this.marked_item = item;
                        message         += "You mark " + item + " for recall.</span>";
                        this.name        = "Recall " + item;
                        break;
                    }

                    if (!(this.marked_item != null))
                    {
                        if (hand_items != null)
                        {
                            message = "<span class='caution'>You aren't holding anything that can be marked for recall.</span>";
                        }
                        else
                        {
                            message = "<span class='notice'>You must hold the desired item in your hands to mark it for recall.</span>";
                        }
                    }
                }
                else if (hand_items.Contains(this.marked_item != null && this.marked_item != null))
                {
                    message          = "<span class='notice'>You remove the mark on " + this.marked_item + " to use elsewhere.</span>";
                    this.name        = "Instant Summons";
                    this.marked_item = null;
                }
                else if (this.marked_item != null && Lang13.Bool(this.marked_item.gc_destroyed))
                {
                    message          = "<span class='warning'>You sense your marked item has been destroyed!</span>";
                    this.name        = "Instant Summons";
                    this.marked_item = null;
                }
                else
                {
                    item_to_retrive    = this.marked_item;
                    infinite_recursion = 0;

                    if (!(item_to_retrive.loc != null))
                    {
                        if (GlobalFuncs.isorgan(item_to_retrive))
                        {
                            organ = item_to_retrive;

                            if (Lang13.Bool(((dynamic)organ).owner))
                            {
                                GlobalFuncs.add_logs(L, ((dynamic)organ).owner, "magically removed " + organ.name + " from", null, "INTENT: " + String13.ToUpper(L.a_intent));
                                ((dynamic)organ).Remove(((dynamic)organ).owner);
                            }
                        }
                    }
                    else
                    {
                        while (!(item_to_retrive.loc is Tile) && infinite_recursion < 10)
                        {
                            if (item_to_retrive.loc is Mob)
                            {
                                M = item_to_retrive.loc;

                                if (M is Mob_Living_Silicon)
                                {
                                    M.loc.visible_message("<span class='warning'>" + M + " suddenly disappears!</span>");
                                    M.loc = L.loc;
                                    M.loc.visible_message("<span class='caution'>" + M + " suddenly appears!</span>");
                                    item_to_retrive = null;
                                    break;
                                }
                                ((Mob)M).unEquip(item_to_retrive);

                                if (M is Mob_Living_Carbon)
                                {
                                    C = M;

                                    if (Lang13.Bool(((dynamic)C).stomach_contents.Contains(Lang13.Bool(((dynamic)C).stomach_contents) && item_to_retrive != null)))
                                    {
                                        ((dynamic)C).stomach_contents -= item_to_retrive;
                                    }
                                }
                            }
                            else
                            {
                                if (item_to_retrive.loc is Obj_Machinery_PortableAtmospherics)
                                {
                                    P = item_to_retrive.loc;
                                    ((dynamic)P).disconnect();
                                    ((dynamic)P).update_icon();
                                }
                                item_to_retrive = item_to_retrive.loc;
                            }
                            infinite_recursion += 1;
                        }
                    }

                    if (!(item_to_retrive != null))
                    {
                        return(false);
                    }

                    if (item_to_retrive.loc != null)
                    {
                        item_to_retrive.loc.visible_message("<span class='warning'>The " + item_to_retrive.name + " suddenly disappears!</span>");
                    }

                    if (L.hand)
                    {
                        if (!L.equip_to_slot_if_possible(item_to_retrive, 4, false, true, true))
                        {
                            if (!L.equip_to_slot_if_possible(item_to_retrive, 5, false, true, true))
                            {
                                butterfingers = true;
                            }
                        }
                    }
                    else if (!L.equip_to_slot_if_possible(item_to_retrive, 5, false, true, true))
                    {
                        if (!L.equip_to_slot_if_possible(item_to_retrive, 4, false, true, true))
                        {
                            butterfingers = true;
                        }
                    }

                    if (butterfingers)
                    {
                        item_to_retrive.loc = L.loc;
                        item_to_retrive.loc.visible_message("<span class='caution'>The " + item_to_retrive.name + " suddenly appears!</span>");
                        GlobalFuncs.playsound(GlobalFuncs.get_turf(L), "sound/magic/SummonItems_generic.ogg", 50, 1);
                    }
                    else
                    {
                        item_to_retrive.loc.visible_message("<span class='caution'>The " + item_to_retrive.name + " suddenly appears in " + L + "'s hand!</span>");
                        GlobalFuncs.playsound(GlobalFuncs.get_turf(L), "sound/magic/SummonItems_generic.ogg", 50, 1);
                    }
                }

                if (Lang13.Bool(message))
                {
                    L.WriteMsg(message);
                }
            }
            return(false);
        }
        // Function from file: experimentor.dm
        public void experiment(double?exp = null, dynamic exp_on = null)
        {
            dynamic    chosenchem       = null;
            dynamic    criticalReaction = null;
            Mob_Living m        = null;
            dynamic    target   = null;
            dynamic    throwing = null;
            dynamic    T        = null;
            Obj_Effect_Decal_Cleanable_Greenglow reagentdecal = null;
            string   savedName = null;
            dynamic  newPath   = null;
            dynamic  CG        = null;
            Reagents R         = null;
            EffectSystem_SmokeSpread_Chem smoke = null;
            Reagents R2 = null;
            EffectSystem_SmokeSpread_Chem smoke2 = null;
            Obj_Item_Weapon_ReagentContainers_Food_Drinks_Coffee C = null;
            dynamic start = null;
            dynamic M     = null;
            dynamic MT    = null;
            Obj_Item_Projectile_Magic_Fireball FB = null;
            GasMixture env                  = null;
            double     transfer_moles       = 0;
            GasMixture removed              = null;
            double?    heat_capacity        = null;
            Mob_Living m2                   = null;
            Obj_Machinery_Vending_Coffee C2 = null;
            Reagents R3 = null;
            EffectSystem_SmokeSpread_Chem smoke3 = null;
            GasMixture env2                 = null;
            double     transfer_moles2      = 0;
            GasMixture removed2             = null;
            double?    heat_capacity2       = null;
            EffectSystem_SmokeSpread smoke4 = null;
            dynamic     material            = null;
            Ent_Dynamic AM         = null;
            ByTable     throwAt    = null;
            Ent_Dynamic AM2        = null;
            int?        counter    = null;
            Ent_Dynamic cast       = null;
            dynamic     a          = null;
            dynamic     b          = null;
            dynamic     R4         = null;
            int         globalMalf = 0;
            Mob_Living  m3         = null;
            ByTable     reqs       = null;
            dynamic     T2         = null;

            this.recentlyExperimented = true;
            this.icon_state           = "h_lathe_wloop";
            criticalReaction          = Lang13.FindIn(exp_on, (this.critical_items != null ? GlobalVars.TRUE : GlobalVars.FALSE));

            if (exp == 1)
            {
                this.visible_message("" + this + " prods at " + exp_on + " with mechanical arms.");

                if (Rand13.PercentChance(35) && Lang13.Bool(criticalReaction))
                {
                    this.visible_message("" + exp_on + " is gripped in just the right way, enhancing its focus.");
                    this.badThingCoeff++;
                }

                if (Rand13.PercentChance(((int)(20 - this.badThingCoeff))))
                {
                    this.visible_message("<span class='danger'>" + this + " malfunctions and destroys " + exp_on + ", lashing its arms out at nearby people!</span>");

                    foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInViewExcludeThis(this, 1), typeof(Mob_Living)))
                    {
                        m = _a;

                        m.apply_damage(15, "brute", Rand13.Pick(new object [] { "head", "chest", "groin" }));
                        this.investigate_log("Experimentor dealt minor brute to " + m + ".", "experimentor");
                    }
                    this.ejectItem(GlobalVars.TRUE);
                }

                if (Rand13.PercentChance(((int)(35 - this.badThingCoeff))))
                {
                    this.visible_message("<span class='warning'>" + this + " malfunctions!</span>");
                    exp = 6;
                }

                if (Rand13.PercentChance(((int)(50 - this.badThingCoeff))))
                {
                    this.visible_message("<span class='danger'>" + this + " malfunctions, throwing the " + exp_on + "!</span>");
                    target = Lang13.FindIn(typeof(Mob_Living), Map13.FetchInViewExcludeThis(this, 7));

                    if (Lang13.Bool(target))
                    {
                        throwing = this.loaded_item;
                        this.investigate_log("Experimentor has thrown " + this.loaded_item + " at " + target, "experimentor");
                        this.ejectItem();

                        if (Lang13.Bool(throwing))
                        {
                            ((Ent_Dynamic)throwing).throw_at(target, 10, 1);
                        }
                    }
                }
            }

            if (exp == 2)
            {
                this.visible_message("<span class='danger'>" + this + " reflects radioactive rays at " + exp_on + "!</span>");

                if (Rand13.PercentChance(35) && Lang13.Bool(criticalReaction))
                {
                    this.visible_message("" + exp_on + " has activated an unknown subroutine!");
                    this.cloneMode  = GlobalVars.TRUE;
                    this.cloneCount = this.badThingCoeff;
                    this.investigate_log("Experimentor has made a clone of " + exp_on, "experimentor");
                    this.ejectItem();
                }

                if (Rand13.PercentChance(((int)(20 - this.badThingCoeff))))
                {
                    this.visible_message("<span class='danger'>" + this + " malfunctions, melting " + exp_on + " and leaking radiation!</span>");
                    GlobalFuncs.radiation_pulse(GlobalFuncs.get_turf(this), 1, 1, 25, true);
                    this.ejectItem(GlobalVars.TRUE);
                }

                if (Rand13.PercentChance(((int)(35 - this.badThingCoeff))))
                {
                    this.visible_message("<span class='warning'>" + this + " malfunctions, spewing toxic waste!</span>");

                    foreach (dynamic _b in Lang13.Enumerate(Map13.FetchInViewExcludeThis(this, 1)))
                    {
                        T = _b;


                        if (!T.density)
                        {
                            if (Rand13.PercentChance(95))
                            {
                                reagentdecal = new Obj_Effect_Decal_Cleanable_Greenglow(T);
                                reagentdecal.reagents.add_reagent("radium", 7);
                            }
                        }
                    }
                }

                if (Rand13.PercentChance(((int)(50 - this.badThingCoeff))))
                {
                    savedName = "" + exp_on;
                    this.ejectItem(GlobalVars.TRUE);
                    newPath          = this.pickWeighted(this.valid_items);
                    this.loaded_item = Lang13.Call(newPath, this);
                    this.visible_message("<span class='warning'>" + this + " malfunctions, transforming " + savedName + " into " + this.loaded_item + "!</span>");
                    this.investigate_log("Experimentor has transformed " + savedName + " into " + this.loaded_item, "experimentor");

                    if (this.loaded_item is Obj_Item_Weapon_Grenade_ChemGrenade)
                    {
                        CG = this.loaded_item;
                        ((Obj_Item_Weapon_Grenade)CG).prime();
                    }
                    this.ejectItem();
                }
            }

            if (exp == 3)
            {
                this.visible_message("<span class='warning'>" + this + " fills its chamber with gas, " + exp_on + " included.</span>");

                if (Rand13.PercentChance(35) && Lang13.Bool(criticalReaction))
                {
                    this.visible_message("" + exp_on + " achieves the perfect mix!");
                    new Obj_Item_Stack_Sheet_Mineral_Plasma(GlobalFuncs.get_turf(Rand13.PickFromTable(Map13.FetchInViewExcludeThis(this, 1))));
                }

                if (Rand13.PercentChance(((int)(20 - this.badThingCoeff))))
                {
                    this.visible_message("<span class='danger'>" + this + " destroys " + exp_on + ", leaking dangerous gas!</span>");
                    chosenchem = Rand13.Pick(new object [] { "carbon", "radium", "toxin", "condensedcapsaicin", "mushroomhallucinogen", "space_drugs", "ethanol", "beepskysmash" });
                    R          = new Reagents(50);
                    R.my_atom  = this;
                    R.add_reagent(chosenchem, 50);
                    this.investigate_log("Experimentor has released " + chosenchem + " smoke.", "experimentor");
                    smoke = new EffectSystem_SmokeSpread_Chem();
                    smoke.set_up(R, 0, this);
                    GlobalFuncs.playsound(this.loc, "sound/effects/smoke.ogg", 50, 1, -3);
                    smoke.start();
                    GlobalFuncs.qdel(R);
                    this.ejectItem(GlobalVars.TRUE);
                }

                if (Rand13.PercentChance(((int)(20 - this.badThingCoeff))))
                {
                    this.visible_message("<span class='danger'>" + this + "'s chemical chamber has sprung a leak!</span>");
                    chosenchem = Rand13.Pick(new object [] { "mutationtoxin", "nanomachines", "sacid" });
                    R2         = new Reagents(50);
                    R2.my_atom = this;
                    R2.add_reagent(chosenchem, 50);
                    smoke2 = new EffectSystem_SmokeSpread_Chem();
                    smoke2.set_up(R2, 0, this);
                    GlobalFuncs.playsound(this.loc, "sound/effects/smoke.ogg", 50, 1, -3);
                    smoke2.start();
                    GlobalFuncs.qdel(R2);
                    this.ejectItem(GlobalVars.TRUE);
                    this.warn_admins(Task13.User, "" + chosenchem + " smoke");
                    this.investigate_log("Experimentor has released <font color='red'>" + chosenchem + "</font> smoke!", "experimentor");
                }

                if (Rand13.PercentChance(((int)(35 - this.badThingCoeff))))
                {
                    this.visible_message("" + this + " malfunctions, spewing harmless gas.");
                    this.throwSmoke(this.loc);
                }

                if (Rand13.PercentChance(((int)(50 - this.badThingCoeff))))
                {
                    this.visible_message("<span class='warning'>" + this + " melts " + exp_on + ", ionizing the air around it!</span>");
                    GlobalFuncs.empulse(this.loc, 4, 6);
                    this.investigate_log("Experimentor has generated an Electromagnetic Pulse.", "experimentor");
                    this.ejectItem(GlobalVars.TRUE);
                }
            }

            if (exp == 4)
            {
                this.visible_message("" + this + " raises " + exp_on + "'s temperature.");

                if (Rand13.PercentChance(35) && Lang13.Bool(criticalReaction))
                {
                    this.visible_message("<span class='warning'>" + this + "'s emergency coolant system gives off a small ding!</span>");
                    GlobalFuncs.playsound(this.loc, "sound/machines/ding.ogg", 50, 1);
                    C          = new Obj_Item_Weapon_ReagentContainers_Food_Drinks_Coffee(GlobalFuncs.get_turf(Rand13.PickFromTable(Map13.FetchInViewExcludeThis(this, 1))));
                    chosenchem = Rand13.Pick(new object [] { "plasma", "capsaicin", "ethanol" });
                    C.reagents.remove_any(25);
                    C.reagents.add_reagent(chosenchem, 50);
                    C.name = "Cup of Suspicious Liquid";
                    C.desc = "It has a large hazard symbol printed on the side in fading ink.";
                    this.investigate_log("Experimentor has made a cup of " + chosenchem + " coffee.", "experimentor");
                }

                if (Rand13.PercentChance(((int)(20 - this.badThingCoeff))))
                {
                    start = GlobalFuncs.get_turf(this);
                    M     = Lang13.FindIn(typeof(Mob_Living), Map13.FetchInView(3, this));
                    MT    = GlobalFuncs.get_turf(M);

                    if (Lang13.Bool(MT))
                    {
                        this.visible_message("<span class='danger'>" + this + " dangerously overheats, launching a flaming fuel orb!</span>");
                        this.investigate_log("Experimentor has launched a <font color='red'>fireball</font> at " + M + "!", "experimentor");
                        FB          = new Obj_Item_Projectile_Magic_Fireball(start);
                        FB.original = MT;
                        FB.current  = start;
                        FB.yo       = Convert.ToDouble(MT.y - start.y);
                        FB.xo       = Convert.ToDouble(MT.x - start.x);
                        FB.fire();
                    }
                }

                if (Rand13.PercentChance(((int)(35 - this.badThingCoeff))))
                {
                    this.visible_message("<span class='danger'>" + this + " malfunctions, melting " + exp_on + " and releasing a burst of flame!</span>");
                    GlobalFuncs.explosion(this.loc, -1, 0, 0, 0, 0, null, 2);
                    this.investigate_log("Experimentor started a fire.", "experimentor");
                    this.ejectItem(GlobalVars.TRUE);
                }

                if (Rand13.PercentChance(((int)(50 - this.badThingCoeff))))
                {
                    this.visible_message("<span class='warning'>" + this + " malfunctions, melting " + exp_on + " and leaking hot air!</span>");
                    env            = this.loc.return_air();
                    transfer_moles = env.total_moles() * 0.25;
                    removed        = env.remove(transfer_moles);

                    if (removed != null)
                    {
                        heat_capacity = removed.heat_capacity();

                        if (heat_capacity == 0 || heat_capacity == null)
                        {
                            heat_capacity = 1;
                        }
                        removed.temperature = Num13.MinInt(Convert.ToInt32((removed.temperature * heat_capacity + 100000) / heat_capacity), 1000);
                    }
                    env.merge(removed);
                    this.air_update_turf();
                    this.investigate_log("Experimentor has released hot air.", "experimentor");
                    this.ejectItem(GlobalVars.TRUE);
                }

                if (Rand13.PercentChance(((int)(50 - this.badThingCoeff))))
                {
                    this.visible_message("<span class='warning'>" + this + " malfunctions, activating its emergency coolant systems!</span>");
                    this.throwSmoke(this.loc);

                    foreach (dynamic _c in Lang13.Enumerate(Map13.FetchInViewExcludeThis(this, 1), typeof(Mob_Living)))
                    {
                        m2 = _c;

                        m2.apply_damage(5, "burn", Rand13.Pick(new object [] { "head", "chest", "groin" }));
                        this.investigate_log("Experimentor has dealt minor burn damage to " + m2, "experimentor");
                    }
                    this.ejectItem();
                }
            }

            if (exp == 5)
            {
                this.visible_message("" + this + " lowers " + exp_on + "'s temperature.");

                if (Rand13.PercentChance(35) && Lang13.Bool(criticalReaction))
                {
                    this.visible_message("<span class='warning'>" + this + "'s emergency coolant system gives off a small ding!</span>");
                    C2 = new Obj_Machinery_Vending_Coffee(GlobalFuncs.get_turf(Rand13.PickFromTable(Map13.FetchInViewExcludeThis(this, 1))));
                    GlobalFuncs.playsound(this.loc, "sound/machines/ding.ogg", 50, 1);
                    chosenchem = Rand13.Pick(new object [] { "uranium", "frostoil", "ephedrine" });
                    C2.reagents.remove_any(25);
                    C2.reagents.add_reagent(chosenchem, 50);
                    C2.name = "Cup of Suspicious Liquid";
                    C2.desc = "It has a large hazard symbol printed on the side in fading ink.";
                    this.investigate_log("Experimentor has made a cup of " + chosenchem + " coffee.", "experimentor");
                }

                if (Rand13.PercentChance(((int)(20 - this.badThingCoeff))))
                {
                    this.visible_message("<span class='danger'>" + this + " malfunctions, shattering " + exp_on + " and releasing a dangerous cloud of coolant!</span>");
                    R3         = new Reagents(50);
                    R3.my_atom = this;
                    R3.add_reagent("frostoil", 50);
                    this.investigate_log("Experimentor has released frostoil gas.", "experimentor");
                    smoke3 = new EffectSystem_SmokeSpread_Chem();
                    smoke3.set_up(R3, 0, this);
                    GlobalFuncs.playsound(this.loc, "sound/effects/smoke.ogg", 50, 1, -3);
                    smoke3.start();
                    GlobalFuncs.qdel(R3);
                    this.ejectItem(GlobalVars.TRUE);
                }

                if (Rand13.PercentChance(((int)(35 - this.badThingCoeff))))
                {
                    this.visible_message("<span class='warning'>" + this + " malfunctions, shattering " + exp_on + " and leaking cold air!</span>");
                    env2            = this.loc.return_air();
                    transfer_moles2 = env2.total_moles() * 0.25;
                    removed2        = env2.remove(transfer_moles2);

                    if (removed2 != null)
                    {
                        heat_capacity2 = removed2.heat_capacity();

                        if (heat_capacity2 == 0 || heat_capacity2 == null)
                        {
                            heat_capacity2 = 1;
                        }
                        removed2.temperature = (removed2.temperature * heat_capacity2 - 75000) / heat_capacity2;
                    }
                    env2.merge(removed2);
                    this.air_update_turf();
                    this.investigate_log("Experimentor has released cold air.", "experimentor");
                    this.ejectItem(GlobalVars.TRUE);
                }

                if (Rand13.PercentChance(((int)(50 - this.badThingCoeff))))
                {
                    this.visible_message("<span class='warning'>" + this + " malfunctions, releasing a flurry of chilly air as " + exp_on + " pops out!</span>");
                    smoke4 = new EffectSystem_SmokeSpread();
                    smoke4.set_up(0, this.loc);
                    smoke4.start();
                    this.ejectItem();
                }
            }

            if (exp == 6)
            {
                this.visible_message("<span class='warning'>" + exp_on + " activates the crushing mechanism, " + exp_on + " is destroyed!</span>");

                if (Rand13.PercentChance(35) && Lang13.Bool(criticalReaction))
                {
                    this.visible_message("<span class='warning'>" + this + "'s crushing mechanism slowly and smoothly descends, flattening the " + exp_on + "!</span>");
                    new Obj_Item_Stack_Sheet_Plasteel(GlobalFuncs.get_turf(Rand13.PickFromTable(Map13.FetchInViewExcludeThis(this, 1))));
                }

                if (this.linked_console.linked_lathe != null)
                {
                    foreach (dynamic _d in Lang13.Enumerate(exp_on.materials))
                    {
                        material = _d;

                        ((MaterialContainer)((dynamic)this.linked_console.linked_lathe).materials).insert_amount(Num13.MinInt(Convert.ToInt32(((dynamic)this.linked_console.linked_lathe).materials.max_amount - ((dynamic)this.linked_console.linked_lathe).materials.total_amount), Convert.ToInt32(exp_on.materials[material])), material);
                    }
                }

                if (Rand13.PercentChance(((int)(20 - this.badThingCoeff))))
                {
                    this.visible_message("<span class='danger'>" + this + "'s crusher goes way too many levels too high, crushing right through space-time!</span>");
                    GlobalFuncs.playsound(this.loc, "sound/effects/supermatter.ogg", 50, 1, -3);
                    this.investigate_log("Experimentor has triggered the 'throw things' reaction.", "experimentor");

                    foreach (dynamic _e in Lang13.Enumerate(Map13.FetchInViewExcludeThis(this, 7), typeof(Ent_Dynamic)))
                    {
                        AM = _e;


                        if (!Lang13.Bool(AM.anchored))
                        {
                            AM.throw_at_fast(this, 10, 1);
                        }
                    }
                }

                if (Rand13.PercentChance(((int)(35 - this.badThingCoeff))))
                {
                    this.visible_message("<span class='danger'>" + this + "'s crusher goes one level too high, crushing right into space-time!</span>");
                    GlobalFuncs.playsound(this.loc, "sound/effects/supermatter.ogg", 50, 1, -3);
                    this.investigate_log("Experimentor has triggered the 'minor throw things' reaction.", "experimentor");
                    throwAt = new ByTable();

                    foreach (dynamic _f in Lang13.Enumerate(Map13.FetchInViewExcludeThis(this, 7), typeof(Ent_Dynamic)))
                    {
                        AM2 = _f;


                        if (!Lang13.Bool(AM2.anchored))
                        {
                            throwAt.Add(AM2);
                        }
                    }
                    counter = null;
                    counter = 1;

                    while ((counter ?? 0) < throwAt.len)
                    {
                        cast = throwAt[counter];
                        cast.throw_at_fast(Rand13.PickFromTable(throwAt), 10, 1);
                        counter++;
                    }
                }
                this.ejectItem(GlobalVars.TRUE);
            }

            if (exp == 8)
            {
                a = Rand13.Pick(new object [] { "rumbles", "shakes", "vibrates", "shudders" });
                b = Rand13.Pick(new object [] { "crushes", "spins", "viscerates", "smashes", "insults" });
                this.visible_message("<span class='warning'>" + exp_on + " " + a + ", and " + b + ", the experiment was a failure.</span>");
            }

            if (exp == 7)
            {
                this.visible_message("" + this + " scans the " + exp_on + ", revealing its true nature!");
                GlobalFuncs.playsound(this.loc, "sound/effects/supermatter.ogg", 50, 3, -1);
                R4 = this.loaded_item;
                R4.reveal();
                this.investigate_log("Experimentor has revealed a relic with <span class='danger'>" + R4.realProc + "</span> effect.", "experimentor");
                this.ejectItem();
            }

            if (Rand13.PercentChance(((int)(20 - this.badThingCoeff))))
            {
                globalMalf = Rand13.Int(1, 100);

                if (globalMalf < 15)
                {
                    this.visible_message("<span class='warning'>" + this + "'s onboard detection system has malfunctioned!</span>");
                    this.item_reactions["" + exp_on.type] = Rand13.Pick(new object [] { 1, 2, 3, 4, 5, 6 });
                    this.ejectItem();
                }

                if (globalMalf > 16 && globalMalf < 35)
                {
                    this.visible_message("<span class='warning'>" + this + " melts " + exp_on + ", ian-izing the air around it!</span>");
                    this.throwSmoke(this.loc);

                    if (Lang13.Bool(this.trackedIan))
                    {
                        this.throwSmoke(this.trackedIan.loc);
                        this.trackedIan.loc = this.loc;
                        this.investigate_log("Experimentor has stolen Ian!", "experimentor");
                    }
                    else
                    {
                        new Mob_Living_SimpleAnimal_Pet_Dog_Corgi(this.loc);
                        this.investigate_log("Experimentor has spawned a new corgi.", "experimentor");
                    }
                    this.ejectItem(GlobalVars.TRUE);
                }

                if (globalMalf > 36 && globalMalf < 50)
                {
                    this.visible_message("<span class='warning'>" + this + " improves " + exp_on + ", drawing the life essence of those nearby!</span>");

                    foreach (dynamic _g in Lang13.Enumerate(Map13.FetchInView(this, 4), typeof(Mob_Living)))
                    {
                        m3 = _g;

                        m3.WriteMsg("<span class='danger'>You feel your flesh being torn from you, mists of blood drifting to " + this + "!</span>");
                        m3.apply_damage(50, "brute", "chest");
                        this.investigate_log("Experimentor has taken 50 brute a blood sacrifice from " + m3, "experimentor");
                    }
                    reqs = this.ConvertReqString2List(exp_on.origin_tech);

                    foreach (dynamic _h in Lang13.Enumerate(reqs))
                    {
                        T2 = _h;

                        reqs[T2] = reqs[T2] + 1;
                    }
                    exp_on.origin_tech = String13.MakeUrlParams(reqs);
                    this.investigate_log("Experimentor has set the origin tech of " + exp_on + " to " + exp_on.origin_tech, "experimentor");
                }

                if (globalMalf > 51 && globalMalf < 75)
                {
                    this.visible_message("<span class='warning'>" + this + " encounters a run-time error!</span>");
                    this.throwSmoke(this.loc);

                    if (Lang13.Bool(this.trackedRuntime))
                    {
                        this.throwSmoke(this.trackedRuntime.loc);
                        this.trackedRuntime.loc = this.loc;
                        this.investigate_log("Experimentor has stolen Runtime!", "experimentor");
                    }
                    else
                    {
                        new Mob_Living_SimpleAnimal_Pet_Cat(this.loc);
                        this.investigate_log("Experimentor failed to steal runtime, and instead spawned a new cat.", "experimentor");
                    }
                    this.ejectItem(GlobalVars.TRUE);
                }

                if (globalMalf > 76)
                {
                    this.visible_message("<span class='warning'>" + this + " begins to smoke and hiss, shaking violently!</span>");
                    this.f_use_power(500000);
                    this.investigate_log("Experimentor has drained power from its APC", "experimentor");
                }
            }
            Task13.Schedule(((int)(this.resetTime)), (Task13.Closure)(() => {
                this.icon_state           = "h_lathe";
                this.recentlyExperimented = false;
                return;
            }));
            return;
        }
Esempio n. 27
0
        // Function from file: special_shadowling_abilities.dm
        public override bool cast(dynamic targets = null, dynamic thearea = null, dynamic user = null)
        {
            thearea = thearea ?? Task13.User;

            dynamic    H              = null;
            string     hatch_or_no    = null;
            Obj_Item   I              = null;
            Mob_Living M              = null;
            Obj_Machinery_Power_Apc A = null;
            Mob_Living_SimpleAnimal_AscendantShadowling A2 = null;
            Obj_Effect_ProcHolder_Spell S = null;

            H = thearea;

            if (!this.shadowling_check(H))
            {
                return(false);
            }
            hatch_or_no = Interface13.Alert(H, "It is time to ascend. Are you sure about this?", null, "Yes", "No");

            switch ((string)(hatch_or_no))
            {
            case "No":
                H.WriteMsg("<span class='warning'>You decide against ascending for now.");
                this.charge_counter = this.charge_max;
                return(false);

                break;

            case "Yes":
                H.notransform = 1;
                ((Ent_Static)H).visible_message("<span class='warning'>" + H + "'s things suddenly slip off. They gently rise into the air, red light glowing in their eyes.</span>", "<span class='shadowling'>You rise into the air and get ready for your transformation.</span>");

                foreach (dynamic _d in Lang13.Enumerate(H, typeof(Obj_Item)))
                {
                    I = _d;

                    ((Mob)H).unEquip(I);
                    Task13.Sleep(50);
                    ((Ent_Static)H).visible_message("<span class='warning'>" + H + "'s skin begins to crack and harden.</span>", "<span class='shadowling'>Your flesh begins creating a shield around yourself.</span>");
                    Task13.Sleep(100);
                    ((Ent_Static)H).visible_message("<span class='warning'>The small horns on " + H + "'s head slowly grow and elongate.</span>", "<span class='shadowling'>Your body continues to mutate. Your telepathic abilities grow.</span>");
                    Task13.Sleep(90);
                    ((Ent_Static)H).visible_message("<span class='warning'>" + H + "'s body begins to violently stretch and contort.</span>", "<span class='shadowling'>You begin to rend apart the final barriers to godhood.</span>");
                    Task13.Sleep(40);
                    H.WriteMsg("<i><b>Yes!</b></i>");
                    Task13.Sleep(10);
                    H.WriteMsg("<i><b><span class='big'>YES!!</span></b></i>");
                    Task13.Sleep(10);
                    H.WriteMsg("<i><b><span class='reallybig'>YE--</span></b></i>");
                    Task13.Sleep(1);

                    foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInRangeExcludeThis(H, 7), typeof(Mob_Living)))
                    {
                        M = _a;

                        M.Weaken(10);
                        M.WriteMsg("<span class='userdanger'>An immense pressure slams you onto the ground!</span>");
                    }
                    Game13.WriteMsg("<font size=5><span class='shadowling'><b>\"VYSHA NERADA YEKHEZET U'RUU!!\"</font></span>");
                    Game13.WriteMsg("sound/hallucinations/veryfar_noise.ogg");

                    foreach (dynamic _b in Lang13.Enumerate(GlobalVars.apcs_list, typeof(Obj_Machinery_Power_Apc)))
                    {
                        A = _b;

                        A.overload_lighting();
                    }
                    A2 = new Mob_Living_SimpleAnimal_AscendantShadowling(H.loc);

                    foreach (dynamic _c in Lang13.Enumerate(H.mind.spell_list, typeof(Obj_Effect_ProcHolder_Spell)))
                    {
                        S = _c;


                        if (S == this)
                        {
                            continue;
                        }
                        ((Mind)H.mind).remove_spell(S);
                    }
                    H.mind.AddSpell(new Obj_Effect_ProcHolder_Spell_Targeted_Annihilate(null));
                    H.mind.AddSpell(new Obj_Effect_ProcHolder_Spell_Targeted_Hypnosis(null));
                    H.mind.AddSpell(new Obj_Effect_ProcHolder_Spell_Self_ShadowlingPhaseShift(null));
                    H.mind.AddSpell(new Obj_Effect_ProcHolder_Spell_AoeTurf_AscendantStorm(null));
                    H.mind.AddSpell(new Obj_Effect_ProcHolder_Spell_Self_ShadowlingHivemindAscendant(null));
                    ((Mind)H.mind).transfer_to(A2);
                    A2.name = H.real_name;

                    if (Lang13.Bool(A2.real_name))
                    {
                        A2.real_name = H.real_name;
                    }
                    H.invisibility = 60;
                    H.loc          = A2;
                    Task13.Sleep(50);

                    if (!GlobalVars.ticker.mode.shadowling_ascended)
                    {
                        GlobalVars.SSshuttle.emergency.request(null, 0.3);
                    }
                    GlobalVars.ticker.mode.shadowling_ascended = true;
                    A2.mind.remove_spell(this);
                    GlobalFuncs.qdel(H);
                }
                break;
            }
            return(false);
        }
        // Function from file: charge.dm
        public override bool cast(dynamic targets = null, dynamic thearea = null, dynamic user = null)
        {
            thearea = thearea ?? Task13.User;

            Mob_Living L                   = null;
            ByTable    hand_items          = null;
            dynamic    charged_item        = null;
            bool       burnt_out           = false;
            dynamic    M                   = null;
            Obj_Effect_ProcHolder_Spell S  = null;
            Obj_Effect_ProcHolder_Spell S2 = null;
            Obj item = null;
            Obj I    = null;
            Obj I2   = null;
            Obj W    = null;
            Obj C    = null;
            Obj I3   = null;
            Obj C2   = null;


            foreach (dynamic _e in Lang13.Enumerate(targets, typeof(Mob_Living)))
            {
                L = _e;

                hand_items   = new ByTable(new object [] { L.get_active_hand(), L.get_inactive_hand() });
                charged_item = null;
                burnt_out    = false;

                if (Lang13.Bool(L.pulling) && L.pulling is Mob_Living)
                {
                    M = L.pulling;

                    if (M.mob_spell_list.len != 0 || Lang13.Bool(M.mind) && M.mind.spell_list.len != 0)
                    {
                        foreach (dynamic _a in Lang13.Enumerate(M.mob_spell_list, typeof(Obj_Effect_ProcHolder_Spell)))
                        {
                            S = _a;

                            S.charge_counter = S.charge_max;
                        }

                        if (Lang13.Bool(M.mind))
                        {
                            foreach (dynamic _b in Lang13.Enumerate(M.mind.spell_list, typeof(Obj_Effect_ProcHolder_Spell)))
                            {
                                S2 = _b;

                                S2.charge_counter = S2.charge_max;
                            }
                        }
                        M.WriteMsg("<span class='notice'>you feel raw magic flowing through you, it feels good!</span>");
                    }
                    else
                    {
                        M.WriteMsg("<span class='notice'>you feel very strange for a moment, but then it passes.</span>");
                        burnt_out = true;
                    }
                    charged_item = M;
                    break;
                }

                foreach (dynamic _d in Lang13.Enumerate(hand_items, typeof(Obj)))
                {
                    item = _d;


                    if (item is Obj_Item_Weapon_Spellbook)
                    {
                        if (item is Obj_Item_Weapon_Spellbook_Oneuse)
                        {
                            I = item;

                            if (Rand13.PercentChance(80))
                            {
                                L.visible_message("<span class='warning'>" + I + " catches fire!</span>");
                                GlobalFuncs.qdel(I);
                            }
                            else
                            {
                                ((dynamic)I).used = 0;
                                charged_item      = I;
                                break;
                            }
                        }
                        else
                        {
                            L.WriteMsg("<span class='caution'>Glowing red letters appear on the front cover...</span>");
                            L.WriteMsg("<span class='warning'>" + Rand13.Pick(new object [] { "NICE TRY BUT NO!", "CLEVER BUT NOT CLEVER ENOUGH!", "SUCH FLAGRANT CHEESING IS WHY WE ACCEPTED YOUR APPLICATION!", "CUTE!", "YOU DIDN'T THINK IT'D BE THAT EASY, DID YOU?" }) + "</span>");
                            burnt_out = true;
                        }
                    }
                    else if (item is Obj_Item_Weapon_Gun_Magic)
                    {
                        I2 = item;

                        if (Rand13.PercentChance(80) && !Lang13.Bool(((dynamic)I2).can_charge))
                        {
                            ((dynamic)I2).max_charges--;
                        }

                        if (Convert.ToDouble(((dynamic)I2).max_charges) <= 0)
                        {
                            ((dynamic)I2).max_charges = 0;
                            burnt_out = true;
                        }
                        ((dynamic)I2).charges = ((dynamic)I2).max_charges;

                        if (item is Obj_Item_Weapon_Gun_Magic_Wand && Lang13.Bool(((dynamic)I2).max_charges) != false)
                        {
                            W            = item;
                            W.icon_state = Lang13.Initial(W, "icon_state");
                        }
                        charged_item = I2;
                        break;
                    }
                    else if (item is Obj_Item_Weapon_StockParts_Cell)
                    {
                        C = item;

                        if (Rand13.PercentChance(80))
                        {
                            ((dynamic)C).maxcharge -= 200;
                        }

                        if (Convert.ToDouble(((dynamic)C).maxcharge) <= 1)
                        {
                            ((dynamic)C).maxcharge = 1;
                            burnt_out = true;
                        }
                        ((dynamic)C).charge = ((dynamic)C).maxcharge;
                        charged_item        = C;
                        break;
                    }
                    else if (item.contents != null)
                    {
                        foreach (dynamic _c in Lang13.Enumerate(item.contents, typeof(Obj)))
                        {
                            I3 = _c;


                            if (I3 is Obj_Item_Weapon_StockParts_Cell)
                            {
                                C2 = I3;

                                if (Rand13.PercentChance(80))
                                {
                                    ((dynamic)C2).maxcharge -= 200;
                                }

                                if (Convert.ToDouble(((dynamic)C2).maxcharge) <= 1)
                                {
                                    ((dynamic)C2).maxcharge = 1;
                                    burnt_out = true;
                                }
                                ((dynamic)C2).charge = ((dynamic)C2).maxcharge;
                                item.update_icon();
                                charged_item = item;
                                break;
                            }
                        }
                    }
                }

                if (!Lang13.Bool(charged_item))
                {
                    L.WriteMsg("<span class='notice'>you feel magical power surging to your hands, but the feeling rapidly fades...</span>");
                }
                else if (burnt_out)
                {
                    L.WriteMsg("<span class='caution'>" + charged_item + " doesn't seem to be reacting to the spell...</span>");
                }
                else
                {
                    GlobalFuncs.playsound(GlobalFuncs.get_turf(L), "sound/magic/Charge.ogg", 50, 1);
                    L.WriteMsg("<span class='notice'>" + charged_item + " suddenly feels very warm!</span>");
                }
            }
            return(false);
        }
        // Function from file: absorb.dm
        public override dynamic sting_action(Mob user = null, Ent_Static target = null)
        {
            Changeling changeling     = null;
            dynamic    G              = null;
            Mob_Living target2        = null;
            int?       stage          = null;
            ByTable    recent_speech  = null;
            dynamic    spoken_memory  = null;
            dynamic    spoken_memory2 = null;

            changeling             = user.mind.changeling;
            G                      = user.get_active_hand();
            target2                = G.affecting;
            changeling.isabsorbing = true;
            stage                  = null;
            stage                  = 1;

            while ((stage ?? 0) <= 3)
            {
                switch ((int?)(stage))
                {
                case 1:
                    user.WriteMsg("<span class='notice'>This creature is compatible. We must hold still...</span>");
                    break;

                case 2:
                    user.visible_message("<span class='warning'>" + user + " extends a proboscis!</span>", "<span class='notice'>We extend a proboscis.</span>");
                    break;

                case 3:
                    user.visible_message("<span class='danger'>" + user + " stabs " + target2 + " with the proboscis!</span>", "<span class='notice'>We stab " + target2 + " with the proboscis.</span>");
                    target2.WriteMsg("<span class='userdanger'>You feel a sharp stabbing pain!</span>");
                    target2.take_overall_damage(40);
                    break;
                }
                GlobalFuncs.feedback_add_details("changeling_powers", "A" + stage);

                if (!GlobalFuncs.do_mob(user, target2, 150))
                {
                    user.WriteMsg("<span class='warning'>Our absorption of " + target2 + " has been interrupted!</span>");
                    changeling.isabsorbing = false;
                    return(null);
                }
                stage++;
            }
            user.visible_message("<span class='danger'>" + user + " sucks the fluids from " + target2 + "!</span>", "<span class='notice'>We have absorbed " + target2 + ".</span>");
            target2.WriteMsg("<span class='userdanger'>You are absorbed by the changeling!</span>");

            if (!changeling.has_dna(((dynamic)target2).dna))
            {
                changeling.add_new_profile(target2, user);
            }

            if (user.nutrition < 450)
            {
                user.nutrition = Num13.MinInt(((int)(user.nutrition + target2.nutrition)), 450);
            }

            if (target2.mind != null)
            {
                target2.mind.show_memory(this, false);
                recent_speech = new ByTable();

                if (target2.say_log.len > 8)
                {
                    recent_speech = target2.say_log.Copy(target2.say_log.len - 8 + 1, 0);
                }
                else
                {
                    foreach (dynamic _b in Lang13.Enumerate(target2.say_log))
                    {
                        spoken_memory = _b;


                        if (recent_speech.len >= 8)
                        {
                            break;
                        }
                        recent_speech.Add(spoken_memory);
                    }
                }

                if (recent_speech.len != 0)
                {
                    user.mind.store_memory("<B>Some of " + target2 + "'s speech patterns, we should study these to better impersonate them!</B>");
                    user.WriteMsg("<span class='boldnotice'>Some of " + target2 + "'s speech patterns, we should study these to better impersonate them!</span>");

                    foreach (dynamic _c in Lang13.Enumerate(recent_speech))
                    {
                        spoken_memory2 = _c;

                        user.mind.store_memory("\"" + spoken_memory2 + "\"");
                        user.WriteMsg("<span class='notice'>\"" + spoken_memory2 + "\"</span>");
                    }
                    user.mind.store_memory("<B>We have no more knowledge of " + target2 + "'s speech patterns.</B>");
                    user.WriteMsg("<span class='boldnotice'>We have no more knowledge of " + target2 + "'s speech patterns.</span>");
                }

                if (target2.mind.changeling != null)
                {
                    changeling.chem_charges  += Num13.MinInt(((int)(target2.mind.changeling.chem_charges)), Convert.ToInt32(changeling.chem_storage));
                    changeling.absorbedcount += target2.mind.changeling.absorbedcount;
                    target2.mind.changeling.stored_profiles.len = 1;
                    target2.mind.changeling.absorbedcount       = 0;
                }
            }
            changeling.chem_charges = Num13.MinInt(((int)(changeling.chem_charges + 10)), Convert.ToInt32(changeling.chem_storage));
            changeling.isabsorbing  = false;
            changeling.canrespec    = true;
            target2.death(false);
            ((dynamic)target2).Drain();
            return(1);
        }
Esempio n. 30
0
        // Function from file: equipment_locker.dm
        public Obj_Effect_Resonance(dynamic loc = null, dynamic creator = null, int timetoburst = 0) : base((object)(loc))
        {
            dynamic    proj_turf   = null;
            dynamic    M           = null;
            GasMixture environment = null;
            double     pressure    = 0;
            Mob_Living L           = null;
            Mob_Living L2          = null;

            proj_turf = GlobalFuncs.get_turf(this);

            if (!(proj_turf is Tile))
            {
                return;
            }

            if (proj_turf is Tile_Simulated_Mineral)
            {
                M = proj_turf;
                Task13.Schedule(timetoburst, (Task13.Closure)(() => {
                    GlobalFuncs.playsound(this, "sound/weapons/resonator_blast.ogg", 50, 1);
                    M.gets_drilled(creator);
                    GlobalFuncs.qdel(this);
                    return;
                }));
            }
            else
            {
                environment = ((Ent_Static)proj_turf).return_air();
                pressure    = environment.return_pressure();

                if (pressure < 50)
                {
                    this.name             = "strong resonance field";
                    this.resonance_damage = 50;
                }
                Task13.Schedule(timetoburst, (Task13.Closure)(() => {
                    GlobalFuncs.playsound(this, "sound/weapons/resonator_blast.ogg", 50, 1);

                    if (Lang13.Bool(creator))
                    {
                        foreach (dynamic _a in Lang13.Enumerate(this.loc, typeof(Mob_Living)))
                        {
                            L = _a;

                            GlobalFuncs.add_logs(creator, L, "used a resonator field on", "resonator");
                            L.WriteMsg("<span class='danger'>The " + this.name + " ruptured with you in it!</span>");
                            L.adjustBruteLoss(this.resonance_damage);
                        }
                    }
                    else
                    {
                        foreach (dynamic _b in Lang13.Enumerate(this.loc, typeof(Mob_Living)))
                        {
                            L2 = _b;

                            L2.WriteMsg("<span class='danger'>The " + this.name + " ruptured with you in it!</span>");
                            L2.adjustBruteLoss(this.resonance_damage);
                        }
                    }
                    GlobalFuncs.qdel(this);
                    return;
                }));
            }
            return;
        }