• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# MUDEngine.CharData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MUDEngine.CharData的典型用法代码示例。如果您正苦于以下问题:C# CharData类的具体用法?C# CharData怎么用?C# CharData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CharData类属于MUDEngine命名空间,在下文中一共展示了CharData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Object

 /// <summary>
 /// Default constructor.
 /// </summary>
 public Object()
 {
     ++_numObjects;
     _createdBy = null;
     _itemType = ObjTemplate.ObjectType.trash;
     _material = 0;
     _size = 0;
     _volume = 0;
     _craftsmanship = 0;
     _wearLocation = 0;
     _weight = 0;
     _cost = 0;
     _level = 1;
     _timer = -1;
     _condition = 100;
     _flyLevel = CharData.FlyLevel.ground;
     int count;
     for( count = 0; count < Limits.NUM_ITEM_EXTRA_VECTORS; ++count )
         _extraFlags[ count ] = 0;
     for (count = 0; count < Limits.NUM_USE_FLAGS_VECTORS; ++count)
         _antiFlags[count] = 0;
     for (count = 0; count < Limits.NUM_WEAR_FLAGS_VECTORS; ++count)
         _wearFlags[count] = 0;
     for (count = 0; count < Limits.NUM_AFFECT_VECTORS; ++count)
         _affectedBy[ count ] = 0;
     for( count = 0; count < 8; ++count )
         _values[ count ] = 0;
 }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:31,代码来源:Object.cs


示例2: FindExit

        /// <summary>
        /// Finds an exit based on a keyword.  Use FindDoor if you are looking for a door.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="arg"></param>
        /// <returns></returns>
        public static Exit.Direction FindExit( CharData ch, string arg )
        {
            Exit exit;
            Exit.Direction door = Exit.DoorLookup(arg);
            if( door == Exit.Direction.invalid )
            {
                for (int doornum = 0; doornum < Limits.MAX_DIRECTION; doornum++)
                {
                    if ((exit = ch.InRoom.ExitData[doornum]) && exit.HasFlag(Exit.ExitFlag.is_door)
                         && !(ch.Level < Limits.LEVEL_AVATAR && exit.ExitFlags != 0
                         && (exit.HasFlag(Exit.ExitFlag.secret) || exit.HasFlag(Exit.ExitFlag.blocked)))
                         && exit.Keyword.Length != 0 && ("door".Equals(arg, StringComparison.CurrentCultureIgnoreCase)
                         || MUDString.NameContainedIn(arg, exit.Keyword)))
                    {
                        return (Exit.Direction)doornum;
                    }
                }
                SocketConnection.Act( "I see no $T here.", ch, null, arg, SocketConnection.MessageTarget.character );
                return Exit.Direction.invalid;
            }

            if( !( exit = ch.InRoom.ExitData[ (int)door ] ) )
            {
                SocketConnection.Act( "I see no door $T here.", ch, null, arg, SocketConnection.MessageTarget.character );
                return Exit.Direction.invalid;
            }

            return door;
        }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:35,代码来源:Movement.cs


示例3: SongChaos

 /// <summary>
 /// Song of chaos.
 /// </summary>
 /// <param name="ch"></param>
 /// <param name="spell"></param>
 /// <param name="level"></param>
 /// <param name="target"></param>
 /// <returns></returns>
 public static bool SongChaos( CharData ch, Spell spell, int level, Target target )
 {
     foreach( CharData victim in ch.InRoom.People )
     {
     }
     return true;
 }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:15,代码来源:Songs.cs


