Esempio n. 1
0
        // Function from file: area_teleport.dm
        public override bool cast(dynamic targets = null, dynamic thearea = null, dynamic user = null)
        {
            user = user ?? Task13.User;

            Mob_Living target  = null;
            ByTable    L       = null;
            dynamic    T       = null;
            bool       clear   = false;
            Obj        O       = null;
            ByTable    tempL   = null;
            dynamic    attempt = null;
            bool       success = false;

            GlobalFuncs.playsound(GlobalFuncs.get_turf(user), this.sound1, 50, 1);

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

                L = new ByTable();

                foreach (dynamic _b in Lang13.Enumerate(GlobalFuncs.get_area_turfs(thearea.type)))
                {
                    T = _b;


                    if (!T.density)
                    {
                        clear = true;

                        foreach (dynamic _a in Lang13.Enumerate(T, typeof(Obj)))
                        {
                            O = _a;


                            if (O.density)
                            {
                                clear = false;
                                break;
                            }
                        }

                        if (clear)
                        {
                            L.Add(T);
                        }
                    }
                }

                if (!(L.len != 0))
                {
                    Task13.User.WriteMsg("The spell matrix was unable to locate a suitable teleport destination for an unknown reason. Sorry.");
                    return(false);
                }

                if (target != null && target.buckled != null)
                {
                    target.buckled.unbuckle_mob();
                }
                tempL   = L;
                attempt = null;
                success = false;

                while (tempL.len != 0)
                {
                    attempt = Rand13.PickFromTable(tempL);
                    target.Move(attempt);

                    if (GlobalFuncs.get_turf(target) == attempt)
                    {
                        success = true;
                        break;
                    }
                    else
                    {
                        tempL.Remove(attempt);
                    }
                }

                if (!success)
                {
                    target.loc = Rand13.PickFromTable(L);
                    GlobalFuncs.playsound(GlobalFuncs.get_turf(user), this.sound2, 50, 1);
                }
            }
            return(false);
        }
Esempio n. 2
0
        // Function from file: ethereal_jaunt.dm
        public override bool cast(dynamic targets = null, dynamic thearea = null, dynamic user = null)
        {
            thearea = thearea ?? Task13.User;

            Mob_Living target = null;
            dynamic    mobloc = null;
            Obj_Effect_Dummy_SpellJaunt holder    = null;
            Dynamic_Overlay             animation = null;
            dynamic direction = null;
            Tile    T         = null;

            GlobalFuncs.playsound(GlobalFuncs.get_turf(thearea), "sound/magic/Ethereal_Enter.ogg", 50, 1, -1);

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

                target.notransform = 1;
                Task13.Schedule(0, (Task13.Closure)(() => {
                    mobloc             = GlobalFuncs.get_turf(target.loc);
                    holder             = new Obj_Effect_Dummy_SpellJaunt(mobloc);
                    animation          = new Dynamic_Overlay(mobloc);
                    animation.name     = "water";
                    animation.density  = false;
                    animation.anchored = 1;
                    animation.icon     = "icons/mob/mob.dmi";
                    animation.layer    = 5;
                    animation.master   = holder;
                    target.ExtinguishMob();

                    if (target.buckled != null)
                    {
                        target.buckled.unbuckle_mob();
                    }

                    if (target.pulledby != null)
                    {
                        target.pulledby.__CallVerb("Stop Pulling");
                    }
                    target.__CallVerb("Stop Pulling");

                    if (Lang13.Bool(target.buckled_mob))
                    {
                        target.unbuckle_mob(true);
                    }
                    this.jaunt_disappear(animation, target);
                    target.loc = holder;
                    target.reset_perspective(holder);
                    target.notransform = 0;
                    this.jaunt_steam(mobloc);
                    Task13.Sleep(this.jaunt_duration);

                    if (target.loc != holder)
                    {
                        GlobalFuncs.qdel(holder);
                        return;
                    }
                    mobloc        = GlobalFuncs.get_turf(target.loc);
                    animation.loc = mobloc;
                    this.jaunt_steam(mobloc);
                    target.canmove     = false;
                    holder.reappearing = true;
                    GlobalFuncs.playsound(GlobalFuncs.get_turf(thearea), "sound/magic/Ethereal_Exit.ogg", 50, 1, -1);
                    Task13.Sleep(20);

                    if (!Lang13.Bool(GlobalFuncs.qdeleted(target)))
                    {
                        this.jaunt_reappear(animation, target);
                    }
                    Task13.Sleep(5);
                    GlobalFuncs.qdel(animation);
                    GlobalFuncs.qdel(holder);

                    if (!Lang13.Bool(GlobalFuncs.qdeleted(target)))
                    {
                        if (mobloc.density)
                        {
                            foreach (dynamic _a in Lang13.Enumerate(new ByTable(new object [] { 1, 2, 4, 8, 5, 6, 9, 10 })))
                            {
                                direction = _a;

                                T = Map13.GetStep(mobloc, Convert.ToInt32(direction));

                                if (T != null)
                                {
                                    if (target.Move(T))
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                        target.canmove = true;
                    }
                    return;
                }));
            }
            return(false);
        }
Esempio n. 3
0
        // Function from file: turf_teleport.dm
        public override bool cast(dynamic targets = null, dynamic thearea = null, dynamic user = null)
        {
            thearea = thearea ?? Task13.User;

            Mob_Living target             = null;
            ByTable    turfs              = null;
            dynamic    T                  = null;
            ByTable    turfs_to_pick_from = null;
            dynamic    T2                 = null;
            dynamic    picked             = null;

            GlobalFuncs.playsound(GlobalFuncs.get_turf(thearea), this.sound1, 50, 1);

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

                turfs = new ByTable();

                foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInRange(this.outer_tele_radius, target)))
                {
                    T = _a;


                    if (Map13.FetchInRange(this.inner_tele_radius, target).Contains(T))
                    {
                        continue;
                    }

                    if (T is Tile_Space && !this.include_space)
                    {
                        continue;
                    }

                    if (T.density && !this.include_dense)
                    {
                        continue;
                    }

                    if (Convert.ToDouble(T.x) > Game13.map_size_x - this.outer_tele_radius || Convert.ToDouble(T.x) < this.outer_tele_radius)
                    {
                        continue;
                    }

                    if (Convert.ToDouble(T.y) > Game13.map_size_y - this.outer_tele_radius || Convert.ToDouble(T.y) < this.outer_tele_radius)
                    {
                        continue;
                    }
                    turfs.Add(T);
                }

                if (!(turfs.len != 0))
                {
                    turfs_to_pick_from = new ByTable();

                    foreach (dynamic _b in Lang13.Enumerate(Map13.FetchInRangeExcludeThis(this.outer_tele_radius, target)))
                    {
                        T2 = _b;


                        if (!Map13.FetchInRangeExcludeThis(this.inner_tele_radius, target).Contains(T2))
                        {
                            turfs_to_pick_from.Add(T2);
                        }
                    }
                    turfs.Add(Rand13.PickFromTable(turfs_to_pick_from.Contains(typeof(Tile))));
                }
                picked = Rand13.PickFromTable(turfs);

                if (!Lang13.Bool(picked) || !(picked is Tile))
                {
                    return(false);
                }

                if (!target.Move(picked))
                {
                    if (target.buckled != null)
                    {
                        target.buckled.unbuckle_mob();
                    }

                    if (Lang13.Bool(target.buckled_mob))
                    {
                        target.unbuckle_mob(true);
                    }
                    target.loc = picked;
                    GlobalFuncs.playsound(GlobalFuncs.get_turf(thearea), this.sound2, 50, 1);
                }
            }
            return(false);
        }