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


C# CharData.IsImmortal方法代码示例

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


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

示例1: Skills

        // reformatted - Xangis
        // Immortals can also see a player's skill list now.
        public static void Skills(CharData ch, string[] str)
        {
            if( ch == null ) return;

            if (ch.IsNPC())
            {
                ch.SendText("&nYou do not need any stinking skills!\r\n");
                return;
            }

            CharData charData = ch;

            if (ch.IsImmortal() && str.Length != 0)
            {
                charData = ch.GetCharWorld(str[0]);
                if (!charData)
                {
                    ch.SendText("No such person.\r\n");
                    return;
                }
                if (charData.IsNPC())
                {
                    ch.SendText("NPCs don't have skills!\r\n");
                    return;
                }
            }

            string text;
            string output = "&n&+rALL Abilities available for your class.&n\r\n";
            output += "&n&+RLv      Abilities&n\r\n";

            for (int level = 1; level <= Limits.LEVEL_HERO; level++)
            {
                bool skill = true;

                foreach (KeyValuePair<String, Skill> kvp in Skill.SkillList)
                {
                    if (kvp.Value.ClassAvailability[(int)charData.CharacterClass.ClassNumber] != level)
                        continue;

                    if (skill)
                    {
                        text = String.Format("&+Y{0}&+y:&n", MUDString.PadInt(level, 2));
                        output += text;
                        skill = false;
                    }
                    else
                    {
                        output += "   ";
                    }

                    output += "     ";

                    // Show skills as words rather than numbers for non-immortals
                    if (((PC)charData).SkillAptitude.ContainsKey(kvp.Key))
                    {
                        if (!ch.IsImmortal())
                        {
                            text = String.Format("&n&+c{0}  &+Y{1}&n", MUDString.PadStr(kvp.Key, 20),
                                   StringConversion.SkillString(((PC)charData).SkillAptitude[kvp.Key]));
                        }
                        else
                        {
                            text = String.Format("&n&+c{0}  &+Y{1}&n", MUDString.PadStr(kvp.Key, 20),
                                   ((PC)charData).SkillAptitude[kvp.Key]);
                        }
                        output += text;
                    }
                    else
                    {
                        text = String.Format("&n&+c{0}  &+YAvailable at level {1}.&n", MUDString.PadStr(kvp.Key, 20), level);
                    }
                    output += "\r\n";
                }
            }

            if ((charData.IsClass(CharClass.Names.monk) || charData.IsClass(CharClass.Names.mystic)))
            {
                output += "\r\n&+WMonk Skills:&n\r\n";
                foreach (KeyValuePair<String, MonkSkill> kvp in Database.MonkSkillList)
                {
                    if (((PC)charData).SkillAptitude[kvp.Key] != 0)
                    {
                        text = String.Format("        &n&+c{0}  &+Y{1}&n\r\n", MUDString.PadStr(kvp.Key, 20),
                              StringConversion.SkillString(((PC)charData).SkillAptitude[kvp.Key]));
                        output += text;
                    }
                }
                output += "\r\n";
            }

            ch.SendText(output);
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:96,代码来源:Command.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: Headbutt


//.........这里部分代码省略.........
                chance = ((PC)ch).SkillAptitude["headbutt"] * 4 / 5;
            }

            // Minotaur headbutt bonus
            if (ch.GetRace() == Race.RACE_MINOTAUR)
            {
                chance += 7;
            }

            if (victim.CurrentPosition < Position.fighting)
            {
                chance /= 3;
            }

            if (MUDMath.NumberPercent() < chance)
            /*  Headbutt successful, possible KO */
            {
                /* First give the victim a chance to dodge */
                if (Combat.CheckDodge(ch, victim))
                {
                    return;
                }
                /* OK, lets settle for stun right now
                * a skill level of 100% has a 20% chance of stun
                * a skill level of 50% has a 2.5% chance of stun
                * a skill level of 23% has a 1% chance of stun
                * immortals get a 15% bonus
                */
                // The stun math was bad.  Stun was way more often that it should have
                // been.  Now we have a flat /4 chance, meaning a the following stun chances
                // at each skill level:
                // 25 = 5%  50 = 10 %  75 = 15%  95 = 19%
                ko = chance / 4;
                if (ch.IsImmortal())
                {
                    ko += 15;
                }
                text = String.Format("Commandheadbutt: {0}&n attempting a KO with {1}%% chance.", ch.Name, ko);
                ImmortalChat.SendImmortalChat(null, ImmortalChat.IMMTALK_SPAM, 0, text);
                if (MUDMath.NumberPercent() < ko + 1)
                {
                    // deal some decent damage
                    // This was previously level d 3 which was fairly pathetic.
                    // Level d 8 = 50 min, 400 max at level 50 with an average of 225
                    // PvP damage is quartered, so headbutt will do about 56 against a player.
                    if (ch.GetRace() != Race.RACE_MINOTAUR)
                    {
                        Combat.InflictDamage(ch, victim, MUDMath.Dice(ch.Level, 8), "headbutt", ObjTemplate.WearLocation.none, AttackType.DamageType.bludgeon);
                    }
                    else
                    {
                        Combat.InflictDamage(ch, victim, MUDMath.Dice(ch.Level, 9), "headbutt", ObjTemplate.WearLocation.none, AttackType.DamageType.bludgeon);
                    }
                    if (victim.CurrentPosition > Position.stunned)
                    {
                        SocketConnection.Act("$n&n staggers about, then collapses in a heap.", victim, null, null, SocketConnection.MessageTarget.room);
                        victim.SendText("You fall to the ground &+Wstunned&n.\r\n");
                        SocketConnection.Act("$n&n is &+Wstunned!&n", victim, null, null, SocketConnection.MessageTarget.room);
                        victim.CurrentPosition = Position.stunned;
                        victim.WaitState((Skill.SkillList["headbutt"].Delay));
                        text = String.Format("Commandheadbutt: {0}&n stunned {1}&n.", ch.Name, victim.Name);
                        ImmortalChat.SendImmortalChat(null, ImmortalChat.IMMTALK_SPAM, 0, text);
                    }
                }
                else
                {
开发者ID:ramseur,项目名称:ModernMUD,代码行数:67,代码来源:Command.cs

示例4: Drink

        /// <summary>
        /// Ingest a liquid.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Drink(CharData ch, string[] str)
        {
            if( ch == null ) return;

            Object obj = null;

            if (ch.IsBlind())
            {
                return;
            }

            if (ch.Fighting || ch.CurrentPosition == Position.fighting)
            {
                ch.SendText("You can't drink while you're fighting!\r\n");
                return;
            }

            if (str.Length == 0 && ch.InRoom != null)
            {
                foreach (Object iobj in ch.InRoom.Contents)
                {
                    if (iobj.ItemType == ObjTemplate.ObjectType.drink_container)
                    {
                        obj = iobj;
                        break;
                    }
                }

                if (!obj)
                {
                    ch.SendText("Drink what?\r\n");
                    return;
                }
            }
            else
            {
                if (!(obj = ch.GetObjHere(str[0])))
                {
                    ch.SendText("You can't find it.\r\n");
                    return;
                }
            }

            // Allow bards to get twice as drunk as other classes - Xangis
            if (!ch.IsNPC() && !ch.IsImmortal()
                    && ((PC)ch).Drunk > 15 && ch.IsClass(CharClass.Names.bard)
                    && MUDMath.NumberPercent() < ch.GetCurrAgi() - ((PC)ch).Drunk)
            {
                ch.SendText("You fail to reach your mouth.  *Hic*\r\n");
                return;
            }
            if (!ch.IsNPC() && !ch.IsImmortal()
                && ((PC)ch).Drunk > 25 && ch.IsClass(CharClass.Names.bard)
                && MUDMath.NumberPercent() < ch.GetCurrAgi() - ((PC)ch).Drunk)
            {
                ch.SendText("You fail to reach your mouth.  *Hic*\r\n");
                return;

            }

            switch (obj.ItemType)
            {
                default:
                    ch.SendText("You can't drink from that.\r\n");
                    break;

                case ObjTemplate.ObjectType.drink_container:
                    // -1 Means a container never goes empty.
                    if (obj.Values[1] <= 0 && obj.Values[1] != -1)
                    {
                        ch.SendText("It is already &+Lempty&n.\r\n");
                        return;
                    }

                    /* No drinking if you're full */
                    if ((!ch.IsImmortal()) && (
                                (!ch.IsNPC() && ((PC)ch).Thirst > 40) ||
                                (!ch.IsNPC() && ((PC)ch).Hunger > 50)))
                    {
                        ch.SendText("You couldn't possibly drink any more.\r\n");
                        return;
                    }

                    int liquid;
                    if ((liquid = obj.Values[2]) >= Liquid.Table.Length)
                    {
                        Log.Error("Drink: bad liquid number {0}.", liquid);
                        liquid = obj.Values[2] = 0;
                    }

                    SocketConnection.Act("You drink $T from $p&n.",
                         ch, obj, Liquid.Table[liquid].Name, SocketConnection.MessageTarget.character);
                    SocketConnection.Act("$n&n drinks $T from $p&n.",
                         ch, obj, Liquid.Table[liquid].Name, SocketConnection.MessageTarget.room);

//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Command.cs

示例5: Attributes

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

            string buf1 = String.Empty;

            if (ch.IsNPC())
            {
                ch.SendText("&nYour attributes are as would be expected for an NPC.\r\n");
                return;
            }

            if (ch.IsImmortal() && str.Length != 0)
            {
                CharData worldChar = ch.GetCharWorld(str[0]);
                if (!worldChar)
                {
                    ch.SendText("No such person.\r\n");
                    return;
                }
                if (worldChar.IsNPC())
                {
                    ch.SendText("NPCs don't have skills!\r\n");
                    return;
                }
            }

            string buf = String.Format(
                "&+WName: &+G{0}&n    &+WLevel: {1}&n\r\n",
                MUDString.PadStr(ch.Name, 17),
                ch.Level);
            buf1 += buf;

            buf = String.Format(
                      "&+WRace:&n {0}          &+WClass:&n {1}     &n&+WSex:&n {2}\r\n",
                      MUDString.PadStr(Race.RaceList[ch.GetRace()].ColorName, 16),
                      MUDString.PadStr(ch.CharacterClass.WholistName, 16),
                      System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(ch.GetSexString()));
            buf1 += buf;

            // Break a player's size into strings when we get around to it
            // -- Xangis
            if (!ch.IsNPC())
            {
                buf = String.Format(
                          "&+WHeight:&n {0} inches         &+WWeight:&n {1} pounds    &+WSize:&n {2}\r\n",
                          MUDString.PadInt(((PC)ch).Height, 3),
                          MUDString.PadInt(((PC)ch).Weight, 5),
                          Race.SizeString(ch.CurrentSize));
            }
            else
            {
                buf = String.Format("&+WSize:&n  {0}\r\n", ch.CurrentSize);
            }
            buf1 += buf;

            TimeSpan time = TimeSpan.FromTicks(ch.TimePlayed.Ticks) + (DateTime.Now - ch.LogonTime);
            int days = (int)time.TotalHours / 24;
            time = (time - TimeSpan.FromDays(days));
            int hours = (int)time.TotalHours;
            time = (time - TimeSpan.FromHours(hours));
            int minutes = (int)time.TotalMinutes;

            // Age is a hack until we get it coded - Xangis
            buf = String.Format(
                      "\r\n&+BAge:&n {0} years.             &+BPlaying Time:&n {1} days {2} hours {3} minutes.\r\n",
                      MUDString.PadInt(ch.GetAge(), 3), days, hours, minutes);
            buf1 += buf;

            // Need to create a function to display character status strings
            buf = String.Format("&+BStatus:&n  {0}", System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(Position.PositionString(ch.CurrentPosition)));
            if (!ch.IsNPC() && ch.IsAffected(Affect.AFFECT_BERZERK))
            {
                buf += ", &+Rberzerk&n";
            }
            if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_MEMORIZING))
            {
                buf += ", Memorizing";
            }
            if (ch.IsAffected(Affect.AFFECT_CASTING))
            {
                buf += ", Casting";
            }
            if (ch.IsAffected(Affect.AFFECT_SINGING))
            {
                buf += ", Singing";
            }
            if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_MEDITATING))
            {
                buf += ", Meditating";
            }
            if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_CAMPING))
            { /* This is ugly and should be moved to its own function */
                buf += ", Camping";
            }