示例4: FindDoor

        /// <summary>
        /// Finds a door based on a keyword or direction.  Use FindExit if you only need to get an exit,
        /// no door required.  This should _not_ tell the character anything; it is an internal function.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="arg"></param>
        /// <returns></returns>
        public static Exit.Direction FindDoor( CharData ch, string arg )
        {
            Exit exit;
            Exit.Direction door = Exit.DoorLookup(arg);
            if (door == Exit.Direction.invalid)
            {
                for( int doornum = 0; doornum < Limits.MAX_DIRECTION; doornum++ )
                {
                    if ((exit = ch.InRoom.ExitData[doornum]) && exit.HasFlag(Exit.ExitFlag.is_door)
                        && !(ch.Level < Limits.LEVEL_AVATAR && exit.ExitFlags != 0
                        && (exit.HasFlag(Exit.ExitFlag.secret) || exit.HasFlag(Exit.ExitFlag.blocked)))
                        && exit.Keyword.Length != 0 && ("door".Equals(arg, StringComparison.CurrentCultureIgnoreCase)
                        || MUDString.NameContainedIn(arg, exit.Keyword)))
                    {
                        return (Exit.Direction)doornum;
                    }
                }
                return Exit.Direction.invalid;
            }

            exit = ch.InRoom.GetExit(door);
            if( !exit )
            {
                return Exit.Direction.invalid;
            }

            if (!exit.HasFlag(Exit.ExitFlag.is_door))
            {
                return Exit.Direction.invalid;
            }

            return door;
        }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:40,代码来源:Movement.cs


示例5: SongCalming

 /// <summary>
 /// Song of calming.
 /// </summary>
 /// <param name="ch"></param>
 /// <param name="spell"></param>
 /// <param name="level"></param>
 /// <param name="target"></param>
 /// <returns></returns>
 public static bool SongCalming( CharData ch, Spell spell, int level, Target target )
 {
     foreach( CharData victim in ch.InRoom.People )
     {
         Combat.StopFighting( victim, false );
         victim.WaitState( 2 );
     }
     return true;
 }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:17,代码来源:Songs.cs


示例6: MakeDrunk

        /// <summary>
        /// Makes a string look drunk.
        /// </summary>
        /// <param name="inputString"></param>
        /// <param name="ch"></param>
        /// <returns></returns>
        public static string MakeDrunk( string inputString, CharData ch )
        {
            int drunklevel = 0;

            if (!ch.IsNPC())
            {
                drunklevel = ((PC)ch).Drunk;
            }

            // Nothing to do here.
            if (drunklevel == 0)
            {
                return inputString;
            }

            string output = String.Empty;

            // Check how drunk a person is...
            for (int pos = 0; pos < inputString.Length; pos++)
            {
                char temp = inputString[pos];

                if ((char.ToUpper(temp) >= 'A') && (char.ToUpper(temp) <= 'Z'))
                {
                    int drunkpos = char.ToUpper(temp) - 'A';
                    if (drunklevel > _drunkSubstitution[drunkpos]._minDrunkLevel)
                    {
                        int randomnum = MUDMath.NumberRange(0, _drunkSubstitution[drunkpos]._numReplacements);
                        output += _drunkSubstitution[drunkpos]._replacement[randomnum];
                    }
                    else
                    {
                        output += temp;
                    }
                }
                else
                {
                    if (drunklevel < 4)
                    {
                        output += MUDMath.FuzzyNumber(temp);
                    }
                    else if ((temp >= '0') && (temp <= '9'))
                    {
                        output += MUDMath.NumberRange(0, 9).ToString();
                    }
                    else
                    {
                        output += temp;
                    }
                }
            }
            return ( output );
        }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:59,代码来源:DrunkSpeech.cs


示例7: AppendFile

 /// <summary>
 /// Appends a string to a file.
 /// </summary>
 /// <param name="ch"></param>
 /// <param name="file"></param>
 /// <param name="str"></param>
 public static void AppendFile( CharData ch, string file, string str )
 {
     if( ch == null || String.IsNullOrEmpty(file) || String.IsNullOrEmpty(str) || ch.IsNPC() )
     {
         return;
     }
     FileStream fp = File.OpenWrite( file );
     StreamWriter sw = new StreamWriter( fp );
     sw.WriteLine( "[{0}] {1}: {2}\n", ch.InRoom ? MUDString.PadInt(ch.InRoom.IndexNumber,5) : MUDString.PadInt(0,5),
         ch.Name, str );
     sw.Flush();
     sw.Close();
     return;
 }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:20,代码来源:Database.cs


