Beispiel #1
0
        // Function from file: glowshroom.dm
        public void Spread(  )
        {
            int?    i                    = null;
            ByTable possibleLocs         = null;
            bool    spreadsIntoAdjacent  = false;
            Tile_Simulated_Floor earth   = null;
            dynamic newLoc               = null;
            int     shroomCount          = 0;
            int     placeCount           = 0;
            Obj_Effect_Glowshroom shroom = null;
            dynamic wallDir              = null;
            Tile    isWall               = null;
            dynamic child                = null;

            i = null;
            i = 1;

            while ((i ?? 0) <= (this.yield ?? 0))
            {
                if (Rand13.PercentChance(((int)(1 / (this.generation * this.generation) * 100))))
                {
                    possibleLocs        = new ByTable();
                    spreadsIntoAdjacent = false;

                    if (Rand13.PercentChance(this.spreadIntoAdjacentChance))
                    {
                        spreadsIntoAdjacent = true;
                    }

                    foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInView(this, 3), typeof(Tile_Simulated_Floor)))
                    {
                        earth = _a;


                        if (spreadsIntoAdjacent || !Lang13.Bool(Lang13.FindIn(typeof(Obj_Effect_Glowshroom), Map13.FetchInView(earth, 1))))
                        {
                            possibleLocs.Add(earth);
                        }
                    }

                    if (!(possibleLocs.len != 0))
                    {
                        break;
                    }
                    newLoc      = Rand13.PickFromTable(possibleLocs);
                    shroomCount = 0;
                    placeCount  = 1;

                    foreach (dynamic _b in Lang13.Enumerate(newLoc, typeof(Obj_Effect_Glowshroom)))
                    {
                        shroom = _b;

                        shroomCount++;
                    }

                    foreach (dynamic _c in Lang13.Enumerate(GlobalVars.cardinal))
                    {
                        wallDir = _c;

                        isWall = Map13.GetStep(newLoc, Convert.ToInt32(wallDir));

                        if (isWall.density)
                        {
                            placeCount++;
                        }
                    }

                    if (shroomCount >= placeCount)
                    {
                    }
                    else
                    {
                        child            = Lang13.Call(this.type, newLoc);
                        child.potency    = Num13.MaxInt(this.potency + Rand13.Int(-3, 6), 0);
                        child.yield      = Num13.MaxInt((this.yield ?? 0) + Rand13.Int(-1, 2), 0);
                        child.delay      = Num13.MaxInt(this.delay + Rand13.Int(-30, 60), 0);
                        child.endurance  = Num13.MaxInt(((int)(this.endurance + Rand13.Int(-3, 6))), 1);
                        child.generation = this.generation + 1;
                        child.desc       = new Txt("This is a ").st_nd_rd(child.generation).str(" generation ").item(child.name).str("!").ToString();
                    }
                }
                i++;
            }
            return;
        }
        // Function from file: shadowling_abilities.dm
        public override bool cast(dynamic targets = null, dynamic thearea = null, dynamic user = null)
        {
            thearea = thearea ?? Task13.User;

            dynamic                  T      = null;
            Obj_Item                 F      = null;
            Obj_Machinery_Light      L      = null;
            Obj_Machinery_Computer   C      = null;
            Obj_Effect_Glowshroom    G      = null;
            Mob_Living               H      = null;
            Mob_Living_Silicon_Robot borgie = null;


            if (!this.shadowling_check(thearea) && !this.admin_override)
            {
                this.revert_cast();
                return(false);
            }
            thearea.WriteMsg("<span class='shadowling'>You silently disable all nearby lights.</span>");

            foreach (dynamic _g in Lang13.Enumerate(targets))
            {
                T = _g;


                foreach (dynamic _a in Lang13.Enumerate(T.contents, typeof(Obj_Item)))
                {
                    F = _a;

                    this.extinguishItem(F);
                }

                foreach (dynamic _b in Lang13.Enumerate(T.contents, typeof(Obj_Machinery_Light)))
                {
                    L = _b;

                    L.on = false;
                    L.visible_message("<span class='warning'>" + L + " flickers and falls dark.</span>");
                    L.update(false);
                }

                foreach (dynamic _c in Lang13.Enumerate(T.contents, typeof(Obj_Machinery_Computer)))
                {
                    C = _c;

                    C.SetLuminosity(0);
                    C.visible_message("<span class='warning'>" + C + " grows dim, its screen barely readable.</span>");
                }

                foreach (dynamic _d in Lang13.Enumerate(Map13.FetchInRangeExcludeThis(thearea, 7), typeof(Obj_Effect_Glowshroom)))
                {
                    G = _d;

                    G.visible_message("<span class='warning'>" + G + " withers away!</span>");
                    GlobalFuncs.qdel(G);
                }

                foreach (dynamic _e in Lang13.Enumerate(T.contents, typeof(Mob_Living)))
                {
                    H = _e;

                    this.extinguishMob(H);
                }

                foreach (dynamic _f in Lang13.Enumerate(T.contents, typeof(Mob_Living_Silicon_Robot)))
                {
                    borgie = _f;

                    borgie.update_headlamp(true);
                }
            }
            return(false);
        }
