当前位置: 首页>>代码示例>>C#>>正文


C# CharData.IsClass方法代码示例

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


在下文中一共展示了CharData.IsClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InflictDamage


//.........这里部分代码省略.........
                {
                    ch.SendText( "&+bYou deny the damage.&n\r\n" );
                    immune = true;
                    dam = 0;
                }
                else
                    dam -= dam / 5;
            }

            // Check for protection spells that give 25% damage reduction - Xangis
            if (damType == AttackType.DamageType.fire && victim.IsAffected( Affect.AFFECT_PROTECT_FIRE))
                dam = ( dam * 3 ) / 4;
            else if (damType == AttackType.DamageType.cold && victim.IsAffected( Affect.AFFECT_PROTECT_COLD))
                dam = ( dam * 3 ) / 4;
            else if (damType == AttackType.DamageType.acid && victim.IsAffected( Affect.AFFECT_PROTECT_ACID))
                dam = ( dam * 3 ) / 4;
            else if (damType == AttackType.DamageType.gas && victim.IsAffected( Affect.AFFECT_PROTECT_GAS))
                dam = ( dam * 3 ) / 4;
            else if (damType == AttackType.DamageType.electricity && victim.IsAffected( Affect.AFFECT_PROTECT_LIGHTNING))
                dam = ( dam * 3 ) / 4;

            // Barkskin protects from 8% of slash and 12% of pierce damage.
            if (victim.IsAffected( Affect.AFFECT_BARKSKIN))
            {
                if (skill == "1h slashing" || skill == "2h slashing")
                    dam = dam * 11 / 12;
                else if (skill == "1h piercing" || skill == "2h piercing")
                    dam = dam * 7 / 8;
            }

            // Check for vampiric touch for anti-paladins and vampires
            if( weapon == ObjTemplate.WearLocation.hand_one || weapon == ObjTemplate.WearLocation.hand_two || weapon == ObjTemplate.WearLocation.hand_three || weapon == ObjTemplate.WearLocation.hand_four )
            {
                if( ( ( ch.IsClass(CharClass.Names.antipaladin) || ch.GetRace() == Race.RACE_VAMPIRE )
                        && skill == "barehanded fighting" && !Object.GetEquipmentOnCharacter(ch, weapon)) || (ch.IsAffected( Affect.AFFECT_VAMP_TOUCH)
                             && ( !( obj = Object.GetEquipmentOnCharacter( ch, weapon ) ) || obj.HasAffect( Affect.AFFECT_VAMP_TOUCH ) ) ) )
                {
                    ch.Hitpoints += dam / 3;
                    if( ch.Hitpoints > ( ch.GetMaxHit() + 50 + ch.Level * 5 ) )
                    {
                        ch.Hitpoints = ch.GetMaxHit() + 50 + ch.Level * 5;
                    }
                }
            }

            /* PC to PC damage quartered.
            *  NPC to PC damage divided by 3.
            */
            if( dam > 0 && !victim.IsNPC() && victim != ch )
            {
                if( !ch.IsNPC() )
                    dam /= 4;
                else
                    dam /= 3;
            }

            /*
            * Just a check for anything that is excessive damage
            * Send a log message, keeping the imms on their toes
            * Changed this from 300 to 250 'cause hitters get more than one
            *  attack/round and w/haste that's 1000 possible in the time one fist
            *  goes off.  That's more than the fist might do and it has to be
            *  memmed.
            */
            if (dam > 250 && skill != "backstab" )
            {
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:67,代码来源:Combat.cs

示例2: Forage

        /// <summary>
        /// Search the local area for food.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Forage(CharData ch, string[] str)
        {
            if( ch == null ) return;

            int indexNumber;
            Object obj = null;
            int[] flist = new int[10] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 25 };

            if (!ch.InRoom)
            {
                ch.SendText("There's no foraging to be done here.\r\n");
                return;
            }

            if (ch.FlightLevel != 0)
            {
                ch.SendText("Right, you're going to find something way up here.\r\n");
                return;
            }
            int chance = 10 + (ch.GetCurrLuck() / 20);
            if (ch.IsClass(CharClass.Names.ranger) || ch.IsClass(CharClass.Names.hunter) || ch.IsImmortal())
                chance = 75;
            if (chance < MUDMath.NumberPercent())
            {
                ch.SendText("You don't find anything at all.\r\n");
                ch.Wait += 10;
                return;
            }
            ch.Wait += 15;
            TerrainType sector = ch.InRoom.TerrainType;
            // TODO: FIXME: Don't use hard-coded item numbers!
            switch (sector)
            {
                default:
                    ch.SendText("Nothing edible could be growing here.\r\n");
                    return;
                case TerrainType.field:
                    flist[0] = 80;
                    flist[1] = 84;
                    flist[2] = 86;
                    flist[6] = 91;
                    flist[7] = 80;
                    break;
                case TerrainType.hills:
                    flist[0] = 82748;
                    flist[1] = 86;
                    flist[2] = 92;
                    flist[6] = 94;
                    break;
                case TerrainType.underground_wild:
                    flist[0] = 3352;
                    flist[5] = 3352;
                    flist[6] = 7711;
                    flist[1] = 85;
                    flist[2] = 88;
                    flist[7] = 82;
                    flist[8] = 83;
                    break;
                case TerrainType.swamp:
                    flist[0] = 3352;
                    flist[1] = 88;
                    flist[5] = 94;
                    flist[6] = 83;
                    flist[7] = 89;
                    break;
                case TerrainType.forest:
                    flist[0] = 2057;
                    flist[1] = 81651;
                    flist[2] = 90;
                    flist[3] = 93;
                    flist[4] = 92;
                    flist[5] = 90;
                    flist[6] = 87;
                    flist[7] = 84;
                    break;
            } //end switch
            if (ch.IsClass(CharClass.Names.ranger) || ch.IsClass(CharClass.Names.hunter))
                indexNumber = flist[MUDMath.NumberRange(0, 9)];
            else
                indexNumber = flist[MUDMath.NumberRange(0, 4)];
            if (indexNumber == 0)
            {
                ch.SendText("You find nothing edible.\r\n");
                return;
            }
            string buf = String.Format("Forage: {0} found index number {1} in room {2}.", ch.Name, indexNumber, ch.InRoom.IndexNumber);
            ImmortalChat.SendImmortalChat(null, ImmortalChat.IMMTALK_SPAM, 0, buf);
            /*
            if (fvnum == StaticObjects.OBJECT_NUMBER_SPRING) {
            //don't allow endless springs
            for ( obj = ch.in_room.contents; obj; obj = obj.next_content ) {
            if (obj.pIndexData.vnum == fvnum) {
            Descriptor._actFlags("You notice the $p&n.", ch, obj, null, Descriptor.MessageTarget.character);
            return;
            }
//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Command.cs

示例3: Guard

        /// <summary>
        /// Guard someone - try to prevent them from becoming the target of attacks.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Guard(CharData ch, string[] str)
        {
            if( ch == null ) return;
            CharData worldChar;

            if (ch.IsNPC())
                return;

            if (!ch.HasSkill("guard"))
            {
                ch.SendText("Guard!? You can't even protect yourself!\r\n");
                return;
            }

            if (str.Length == 0)
            {
                if (!((PC)ch).Guarding)
                {
                    ch.SendText("Guard who?\r\n");
                    return;
                }
                if (!((PC)ch).Guarding)
                {
                    string buf = "You are guarding " + (((PC)ch).Guarding.IsNPC() ?
                                 ((PC)ch).Guarding.ShortDescription : ((PC)ch).Guarding.Name) + ".\r\n";
                    ch.SendText(buf);
                    return;
                }
            }

            if (!MUDString.StringsNotEqual(str[0], "who"))
            {
                if (!((PC)ch).Guarding)
                {
                    ch.SendText("You are not guarding anyone.\r\n");
                }
                else
                {
                    SocketConnection.Act("You are guarding $N&n.", ch, null, ((PC)ch).Guarding, SocketConnection.MessageTarget.character);
                }
                foreach (CharData it in Database.CharList)
                {
                    worldChar = it;
                    if (worldChar.IsNPC())
                    {
                        continue;
                    }
                    if (((PC)worldChar).Guarding && ((PC)worldChar).Guarding == ch)
                    {
                        SocketConnection.Act("$N&n is guarding you.", ch, null, worldChar, SocketConnection.MessageTarget.character);
                    }
                }
                return;
            }

            CharData victim = ch.GetCharRoom(str[0]);
            if (!victim)
            {
                ch.SendText("You don't see them here.\r\n");
                return;
            }

            if (victim == ch)
            {
                ch.SendText("You no longer guard anyone.\r\n");
                ((PC)ch).Guarding = null;
                return;
            }

            if (ch.IsClass(CharClass.Names.paladin) && victim.IsEvil())
            {
                ch.SendText("Their blackened soul is hardly worth the effort.\r\n");
                return;
            }

            if (((PC)ch).Guarding)
            {
                SocketConnection.Act("$N&n stops guarding you.", ((PC)ch).Guarding, null, ch, SocketConnection.MessageTarget.character);
                SocketConnection.Act("You stop guarding $N&n.", ch, null, ((PC)ch).Guarding, SocketConnection.MessageTarget.character);
            }

            ((PC)ch).Guarding = victim;
            SocketConnection.Act("You now guard $N&n.", ch, null, victim, SocketConnection.MessageTarget.character);
            SocketConnection.Act("$n&n is now guarding you.", ch, null, victim, SocketConnection.MessageTarget.victim);
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:91,代码来源:Command.cs

示例4: Train

        /// <summary>
        /// Train: For monks or mystics, lets them learn skills and traditions.  For everyone
        /// else it tells them they practice by using their skills.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Train(CharData ch, string[] str)
        {
            if( ch == null ) return;
            int count, teacherTradition = 0;
            string buf;
            Object icon = null;
            CharData teacher = null;
            int skillLevel;

            if (!ch.IsClass(CharClass.Names.monk) && !ch.IsClass(CharClass.Names.mystic))
            {
                // Send them to the error message.
                Practice(ch, str);
                return;
            }
            if (ch.IsNPC())
            {
                return;
            }
            //find a teacher
            foreach (CharData iteacher in ch.InRoom.People)
            {
                if (iteacher.CharacterClass == ch.CharacterClass && iteacher.HasActionBit(MobTemplate.ACT_TEACHER))
                {
                    teacher = iteacher;
                    break;
                }
            }
            // find an icon
            foreach (Object iconobj in ch.InRoom.Contents)
            {
                if (iconobj.ItemType == ObjTemplate.ObjectType.tradition_icon)
                {
                    icon = iconobj;
                    break;
                }
            }
            // if not in room, check on the teacher
            if (!icon && teacher)
            {
                foreach (Object iconobj in teacher.Carrying)
                {
                    if (iconobj.ItemType == ObjTemplate.ObjectType.tradition_icon)
                    {
                        icon = iconobj;
                        break;
                    }
                }
            }
            if (icon && teacher)
            {
                teacherTradition = icon.Values[0];
            }
            int tradition = ((PC)ch).Tradition;

            if (str.Length == 0)
            {
                if (tradition == 0 && teacherTradition == 0)
                {
                    // tell em how to train
                    ch.SendText("One trains their skills by first training a tradition.\r\n");
                    return;
                }
                string buf1;
                if (tradition != teacherTradition && teacherTradition <= TraditionData.Table.Length
                    && teacherTradition != 0)
                {
                    // they can train a new tradition here
                    if (tradition == 0)
                    {
                        buf1 = String.Format("To train the {0} tradition, type 'train tradition'.\r\n", TraditionData.Names[teacherTradition]);
                    }
                    else
                    {
                        buf1 = String.Format("It will cost you {0} points to train tradition in the {1}.\r\n", ch.Level, TraditionData.Names[teacherTradition]);
                    }
                    ch.SendText(buf1);
                    return;
                }
                //show  existing monk skills

                buf1 = "&+WTradition:&n ";
                if (tradition != 0)
                {
                    buf = String.Format("&+B{0}&n\r\n", TraditionData.Names[tradition]);
                }
                else
                {
                    buf = String.Format("none\r\n");
                }
                buf1 += buf;
                buf1 += "\r\n&+WYou can train the following:&n\r\n\r\n";
                buf1 += "      Skill                  Level                  Cost\r\n";
                for (count = 0; count < TraditionData.Table.Length; ++count)
//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Command.cs

示例5: Cast

        /// <summary>
        /// Command to cast a spell.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Cast(CharData ch, string[] str)
        {
            if( ch == null ) return;

            if ((ch.IsClass(CharClass.Names.psionicist) || ch.IsClass(CharClass.Names.enslaver)) && !ch.IsImmortal())
            {
                ch.SendText("Psionicists use the WILL command to invoke their powers.\r\n");
                return;
            }

            if (ch.IsClass(CharClass.Names.bard) && !ch.IsImmortal())
            {
                ch.SendText("Bards use the SING or PLAY commands to invoke their powers.\r\n");
                return;
            }

            if (ch.Riding && ch.InRoom == ch.Riding.InRoom)
            {
                ch.SendText("You cannot cast while mounted!\r\n");
                return;
            }

            if (ch.IsAffected( Affect.AFFECT_MINOR_PARA) ||
                    ch.IsAffected( Affect.AFFECT_HOLD))
            {
                ch.SendText("You can't cast when you're paralyzed!\r\n");
                return;
            }

            if (str.Length == 0)
            {
                ch.SendText("Cast what spell where?\r\n");
                return;
            }

            Magic.Cast(ch, String.Join(" ", str));
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:42,代码来源:Command.cs

示例6: Songs

        /// <summary>
        /// Shows the list of songs available to the player, if any.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Songs(CharData ch, string[] str)
        {
            if( ch == null ) return;

            string buf = String.Empty;
            int level;

            if (ch.IsNPC() || ch.IsClass(CharClass.Names.bard))
            {
                ch.SendText("&nYou do not need any stinking songs!\r\n");
                return;
            }

            buf += "&n&+rALL songs available for your class.&n\r\n";
            buf += "&+RLv      Song&n\r\n";

            for (level = 1; level < 56; level++)
            {
                bool pSong = true;

                foreach (KeyValuePair<String, Song> kvp in Database.SongList)
                {
                    if (kvp.Value.SongCircle[(int)ch.CharacterClass.ClassNumber] != level)
                        continue;

                    if (pSong)
                    {
                        buf += "&+Y" + MUDString.PadInt(level, 2) + "&+y:&n";
                        pSong = false;
                    }
                    else
                    {
                        buf += "   ";
                    }
                    buf += "     ";
                    buf += "&n&+c" + MUDString.PadStr(kvp.Key, 21) + "  &+Y" + ((PC)ch).SongAptitude[kvp.Key] +
                        "&n (" + StringConversion.SpellSchoolString(kvp.Value.PerformanceType) + ")";
                    buf += "\r\n";
                }

            }

            ch.SendText(buf);
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:50,代码来源:Command.cs

示例7: Cant

        /// <summary>
        /// Cant language for thieves only.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Cant(CharData ch, string[] str)
        {
            if( ch == null ) return;

            string buf;

            if (str.Length == 0)
            {
                ch.SendText("Cant what?\r\n");
                return;
            }

            if (!ch.IsClass(CharClass.Names.thief) && !ch.IsImmortal())
            {
                ch.SendText("You speak gibberish.\r\n");
                buf = String.Format("$n says, '{0}'\r\n", NounType.RandomSentence());
                SocketConnection.Act(buf, ch, null, null, SocketConnection.MessageTarget.room);
                return;
            }

            string text = String.Join(" ", str);

            // We don't want to let them know they're drunk.
            SocketConnection.Act("You cant '&n$T&n'", ch, null, text, SocketConnection.MessageTarget.character);

            text = DrunkSpeech.MakeDrunk(text, ch);
            string random = NounType.RandomSentence();

            foreach (CharData roomChar in ch.InRoom.People)
            {
                if (roomChar == ch || roomChar.IsNPC())
                    continue;

                if (roomChar.IsImmortal() || roomChar.IsClass(CharClass.Names.thief))
                {
                    buf = String.Format("{0} cants '&n$T&n'", ch.ShowNameTo(roomChar, true));
                }
                else
                {
                    buf = String.Format("{0} says, '{1}'\r\n", ch.ShowNameTo(roomChar, true), random);
                }

                SocketConnection.Act(buf, roomChar, null, SocketConnection.TranslateText(text, ch, roomChar), SocketConnection.MessageTarget.character);
            }

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

示例8: CheckCastable

        /// <summary>
        /// Checks whether spells can be cast in this room.
        /// </summary>
        /// <param name="ch">The caster</param>
        /// <param name="song">Is this a bard song?</param>
        /// <param name="start">true if just starting to cast, false if finishing up the spell.</param>
        /// <returns>true if the caster is able to cast spells here.</returns> 
        public bool CheckCastable( CharData ch, bool song, bool start )
        {
            if( !ch.IsClass( CharClass.Names.psionicist ) )
            {
                if( HasFlag( ROOM_SILENT ) )
                {
                    ch.SendText( "Your voice makes no sound in this room!\r\n" );
                    return false;
                }

                if( !song && HasFlag( ROOM_NO_MAGIC ) )
                {
                    // Extra message and a wait state if this happens when they start casting.
                    if( start )
                    {
                        ch.SendText( "You start casting..." );
                        ch.WaitState( 6 );
                    }
                    ch.SendText( "After a brief gathering of energy, your spell fizzles!\r\n" );
                    return false;
                }
            }
            else if( HasFlag( ROOM_NO_PSIONICS ) )
            {
                ch.SendText( "Something here prevents you from focusing your will.\r\n" );
                ch.WaitState( 2 );
                return false;
            }
            // No reason they can't cast.
            return true;
        }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:38,代码来源:Room.cs

示例9: CheckStarshell

 /// <summary>
 /// Checks whether a spell cast by the player is swallowed by one of the starshell types.
 /// </summary>
 /// <param name="ch">The caster</param>
 /// <returns>true if the spell was eaten.</returns>
 public bool CheckStarshell(CharData ch)
 {
     if( !ch.IsClass( CharClass.Names.bard ) )
     {
         if( ch.InRoom.HasFlag( ROOM_EARTHEN_STARSHELL ) )
         {
             ch.SendText( "You start casting...\r\n" );
             ch.SendText( "&+lThe &+yearth&n &+lcomes up &+yand engulfs &+lyour spell.\r\n" );
             Combat.InflictSpellDamage( ch, ch, 1, "earthen starshell", AttackType.DamageType.fire );
             ch.WaitState( 6 );
             return true;
         }
         if( ch.InRoom.HasFlag( ROOM_AIRY_STARSHELL ) )
         {
             ch.SendText( "You start casting...\r\n" );
             ch.SendText( "&+CAir swir&n&+cls a&+Cnd absorbs y&n&+cour spell.&n\r\n" );
             ch.WaitState( 6 );
             if( ch.CurrentPosition > Position.reclining && MUDMath.NumberPercent() + 50 > ch.GetCurrAgi() )
             {
                 ch.CurrentPosition = Position.reclining;
                 ch.WaitState( 6 );
                 ch.SendText( "You are knocked over!\r\n" );
             }
             return true;
         }
         if( ch.InRoom.HasFlag( ROOM_WATERY_STARSHELL ) )
         {
             ch.SendText( "You start casting...\r\n" );
             ch.SendText( "&+bWater b&+Bursts up a&n&+bnd absor&+Bbs your spell.&n\r\n" );
             ch.WaitState( 6 );
             ch.CurrentMoves -= 20;
             ch.SendText( "You feel tired!\r\n" );
             return true;
         }
         if( ch.InRoom.HasFlag( ROOM_FIERY_STARSHELL ) )
         {
             ch.SendText( "You start casting...\r\n" );
             ch.SendText( "&+RFire&n&+r engu&+Rlfs y&n&+rour s&+Rpell.&n\r\n" );
             Combat.InflictSpellDamage( ch, ch, 1, "fiery starshell", AttackType.DamageType.fire );
             ch.WaitState( 6 );
             return true;
         }
     }
     return false;
 }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:50,代码来源:Room.cs

示例10: CheckAggressive

        public static bool CheckAggressive( CharData ch, CharData victim )
        {
            if( ch == null )
            {
                Log.Error( "CheckAggressive: called with null ch.", 0 );
                return false;
            }
            if( victim == null )
            {
                Log.Error( "CheckAggressive: called with null victim.", 0 );
                return false;
            }

            if (!victim.IsAggressive(ch))
            {
                return false;
            }
            if( !ch.IsNPC() && ( (PC)ch ).AggressiveLevel >= 1 && ( (PC)ch ).AggressiveLevel < ch.Hitpoints && ch.CurrentPosition == Position.standing
                    && !ch.IsAffected( Affect.AFFECT_CASTING ) )
            {
                ch.SendText( "You charge aggressively at your foe!\r\n" );
                if (ch.IsClass(CharClass.Names.thief) || ch.IsClass(CharClass.Names.assassin)
                        || ch.IsClass(CharClass.Names.bard) || ch.IsClass(CharClass.Names.mercenary))
                {
                    Backstab(ch, victim);
                    SetFighting(victim, ch);
                }
                else
                {
                    CombatRound(ch, victim, String.Empty);
                }
                return true;
            }
            return false;
        }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:35,代码来源:Combat.cs

示例11: CombatRound

        /// <summary>
        /// Do one round of attacks for one character.
        /// Note: This is a round, not a single attack!
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="victim"></param>
        /// <param name="skill"></param>
        /// <returns></returns>
        public static bool CombatRound(CharData ch, CharData victim, string skill)
        {
            Object wield;
            int chance = 0;

            if( ch == null )
            {
                return false;
            }

            if( victim == null )
            {
                return false;
            }

            /* No casting/being para'd and hitting at the same time. */
            if( ( ch.IsAffected( Affect.AFFECT_CASTING ) ) || ch.IsAffected( Affect.AFFECT_MINOR_PARA )
                    || ch.IsAffected(Affect.AFFECT_HOLD))
            {
                return false;
            }

            /* I don't know how a dead person can hit someone/be hit. */
            if( victim.CurrentPosition == Position.dead || victim.Hitpoints < -10 )
            {
                StopFighting( victim, true );
                return true;
            }

            /*
            * Set the fighting fields now.
            */
            if( victim.CurrentPosition > Position.stunned )
            {
                if( !victim.Fighting )
                    SetFighting( victim, ch );
                // Can't have bashed/prone people just automatically be standing.
                if( victim.CurrentPosition == Position.standing )
                    victim.CurrentPosition = Position.fighting;
            }

            // HORRIBLE HORRIBLE! We've got index numbers hard-coded.  TODO: FIXME: BUG: Get rid of this!
            if( ch.IsNPC() && ch.MobileTemplate != null && ( ch.MobileTemplate.IndexNumber == 9316 ||
                   ch.MobileTemplate.IndexNumber == 9748 ) && MUDMath.NumberPercent() < 20 )
            {
                CheckShout( ch, victim );
            }
            ch.BreakInvisibility();

            // Everyone gets at least one swing/breath in battle.
            // This handles breathing, roaring, etc.
            if (!CheckRaceSpecial(ch, victim, skill))
                SingleAttack(ch, victim, skill, ObjTemplate.WearLocation.hand_one);

            // Thrikreen primary hand extra attack, only thri extra attack that is
            // given to non-warriors in addition to warriors
            if( ch.GetRace() == Race.RACE_THRIKREEN && MUDMath.NumberPercent() < ch.Level )
            {
                if( ch.IsClass(CharClass.Names.warrior) )
                {
                    switch( MUDMath.NumberRange( 1, 4 ) )
                    {
                        case 1:
                            if( Object.GetEquipmentOnCharacter( ch, ObjTemplate.WearLocation.hand_one ) )
                                SingleAttack(ch, victim, skill, ObjTemplate.WearLocation.hand_one);
                            break;
                        case 2:
                            if( Object.GetEquipmentOnCharacter( ch, ObjTemplate.WearLocation.hand_two ) )
                                SingleAttack(ch, victim, skill, ObjTemplate.WearLocation.hand_two);
                            break;
                        case 3:
                            if( Object.GetEquipmentOnCharacter( ch, ObjTemplate.WearLocation.hand_three ) )
                                SingleAttack(ch, victim, skill, ObjTemplate.WearLocation.hand_three);
                            break;
                        case 4:
                            if( Object.GetEquipmentOnCharacter( ch, ObjTemplate.WearLocation.hand_four ) )
                                SingleAttack(ch, victim, skill, ObjTemplate.WearLocation.hand_four);
                            break;
                    }
                }
                else
                {
                    SingleAttack(ch, victim, skill, ObjTemplate.WearLocation.hand_one);
                    if( MUDMath.NumberPercent() < ch.Level / 2 )
                    {
                        SingleAttack(ch, victim, skill, ObjTemplate.WearLocation.hand_one);
                    }
                }
            }

            // Don't hurt a corpse.
            if( victim.CurrentPosition == Position.dead || victim.Hitpoints < -10 )
//.........这里部分代码省略.........
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:101,代码来源:Combat.cs

示例12: BlurAttack

        /// <summary>
        /// Processes a blur-type attack.  Returns true if the victim died.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="victim"></param>
        /// <returns></returns>
        public static bool BlurAttack( CharData ch, CharData victim )
        {
            if (ch == null) return false;

            int numAttacks;
            int count;

            if( ch.IsAffected( Affect.AFFECT_CASTING ) )
            {
                return false;
            }

            if( ch.IsAffected( Affect.AFFECT_BLUR ) && MUDMath.NumberPercent() < 25 )
            {
                SocketConnection.Act( "$n&n moves with a BLUR of speed!", ch, null, null, SocketConnection.MessageTarget.room );
                SocketConnection.Act( "You move with a BLUR of speed!", ch, null, null, SocketConnection.MessageTarget.character );
                for( count = 0, numAttacks = 4; count < numAttacks && victim.CurrentPosition > Position.dead; ++count )
                {
                    SingleAttack( ch, victim, String.Empty, ObjTemplate.WearLocation.hand_one );
                }
            }
            else
            {
                Object wield;

                if( MUDMath.NumberPercent() > 10 )
                    return false;
                if( ch.IsClass(CharClass.Names.hunter) || ch.IsClass(CharClass.Names.ranger ))
                    numAttacks = 2;
                else if( ch.GetRace() == Race.RACE_OGRE || ch.GetRace() == Race.RACE_CENTAUR )
                    numAttacks = 4;
                else
                    numAttacks = 9;
                if( MUDMath.NumberPercent() < ch.GetCurrLuck() )
                    numAttacks++;
                if( MUDMath.NumberPercent() < victim.GetCurrLuck() )
                    numAttacks--;

                /* 9716 is the index number for the dagger of the wind. */
                // HORRIBLE HORRIBLE TODO: FIXME: BUG: Never hard-code item index numbers.
                if( ( wield = Object.GetEquipmentOnCharacter( ch, ObjTemplate.WearLocation.hand_one ) ) && wield.ObjIndexData.IndexNumber == 9716 )
                {
                    SocketConnection.Act( "&+c$n&+c's $p&n &+cbegins to move with the &+Wspeed&+c of a &+lstorm&+c!&n", ch, wield, null, SocketConnection.MessageTarget.room );
                    SocketConnection.Act( "Your $p&n &+cbegins to move with the &+Wspeed&+c of a &+lstorm&+c!&n", ch, wield, null, SocketConnection.MessageTarget.character );
                    for( count = 0; count < numAttacks && victim.CurrentPosition > Position.dead; ++count )
                    {
                        SingleAttack(ch, victim, String.Empty, ObjTemplate.WearLocation.hand_one);
                    }
                    return ( victim.CurrentPosition > Position.dead );
                }
                if( ( wield = Object.GetEquipmentOnCharacter( ch, ObjTemplate.WearLocation.hand_two ) ) && wield.ObjIndexData.IndexNumber == 9716 )
                {
                    SocketConnection.Act( "&+c$n&+c's $p&n &+cbegins to move with the &+Wspeed&+c of a &+lstorm&+c!&n", ch, wield, null, SocketConnection.MessageTarget.room );
                    SocketConnection.Act( "Your $p&n &+cbegins to move with the &+Wspeed&+c of a &+lstorm&+c!&n", ch, wield, null, SocketConnection.MessageTarget.character );
                    for( count = 0; count < numAttacks && victim.CurrentPosition > Position.dead; ++count )
                    {
                        SingleAttack(ch, victim, String.Empty, ObjTemplate.WearLocation.hand_two);
                    }
                    return ( victim.CurrentPosition > Position.dead );
                }
                if( ( wield = Object.GetEquipmentOnCharacter( ch, ObjTemplate.WearLocation.hand_three ) ) && wield.ObjIndexData.IndexNumber == 9716 )
                {
                    SocketConnection.Act( "&+c$n&+c's $p&n &+cbegins to move with the &+Wspeed&+c of a &+lstorm&+c!&n", ch, wield, null, SocketConnection.MessageTarget.room );
                    SocketConnection.Act( "Your $p&n &+cbegins to move with the &+Wspeed&+c of a &+lstorm&+c!&n", ch, wield, null, SocketConnection.MessageTarget.character );
                    for( count = 0; count < numAttacks && victim.CurrentPosition > Position.dead; ++count )
                    {
                        SingleAttack(ch, victim, String.Empty, ObjTemplate.WearLocation.hand_three);
                    }
                    return ( victim.CurrentPosition > Position.dead );
                }
                if( ( wield = Object.GetEquipmentOnCharacter( ch, ObjTemplate.WearLocation.hand_four ) ) && wield.ObjIndexData.IndexNumber == 9716 )
                {
                    SocketConnection.Act( "&+c$n&+c's $p&n &+cbegins to move with the &+Wspeed&+c of a &+lstorm&+c!&n", ch, wield, null, SocketConnection.MessageTarget.room );
                    SocketConnection.Act( "Your $p&n &+cbegins to move with the &+Wspeed&+c of a &+lstorm&+c!&n", ch, wield, null, SocketConnection.MessageTarget.character );
                    for( count = 0; count < numAttacks && victim.CurrentPosition > Position.dead; ++count )
                    {
                        SingleAttack(ch, victim, String.Empty, ObjTemplate.WearLocation.hand_four);
                    }
                    return ( victim.CurrentPosition > Position.dead );
                }
            }
            return false;
        }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:89,代码来源:Combat.cs

示例13: Backstab


//.........这里部分代码省略.........
            if (Math.Abs(ch.CurrentSize - victim.CurrentSize) == 2)
                stabChance -= 10;
            switch (victim.CurrentPosition)
            {
                default:
                    break;
                case Position.mortally_wounded:
                case Position.incapacitated:
                case Position.unconscious:
                    stabChance += 80;
                    break;
                case Position.stunned:
                case Position.sleeping:
                    stabChance += 40;
                    break;
                case Position.reclining:
                    stabChance += 20;
                    break;
                case Position.resting:
                case Position.sitting:
                    stabChance += 10;
                    break;
            } //end switch
            // Half as likely to succeed on those that are aware
            if (victim.IsAffected(Affect.AFFECT_AWARE) || victim.IsAffected( Affect.AFFECT_SKL_AWARE))
            {
                chance /= 2;
            }
            string lbuf = String.Format("Command.Backstab: {0} is attempting with a {1}%% chance.", ch.Name, stabChance);
            ImmortalChat.SendImmortalChat(null, ImmortalChat.IMMTALK_SPAM, 0, lbuf);
            if (MUDMath.NumberPercent() < stabChance)
            {
                /* First hit on backstab.  Check for instant kill. - Xangis */
                if (ch.HasSkill("instant kill"))
                {
                    if (!ch.IsNPC())
                        chance = ((PC)ch).SkillAptitude["instant kill"];
                    else
                        chance = (ch.Level * 3) / 2 + 20;

                    // People over level 50 get a bonus, equates to about 1-2%
                    if (ch.Level > 50)
                        chance += 25;

                    chance += (ch.Level - victim.Level);

                    // Immortals will get a bonus too
                    if (ch.IsImmortal())
                        chance *= 4;

                    // Half as likely to succeed on those that are aware
                    if (victim.IsAffected(Affect.AFFECT_AWARE) || victim.IsAffected(Affect.AFFECT_SKL_AWARE))
                    {
                        chance /= 2;
                    }

                    if (MUDMath.NumberRange(1, 20000) < chance)
                    {
                        if (!ch.IsNPC())
                            ch.PracticeSkill("instant kill");
                        {
                            lbuf = String.Format("backstab: {0} hit an instakill on {1} with a {2} chance in hundredths of a percent.",
                                      ch.Name, victim.Name, (chance / 30));
                            ImmortalChat.SendImmortalChat(null, ImmortalChat.IMMTALK_SPAM, 0, lbuf);
                            Log.Trace(lbuf);
                            ch.WaitState(15);
                            SingleAttack(ch, victim, "instant kill", hand);
                            return true;
                        }
                    }
                }

                SingleAttack(ch, victim, "backstab", hand);
                /* No double stabs when the first stab kills'm. */
                if (victim.CurrentPosition == Position.dead)
                    return true;

                /* Case of thieves/assassins doing a double backstab. */
                obj = Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_two);
                /* Stop 2nd-hand non-pierce backstabs. */
                if (!ch.IsNPC() && (obj != null) && (hand != ObjTemplate.WearLocation.hand_two)
                        && obj.ItemType == ObjTemplate.ObjectType.weapon
                        && (AttackType.Table[obj.Values[3]].SkillName) == "1h piercing")
                {
                    /* Thieves get 1/2 chance at double, assassins get 2/3. */
                    // Xangis - removed double stab for thieves 6-9-00
                    if ((ch.IsClass(CharClass.Names.assassin)) && (MUDMath.NumberPercent() < ((PC)ch).SkillAptitude["backstab"] * 2 / 3))
                    {
                        lbuf = String.Format("backstab: {0} hit a double backstab.", ch.Name);
                        ImmortalChat.SendImmortalChat(null, ImmortalChat.IMMTALK_SPAM, 0, lbuf);
                        SingleAttack(ch, victim, "backstab", ObjTemplate.WearLocation.hand_two);
                    }
                }
            }
            else    /* Send a "you miss your backstab" messge & engage. */
            {
                InflictDamage(ch, victim, 0, "backstab", ObjTemplate.WearLocation.hand_one, AttackType.DamageType.pierce);
            }
            return true;
        }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:101,代码来源:Combat.cs