示例8: SongArmor

        /// <summary>
        /// Song of armor.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongArmor( CharData ch, Spell spell, int level, Target target )
        {
            ch.SendText( "You Sing a song of protection.\r\n" );

            foreach( CharData victim in ch.InRoom.People )
            {
                if (victim.IsAffected( Affect.AFFECT_ARMOR))
                    continue;

                Affect af = new Affect( Affect.AffectType.song, spell.Name, 4, Affect.Apply.ac, ( 0 - ( 10 + ( level / 5 ) ) ), Affect.AFFECT_ARMOR );
                victim.CombineAffect( af );

                victim.SendText( "You feel someone protecting you.\r\n" );
            }

            return true;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:25,代码来源:Songs.cs


示例9: ShoutAndHunt

        /// <summary>
        /// Shout for one's minions to come and attack the victim.
        /// </summary>
        /// <param name="mob"></param>
        /// <param name="victim"></param>
        /// <param name="msg"></param>
        /// <param name="helpers"></param>
        /// <returns></returns>
        static bool ShoutAndHunt( System.Object mob, CharData victim, string msg, int[] helpers )
        {
            if (mob == null) return false;
            int count = 0;
            CharData ch = (CharData)mob;
            // Send the shout message
            string buf = String.Format( msg, victim.Name );
            CommandType.Interpret(ch, "shout " + buf);

            if (helpers[0] == 0)
            {
                return false;
            }
            // Loop through all chars
            foreach (CharData worldChar in Database.CharList)
            {
                if( !worldChar.InRoom )
                    continue;
                if( !worldChar.MobileTemplate )
                    continue;
                if( !worldChar.IsNPC() || worldChar.InRoom.Area != ch.InRoom.Area )
                    continue;
                bool isHelper = false;
                int i;
                for( i = 0; helpers[ i ] > 0; i++ )
                {
                    if (worldChar.MobileTemplate.IndexNumber == helpers[i])
                    {
                        isHelper = true;
                    }
                }
                if (!isHelper)
                {
                    continue;
                }

                Combat.StartGrudge( worldChar, victim, true );

                ++count;
            }
            if (count > 0)
            {
                return true;
            }
            return false;
        }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:54,代码来源:MobFun.cs


示例10: HealSelf

 // Keep in mind that any healing spells that give affects to the mob
 // will only be able to be cast if they are not affected by them because
 // the CheckSpellup _function checks to see if they are affected by
 // that spell, so a heal spell that heals *and* blesses will not work
 // properly and we'll need to write a new _function for it -- Xangis
 static bool HealSelf( CharData ch )
 {
     if (ch == null) return false;
     if (CheckSpellup(ch, "heal", 75))
         return true;
     return false;
 }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:12,代码来源:MobFun.cs


示例11: CheckSpellup

        // This _function should prevent a mob from spamming
        // spellups on itself if it is already affected by the spell.
        // in the Spellup() _function, checks for Affect.AFFECT_WHATEVER
        // still need to be done. - Xangis
        static bool CheckSpellup( CharData ch, string name, int percent )
        {
            if (ch == null) return false;
            if (String.IsNullOrEmpty(name))
                return false;

            Spell spell = Spell.SpellList[name];
            if (spell == null)
            {
                return false;
            }

            // Keep mobs from casting spells they are affected by
            if( ch.HasAffect( Affect.AffectType.spell, spell ) )
                return false;

            if( ( ch.HasSpell( name ) )
                    && ( MUDMath.NumberPercent() < percent ) )
            {
                if (spell.ValidTargets != TargetType.singleCharacterDefensive &&
                        spell.ValidTargets != TargetType.self)
                    Log.Error( "CheckSpellup:  Mob casting spell {0} which is neither TargetType.self nor TargetType.defensive.", spell );

                SocketConnection.Act( "$n&n starts casting...", ch, null, null, SocketConnection.MessageTarget.room );
                ch.SetAffectBit( Affect.AFFECT_CASTING );
                CastData caster = new CastData();
                caster.Who = ch;
                caster.Eventdata = Event.CreateEvent(Event.EventType.spell_cast, spell.CastingTime, ch, ch, spell);
                Database.CastList.Add( caster );
                return true;
            }

            return false;
        }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:38,代码来源:MobFun.cs


示例12: SummonIfHating

        /*
        * If a spell casting mob is hating someone, try to summon them.
        *
        * Xangis - Need to add code to also gate to the person if they can't be summoned
        */
        static void SummonIfHating( CharData ch )
        {
            string name = String.Empty;
            string buf = String.Empty;

            if( ch.Fighting || ch.Fearing || ch.Hating.Count == 0 || ch.InRoom.HasFlag( RoomTemplate.ROOM_SAFE ) )
                return;

            /* If summoner is busy hunting someone aleady, don't summon. */
            if( ch.Hunting )
                return;

            CharData victim = ch.GetRandomHateTarget( false );

            // Pretty stupid to summon someone who's in the same room.
            if( !victim || ch.InRoom == victim.InRoom )
                return;

            if( ( ch.HasSpell( "relocate" ) ))
            {
                if( !victim.IsNPC() )
                    buf += "relocate 0." + name;
                else
                    buf += "relocate " + name;
            }
            else if( ch.HasSpell( "summon" ) )
            {
                if( !victim.IsNPC() )
                    buf += "summon 0." + name;
                else
                    buf += "summon " + name;
            }
            else if ((ch.Level * 4 - 3) >= Spell.SpellList["spirit jump"].SpellCircle[(int)ch.CharacterClass.ClassNumber])
            {
                if( !victim.IsNPC() )
                    buf += "'spirit jump' 0." + name;
                else
                    buf += "'spirit jump' " + name;
            }

            CommandType.Interpret(ch, "cast " + buf);
            return;
        }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:48,代码来源:MobFun.cs


示例13: SpellupOthers

        static bool SpellupOthers( CharData ch )
        {
            if (ch == null) return false;
            if (ch.InRoom.HasFlag(RoomTemplate.ROOM_NO_MAGIC))
                return false;

            if( !ch.IsAwake() || ch.Fighting )
                return false;

            if( !ch.CanSpeak() )
                return false;

            CharData victim = null;
            foreach( CharData ivictim in ch.InRoom.People )
            {
                if (ivictim != ch && CharData.CanSee(ch, ivictim) && MUDMath.NumberBits(1) == 0 && ivictim.IsNPC())
                {
                    victim = ivictim;
                    break;
                }
            }

            if( !victim )
                return false;

            if( victim.Hitpoints < ( victim.GetMaxHit() - 10 ) )
            {
                if( CheckDefensive( ch, victim, "full heal", 75 ) )
                    return true;
                if( CheckDefensive( ch, victim, "aid", 60 ) )
                    return true;
                if( CheckDefensive( ch, victim, "heal", 75 ) )
                    return true;
                if( CheckDefensive( ch, victim, "mending", 75 ) )
                    return true;
            }

            if (!victim.IsAffected(Affect.AFFECT_HASTE))
                if( CheckDefensive( ch, victim, "haste", 45 ) )
                    return true;

            return false;
        }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:43,代码来源:MobFun.cs


示例14: SpecGrumbarShout

        static bool SpecGrumbarShout( System.Object mob, int cmd )
        {
            if (mob == null) return false;
            int[] helpers = new[] {9500, 9501, 9502, 9503, 9504, 9505, 9506, 9507,
                         9508, 9509, 9510, 0};

            if( cmd == PROC_DEATH )
                return false;
            CharData ch = (CharData)mob;
            if( !ch || !ch.IsAwake() )
                return false;

            if( !ch.Fighting )
            {
                _wasFighting = null;
                return false;
            }

            if( ch.Fighting == _wasFighting )
                return false;

            _wasFighting = ch.Fighting;
            return ShoutAndHunt( ch, ch.Fighting, "&+LDenizens of the Earth plane, {0} has trespassed upon us!", helpers );
        }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:24,代码来源:MobFun.cs


示例15: FindPath

        public static Exit.Direction FindPath( int inRoomIndexNumber, int outRoomIndexNumber, CharData ch, int depth, bool inZone )
        {
            RoomTemplate herep;
            RoomTemplate startp;
            Exit exitp;
            RoomQ tmp_q;
            RoomQ q_head;
            RoomQ q_tail;
            HashHeader x_room = null;
            bool throughDoors;
            int i;
            int tmp_room;
            int count = 0;

            // TODO: Re-enable this.
            return Exit.Direction.invalid;

            if (depth < 0)
            {
                throughDoors = true;
                depth = -depth;
            }
            else
            {
                throughDoors = false;
            }

            startp = Room.GetRoom(inRoomIndexNumber);

            InitHashTable(x_room, sizeof(int), 2048);
            //HashEnter(x_room, inRoomIndexNumber, null);

            /* initialize queue */
            q_head = new RoomQ();
            q_tail = q_head;
            q_tail.RoomNR = inRoomIndexNumber;
            q_tail.NextQ = null;

            while (q_head != null)
            {
                herep = Room.GetRoom(q_head.RoomNR);
                /* for each room test all directions */
                if (herep.Area == startp.Area || inZone == false)
                {
                    /*
                    * only look in this zone...
                    * saves cpu time and makes world safer for players
                    */
                    for (i = 0; i < Limits.MAX_DIRECTION; i++)
                    {
                        exitp = herep.ExitData[i];
                        if (ExitOk(exitp) != 0 && (throughDoors ? GO_OK_SMARTER :
                            Macros.IsSet((int)Room.GetRoom(q_head.RoomNR).ExitData[i].ExitFlags, (int)Exit.ExitFlag.closed)))
                        {
                            /* next room */
                            tmp_room = herep.ExitData[i].TargetRoom.IndexNumber;
                            if (tmp_room != outRoomIndexNumber)
                            {
                                /*
                                * shall we add room to queue ?
                                * count determines total breadth and depth
                                */
                                if (!hash_find(x_room, tmp_room)
                                        && (count < depth))
                                /* && !IS_SET( RM_FLAGS(tmp_room), DEATH ) ) */
                                {
                                    ++count;
                                    /* mark room as visted and put on queue */

                                    tmp_q = new RoomQ();
                                    tmp_q.RoomNR = tmp_room;
                                    tmp_q.NextQ = null;
                                    q_tail.NextQ = tmp_q;
                                    q_tail = tmp_q;

                                    /* Ancestor for first layer is the direction */
                                    /*HashEnter(x_room, tmp_room,
                                                ((long)hash_find(x_room, q_head.RoomNR) == -1)
                                                ? (Object)(i + 1)
                                                : hash_find(x_room, q_head.RoomNR));*/
                                }
                            }
                            else
                            {
                                /* have reached our goal so free queue */
                                tmp_room = q_head.RoomNR;
                                for (; q_head != null; q_head = tmp_q)
                                {
                                    tmp_q = q_head.NextQ;
                                    q_head = null;
                                }
                                /* return direction if first layer */
                                /*if ((long)hash_find(x_room, tmp_room) == -1)
                                {
                                    if (x_room.Buckets)
                                    {
                                        // junk left over from a previous track
                                        DestroyHashTable(x_room, null);
                                    }
                                    return (i);*/
//.........这里部分代码省略.........
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:101,代码来源:Track.cs


示例16: CheckOffensive

        /// <summary>
        /// Check for use of Direct targeted spells (TargetType.singleCharacterOffensive)
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="victim"></param>
        /// <param name="spell"></param>
        /// <param name="percent"></param>
        /// <returns></returns>
        public static bool CheckOffensive( CharData ch, CharData victim, Spell spell, int percent )
        {
            if (ch == null) return false;
            string buf = String.Format("CheckOffensive: spell ({0})'{1}'", spell, spell.Name);
            Log.Trace( buf );

            if( spell == null )
                return false;

            if( ch.HasSpell(spell) && ( MUDMath.NumberPercent() < percent ) )
            {
                if (spell.ValidTargets != TargetType.singleCharacterOffensive &&
                        spell.ValidTargets != TargetType.none &&
                        spell.ValidTargets != TargetType.singleCharacterRanged)
                    Log.Error( "Check_spellup:  Mob casting spell {0} which is neither _targetType offensive nor ignore.a", spell );

                SocketConnection.Act( "$n&n  starts casting...", ch, null, null, SocketConnection.MessageTarget.room );
                ch.SetAffectBit( Affect.AFFECT_CASTING );
                CastData caster = new CastData();
                caster.Who = ch;
                caster.Eventdata = Event.CreateEvent(Event.EventType.spell_cast, spell.CastingTime, ch, victim, spell);
                Database.CastList.Add( caster );
                return true;
            }

            return false;
        }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:35,代码来源:MobFun.cs


示例17: CheckVigorize

 /// <summary>
 /// Check for casting of vigorize spells.
 /// </summary>
 /// <param name="ch"></param>
 /// <returns></returns>
 public static bool CheckVigorize( CharData ch )
 {
     if (ch == null) return false;
     if (ch.CurrentMoves > 30)
         return false;
     if( CheckSpellup( ch, "stamina", 35 ) )
         return true;
     return false;
 }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:14,代码来源:MobFun.cs


示例18: HuntVictim

        /// <summary>
        /// Tracking code.
        /// </summary>
        /// <param name="ch"></param>
        public static void HuntVictim( CharData ch )
        {
            if (!ch || !ch.Hunting || !ch.IsAffected(Affect.AFFECT_TRACK))
            {
                return;
            }

            if( ch.CurrentPosition != Position.standing )
            {
                if( ch.IsAffected( Affect.AFFECT_TRACK ) )
                {
                    ch.SendText( "You abort your tracking effort.\r\n" );
                    ch.RemoveAffect(Affect.AFFECT_TRACK);
                    Combat.StopHunting( ch );
                }
                return;
            }

            CharData tmp = null;

            try
            {
                /*
                * Make sure the victim still exists.
                */
                bool found = false;
                foreach (CharData it in Database.CharList)
                {
                    ch = it;
                    if (ch.Hunting != null && ch.Hunting.Who == tmp)
                        found = true;
                }

                if (!found || !CharData.CanSee(ch, ch.Hunting.Who))
                {
                    if (!ch.IsAffected(Affect.AFFECT_TRACK))
                        CommandType.Interpret(ch, "say Damn!  My prey is gone!");
                    else
                    {
                        ch.SendText("The trail seems to disappear.\r\n");
                        ch.RemoveAffect(Affect.AFFECT_TRACK);
                    }
                    Combat.StopHunting(ch);
                    return;
                }

                if (ch.InRoom == ch.Hunting.Who.InRoom)
                {
                    if (ch.Fighting)
                    {
                        return;
                    }
                    FoundPrey(ch, ch.Hunting.Who);
                    return;
                }

                ch.WaitState(Skill.SkillList["track"].Delay);
                Exit.Direction dir = FindPath(ch.InRoom.IndexNumber, ch.Hunting.Who.InRoom.IndexNumber, ch, -40000, true);

                if (dir == Exit.Direction.invalid)
                {
                    if (!ch.IsAffected(Affect.AFFECT_TRACK))
                    {
                        SocketConnection.Act("$n&n says 'Damn! Lost $M!'", ch, null, ch.Hunting.Who, SocketConnection.MessageTarget.room);
                    }
                    else
                    {
                        ch.SendText("You lose the trail.\r\n");
                        ch.RemoveAffect(Affect.AFFECT_TRACK);
                        Combat.StopHunting(ch);
                    }
                    return;
                }

                /*
                * Give a random direction if the mob misses the die roll.
                */
                if (MUDMath.NumberPercent() > 75)   /* @ 25% */
                {
                    do
                    {
                        dir = Database.RandomDoor();
                    }
                    while (!(ch.InRoom.ExitData[(int)dir]) || !(ch.InRoom.ExitData[(int)dir].TargetRoom));
                }

                if (ch.InRoom.ExitData[(int)dir].HasFlag(Exit.ExitFlag.closed))
                {
                    CommandType.Interpret(ch, "open " + dir.ToString());
                    return;
                }
                ImmortalChat.SendImmortalChat(null, ImmortalChat.IMMTALK_HUNTING, 0, String.Format("{0}&n leaves room {1} to the {2}.",
                    ch.ShortDescription, ch.InRoom.IndexNumber, dir.ToString()));
                if (ch.IsAffected(Affect.AFFECT_TRACK))
                {
                    SocketConnection.Act(String.Format("You sense $N&n's trail {0} from here...", dir.ToString()),
//.........这里部分代码省略.........
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:101,代码来源:Track.cs


示例19: Spellup

        // Checks for a mob spelling itself up.  Certain spells have higher
        // priority and percentage chances.
        //
        // The spell_lookup _function is horribly inefficient and anywhere possible
        // should be replaced with _skillNumber's (Spell.SpellNumber_armor and whatever) - Xangis
        //
        // The commented out spells have not been written yet.
        //
        // The CheckSpellup _function automatically checks to see whether they
        // are effected by the particular spell, so unless the spell has an
        // associated bitvector, there is no need for extra logic.
        //
        // Spells with associated bitvectors will need the "CharData.IsAffected" stuff
        // before the if( CheckSpellup( ... ) ) for the particular spell
        static bool Spellup( CharData ch )
        {
            if (ch == null) return false;
            if (ch.IsAffected(Affect.AFFECT_BLIND))
            {
                if( CheckSpellup( ch, "purify spirit", 35 ) )
                    return true;
            }

            if( !ch.IsAffected( Affect.AFFECT_BLUR ) )
                if( CheckSpellup( ch, "blur", 45 ) )
                    return true;

            /* Fireshield and Frostshield cancel eachother!  So, we don't want
            * that  to happen.  Easiest way is to give a chance to try either.
            * Odds  are, if they only have one of the two, that they'll take twice
            * as long to cast it on themselves. Yes, this is a  quick fix.
            */
            if( !ch.IsAffected( Affect.AFFECT_FIRESHIELD ) && !ch.IsAffected( Affect.AFFECT_COLDSHIELD ) )
            {
                if( MUDMath.NumberPercent() < 50 )
                {
                    if( CheckSpellup( ch, "fireshield", 30 ) )
                        return true;
                }
                else
                    if( CheckSpellup( ch, "coldshield", 30 ) )
                        return true;
            }

            if( CheckSpellup( ch, "vitality", 55 ) )
                return true;

            return false;
        }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:49,代码来源:MobFun.cs


示例20: ReturnToLoad

        public static void ReturnToLoad( CharData ch )
        {
            if( !ch || !ch.InRoom )
                return;
            if( ch.InRoom.Area != Room.GetRoom( ch.LoadRoomIndexNumber ).Area )
                return;

            Exit.Direction dir = FindPath( ch.InRoom.IndexNumber, ch.LoadRoomIndexNumber, ch, -40000, true );

            if( dir == Exit.Direction.invalid )
            {
                return;
            }

            if( ch.InRoom.ExitData[ (int)dir ].HasFlag( Exit.ExitFlag.closed ) &&
                    !ch.IsAffected( Affect.AFFECT_PASS_DOOR ) && !ch.HasInnate( Race.RACE_PASSDOOR ) )
            {
                CommandType.Interpret(ch, "unlock " + dir.ToString());
                CommandType.Interpret(ch, "open " + dir.ToString());
                return;
            }

            ch.Move( dir );

            if( !ch.InRoom )
            {
                string text = "Return_to_load: no ch._inRoom!  Mob #" + ch.MobileTemplate.IndexNumber + ", _name: " +
                       ch.Name + ".  Placing mob in limbo (mob.AddToRoom()).";
                Log.Error( text, 0 );
                ch.AddToRoom( Room.GetRoom( StaticRooms.GetRoomNumber("ROOM_NUMBER_LIMBO") ) );
                ImmortalChat.SendImmortalChat(ch, ImmortalChat.IMMTALK_SPAM, 0, text);
                return;
            }
            return;
        }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:35,代码来源:Track.cs



注:本文中的MUDEngine.CharData类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MUd.UruStream类代码示例发布时间:2022-05-26
下一篇:
C# LST.BufferChunk类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap