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


C# CharData.WaitState方法代码示例

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


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

示例1: Search

        /// <summary>
        /// Try to find hidden things.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Search(CharData ch, string[] str)
        {
            if( ch == null ) return;

            Room toRoom;
            Exit reverseExit;
            Exit exit = null;
            Object obj;
            bool isArg;
            Exit.Direction door;

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

            /* Calculate the probability that ch finds something. */
            int chance = ch.GetCurrInt() * 35 / 100;
            chance += ch.GetCurrWis() * 35 / 100;
            chance += ch.GetCurrLuck() * 10 / 100;

            // Dwarves, being natural architects, can search better - Xangis
            if (ch.GetRace() == Race.RACE_DWARF)
                chance += 25;

            if (chance > 95)
                chance = 95;
            if (chance < 10)
                chance = 10;

            /* Searching with arguments. */
            if (str.Length != 0)
            {
                isArg = true;
                obj = ch.GetObjHere(str[0]);
                if (obj == null)
                {
                    ch.SendText("You don't see that object here.\r\n");
                    return;
                }
                switch (obj.ItemType)
                {
                    case ObjTemplate.ObjectType.quiver:
                    case ObjTemplate.ObjectType.container:
                    case ObjTemplate.ObjectType.npc_corpse:
                    case ObjTemplate.ObjectType.pc_corpse:
                        if (Macros.IsSet(obj.Values[1], ObjTemplate.CONTAINER_CLOSED.Vector))
                        {
                            SocketConnection.Act("$p&n is closed.", ch, obj, null, SocketConnection.MessageTarget.character);
                            return;
                        }
                        break;
                    default:
                        ch.SendText("That is not a container!\r\n");
                        return;
                }
            }
            else
            {
                isArg = false;
                obj = null;
            }

            /* Lag ch from searching. */
            if (ch.Level < Limits.LEVEL_AVATAR)
            {
                ch.WaitState(MUDMath.FuzzyNumber(18));
            }

            List<Object> list;
            if (obj != null)
            {
                list = obj.Contains;
            }
            else
            {
                list = ch.InRoom.Contents;
            }
            foreach (Object obj2 in list)
            {
                if (obj2.HasFlag(ObjTemplate.ITEM_SECRET) && chance > MUDMath.NumberPercent()
                        && obj2.FlyLevel == ch.FlightLevel)
                {
                    obj2.RemoveFlag(ObjTemplate.ITEM_SECRET);
                    SocketConnection.Act("You find $p&n.", ch, obj2, null, SocketConnection.MessageTarget.character);
                    SocketConnection.Act("$n&n points out $p&n!", ch, obj, null, SocketConnection.MessageTarget.room);
                    return;
                }
            }

            /* Look for a hidden exit. */
            door = Exit.Direction.invalid;
            for (int doornum = 0; doornum <= Limits.MAX_DIRECTION; doornum++)
            {
//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Command.cs

示例2: Bash

        /// <summary>
        /// Bash. Usable to initiate combat and during combat.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Bash(CharData ch, string[] str)
        {
            if( ch == null ) return;

            int chance;

            /* Check player's level and class, mobs can use this skill */
            if ((!ch.HasSkill("bash")))
            {
                ch.SendText("You'd better leave that to those with more skills.\r\n");
                return;
            }

            if (ch.IsBlind() && !ch.Fighting)
            {
                return;
            }

            /* Verify a target. */
            CharData victim = ch.Fighting;
            if (str.Length != 0)
            {
                victim = ch.GetCharRoom(str[0]);
                if (!victim || victim.CurrentPosition == Position.dead)
                {
                    ch.SendText("They aren't anywhere to be found.\r\n");
                    return;
                }
            }
            else
            {
                if (!victim || victim.CurrentPosition == Position.dead)
                {
                    ch.SendText("You aren't fighting anyone.\r\n");
                    return;
                }
            }

            /* Bash self? Ok! */
            // Toned down the damage cuz you can't really bash yourself
            // like you could with someone else.
            if (victim == ch)
            {
                ch.SendText("You throw yourself to the ground!\r\n");
                SocketConnection.Act("$N&n knocks $mself to the ground.", ch, null, victim, SocketConnection.MessageTarget.room_vict);
                ch.CurrentPosition = Position.kneeling;
                ch.WaitState((Skill.SkillList["bash"].Delay * 8) / 10);
                Combat.InflictDamage(ch, ch, MUDMath.NumberRange(1, 3), "bash", ObjTemplate.WearLocation.none,
                        AttackType.DamageType.bludgeon);
                return;
            }

            /* Check size of ch vs. victim. */
            /* If ch is too small. */
            if (ch.CurrentSize < victim.CurrentSize)
            {
                SocketConnection.Act("$N&n is too big for you to bash!", ch, null, victim, SocketConnection.MessageTarget.character);
                return;
            }
            /* Ch 2 or more sizes larger than victim => bad! */
            if (ch.CurrentSize - 2 > victim.CurrentSize)
            {
                SocketConnection.Act("You nearly topple over as you try to bash $N&n.", ch, null, victim, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$n&n nearly topples over as $e attempts to bash you.", ch, null, victim, SocketConnection.MessageTarget.victim);
                SocketConnection.Act("$n&n nearly topples over as $e attempts to bash $N&n.", ch, null, victim, SocketConnection.MessageTarget.room_vict);
                ch.WaitState((Skill.SkillList["bash"].Delay));
                ch.CurrentPosition = Position.kneeling;
                if (victim.Fighting == null)
                {
                    Combat.SetFighting(victim, ch);
                }
                return;
            }

            /* Lag to basher from bash. Pets get more lag because pets are cheesy */
            if (!ch.IsNPC())
            {
                ch.WaitState(MUDMath.FuzzyNumber(Skill.SkillList["bash"].Delay));
            }
            else
            {
                ch.WaitState((Skill.SkillList["bash"].Delay * 6 / 5));
            }

            /* Base chance to bash, followed by chance modifications. */
            if (ch.IsNPC())
            {
                chance = (ch.Level * 3) / 2 + 15;
            }
            else
            {
                chance = ((PC)ch).SkillAptitude["bash"] - 5;
            }

            if (victim.CurrentPosition < Position.fighting)
//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Command.cs

示例3: HideItem

        /// <summary>
        /// Hide an item.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void HideItem(CharData ch, string[] str)
        {
            if( ch == null ) return;

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

            Object obj = Object.GetObjectInRoom(ch, str[0]);
            if (!obj)
            {
                ch.SendText("You do not see that here.\r\n");
                return;
            }

            if (!obj.HasWearFlag(ObjTemplate.WEARABLE_CARRY))
            {
                SocketConnection.Act("You attempt to hide $p&n.", ch, obj, null, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$n&n stands in front of $p&n with arms outstretched.",
                    ch, obj, null, SocketConnection.MessageTarget.room);
                ch.WaitState(12);
                return;
            }
            if (obj.ItemType == ObjTemplate.ObjectType.pc_corpse || obj.ItemType == ObjTemplate.ObjectType.npc_corpse)
            {
                ch.SendText("You can't hide corpses.\r\n");
                return;
            }
            SocketConnection.Act("You hide $p&n.", ch, obj, null, SocketConnection.MessageTarget.character);
            SocketConnection.Act("$n&n hides $p&n.", ch, obj, null, SocketConnection.MessageTarget.room);
            obj.AddFlag(ObjTemplate.ITEM_SECRET);

            ch.WaitState(24);

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

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

示例5: Bandage

        /// <summary>
        /// Bandage someone's wounds.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Bandage(CharData ch, string[] str)
        {
            if( ch == null ) return;

            if (ch.IsNPC() || !ch.HasSkill("bandage"))
            {
                ch.SendText("You don't know how to bandage!\r\n");
                return;
            }

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

            CharData victim = ch.GetCharRoom(str[0]);
            if (victim == null)
            {
                ch.SendText("They're not here.\r\n");
                return;
            }

            if (victim.Hitpoints > 0)
            {
                ch.SendText("They do not need your help.\r\n");
                return;
            }

            int chance = ((PC)ch).SkillAptitude["bandage"];

            if (ch.IsClass(CharClass.Names.cleric))
                chance += 4;
            else if (ch.IsClass(CharClass.Names.antipaladin))
                chance -= 4;

            /* Don't allow someone doing more than 1 pt. of damage with bandage. */
            int change = (Math.Max(chance - MUDMath.NumberPercent(), -1) / 20) + 1;

            // Bandage is rarely used, make it likely to increase
            ch.PracticeSkill("bandage");
            ch.PracticeSkill("bandage");
            ch.PracticeSkill("bandage");

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

            if (change < 0)
            {
                ch.SendText("You just made the problem worse!\r\n");
                SocketConnection.Act("$n&n tries bandage you but your condition only worsens.", ch, null, victim, SocketConnection.MessageTarget.victim);
                SocketConnection.Act("$n&n tries bandage $N&n but $S condition only worsens.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
            }
            else if (change > 0)
            {
                ch.SendText("You manage to fix them up a _bitvector.\r\n");
                SocketConnection.Act("$n&n bandages you.", ch, null, victim, SocketConnection.MessageTarget.victim);
                SocketConnection.Act("$n&n bandages $N&n.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
            }
            else
            {
                ch.SendText("Your bandaging attempt had no effect.\r\n");
                SocketConnection.Act("$n&n tries to bandage you but the wounds are too great.", ch, null, victim, SocketConnection.MessageTarget.victim);
                SocketConnection.Act("$n&n tries to bandage $N&n but is unable to have any effect.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
            }

            victim.Hitpoints += change;

            victim.UpdatePosition();

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

示例6: DirtToss


//.........这里部分代码省略.........
            if (!ch.IsNPC())
            {
                percent = ((PC)ch).SkillAptitude["dirt toss"];
            }
            else
            {
                percent = (ch.Level * 3) / 2 + 25;
            }

            percent += (ch.Level - victim.Level) * 2;
            percent += (ch.GetCurrDex() / 10);
            percent -= (victim.GetCurrDex() / 10);
            percent -= (victim.GetCurrAgi() / 10);

            // Why waste time listing sectors with no modifier?
            switch (ch.InRoom.TerrainType)
            {
                case TerrainType.inside:
                case TerrainType.arctic:
                case TerrainType.swamp:
                    percent -= 20;
                    break;
                case TerrainType.city:
                case TerrainType.mountain:
                    percent -= 10;
                    break;
                case TerrainType.plane_of_fire:
                case TerrainType.plane_of_air:
                case TerrainType.plane_of_water:
                case TerrainType.plane_ethereal:
                case TerrainType.plane_astral:
                case TerrainType.underwater_has_ground:
                case TerrainType.underwater_no_ground:
                case TerrainType.swimmable_water:
                case TerrainType.unswimmable_water:
                case TerrainType.air:
                case TerrainType.ocean:
                case TerrainType.underground_swimmable_water:
                case TerrainType.underground_unswimmable_water:
                    percent = 0;
                    break;
                case TerrainType.field:
                    percent += 5;
                    break;
                case TerrainType.desert:
                    percent += 10;
                    break;
                case TerrainType.plane_of_earth:
                    percent += 15;
                    break;
                default:
                    break;
            }

            if (percent > 75)
            {
                percent = 75;
            }
            else if (percent < 5)
            {
                percent = 5;
            }

            if (percent <= 0)
            {
                ch.SendText("There isn't any &n&+ydirt&n to kick.\r\n");
                return;
            }

            ch.PracticeSkill("dirt toss");

            if (percent < MUDMath.NumberPercent())
            {
                Affect af = new Affect();

                SocketConnection.Act("$n is &+Lblinded&n by the &n&+ydirt&n in $s eyes!", victim, null, null,
                     SocketConnection.MessageTarget.room);
                SocketConnection.Act("$n kicks &n&+ydirt&n into your eyes!", ch, null, victim, SocketConnection.MessageTarget.victim);

                victim.SendText("&+LYou can't see a thing!&n\r\n");

                af.Value = "dirt toss";
                af.Type = Affect.AffectType.skill;
                af.Duration = MUDMath.NumberRange(1, 2);
                af.AddModifier(Affect.Apply.hitroll, -4);
                af.SetBitvector(Affect.AFFECT_BLIND);
                victim.AddAffect(af);

            }
            else
            {
                ch.SendText("&+LYou kick dirt at your target!&n\r\n");
            }

            Combat.SetFighting(victim, ch);

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

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

示例7: Disengage

        public static void Disengage(CharData ch, string[] str)
        {
            if( ch == null ) return;

            if (!ch.Fighting)
            {
                ch.SendText("You're not fighting anyone!\r\n");
                if (ch.CurrentPosition == Position.fighting)
                    ch.CurrentPosition = Position.standing;
                return;
            }

            if (ch.Fighting.Fighting && ch.Fighting.Fighting == ch
                    && ch.HasActionBit(PC.PLAYER_VICIOUS))
            {
                ch.SendText("You're a little busy getting beat on at the moment.\r\n");
                return;
            }

            ch.SendText("You disengage from the fight!\r\n");
            ch.WaitState(8);
            Combat.StopFighting(ch, false);

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

示例8: Springleap

        /// <summary>
        /// Springleap.  Can be used to initiate combat and can be used during combat.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Springleap(CharData ch, string[] str)
        {
            if( ch == null ) return;

            int chance;

            /* Check player's level and class, mobs can use this skill */
            if ((!ch.HasSkill("springleap")))
            {
                ch.SendText("You'd better leave the martial arts to Bruce Lee.\r\n");
                return;
            }

            if (ch.GetRace() == Race.RACE_CENTAUR)
            {
                ch.SendText("Your anatomy prevents you from springleaping.\r\n");
                return;
            }

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

            CharData victim = ch.Fighting;

            if (str.Length != 0)
            {
                if (!(victim = ch.GetCharRoom(str[0])) || victim.CurrentPosition == Position.dead)
                {
                    ch.SendText("You don't see them here.\r\n");
                    return;
                }
            }
            else
            {
                if (!victim || victim.CurrentPosition == Position.dead)
                {
                    ch.SendText("You aren't fighting anyone.\r\n");
                    return;
                }
            }

            /* springleap self */
            if (ch == victim)
            {
                ch.SendText("You can't quite figure out how to do that.\r\n");
                return;
            }

            /* Check size of ch vs. victim. */
            /* If ch is too small. */
            if (ch.CurrentSize - 2 > victim.CurrentSize)
            {
                SocketConnection.Act("Your acrobatic maneuver cannot accurately leap into such a small being.", ch, null, victim, SocketConnection.MessageTarget.character);
                return;
            }
            /* Ch 2 or more sizes larger than victim => bad! */
            if (ch.CurrentSize + 2 < victim.CurrentSize)
            {
                SocketConnection.Act("Your acrobatic maneuver does not seem to work on someone so large.", ch, null, victim, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$n&n jumps into you, and slides down your leg.", ch, null, victim, SocketConnection.MessageTarget.victim);
                SocketConnection.Act("$n&n jumps into $N&n and slides down $S leg.", ch, null, victim, SocketConnection.MessageTarget.room_vict);

                ch.WaitState(Skill.SkillList["springleap"].Delay);
                ch.CurrentPosition = Position.reclining;
                if (victim.Fighting == null)
                {
                    Combat.SetFighting(victim, ch);
                }
                return;
            }

            ch.WaitState(MUDMath.FuzzyNumber(Skill.SkillList["springleap"].Delay));
            ch.PracticeSkill("springleap");

            if (ch.IsNPC())
            {
                chance = (ch.Level * 3) / 2 + 15;
            }
            else
            {
                chance = ((PC)ch).SkillAptitude["springleap"] - 5;
            }

            if (chance > 95)
            {
                chance = 95;
            }

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

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

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

示例10: Brew

        public static void Brew(CharData ch, string[] str)
        {
            if( ch == null ) return;

            Object potion;
            Spell spell;

            if (str.Length == 0)
            {
                ch.SendText("Which spell do you want to brew into a &+Lpotion&n?\r\n");
                return;
            }

            if (!(potion = Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_one)))
            {
                ch.SendText("You hold nothing in your hand.\r\n");
                return;
            }

            if (potion.ItemType != ObjTemplate.ObjectType.potion)
            {
                ch.SendText("You are not holding a vial.\r\n");
                return;
            }

            if ((spell = StringLookup.SpellLookup(str[0])) == null)
            {
                ch.SendText("You don't know any spells by that _name.\r\n");
                return;
            }

            if (spell.ValidTargets != TargetType.singleCharacterDefensive
                    && spell.ValidTargets != TargetType.self)
            {
                ch.SendText("You cannot brew that spell.\r\n");
                return;
            }

            SocketConnection.Act("$n begins preparing a &+Lpotion&n.", ch, potion, null, SocketConnection.MessageTarget.room);
            ch.WaitState(Skill.SkillList["brew"].Delay);

            ch.PracticeSkill("brew");

            if (!ch.IsNPC() && (MUDMath.NumberPercent() > ((PC)ch).SkillAptitude["brew"] ||
                MUDMath.NumberPercent() > ((ch.GetCurrInt() - 13) * 5 + (ch.GetCurrWis() - 13) * 3)))
            {
                SocketConnection.Act("$p&n explodes violently!", ch, potion, null, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$p&n explodes violently!", ch, potion, null, SocketConnection.MessageTarget.room);
                potion.RemoveFromWorld();
                Combat.InflictDamage(ch, ch, ch.GetMaxHit() / 16, "brew", ObjTemplate.WearLocation.none, AttackType.DamageType.energy);
                return;
            }

            potion.Level = ch.Level / 2;
            potion.Values[0] = ch.Level / 4;
            ch.ImprintSpell(spell, ch.Level, potion);
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:58,代码来源:Command.cs

示例11: Sneak

        /// <summary>
        /// Move silently.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Sneak(CharData ch, string[] str)
        {
            if( ch == null ) return;
            /* Don't allow charmed mobs to do this, check player's skill */
            if ((!ch.HasSkill("sneak")))
            {
                ch.SendText("You're about as sneaky as a buffalo in tap shoes.\r\n");
                return;
            }

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

            if (str.Length != 0 && !MUDString.StringsNotEqual(str[0], "off"))
            {
                if (!ch.IsAffected(Affect.AFFECT_SNEAK))
                {
                    ch.SendText("You're not sneaking.\r\n");
                }
                else
                {
                    ch.SendText("You stop sneaking around.\r\n");
                    ch.RemoveAffect(Affect.AFFECT_SNEAK);
                }
                return;
            }

            ch.SendText("You attempt to move silently.\r\n");
            ch.RemoveAffect( Affect.AFFECT_SNEAK );

            /* Check skill knowledge when moving only. */
            Affect af = new Affect(Affect.AffectType.skill, "sneak", -1, Affect.Apply.none, 0, Affect.AFFECT_SNEAK);
            ch.AddAffect(af);

            ch.PracticeSkill("sneak");
            ch.WaitState(10);
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:46,代码来源:Command.cs

示例12: Shift

        public static void Shift(CharData ch, string[] str)
        {
            if( ch == null ) return;
            if (ch.GetRace() != Race.RACE_GITHYANKI && !ch.IsImmortal())
            {
                ch.SendText("You lack that abillity!\r\n");
                return;
            }

            if (str.Length < 1 || String.IsNullOrEmpty(str[0]))
            {
                ch.SendText("Shift to where?\r\n");
                return;
            }

            if (ch.Fighting)
            {
                ch.SendText("You can't break off your fight.\r\n");
                return;
            }
            if ((ch.HasInnateTimer(InnateTimerData.Type.shift_astral) && !MUDString.IsPrefixOf(str[0], "astral"))
                || (ch.HasInnateTimer(InnateTimerData.Type.shift_prime) && !MUDString.IsPrefixOf(str[0], "prime")))
            {
                ch.SendText("You need to rest a _bitvector first.\r\n");
                return;
            }

            Area area = ch.InRoom.Area;
            Spell spell = StringLookup.SpellLookup("plane shift");
            if (!spell)
            {
                ch.SendText("Something seems to be blocking your ability to shift.");
                Log.Error("Shift: 'plane shift' spell not found. Check the spells file.");
                return;
            }
            spell.Invoke(ch, ch.Level, new Target(str[0]));
            // if it failed, don't lag or add a timer
            if (area == ch.InRoom.Area)
                return;
            if (!ch.IsImmortal())
            {
                if (!MUDString.IsPrefixOf(str[0], "astral"))
                    ch.AddInnateTimer(InnateTimerData.Type.shift_astral, 8);
                else if (!MUDString.IsPrefixOf(str[0], "prime"))
                    ch.AddInnateTimer(InnateTimerData.Type.shift_prime, 8);
            }
            ch.WaitState(14);
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:48,代码来源:Command.cs

示例13: Shadow

        public static void Shadow(CharData ch, string[] str)
        {
            if( ch == null ) return;
            Affect af = new Affect();

            if (!ch.IsNPC()
                    && !ch.HasSkill("shadow form"))
            {
                ch.SendText("You don't know how to take shadow form.\r\n");
                return;
            }

            ch.SendText("You attempt to move in the shadows.\r\n");
            ch.AffectStrip( Affect.AffectType.skill, "shadow form");

            if (ch.CheckSkill("shadow form"))
            {
                af.Value = "shadow form";
                af.Type = Affect.AffectType.skill;
                af.Duration = ch.Level;
                af.SetBitvector(Affect.AFFECT_SNEAK);
                ch.AddAffect(af);
            }
            ch.WaitState(10);

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

示例14: Brandish

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

            Object staff;

            if (!(staff = Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_one)))
            {
                ch.SendText("You hold nothing in your hand.\r\n");
                return;
            }

            if (staff.ItemType != ObjTemplate.ObjectType.staff)
            {
                ch.SendText("You can brandish only with a &n&+ystaff&n.\r\n");
                return;
            }

            if (ch.IsNPC() && !ch.IsFreewilled())
            {
                SocketConnection.Act("You try to brandish $p&n, but you have no free will.", ch, staff, null, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$n&n tries to brandish $p&n, but has no free will.", ch, staff, null, SocketConnection.MessageTarget.room);
                return;
            }

            String spellName = SpellNumberToTextMap.GetSpellNameFromNumber(staff.Values[3]);
            if (String.IsNullOrEmpty(spellName))
            {
                ch.SendText("You try to zap, but your wand fizzles.\r\n");
                Log.Error("Brandish: Spell number " + staff.Values[3] + " not found in SpellNumberToTextMap for object " + staff.ObjIndexNumber + ".");
                return;
            }

            Spell spell = StringLookup.SpellLookup(spellName);
            if (!spell)
            {
                ch.SendText("You try to zap, but your wand fizzles.\r\n");
                Log.Error("Brandish: Spell '" + spellName + "' not found for object " + staff.ObjIndexNumber + ". Check that it exists in the spells file.");
                return;
            }

            ch.WaitState(2 * Event.TICK_COMBAT);

            if (staff.Values[2] > 0)
            {
                SocketConnection.Act("You brandish $p&n.", ch, staff, null, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$n&n brandishes $p&n.", ch, staff, null, SocketConnection.MessageTarget.room);

                ch.PracticeSkill("staves");

                if (!ch.IsNPC() && (MUDMath.NumberPercent() > ((PC)ch).SkillAptitude["staves"]))
                {
                    switch (MUDMath.NumberBits(3))
                    {
                        default:
                        case 0:
                        case 1:
                        case 2:
                        case 3:
                            SocketConnection.Act("You are unable to invoke the power of $p&n.",
                                 ch, staff, null, SocketConnection.MessageTarget.character);
                            SocketConnection.Act("$n&n is unable to invoke the power of $p&n.",
                                 ch, staff, null, SocketConnection.MessageTarget.room);
                            return;
                        case 4:
                        case 5:
                        case 6:
                            SocketConnection.Act("You summon the power of $p&n, but it fizzles away.",
                                 ch, staff, null, SocketConnection.MessageTarget.character);
                            SocketConnection.Act("$n&n summons the power of $p&n, but it fizzles away.",
                                 ch, staff, null, SocketConnection.MessageTarget.room);
                            if (--staff.Values[2] <= 0)
                            {
                                SocketConnection.Act("$p&n blazes brightly and is gone.",
                                     ch, staff, null, SocketConnection.MessageTarget.character);
                                SocketConnection.Act("$p&n blazes brightly and is gone.",
                                     ch, staff, null, SocketConnection.MessageTarget.room);
                                staff.RemoveFromWorld();
                                ;
                            }
                            return;
                        case 7:
                            SocketConnection.Act("You can't control the power of $p&n, and it shatters!",
                                 ch, staff, null, SocketConnection.MessageTarget.character);
                            SocketConnection.Act("$p&n shatters into tiny pieces!",
                                 ch, staff, null, SocketConnection.MessageTarget.room);
                            staff.RemoveFromWorld();
                            Combat.InflictDamage(ch, ch, staff.Level, "staves", ObjTemplate.WearLocation.none, AttackType.DamageType.energy);
                            return;
                    }
                }
            }

            foreach (CharData roomChar in ch.InRoom.People)
            {
//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Command.cs

示例15: Circle


//.........这里部分代码省略.........
                return;
            }

            /* Yeah, gallop around them without them noticing. */
            if (ch.Riding)
            {
                ch.SendText("You can't circle while mounted.\r\n");
                return;
            }

            /* Find the unlucky soul. */
            if (str.Length == 0)
            {
                victim = ch.Fighting;
            }
            else
            {
                if (!(victim = ch.GetCharRoom(str[0])))
                {
                    ch.SendText("They aren't here.\r\n");
                    return;
                }
            }

            /* No target. */
            if (!victim)
            {
                ch.SendText("Circle who?\r\n");
                return;
            }

            /* Run around yourself? Ok. */
            if (victim == ch)
            {
                ch.SendText("You spin around in a circle.  Whee!\r\n");
                return;
            }

            /* Check for protection of victim. */
            victim = Combat.CheckGuarding(ch, victim);
            if (Combat.IsSafe(ch, victim))
            {
                return;
            }

            // is_safe could wipe out victim, as it calls procs if a boss
            // check and see that victim is still valid
            if (!victim)
            {
                return;
            }

            /* Check if someone is attacking ch. */
            CharData roomChar = null;
            foreach (CharData irch in ch.InRoom.People)
            {
                if (irch.Fighting == ch)
                {
                    roomChar = irch;
                    break;
                }
            }
            if (roomChar)
            {
                ch.SendText("You're too busy being hit right now.\r\n");
                return;
            }

            Object obj = Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_one);
            if (!obj || obj.Values[3] != 11)
            {
                ch.SendText("You need to wield a piercing weapon.\r\n");
                return;
            }

            SocketConnection.Act("You circle around behind $N&n...", ch, null, victim, SocketConnection.MessageTarget.character);
            SocketConnection.Act("$n&n circles around behind $N&n...", ch, null, victim, SocketConnection.MessageTarget.room_vict);

            Crime.CheckAttemptedMurder(ch, victim);
            ch.WaitState(Skill.SkillList["circle"].Delay);

            if (ch.IsNPC() || MUDMath.NumberPercent() < ((PC)ch).SkillAptitude["circle"] +
                    ch.GetCurrAgi() - victim.GetCurrAgi())
            {
                /* Don't always switch. */
                if (MUDMath.NumberPercent() < 40)
                {
                    Combat.StopFighting(victim, false);
                }
                Combat.SingleAttack(ch, victim, "circle", ObjTemplate.WearLocation.hand_one);
            }
            else
            {
                SocketConnection.Act("You failed to get around $M!", ch, null, victim, SocketConnection.MessageTarget.character);
            }

            ch.PracticeSkill("circle");

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


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