Beispiel #3
0
        // Function from file: glowshroom.dm
        public dynamic CalcDir(Ent_Static location = null)
        {
            location = location ?? this.loc;

            int     direction            = 0;
            dynamic wallDir              = null;
            Tile    newTurf              = null;
            Obj_Effect_Glowshroom shroom = null;
            ByTable dirList              = null;
            int?    i      = null;
            dynamic newDir = null;

            direction = 16;

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.cardinal))
            {
                wallDir = _a;

                newTurf = Map13.GetStep(location, Convert.ToInt32(wallDir));

                if (newTurf.density)
                {
                    direction |= Convert.ToInt32(wallDir);
                }
            }

            foreach (dynamic _b in Lang13.Enumerate(location, typeof(Obj_Effect_Glowshroom)))
            {
                shroom = _b;


                if (shroom == this)
                {
                    continue;
                }

                if (shroom.floor)
                {
                    direction &= 65519;
                }
                else
                {
                    direction &= ~shroom.dir;
                }
            }
            dirList = new ByTable();
            i       = null;
            i       = 1;

            while ((i ?? 0) <= 16)
            {
                if ((direction & (i ?? 0)) != 0)
                {
                    dirList.Add(i);
                }
                i <<= 1;
            }

            if (dirList.len != 0)
            {
                newDir = Rand13.PickFromTable(dirList);

                if (newDir == 16)
                {
                    this.floor = true;
                    newDir     = 1;
                }
                return(newDir);
            }
            this.floor = true;
            return(1);
        }
Beispiel #4
0
        // Function from file: revenant_abilities.dm
        public override bool cast(dynamic targets = null, dynamic thearea = null, dynamic user = null)
        {
            thearea = thearea ?? Task13.User;

            dynamic                   T           = null;
            Mob_Living                mob         = null;
            Mob_Living                H           = null;
            bool                      blightfound = false;
            Disease_Revblight         blight      = null;
            Obj_Effect_Spacevine      vine        = null;
            Obj_Effect_Glowshroom     shroom      = null;
            Obj_Machinery_Hydroponics tray        = null;


            if (this.attempt_cast(thearea))
            {
                foreach (dynamic _f in Lang13.Enumerate(targets))
                {
                    T = _f;

                    Task13.Schedule(0, (Task13.Closure)(() => {
                        foreach (dynamic _b in Lang13.Enumerate(T.contents, typeof(Mob_Living)))
                        {
                            mob = _b;


                            if (mob == thearea)
                            {
                                continue;
                            }
                            GlobalFuncs.PoolOrNew(typeof(Obj_Effect_Overlay_Temp_Revenant), mob.loc);

                            if (mob is Mob_Living_Carbon)
                            {
                                if (mob is Mob_Living_Carbon_Human)
                                {
                                    H = mob;

                                    if (Lang13.Bool(((dynamic)H).dna) && Lang13.Bool(((dynamic)H).dna.species))
                                    {
                                        ((Species)((dynamic)H).dna.species).handle_mutant_bodyparts(H, "#1d2953");
                                        ((Species)((dynamic)H).dna.species).handle_hair(H, "#1d2953");
                                        ((Species)((dynamic)H).dna.species).update_color(H, "#1d2953");
                                        Task13.Schedule(20, (Task13.Closure)(() => {
                                            if (H != null && Lang13.Bool(((dynamic)H).dna) && Lang13.Bool(((dynamic)H).dna.species))
                                            {
                                                ((Species)((dynamic)H).dna.species).handle_mutant_bodyparts(H);
                                                ((Species)((dynamic)H).dna.species).handle_hair(H);
                                                ((Species)((dynamic)H).dna.species).update_color(H);
                                            }
                                            return;
                                        }));
                                    }
                                    blightfound = false;

                                    foreach (dynamic _a in Lang13.Enumerate(H.viruses, typeof(Disease_Revblight)))
                                    {
                                        blight = _a;

                                        blightfound = true;

                                        if ((blight.stage ?? 0) < 5)
                                        {
                                            blight.stage++;
                                        }
                                    }

                                    if (!blightfound)
                                    {
                                        H.AddDisease(new Disease_Revblight());
                                        H.WriteMsg("<span class='revenminor'>You feel " + Rand13.Pick(new object [] { "suddenly sick", "a surge of nausea", "like your skin is <span class='italics'>wrong</span>" }) + ".</span>");
                                    }
                                }
                                else if (mob.reagents != null)
                                {
                                    mob.reagents.add_reagent("plasma", 5);
                                }
                            }
                            else
                            {
                                mob.adjustToxLoss(5);
                            }
                        }

                        foreach (dynamic _c in Lang13.Enumerate(T.contents, typeof(Obj_Effect_Spacevine)))
                        {
                            vine = _c;

                            vine.color = "#823abb";
                            GlobalFuncs.PoolOrNew(typeof(Obj_Effect_Overlay_Temp_Revenant), vine.loc);
                            Task13.Schedule(20, (Task13.Closure)(() => {
                                if (vine != null)
                                {
                                    GlobalFuncs.qdel(vine);
                                }
                                return;
                            }));
                        }

                        foreach (dynamic _d in Lang13.Enumerate(T.contents, typeof(Obj_Effect_Glowshroom)))
                        {
                            shroom = _d;

                            shroom.color = "#823abb";
                            GlobalFuncs.PoolOrNew(typeof(Obj_Effect_Overlay_Temp_Revenant), shroom.loc);
                            Task13.Schedule(20, (Task13.Closure)(() => {
                                if (shroom != null)
                                {
                                    GlobalFuncs.qdel(shroom);
                                }
                                return;
                            }));
                        }

                        foreach (dynamic _e in Lang13.Enumerate(T.contents, typeof(Obj_Machinery_Hydroponics)))
                        {
                            tray = _e;

                            GlobalFuncs.PoolOrNew(typeof(Obj_Effect_Overlay_Temp_Revenant), tray.loc);
                            tray.pestlevel = Rand13.Int(8, 10);
                            tray.weedlevel = Rand13.Int(8, 10);
                            tray.toxic     = Rand13.Int(45, 55);
                        }
                        return;
                    }));
                }
            }
            return(false);
        }