//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Command.cs

示例6: CrashBug

        public static void CrashBug(CharData ch, string[] str)
        {
            if( ch == null ) return;
            if (str.Length == 0)
            {
                ch.SendText("Report what crash bug?\r\n");
                return;
            }

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

            Issue issue = new Issue();
            issue.IssueDetail = new IssueEntry(ch.Name, text);
            issue.OpenedByImmortal = ch.IsImmortal();
            issue.IssueType = Issue.Type.bug;
            issue.IssuePriority = Issue.Priority.highest;
            if (ch.InRoom != null)
            {
                issue.RoomIndexNumber = ch.InRoom.IndexNumber;
            }
            Database.IssueList.Add(issue);
            ImmortalChat.SendImmortalChat(null, ImmortalChat.IMMTALK_DEBUG, 0, String.Format("New CRASH BUG, issue # {0} created by {1}.  Text is:\n{2}",
                issue.IssueNumber, ch.Name, text));
            Issue.Save();
            ch.SendText("Crash bug report recorded.  Thank you.\r\n");
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:27,代码来源:Command.cs

示例7: DoorBash

        /// <summary>
        /// Knock a door from its hinges with brute force.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void DoorBash(CharData ch, string[] str)
        {
            if( ch == null ) return;
            Exit.Direction door;
            Room toRoom;

            if (ch.IsNPC() || (!ch.HasSkill("doorbash") && !ch.HasInnate(Race.RACE_DOORBASH)))
            {
                ch.SendText("You don't feel massive enough!\r\n");
                return;
            }

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

            if (ch.Fighting)
            {
                ch.SendText("You can't break off your fight.\r\n");
                return;
            }

            if ((door = Movement.FindDoor(ch, str[0])) >= 0)
            {
                Exit reverseExit;
                int chance;

                Exit exit = ch.InRoom.GetExit(door);
                if (!exit.HasFlag(Exit.ExitFlag.closed))
                {
                    ch.SendText("Calm down. It is already open.\r\n");
                    return;
                }

                ch.WaitState(Skill.SkillList["doorbash"].Delay);

                if (ch.IsNPC())
                {
                    chance = 0;
                }
                else if (!ch.HasSkill("doorbash"))
                {
                    chance = 20;
                }
                else
                {
                    chance = ((PC)ch).SkillAptitude["doorbash"] / 2;
                }

                if (exit.HasFlag(Exit.ExitFlag.locked))
                {
                    chance /= 2;
                }

                if (exit.HasFlag(Exit.ExitFlag.bashproof) && !ch.IsImmortal())
                {
                    SocketConnection.Act("WHAAAAM!!!  You bash against the $d, but it doesn't budge.",
                         ch, null, exit.Keyword, SocketConnection.MessageTarget.character);
                    SocketConnection.Act("WHAAAAM!!!  $n&n bashes against the $d, but it holds strong.",
                         ch, null, exit.Keyword, SocketConnection.MessageTarget.room);
                    Combat.InflictDamage(ch, ch, (ch.GetMaxHit() / 20), "doorbash", ObjTemplate.WearLocation.none, AttackType.DamageType.bludgeon);
                    if (exit.HasFlag(Exit.ExitFlag.spiked))
                    {
                        SocketConnection.Act("You are impaled by spikes protruding from the $d!",
                            ch, null, exit.Keyword, SocketConnection.MessageTarget.character);
                        SocketConnection.Act("$n&n is impaled by spikes protruding from the $d!",
                            ch, null, exit.Keyword, SocketConnection.MessageTarget.room);
                        Combat.InflictDamage(ch, ch, (ch.GetMaxHit() / 5), "doorbash", ObjTemplate.WearLocation.none, AttackType.DamageType.pierce);
                    }
                    return;
                }

                if (exit.HasFlag(Exit.ExitFlag.spiked))
                {
                    SocketConnection.Act("You are impaled by spikes protruding from the $d!",
                        ch, null, exit.Keyword, SocketConnection.MessageTarget.character);
                    SocketConnection.Act("$n&n is impaled by spikes protruding from the $d!",
                        ch, null, exit.Keyword, SocketConnection.MessageTarget.room);
                    Combat.InflictDamage(ch, ch, (ch.GetMaxHit() / 5), "doorbash", ObjTemplate.WearLocation.none, AttackType.DamageType.pierce);
                }

                if ((ch.GetCurrStr() >= 20) && MUDMath.NumberPercent() < (chance + 4 * (ch.GetCurrStr() - 20)))
                {
                    /* Success */

                    exit.RemoveFlag(Exit.ExitFlag.closed);
                    if (exit.HasFlag(Exit.ExitFlag.locked))
                    {
                        exit.RemoveFlag(Exit.ExitFlag.locked);
                    }

                    exit.AddFlag(Exit.ExitFlag.bashed);

//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Command.cs

示例8: Capture

        /// <summary>
        /// Capture command - restrain another character.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Capture(CharData ch, string[] str)
        {
            if( ch == null ) return;
            CharData victim;
            Affect af = new Affect();

            /* Check player's level and class, allow mobs to do this too */
            if ((!ch.HasSkill("capture")))
            {
                ch.SendText("You couldn't capture a dead rat.\r\n");
                return;
            }

            if (str.Length == 0)
            {
                victim = ch.Fighting;
                if (!victim)
                {
                    ch.SendText("Capture whom?\r\n");
                    return;
                }
            }
            else                /* argument supplied */
            {
                victim = ch.GetCharRoom(str[0]);
                if (!victim)
                {
                    ch.SendText("They aren't here.\r\n");
                    return;
                }
            }
            if (ch.Fighting && ch.Fighting != victim)
            {
                ch.SendText("Take care of the person you are fighting first!\r\n");
                return;
            }
            if (!ch.IsImmortal())
            {
                ch.WaitState(Skill.SkillList["capture"].Delay);
            }

            Object rope = Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_one);
            if (!rope || rope.ItemType != ObjTemplate.ObjectType.rope)
            {
                rope = Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_two);
                if (!rope || rope.ItemType != ObjTemplate.ObjectType.rope)
                {
                    rope = Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_three);
                    if (!rope || rope.ItemType != ObjTemplate.ObjectType.rope)
                    {
                        rope = Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_four);
                        if (!rope || rope.ItemType != ObjTemplate.ObjectType.rope)
                            rope = null;
                    }
                }
            }
            if (!rope)
            {
                ch.SendText("You must have some rope to tie someone up!\r\n");
                return;
            }
            rope.RemoveFromWorld();

            /* only appropriately skilled PCs and uncharmed mobs */
            if ((ch.IsNPC() && !ch.IsAffected( Affect.AFFECT_CHARM))
                    || (!ch.IsNPC() && MUDMath.NumberPercent() < ((PC)ch).SkillAptitude["capture"] / 4))
            {
                victim.AffectStrip( Affect.AffectType.skill, "capture");

                af.Value = "capture";
                af.Type = Affect.AffectType.skill;
                af.Duration = 3 + ((ch.Level) / 8);
                af.SetBitvector(Affect.AFFECT_BOUND);

                victim.AddAffect(af);

                SocketConnection.Act("You have captured $M!", ch, null, victim, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$n&n has captured you!", ch, null, victim, SocketConnection.MessageTarget.victim);
                SocketConnection.Act("$n&n has captured $N&n.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
            }
            else
            {
                SocketConnection.Act("You failed to capture $M.  Uh oh!",
                     ch, null, victim, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$n&n tried to capture you!  Get $m!",
                     ch, null, victim, SocketConnection.MessageTarget.victim);
                SocketConnection.Act("$n&n attempted to capture $N&n, but failed!",
                     ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
            }

            /* go for the one who wanted to fight :) */
            if (ch.IsNPC() && ch.IsAffected( Affect.AFFECT_CHARM) && !victim.Fighting)
            {
                victim.AttackCharacter(ch.Master);
            }
//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Command.cs

示例9: TrackCommand

        /// <summary>
        /// Player track command.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void TrackCommand(CharData ch, string[] str)
        {
            if( ch == null ) return;

            CharData victim;

            if (ch.IsAffected(Affect.AFFECT_TRACK))
            {
                ch.SendText("You stop tracking.\r\n");
                Combat.StopHunting(ch);
                ch.RemoveAffect(Affect.AFFECT_TRACK);
                return;
            }

            if (!ch.HasSkill("track"))
            {
                ch.SendText("You couldn't track an &+Lelephant&n in your own bedroom.\r\n");
                return;
            }

            if (str.Length == 0)
            {
                ch.SendText("Whom are you trying to track?\r\n");
                return;
            }

            if (ch.Riding)
            {
                ch.SendText("You can't sniff a trail mounted.\r\n");
                return;
            }

            if (ch.FlightLevel != 0)
            {
                ch.SendText("You find tracks on the _ground_!\r\n");
                return;
            }

            if (ch.InRoom.IsWater())
            {
                ch.SendText("You can't track through water.\r\n");
                return;
            }

            if (ch.CurrentPosition != Position.standing)
            {
                if (ch.CurrentPosition == Position.fighting)
                    ch.SendText("You're too busy fighting .\r\n");
                else
                    ch.SendText("You must be standing to track!\r\n");
                return;
            }

            /* only imps can hunt to different areas */
            bool area = (ch.GetTrust() < Limits.LEVEL_OVERLORD);

            if (area)
            {
                victim = ch.GetCharInArea(str[0]);
            }
            else
            {
                victim = ch.GetCharWorld(str[0]);
            }

            if (!victim || (!victim.IsNPC() && (ch.IsRacewar(victim)) && !ch.IsImmortal()))
            {
                ch.SendText("You can't find a trail of anyone like that.\r\n");
                return;
            }

            if (ch.InRoom == victim.InRoom)
            {
                SocketConnection.Act("You're already in $N&n's room!", ch, null, victim, SocketConnection.MessageTarget.character);
                return;
            }

            /*
            * Deduct some movement.
            */
            if (ch.CurrentMoves > 2)
            {
                ch.CurrentMoves -= 3;
            }
            else
            {
                ch.SendText("You're too exhausted to hunt anyone!\r\n");
                return;
            }

            SocketConnection.Act("$n carefully sniffs the air.", ch, null, null, SocketConnection.MessageTarget.room);
            ch.WaitState(Skill.SkillList["track"].Delay);
            Exit.Direction direction = Track.FindPath(ch.InRoom.IndexNumber, victim.InRoom.IndexNumber, ch, -40000, area);

            if (direction == Exit.Direction.invalid)
//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Command.cs

示例10: 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

示例11: Title

        /// <summary>
        /// Sets a character's title, cropped to a maximum length to avoid word wrap.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Title(CharData ch, string[] str)
        {
            if( ch == null ) return;

            int point;

            if (!ch || ch.IsNPC())
                return;

            if (str.Length  < 2)
            {
                ch.SendText("&nChange whose title to what?\r\n");
                return;
            }

            CharData victim = ch.GetCharWorld(str[0]);
            if (!victim)
            {
                ch.SendText("&nThat person isn't here.\r\n");
                return;
            }

            if (ch.IsSameGuild(victim) && !ch.IsImmortal())
            {
                /* Officers and deputies can title themselves. */
                if (ch == victim && ((PC)ch).GuildRank < Guild.Rank.officer)
                {
                    ch.SendText("&nThey might not appreciate that.\r\n");
                    return;
                }

                /* Leaders can title others. */
                if (ch != victim && ((PC)ch).GuildRank < Guild.Rank.leader)
                {
                    ch.SendText("You can't do that to another at your rank.\r\n");
                    return;
                }
            }
            else if (!ch.IsImmortal() || (ch.Level <= victim.Level && ch != victim)
                     || ch.IsNPC() || victim.IsNPC())
            {
                SocketConnection.Act("$N&n might not appreciate that.", ch, null, victim, SocketConnection.MessageTarget.character);
                return;
            }

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

            int length = 0;
            for (point = 0; point < text.Length; ++point)
            {
                if (text[point] == '&')
                {   /* Don't count color codes. */
                    point++;
                    /* Skip the &n's. */
                    if (!(text[point] == 'N' || text[point] == 'n'))
                    {
                        /* Skip the &+'s and &-'s. */
                        if (text[point] == '+' || text[point] == '-')
                        {
                            point++;
                        }
                        else
                        {
                            // Cap title at max length
                            if (++length >= Limits.MAX_TITLE_LENGTH)
                            {
                                text = text.Substring(0, point);
                                break;
                            }
                        }
                    }
                }
                else
                {
                    // Cap title at max length.
                    if (++length >= Limits.MAX_TITLE_LENGTH)
                    {
                        text = text.Substring(0, Limits.MAX_TITLE_LENGTH);
                        break;
                    }
                }
            }

            SetTitle(victim, text);
            ch.SendText("&nOk.\r\n");
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:91,代码来源:Command.cs

示例12: Tell

        /// <summary>
        /// Direct telepathy-like communication with another individual.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Tell(CharData ch, string[] str)
        {
            if( ch == null ) return;

            if (!ch.CanSpeak())
            {
                ch.SendText("Your lips move but no sound comes out.\r\n");
                return;
            }

            if (str.Length < 2)
            {
                ch.SendText("Tell what to who?\r\n");
                return;
            }

            /*
            * PCs can receive a tell anywhere, but NPCs only can only hear them in the same room.
            *
            * get PC target first, if fails then get NPC
            */

            CharData victim = ch.GetCharWorld(str[0]);
            if (!victim || (victim.IsNPC() && victim.InRoom != ch.InRoom))
            {
                ch.SendText("They aren't here.\r\n");
                return;
            }

            if (victim == ch)
            {
                ch.SendText("You listen to your own thoughts. *cricket* *cricket*\r\n");
                return;
            }

            if ((ch.IsRacewar(victim)) && (!ch.IsImmortal() && !victim.IsImmortal())
                    && (ch.InRoom != victim.InRoom))
            {
                ch.SendText("They aren't here.\r\n");
                return;
            }

            /* Can tell to other side of racewar iff the opponent is in the same
            room or one of the people are Immortals. */
            if ((!ch.IsImmortal() && !victim.IsImmortal()) && (ch.IsRacewar(victim))
                    && (victim.InRoom != ch.InRoom))
            {
                ch.SendText("They aren't here.\r\n");
                return;
            }

            if ((!ch.IsNPC() && (ch.HasActionBit(PC.PLAYER_SILENCE) || !ch.HasActionBit(PC.PLAYER_TELL)
                || (!victim.IsNPC() && !victim.HasActionBit(PC.PLAYER_TELL))))
                    || victim.InRoom.HasFlag(RoomTemplate.ROOM_SILENT))
            {
                ch.SendText("They can't hear you.\r\n");
                return;
            }

            if (!victim.Socket && !victim.IsNPC())
            {
                SocketConnection.Act("$N&n is &+Llinkdead&n.", ch, null, victim, SocketConnection.MessageTarget.character);
                return;
            }

            if (!ch.IsImmortal() && !victim.IsAwake())
            {
                SocketConnection.Act("$E isn't paying attention.", ch, null, victim, SocketConnection.MessageTarget.character);
                return;
            }

            if (victim.IsIgnoring(ch))
            {
                SocketConnection.Act("$E is ignoring you.", ch, null, victim, SocketConnection.MessageTarget.character);
                return;
            }

            string text = String.Join(" ", str, 1, (str.Length - 1));
            text = DrunkSpeech.MakeDrunk(text, ch);

            int position = victim.CurrentPosition;
            victim.CurrentPosition = Position.standing;
            Race.Language lang = ch.IsNPC() ? Race.RaceList[ch.GetOrigRace()].PrimaryLanguage :
                                                                                       ((PC)ch).Speaking;
            if (lang == Race.Language.god || lang == Race.Language.unknown)
            {
                text = String.Format("&+WYou tell $N&+W '$t&+W'&n");
            }
            else
            {
                text = String.Format("&+WYou tell $N&+W in {0} '$t&+W'&n", Race.LanguageTable[(int)lang]);
            }

            SocketConnection.Act(text, ch, text, victim, SocketConnection.MessageTarget.character);
            if (lang == Race.Language.god || lang == Race.Language.unknown)
//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Command.cs

示例13: SummonMount

        /// <summary>
        /// Innate mount summoning command for antipaladins and paladins.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void SummonMount(CharData ch, string[] str)
        {
            MobTemplate mobTemplate;
            Affect af = new Affect();
            int mountNumber = ch.CharacterClass.CanSummonMountNumber;

            if (mountNumber == 0)
            {
                ch.SendText("You scream and yell for a mount.  Strangely nothing comes.\r\n");
                return;
            }

            if (ch.IsAffected( Affect.AFFECT_SUMMON_MOUNT_TIMER))
            {
                ch.SendText("&nIt is too soon to accomplish that!\r\n");
                return;
            }

            // Look to see if they already have a mount.
            foreach (CharData previousMount in Database.CharList)
            {
                if (previousMount.Master == ch && previousMount.IsNPC() && previousMount.MobileTemplate != null
                    && (previousMount.MobileTemplate.IndexNumber == mountNumber))
                {
                    ch.SendText("You already have a mount!\r\n");
                    return;
                }
            }

            // If not let found, them summon one.
            mobTemplate = Database.GetMobTemplate(mountNumber);

            if (mobTemplate == null)
            {
                Log.Error("SummonMount: Invalid MobTemplate!", 0);
                return;
            }

            CharData mount = Database.CreateMobile(mobTemplate);

            // Simulate the poor mount running across the world.
            // They arrive with partially depleted moves.
            mount.CurrentMoves -= MUDMath.Dice(4, 40);
            CharData.AddFollower(mount, ch);
            mount.SetAffectBit(Affect.AFFECT_CHARM);
            mount.SetActionBit(MobTemplate.ACT_NOEXP);
            mount.AddToRoom(ch.InRoom);

            ch.WaitState(MUDMath.FuzzyNumber(Skill.SkillList["summon mount"].Delay));

            SocketConnection.Act("$n&n trots up to you.", mount, null, ch, SocketConnection.MessageTarget.victim);
            SocketConnection.Act("$n&n trots up to $N&n.", mount, null, ch, SocketConnection.MessageTarget.everyone_but_victim);

            if (ch.IsImmortal())
            {
                return;
            }
            af.Value = "summon mount";
            af.Type = Affect.AffectType.skill;
            af.Duration = 48;
            af.SetBitvector(Affect.AFFECT_SUMMON_MOUNT_TIMER);
            ch.AddAffect(af);

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

示例14: Steal

        /// <summary>
        /// Steal an object or some coins from a victim.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Steal(CharData ch, string[] str)
        {
            if( ch == null ) return;

            Object obj = null;
            CharData victim;
            bool sleeping = false;
            string arg1 = String.Empty;
            string arg2 = String.Empty;
            string arg = String.Empty;
            int percent;

            if (!ch.HasSkill("steal") && !ch.IsAffected(Affect.AFFECT_CHARM))
            {
                ch.SendText("Who are you trying to kid?  You couldn't steal shoes from a &n&+mbl&+Mo&n&+ma&+Mte&n&+md&n corpse.\r\n");
                return;
            }

            if (ch.Riding != null)
            {
                ch.SendText("You can't do that while mounted.\r\n");
                return;
            }

            if (String.IsNullOrEmpty(arg1) || String.IsNullOrEmpty(arg2))
            {
                ch.SendText("Steal what from whom?\r\n");
                return;
            }

            if ((victim = ch.GetCharRoom(arg2)) == null)
            {
                ch.SendText("They aren't here.\r\n");
                return;
            }

            if (victim == ch)
            {
                ch.SendText("That's pointless.\r\n");
                return;
            }

            if (Combat.IsSafe(ch, victim))
                return;

            if (!ch.IsImmortal())
            {
                ch.WaitState(Skill.SkillList["steal"].Delay);
            }

            // Justice stuff
            Crime.CheckThief(ch, victim);

            if (ch.IsNPC())
            {
                percent = ch.Level * 2;
            }
            else
            {
                percent = ((PC)ch).SkillAptitude["steal"];
            }

            percent += ch.GetCurrLuck() / 20; /* Luck */

            percent -= victim.Level; /* Character level vs victim's */

            if (ch.GetRace() == Race.RACE_HALFLING)
            {
                // Halflings get a racial bonus
                percent += 10;
            }

            if (victim.IsAffected(Affect.AFFECT_CURSE))
                percent += 15;

            if (ch.IsAffected(Affect.AFFECT_CURSE))
                percent -= 15;

            if (!victim.IsAwake())
                percent += 25; /* Sleeping characters are easier */

            if (ch.CheckSneak())
                percent += 10; /* Quiet characters steal better */

            if (!CharData.CanSee(ch, victim))
                percent += 10; /* Unseen characters steal better */

            if (!MUDString.IsPrefixOf(arg1, "coins"))
            {
                percent = (int)(percent * 1.2); /* Cash is fairly easy to steal */
            }
            else
            {
                int number = MUDString.NumberArgument(arg1, ref arg);
                int count = 0;
//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Command.cs

示例15: 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


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