示例14: SingleAttack


//.........这里部分代码省略.........
            * Calc damage.
            *
            * NPCs are more badass barehanded than players.  If they weren't
            * the game would be too damned easy since mobs almost never have
            * weapons.
            *
            * Increased mob damage by about 1/6
            * It was previously level/2 to level*3/2 (25-75 at 50, average 50)
            * It is now level*3/5 to level*10/6      (30-87 at 50, average 59)
            *
            * Added the + ch.level - 1 'cause mobs still not hittin' hard enough
            */
            if( ch.IsNPC() )
            {
                dam = MUDMath.NumberRange( ( ch.Level * 3 / 5 ), ( ch.Level * 14 / 8 ) )
                      + ( ch.Level - 1 );
                if (wield)
                {
                    dam += MUDMath.Dice(wield.Values[1], wield.Values[2]);
                }
                else if (ch.CheckSkill("unarmed damage"))
                {
                    dam += MUDMath.NumberRange(1, (ch.GetSkillChance("unarmed damage") / 12));
                }
            }
            else
            {
                if (wield)
                {
                    dam = MUDMath.Dice(wield.Values[1], wield.Values[2]);
                }
                else
                {
                    if (!ch.IsClass(CharClass.Names.monk))
                    {
                        dam = MUDMath.NumberRange(1, (2 + (int)ch.CurrentSize / 3));
                        if (ch.CheckSkill("unarmed damage"))
                        {
                            dam += MUDMath.NumberRange(1, (ch.GetSkillChance("unarmed damage") / 12));
                        }
                    }
                    else
                    {
                        int min;
                        // monk barehanded damage - Xangis
                        ch.PracticeSkill("unarmed damage");
                        chance = ch.GetSkillChance("unarmed damage");
                        if (chance < 13)
                        {
                            min = 1;
                        }
                        else
                        {
                            min = chance / 13;
                        }
                        // at max skill for barehanded and unarmed, a monk will get
                        // a damage of 7-38, an average of 22.5 damage per hit before
                        // modifiers.  This is slightly better than a 6d6 weapon (average of 21 dmg)
                        // this is slightly worse than a 6d7 weapon (average of 24 dmg)
                        dam = MUDMath.NumberRange(min, ((chance / 3) + min));
                    }
                }
                if( ( wield && dam > 1000 ) && ch.Level < Limits.LEVEL_AVATAR )
                {
                    text = String.Format( "SingleAttack damage range > 1000 from {0} to {1}",
                              wield.Values[ 1 ], wield.Values[ 2 ] );
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:67,代码来源:Combat.cs

示例15: Score

        /// <summary>
        /// Shows a character's score screen.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Score(CharData ch, string[] str)
        {
            if( ch == null ) return;

            string text = String.Empty;

            if (ch == null)
            {
                Log.Error("Command.Score(): null ch.", 0);
                return;
            }

            Affect prev;

            text += "&+WName: &+G" + ch.Name + "&n" + (ch.IsNPC() ? String.Empty : ((PC)ch).Title) + "\r\n";
            text += "&+WRace:&n " + MUDString.PadStr(Race.RaceList[ch.GetRace()].ColorName, 16);
            text += "&+WClass:&n " + MUDString.PadStr(ch.CharacterClass.WholistName, 32) + "&n\r\n";
            text += "&+WLevel: " + MUDString.PadInt(ch.Level, 5) + "     Played: " + (ch.TimePlayed.Hours) + " hours       &+WSex: ";
            text += System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(ch.GetSexString()) + "\r\n";
            if (ch.Fighting == null)
            {
                text += "&+WExperience: &+B" + StringConversion.ExperienceString(ch) + "&n\r\n\r\n";
            }
            text += "&+WCurrent/Max Health: [&n&+g" + MUDString.PadInt(ch.Hitpoints, 5) + "&+W / &n&+g" + MUDString.PadInt(ch.GetMaxHit(), 5);
            text += "&+W]     Coins:     Carried     In Bank\r\n";
            text += "&+WCurrent/Max Moves:  [&n&+g" + MUDString.PadInt(ch.CurrentMoves, 5) + "&+W / &n&+g" + MUDString.PadInt(ch.MaxMoves, 5);
            text += "&+W]     &+WPlatinum      " + MUDString.PadInt(ch.GetPlatinum(), 5) + "        ";
            text += (ch.IsNPC() ? 0 : ((PC)ch).Bank.Platinum) + "\r\n";
            text += "Current/Max Mana:   [&n&+g" + MUDString.PadInt(ch.CurrentMana, 5) + "&+W / &n&+g" + MUDString.PadInt(ch.MaxMana, 5);
            text += "&+W]     &+YGold          " + MUDString.PadInt(ch.GetGold(), 5) + "        " + (ch.IsNPC() ? 0 : ((PC)ch).Bank.Gold) + "\r\n";
            text += "                                        &n&+wSilver        " + MUDString.PadInt(ch.GetSilver(), 5) + "        ";
            text += (ch.IsNPC() ? 0 : ((PC)ch).Bank.Silver) + "\r\n";
            text += "&+WFrags: &+W" + MUDString.PadInt((ch.IsNPC() ? 0 : ((PC)ch).Frags), 3) + "&n                               &n&+yCopper        ";
            text += MUDString.PadInt(ch.GetCopper(), 5) + "        " + (ch.IsNPC() ? 0 : ((PC)ch).Bank.Copper) + "\r\n";
            if (!ch.IsNPC())
            {
                text += "&+WTotal Deaths: &+W" + MUDString.PadInt(((PC)ch).MobDeaths + ((PC)ch).PlayerDeaths, 5) + "&n     &+WMobs Killed: &+W";
                text += MUDString.PadInt(((PC)ch).MobKills, 5) + "&n\r\n&+WPlayers Killed: &+W" + MUDString.PadInt(((PC)ch).PlayerKills, 5);
                text += "&n   &+WPlayer Deaths: &+W" + MUDString.PadInt(((PC)ch).PlayerDeaths, 5) + "&n\r\n";
            }

            if (!ch.IsNPC())
            {
                int divisor = ((PC)ch).Created.Quantity;
                if (divisor == 0)
                    divisor = 1;
                text += String.Format("&+WItems Created: &n{0}    &+WTotal Value: &n{1}  &+WBest: &n{2}  &+WAvg: &n{3}\r\n",
                    MUDString.PadInt(((PC)ch).Created.Quantity, 5),
                    MUDString.PadInt(((PC)ch).Created.TotalCost, 5),
                    MUDString.PadInt(((PC)ch).Created.MaxCost, 5),
                    MUDString.PadInt((((PC)ch).Created.TotalCost / divisor), 5));
                divisor = ((PC)ch).Destroyed.Quantity;
                if (divisor == 0)
                    divisor = 1;
                text += String.Format("&+WItems Destroyed: &n{0}  &+WTotal Value: &n{1}  &+WBest: &n{2}  &+WAvg: &n{3}\r\n",
                    MUDString.PadInt(((PC)ch).Destroyed.Quantity, 5),
                    MUDString.PadInt(((PC)ch).Destroyed.TotalCost, 5),
                    MUDString.PadInt(((PC)ch).Destroyed.MaxCost, 5),
                    MUDString.PadInt((((PC)ch).Destroyed.TotalCost / divisor), 5));
            }

            if (!ch.IsNPC())
            {
                text += "&+WTotal Score: &+W" + ((PC)ch).Score + "&n\r\n";
            }

            if (ch.IsClass(CharClass.Names.monk) || ch.IsClass(CharClass.Names.mystic))
            {
                text += "&+WTradition: &+B" + TraditionData.Names[((PC)ch).Tradition] + "&n\r\n";
                text += "&+WTraining Points: &+B" + (ch.IsNPC() ? 0 : ((PC)ch).SkillPoints) + "&n\r\n";
            }

            if (ch.Followers != null && ch.Followers.Count > 0)
            {
                text += "&+BFollowers:&n\r\n";
                foreach (CharData follower in ch.Followers)
                {
                    if (follower == null)
                    {
                        continue;
                    }
                    text += follower.ShowNameTo(ch, true) + " &n\r\n";
                }
                text += "\r\n";
            }
            if (ch.IsAffected( Affect.AFFECT_POISON))
            {
                text += "&+GYou are poisoned.&n\r\n";
            }

            if ((ch.IsAffected( Affect.AFFECT_DETECT_MAGIC) || ch.IsImmortal())
                    && MUDString.StringsNotEqual(BitvectorFlagType.AffectString(ch.AffectedBy, true), "none"))
            {
                text += "&+BEnchantments: &+W" + BitvectorFlagType.AffectString(ch.AffectedBy, true) + "&n\r\n\r\n";
            }
//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Command.cs


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