コード例 #1
0
        // Function from file: runes.dm
        public override void invoke(dynamic user = null)
        {
            ByTable potential_runes    = null;
            Obj_Effect_Rune_Teleport T = null;
            dynamic selected_rune      = null;

            potential_runes = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.teleport_runes, typeof(Obj_Effect_Rune_Teleport)))
            {
                T = _a;


                if (T.keyword == this.keyword && T != this && T.z <= 7)
                {
                    potential_runes.Add(T);
                }
            }

            if (!(potential_runes.len != 0))
            {
                user.WriteMsg("<span class='warning'>There are no runes with the same keyword!</span>");
                this.fail_invoke();
                GlobalFuncs.log_game("Teleport rune failed - no candidates with matching keyword");
                return;
            }

            if (Convert.ToDouble(user.z) > 7)
            {
                user.WriteMsg("<span class='cultitalic'>You are not in the right dimension!</span>");
                this.fail_invoke();
                GlobalFuncs.log_game("Teleport rune failed - user in away mission");
                return;
            }
            selected_rune = Rand13.PickFromTable(potential_runes);
            ((Ent_Static)user).visible_message("<span class='warning'>" + user + " vanishes in a flash of red light!</span>", "<span class='cult'>Your vision blurs, and you suddenly appear somewhere else.</span>");
            ((Ent_Dynamic)user).forceMove(GlobalFuncs.get_turf(selected_rune));
            return;
        }
コード例 #2
0
        // Function from file: talisman.dm
        public override bool invoke(dynamic user = null)
        {
            ByTable possible_runes     = null;
            Obj_Effect_Rune_Teleport R = null;
            dynamic chosen_rune        = null;

            possible_runes = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.teleport_runes, typeof(Obj_Effect_Rune_Teleport)))
            {
                R = _a;


                if (R.keyword == this.keyword)
                {
                    possible_runes.Add(R);
                }
            }

            if (!(possible_runes.len != 0))
            {
                user.WriteMsg("<span class='cultitalic'>There are no Teleport runes with the same keyword!</span>");
                GlobalFuncs.log_game("Teleportation talisman failed - no teleport runes of the same keyword");
                this.uses++;
                return(false);
            }
            chosen_rune = Rand13.PickFromTable(possible_runes);
            ((Ent_Static)user).visible_message("<span class='warning'>Dust flows from " + user + "'s hand, and they disappear in a flash of red light!</span>", "<span class='cultitalic'>You speak the words of the talisman and find yourself somewhere else!</span>");

            if (user.buckled != null)
            {
                user.buckled.unbuckle_mob();
            }
            user.loc = GlobalFuncs.get_turf(chosen_rune);
            return(false);
        }