示例#1
0
        /// <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++)
            {
                /* If there's a secret exit that leads to a room. */
                exit = ch.InRoom.GetExit((Exit.Direction)doornum);
                if (exit && exit.HasFlag(Exit.ExitFlag.secret) && exit.TargetRoom)
                {
                    door = (Exit.Direction)doornum;
                    break;
                }
            }

            if (isArg)
            {
                door = Exit.Direction.invalid;
            }
            if (door != Exit.Direction.invalid)
            {
                if (exit == null)
                {
                    Log.Error("Command.Search: null exit found", 0);
                    return;
                }
                if (exit.TargetRoom == null)
                {
                    Log.Error("Command.Search: exit to null room found", 0);
                    return;
                }
                if (MUDMath.NumberPercent() < chance)
                {
                    if (ch.FlightLevel > 0)
                    {
                        ch.SendText("You're too high to be sure of what you saw.\r\n");
                        return;
                    }
                    ch.SendText("You found a hidden exit!\r\n");
                    SocketConnection.Act("$n&n points out a secret exit!", ch, null, null, SocketConnection.MessageTarget.room);

                    /* Search out one side. */
                    exit.RemoveFlag(Exit.ExitFlag.secret);
                    /* And the other side, if it exists. */
                    toRoom = Room.GetRoom(exit.IndexNumber);
                    if (toRoom && (reverseExit = toRoom.GetExit(Exit.ReverseDirection(door))) && (reverseExit.TargetRoom == ch.InRoom))
                    {
                        reverseExit.RemoveFlag(Exit.ExitFlag.secret);
                    }
                    return;
                }
            }

            if (!isArg)
            {
                // Chance of finding people hiding in the room
                foreach (CharData roomChar in ch.InRoom.People)
                {
                    if (!roomChar.IsAffected(Affect.AFFECT_HIDE) || roomChar.FlightLevel != ch.FlightLevel)
                        continue;
                    if (MUDMath.NumberPercent() < chance)
                    {
                        roomChar.RemoveAffect(Affect.AFFECT_HIDE);
                        /* People without DI can't search out invis hiding pplz. */
                        if (CharData.CanSee(ch, roomChar))
                        {
                            SocketConnection.Act("$n&n points out $N&n lurking here!", ch, null, roomChar, SocketConnection.MessageTarget.room);
                            SocketConnection.Act("You point out $N&n lurking here!", ch, null, roomChar, SocketConnection.MessageTarget.character);
                            SocketConnection.Act("$n&n reveals your hiding spot!", ch, null, roomChar, SocketConnection.MessageTarget.victim);
                            return;
                        }
                        roomChar.SetAffectBit(Affect.AFFECT_HIDE);
                    }
                }
            }

            ch.SendText("You find nothing new.\r\n");
            return;
        }
示例#2
0
        /// <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)
            {
                chance /= 5; //used to be 0
            }
            else
            {
                chance += ch.GetCurrAgi() - victim.GetCurrAgi();
            }

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

            Object obj = Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_one);
            if (!obj)
            {            /* No primary item. */
                if (!(obj = Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_two)))
                {          /* No items in hand. */
                    if (!ch.IsClass(CharClass.Names.paladin) && !ch.IsClass(CharClass.Names.antipaladin))
                    {
                        if (!ch.IsClass(CharClass.Names.warrior))
                        {
                            chance -= 25;
                        }
                        else
                        {
                            chance -= 20;
                        }
                        ch.SendText("You lower your shoulder and attempt to bash without a shield...\r\n");
                    }
                    else
                    {
                        chance -= 3; // Hidden penalty for not having a shield
                    }
                }
                else if (obj.ItemType != ObjTemplate.ObjectType.shield)
                {          /* Secondary item isn't a shield, no primary. */
                    if (!ch.IsClass(CharClass.Names.paladin) && !ch.IsClass(CharClass.Names.antipaladin))
                    {
                        if (!ch.IsClass(CharClass.Names.warrior))
                        {
                            chance -= 25;
                        }
                        else
                        {
                            chance -= 20;
                        }
                        ch.SendText("Bashing without a shield is tough, but you try anyway...\r\n");
                    }
                    else
                    {
                        chance -= 5; // Small hidden penalty for not having a shield
                    }
                }          /* Secondary item is a shield, no primary. */
                else if (ch.IsClass(CharClass.Names.paladin) || ch.IsClass(CharClass.Names.antipaladin))
                {
                    chance += 3; // Small hidden bonus for having a shield
                }
            }
            else if (obj.ItemType != ObjTemplate.ObjectType.shield)
            {            /* Primary item isn't a shield. */
                if (!(obj = Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_two)))
                {          /* No secondary. */
                    if (!ch.IsClass(CharClass.Names.paladin) && !ch.IsClass(CharClass.Names.antipaladin))
                    {
                        if (!ch.IsClass(CharClass.Names.warrior))
                        {
                            chance -= 25;
                        }
                        else
                        {
                            chance -= 20;
                        }
                        ch.SendText("Without a shield, bashing is a wistful thought, but you try anyway...\r\n");
                    }
                    else
                    {
                        chance -= 5; // Hidden penalty for not having a shield
                    }
                }
                else if (obj.ItemType != ObjTemplate.ObjectType.shield)
                {          /* Secondary item is not a shield. */
                    if (!ch.IsClass(CharClass.Names.paladin) && !ch.IsClass(CharClass.Names.antipaladin))
                    {
                        if (!ch.IsClass(CharClass.Names.warrior))
                        {
                            chance -= 25;
                        }
                        else
                        {
                            chance -= 20;
                        }
                        ch.SendText("Without a shield, your shoulder bash is but wishful thinking...\r\n");
                    }
                    else
                    {
                        chance -= 5; // Hidden penalty for not having a shield
                    }
                }
                else if (ch.IsClass(CharClass.Names.paladin) || ch.IsClass(CharClass.Names.antipaladin))
                {          /* Secondary is a shield. */
                    chance += 3; // Small hidden bonus for having a shield
                }
                else if (ch.IsClass(CharClass.Names.ranger))
                {
                    chance -= 8;
                }
                else if (ch.IsClass(CharClass.Names.warrior))
                {
                    chance -= 5;
                }
            }

            // Centaurs are awful damned hard to bash -- Xangis
            if (victim.GetRace() == Race.RACE_CENTAUR)
            {
                chance -= 25;
            }

            // damned high penalty for bashing blind
            if (ch.IsAffected(Affect.AFFECT_BLIND) && !victim.IsAffected(Affect.AFFECT_BLIND))
            {
                chance /= 10;
            }
            if (ch.IsAffected(Affect.AFFECT_BLIND) && victim.IsAffected(Affect.AFFECT_BLIND))
            {
                chance /= 4;
            }

            ch.PracticeSkill("bash");

            /* Start a fight if not already in one. */
            if (ch != victim)
            {
                if (!ch.Fighting)
                {
                    Combat.SetFighting(ch, victim);
                }
                if (!victim.Fighting)
                {
                    Combat.SetFighting(victim, ch);
                }
            }

            string lbuf = "Bash: " + ch.Name + " bashing " + victim.Name + " with " + chance + " chance.";
            ImmortalChat.SendImmortalChat(null, ImmortalChat.IMMTALK_SPAM, 0, lbuf);

            /* Do the bash, deal the damage. */
            if (MUDMath.NumberPercent() < chance)
            {
                /* Hit the bash. */
                if (victim.IsAffected(Affect.AFFECT_SINGING))
                {
                    victim.RemoveAffect(Affect.AFFECT_SINGING);
                    SocketConnection.Act("$n&n chokes on a note and falls silent as $e slams into the ground!", victim, null, null, SocketConnection.MessageTarget.room);
                    victim.SendText("You abort your singing!\r\n");
                }
                if (victim.IsAffected(Affect.AFFECT_CASTING))
                {
                    victim.RemoveAffect(Affect.AFFECT_CASTING);
                    SocketConnection.Act("$n&n's eyes roll back in $s head and $e forgets all about $s spell.", victim, null, null, SocketConnection.MessageTarget.room);
                    victim.SendText("Being knocked over so forcefully makes it hard to cast.\r\n");
                }
                if (!Combat.CheckTumble(victim))
                {
                    victim.WaitState(((Skill.SkillList["bash"].Delay * 5) / 6));
                    if (victim.CurrentPosition > Position.kneeling)
                    {
                        victim.CurrentPosition = Position.kneeling;
                    }
                    victim.SendText("You are knocked to the ground!\r\n");
                    Combat.InflictDamage(ch, victim, MUDMath.NumberRange(1, ch.Level), "bash", ObjTemplate.WearLocation.none, AttackType.DamageType.bludgeon);
                }
                else
                {
                    Combat.InflictDamage(ch, victim, MUDMath.NumberRange(1, (ch.Level / 3)), "bash", ObjTemplate.WearLocation.none, AttackType.DamageType.bludgeon);
                    victim.SendText("You roll with the blow, finally landing on your feet.\r\n");
                    SocketConnection.Act("$n&n rolls with the blow, finally landing on $s feet.", victim, null, null, SocketConnection.MessageTarget.room);
                }
            }
            else
            { /* Miss the bash. */
                SocketConnection.Act("As $N&n avoids your bash, you topple to the &n&+yground&n with a loud crash.", ch, null, victim, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$n&n crashes to the &n&+yground&n as you sidestep $s bash.", ch, null, victim, SocketConnection.MessageTarget.victim);
                SocketConnection.Act("$n&n misses $s bash at $N&n and is driven to the &n&+yground&n.", ch, null, victim, SocketConnection.MessageTarget.room_vict);
                ch.CurrentPosition = Position.kneeling;
            }

            return;
        }
示例#3
0
        /// <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;
        }
示例#4
0
        /// <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);

                    SocketConnection.Act("Crash!  You bashed open the $d!",
                         ch, null, exit.Keyword, SocketConnection.MessageTarget.character);
                    SocketConnection.Act("$n&n bashes open the $d!",
                         ch, null, exit.Keyword, SocketConnection.MessageTarget.room);

                    Combat.InflictDamage(ch, ch, (ch.GetMaxHit() / 30), "doorbash", ObjTemplate.WearLocation.none, AttackType.DamageType.bludgeon);

                    /* Bash through the other side */
                    if ((toRoom = Room.GetRoom(exit.IndexNumber)) && (reverseExit = toRoom.GetExit(Exit.ReverseDirection(door)))
                        && reverseExit.TargetRoom == ch.InRoom)
                    {
                        reverseExit.RemoveFlag(Exit.ExitFlag.closed);
                        if (reverseExit.HasFlag(Exit.ExitFlag.locked))
                        {
                            reverseExit.RemoveFlag(Exit.ExitFlag.locked);
                        }

                        reverseExit.AddFlag(Exit.ExitFlag.bashed);

                        foreach (CharData irch in toRoom.People)
                        {
                            SocketConnection.Act("The $d crashes open!",
                                 irch, null, reverseExit.Keyword, SocketConnection.MessageTarget.character);
                        }

                        // Have any aggro mobs on the other side come after the player.
                        foreach (CharData charData in toRoom.People)
                        {
                            if (charData != ch && (charData.IsNPC() && !charData.IsAffected( Affect.AFFECT_CHARM))
                                && charData.IsAggressive(ch) && charData.IsAwake() && CharData.CanSee(charData, ch)
                                && !charData.Fighting)
                            {
                                Combat.StartHating(charData, ch);
                                Combat.StartHunting(charData, ch);
                            }
                        }

                    }
                }
                else
                {
                    /* Failure */
                    SocketConnection.Act("OW!  You bash against the $d, but it doesn't budge.",
                         ch, null, exit.Keyword, SocketConnection.MessageTarget.character);
                    SocketConnection.Act("$n&n bashes against the $d, but it holds strong.",
                         ch, null, exit.Keyword, SocketConnection.MessageTarget.room);
                    Combat.InflictDamage(ch, ch, (ch.GetMaxHit() / 10), "doorbash", ObjTemplate.WearLocation.none, AttackType.DamageType.bludgeon);
                }
            }

            /*
            * Check for "guards"... anyone bashing a door is considered as
            * a potential aggressor, and there's a 25% chance that mobs
            * will do unto before being done unto.
            * But first...let's make sure ch ain't dead?  That'd be a pain.
            */

            if (ch.Hitpoints <= 1)
                return;

            ch.PracticeSkill("doorbash");

            foreach (CharData guardChar in ch.InRoom.People)
            {
                if (guardChar != ch && guardChar.HasActionBit(MobTemplate.ACT_PROTECTOR) && (guardChar.IsNPC() &&
                    !guardChar.IsAffected( Affect.AFFECT_CHARM)) && guardChar.IsAwake() && CharData.CanSee(guardChar, ch) &&
                    !guardChar.Fighting && MUDMath.NumberBits(2) == 0)
                {
                    SocketConnection.Act("$n&n is very unhappy about you trying to destroy the door.", guardChar, null, ch, SocketConnection.MessageTarget.victim);
                    guardChar.AttackCharacter(ch);
                }
            }
            return;
        }
示例#5
0
        /// <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;
        }
示例#6
0
        /// <summary>
        /// Throw dirt in someone's eyes.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void DirtToss(CharData ch, string[] str)
        {
            if( ch == null ) return;

            int percent;

            /* Don't allow the unskilled to do this, check player's level */
            if (!ch.HasSkill("dirt toss"))
            {
                ch.SendText("You get your feet dirty.\r\n");
                return;
            }

            if (ch.IsBlind())
            {
                ch.SendText("You can't see anything!\r\n");
                return;
            }

            if (ch.FlightLevel != 0)
            {
                ch.SendText("Perhaps you should land first matey.\r\n");
                return;
            }

            CharData victim = ch.Fighting;

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

            if (victim == ch)
            {
                ch.SendText("How about sticking a fork your eye instead?\r\n");
                return;
            }

            if (victim.IsAffected( Affect.AFFECT_BLIND))
            {
                SocketConnection.Act("$E's already been &+Lblinded&n.", ch, null, victim, SocketConnection.MessageTarget.character);
                return;
            }

            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;
        }
示例#7
0
        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;
        }
示例#8
0
        /// <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;
            }

            if (MUDMath.NumberPercent() < chance)
            {
                ch.CurrentPosition = Position.fighting;
                SocketConnection.Act("&+WYour springleap knocks $N&n&+W on $S butt.&n", ch, null, victim, SocketConnection.MessageTarget.character);
                SocketConnection.Act("&+W$n&n&+W leaps gracefully at $N&n&+W, sending $M to the ground.&n", ch, null, victim, SocketConnection.MessageTarget.room);
                SocketConnection.Act("&+W$n&n&+W leaps at you, knocking you to the ground!&n", ch, null, victim, SocketConnection.MessageTarget.victim);
                if (victim.IsAffected(Affect.AFFECT_SINGING))
                {
                    victim.RemoveAffect(Affect.AFFECT_SINGING);
                    SocketConnection.Act("$n&n gasps and falls silent as $e falls over backward!", victim, null, null, SocketConnection.MessageTarget.room);
                    victim.SendText("You abort your singing!\r\n");
                }
                if (victim.IsAffected(Affect.AFFECT_CASTING))
                {
                    victim.RemoveAffect(Affect.AFFECT_CASTING);
                    SocketConnection.Act("$n&n no longer has any idea what $e was casting.", victim, null, null, SocketConnection.MessageTarget.room);
                    victim.SendText("Lying on the ground, you realize you have no idea what you were just casting.\r\n");
                }

                if (!ch.Fighting)
                {
                    Combat.SetFighting(ch, victim);
                }
                if (!victim.Fighting)
                {
                    Combat.SetFighting(victim, ch);
                }
                if (!Combat.CheckTumble(victim))
                {
                    victim.WaitState((Skill.SkillList["springleap"].Delay * 5 / 6));
                    if (victim.CurrentPosition > Position.sitting)
                    {
                        victim.CurrentPosition = Position.sitting;
                    }
                    Combat.InflictDamage(ch, victim, MUDMath.NumberRange(1, ch.Level), "springleap", ObjTemplate.WearLocation.none, AttackType.DamageType.bludgeon);
                }
                else
                {
                    Combat.InflictDamage(ch, victim, MUDMath.NumberRange(1, (ch.Level / 3)), "springleap", ObjTemplate.WearLocation.none, AttackType.DamageType.bludgeon);
                    ch.SendText("You roll with the blow, finally landing on your feet.\r\n");
                    SocketConnection.Act("$n&n rolls with the blow, finally landing on $s feet.", victim, null, null, SocketConnection.MessageTarget.room);
                }
            }
            else
            {
                bool pissedOff = false;
                if (ch.Fighting == victim || victim.GetCurrInt() > MUDMath.NumberPercent())
                {
                    pissedOff = true;
                }
                if (pissedOff)
                {
                    SocketConnection.Act("As $N&n avoids your leap you crash to the ground.", ch, null, victim, SocketConnection.MessageTarget.character);
                    SocketConnection.Act("$n&n crashes to the ground as you avoid $s springleap.", ch, null, victim, SocketConnection.MessageTarget.victim);
                    if (!ch.Fighting)
                    {
                        Combat.SetFighting(ch, victim);
                    }
                    if (!victim.Fighting)
                    {
                        Combat.SetFighting(victim, ch);
                    }
                }
                else
                {
                    SocketConnection.Act("You ungracefully leap at $N and miss, landing head first!", ch, null, victim, SocketConnection.MessageTarget.character);
                }
                SocketConnection.Act("$n&n misses a springleap and falls awkwardly to the ground.", ch, null, null, SocketConnection.MessageTarget.room);
                ch.CurrentPosition = Position.reclining;
                Combat.InflictDamage(ch, ch, MUDMath.NumberRange(1, 4), "springleap",
                        ObjTemplate.WearLocation.none, AttackType.DamageType.bludgeon);
            }

            return;
        }
示例#9
0
        /// <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;
                foreach (Object iobj in victim.Carrying)
                {
                    if (CharData.CanSeeObj(ch, iobj) && MUDString.NameContainedIn(arg, iobj.Name))
                    {
                        if (++count == number)
                        {
                            obj = iobj;
                            break;
                        }
                    }
                }

                if (!obj)
                {
                    ch.SendText("You can't find it.\r\n");
                    return;
                }

                if (ch.Level < victim.Level)
                {
                    // stealing from higher level is possible, but harder
                    percent -= 5 * (victim.Level - ch.Level);
                }
                else
                {
                    // slight bonus for mobs lower level
                    percent += (ch.Level - victim.Level);
                }
                if (obj.WearLocation == ObjTemplate.WearLocation.none)
                    /* Items worn are harder */
                    percent = (int)(percent * .8);
                else
                    percent = (int)(percent * .4);
            }

            ch.PracticeSkill("steal");

            if (percent > 85)
                percent = 85;

            if (percent < 2)
                percent = 2;
            if (percent < MUDMath.NumberPercent())
            {
                /*
                * Failure.
                */
                //strip sneak
                ch.RemoveAffect(Affect.AFFECT_SNEAK);
                // chance of removing invis
                if (ch.IsAffected(Affect.AFFECT_INVISIBLE) && MUDMath.NumberPercent() > percent)
                {
                    ch.SendText("You really bungled that attempt.\r\n");
                    ch.RemoveAffect(Affect.AFFECT_INVISIBLE);
                }
                else
                {
                    ch.SendText("Oops.\r\n");
                }
                SocketConnection.Act("$n&n tried to steal from $N&n.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
                if (victim.IsAwake())
                {
                    SocketConnection.Act("$n&n tried to steal from you!", ch, null, victim, SocketConnection.MessageTarget.victim);
                }
                else
                {
                    sleeping = true;
                }
                // Thief flag for justice.
                // Added so blind mobs dont hit who ever failed steal from em.
                if (victim.IsNPC())
                {
                    if (!sleeping && !victim.IsBlind())
                    {
                        CommandType.Interpret(victim, "kill " + ch.Name);
                    }
                }
                else
                {
                    if (!victim.IsBlind() && !sleeping && victim.IsAffected(Affect.AFFECT_BERZERK))
                    {
                        victim.SendText("In your &+Rblood rage&n, you lash out in anger!\r\n");
                        CommandType.Interpret(victim, "kill " + ch.Name);
                    }
                }
                /*
                if ( !Macros.IS_SET( ch.actflags, PC.PLAYER_THIEF ) )
                {
                Macros.SET_BIT( ref ch.actflags, PC.PLAYER_THIEF );
                buf = String.Format(  "{0} became a THIEF by stealing from {1}",
                ch._name, victim._name );
                Immtalk.Immtalk( ch, Immtalk.IMMTALK_CRIME, ch.GetTrust(), buf );
                CharData.SavePlayer( ch );
                }
                */
                //    }
                if (sleeping)
                {
                    if (MUDMath.NumberPercent() < victim.GetCurrLuck())
                    {
                        CommandType.Interpret(victim, "wake");
                    }
                }
                return;
            } //end failure

            if (!MUDString.IsPrefixOf(arg1, "coins"))
            {
                int amount = victim.GetGold() * MUDMath.NumberRange(1, 20) / 100;
                int amount2 = victim.GetSilver() * MUDMath.NumberRange(1, 20) / 100;
                int amount3 = victim.GetCopper() * MUDMath.NumberRange(1, 20) / 100;
                int amount4 = victim.GetPlatinum() * MUDMath.NumberRange(1, 20) / 100;

                if ((amount + amount2 + amount3 + amount4) <= 0)
                {
                    ch.SendText("You couldn't get any &n&+wcoins&n.\r\n");
                    return;
                }

                ch.ReceiveGold(amount);
                ch.ReceiveSilver(amount2);
                ch.ReceiveCopper(amount3);
                ch.ReceivePlatinum(amount4);

                victim.SpendGold(amount);
                victim.SpendSilver(amount2);
                victim.SpendCopper(amount3);
                victim.SpendPlatinum(amount4);

                string text = String.Format("Success!  You got {0} &+Wplatinum&n, {1} &+Ygold&n, {2} silver, and {3} &+ycopper&n.\r\n",
                                            amount2, amount3, amount, amount4);
                ch.SendText(text);
                return;
            }

            if (!ch.CanDropObject(obj) || obj.HasFlag(ObjTemplate.ITEM_INVENTORY))
            {
                ch.SendText("You can't pry it away.\r\n");
                return;
            }

            if (ch.CarryNumber + 1 > Limits.MAX_CARRY)
            {
                ch.SendText("You have your hands full.\r\n");
                return;
            }

            if (ch.CarryWeight + obj.GetWeight() > ch.MaxCarryWeight())
            {
                ch.SendText("You cannot carry that much weight.\r\n");
                return;
            }

            if (obj.WearLocation != ObjTemplate.WearLocation.none)
            {
                ch.SendText("Very daring, and you got it!\r\n");
                victim.UnequipObject(obj);
            }

            obj.RemoveFromChar();
            obj.ObjToChar(ch);
            ch.SendText("Nice work.\r\n");
            if (obj.Trap != null && obj.Trap.CheckTrigger( Trap.TriggerType.steal))
            {
                ch.SetOffTrap(obj);
                if (ch.CurrentPosition == Position.dead)
                {
                    return;
                }
            }
            return;
        }
示例#10
0
        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;
        }
示例#11
0
        /// <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;
        }
示例#12
0
        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);
        }
示例#13
0
        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;
        }
示例#14
0
        /// <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)
            {
                if( ch == null ) return;

                switch (spell.ValidTargets)
                {
                    default:
                        Log.Error("Brandish: Bad TargetType for spell {0}.", spell.Name);
                        return;

                    case TargetType.none:
                        if (roomChar != ch)
                            continue;
                        break;

                    case TargetType.singleCharacterOffensive:
                        if (ch.IsNPC() ? roomChar.IsNPC() : !roomChar.IsNPC())
                            continue;
                        break;

                    case TargetType.singleCharacterDefensive:
                        if (ch.IsNPC() ? !roomChar.IsNPC() : roomChar.IsNPC())
                            continue;
                        break;

                    case TargetType.self:
                        if (roomChar != ch)
                            continue;
                        break;
                }

                Magic.ObjectCastSpell(ch, spell, staff.Level, roomChar, null);
            }

            if (!ch.IsNPC() || (ch.IsNPC() && ch.IsAffected(Affect.AFFECT_CHARM)))
            {
                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;
        }
示例#15
0
        /// <summary>
        /// Circle around behind someone and backstab them.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Circle(CharData ch, string[] str)
        {
            if( ch == null ) return;

            CharData victim;

            /* Verify that ch can circle. */
            if (!ch.IsNPC() && !ch.HasSkill("circle"))
            {
                ch.SendText("You'd better leave the assassination trade to those more skilled.\r\n");
                return;
            }

            /* No charmies or NPC's are allowed to circle. */
            if (ch.IsNPC() && ch.IsAffected(Affect.AFFECT_CHARM))
            {
                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;
        }
示例#16
0
        /// <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;
        }
示例#17
0
        /// <summary>
        /// Command to climb something.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Climb(CharData ch, string[] str)
        {
            if( ch == null ) return;

            int chance;

            if (!ch.HasSkill("climb"))
            {
                ch.SendText("You lack the skills to climb anything.\r\n");
                return;
            }

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

            Object obj = ch.GetObjHere(str[0]);
            if (!obj)
            {
                ch.SendText("Uhh... what exactly did you want to climb!?\r\n");
                return;
            }

            if (obj.ItemType != ObjTemplate.ObjectType.wall)
            {
                ch.SendText("That wasn't exactly designed for climbing.\r\n");
                return;
            }

            if (ch.IsNPC())
            {
                chance = ch.Level * 3 / 2 + 20;
            }
            else
            {
                chance = ((PC)ch).SkillAptitude["climb"];
            }

            // Agility helps.
            chance += ch.GetCurrAgi() / 10;

            switch (obj.ObjIndexData.IndexNumber)
            {
                case StaticObjects.OBJECT_NUMBER_WALL_STONE:
                    chance += 5;
                    break;
                case StaticObjects.OBJECT_NUMBER_WALL_IRON:
                    chance -= 15;
                    break;
                default:
                    ch.SendText("That wasn't exactly designed for climbing.\r\n");
                    return;
            }

            // Maximum chance of 98%
            if (chance > 98)
            {
                chance = 98;
            }

            if (MUDMath.NumberPercent() >= chance)
            {
                ch.SendText("You try to climb it, but you fall on your ass!\r\n");
                ch.CurrentPosition = Position.sitting;
                ch.WaitState(5);
                return;
            }

            ch.SendText("With great skill, you scale the wall!\r\n");

            // Value 0 of a wall object is the direction that has been walled...
            // This means that they should move in that direction.  We leave it up to
            // move_char to make sure that there is actually an exit in that direction.
            // we use the climbing bit to allow them to pass the walls in move_char.
            ch.SetAffectBit(Affect.AFFECT_CLIMBING);
            ch.Move((Exit.Direction)obj.Values[0]);
            ch.RemoveAffect(Affect.AFFECT_CLIMBING);

            return;
        }
示例#18
0
        /// <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);
            }
            else if (!victim.Fighting)
            {
                victim.AttackCharacter(ch);
            }

            return;
        }
示例#19
0
        /// <summary>
        /// Knock the weapon from an opponent's hand.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Disarm(CharData ch, string[] str)
        {
            if( ch == null ) return;

            int odds;

            /* Don't allow charmed mobiles to do this, check player's level */
            if ((ch.IsNPC() && ch.IsAffected( Affect.AFFECT_CHARM))
                    || (!ch.IsNPC() && !ch.HasSkill("disarm")))
            {
                ch.SendText("You don't know how to disarm opponents.\r\n");
                return;
            }

            if (!Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_one)
                    && !Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_two))
            {
                ch.SendText("You must wield a weapon to disarm.\r\n");
                return;
            }

            if (!ch.Fighting)
            {
                ch.SendText("You aren't fighting anyone.\r\n");
                return;
            }

            CharData victim = ch.Fighting;

            if (str.Length != 0)
            {
                if (!(victim = ch.GetCharRoom(str[0])))
                {
                    ch.SendText("They aren't here.\r\n");
                    return;
                }
            }

            if (victim.Fighting != ch && ch.Fighting != victim)
            {
                SocketConnection.Act("$E is not fighting you!", ch, null, victim, SocketConnection.MessageTarget.character);
                return;
            }

            if (!Object.GetEquipmentOnCharacter(victim, ObjTemplate.WearLocation.hand_one)
                    && !Object.GetEquipmentOnCharacter(victim, ObjTemplate.WearLocation.hand_two))
            {
                ch.SendText("Your opponent is not wielding a weapon.\r\n");
                return;
            }

            if (victim.Level > ch.Level + 10)
            {
                ch.SendText("They are much too clever for such a clumsy attempt at that maneuver.\r\n");
                return;
            }

            ch.WaitState(Skill.SkillList["disarm"].Delay);
            ch.PracticeSkill("disarm");
            if (ch.IsNPC())
            {
                odds = ch.Level;
            }
            else
            {
                odds = ((PC)ch).SkillAptitude["disarm"] / 2;
            }
            if (victim.IsNPC())
            {
                odds += 2 * (ch.Level - victim.Level);
            }
            else
            {
                /* Offense skill helps prevent disarms */
                odds -= ((PC)victim).SkillAptitude["offense"] / 4;
            }
            if (!Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_one))
            {
                odds /= 2;      /* 1/2 as likely with only 2nd weapon */
            }
            odds = Math.Min(odds, 98);
            odds = Math.Max(odds, 2);
            string lbuf = String.Format("Disarm: {0} attempting with {1}%% chance.", ch.Name, odds);
            ImmortalChat.SendImmortalChat(null, ImmortalChat.IMMTALK_SPAM, 0, lbuf);
            if (MUDMath.NumberPercent() < odds)
            {
                Combat.Disarm(ch, victim);
            }
            else if (MUDMath.NumberPercent() > 80)
            {
                ch.SendText("Expertly countering your maneuver, they dislodge your weapon and send it flying.\r\n");
                Combat.Disarm(victim, ch);
            }
            else
            {
                ch.SendText("You failed in your attempt.\r\n");
            }
            return;
        }
示例#20
0
        /// <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)
            {
                SocketConnection.Act("You can't sense $N&n's trail from here.",
                     ch, null, victim, SocketConnection.MessageTarget.character);
                return;
            }

            /*
            * Give a random direction if the player misses the die roll.
            */
            if ((ch.IsNPC() && MUDMath.NumberPercent() > 75)  /* NPC @ 25% */
                    || (!ch.IsNPC() && MUDMath.NumberPercent() >   /* PC @ norm */
                         ((PC)ch).SkillAptitude["track"]))
            {
                do
                {
                    direction = Database.RandomDoor();
                }
                while (!(ch.InRoom.ExitData[(int)direction]) || !(ch.InRoom.ExitData[(int)direction].TargetRoom));
            }

            ch.PracticeSkill("track");

            /*
            * Display the results of the search.
            */
            ch.SetAffectBit(Affect.AFFECT_TRACK);
            string buf = String.Format("You sense $N&n's trail {0} from here...", direction.ToString());
            SocketConnection.Act(buf, ch, null, victim, SocketConnection.MessageTarget.character);
            if (ch.CurrentPosition == Position.standing)
            {
                ch.Move(direction);
            }
            Combat.StartHunting(ch, victim);

            return;
        }
示例#21
0
        /// <summary>
        /// Get down from a mount.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Dismount(CharData ch, string[] str)
        {
            if( ch == null ) return;

            CharData victim = ch.Riding;
            if (!victim)
            {
                ch.SendText("You're not mounted.\r\n");
                return;
            }

            if (ch.Riding.InRoom != ch.InRoom)
            {
                ch.SendText("Weird! You dismount, but your mount isn't here.");
                if (ch.Riding.Rider && ch.Riding.Rider == ch)
                {
                    ch.Riding.Rider = null;
                }
                ch.Riding = null;
                return;
            }

            ch.WaitState(Skill.SkillList["mount"].Delay);
            if (ch.CheckSkill("mount", PracticeType.easy))
            {
                SocketConnection.Act("You dismount $N&n.", ch, null, victim, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$n&n skillfully dismounts $N&n.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
                SocketConnection.Act("$n&n dismounts you.  Whew!", ch, null, victim, SocketConnection.MessageTarget.victim);
                victim.Rider = null;
                ch.Riding = null;
                ch.CurrentPosition = Position.standing;
            }
            else
            {
                SocketConnection.Act("You fall off while dismounting $N&n.  Ouch!", ch, null, victim, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$n&n falls off of $N&n while dismounting.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
                SocketConnection.Act("$n&n falls off your back.", ch, null, victim, SocketConnection.MessageTarget.victim);
                victim.Rider = null;
                ch.Riding = null;
                ch.CurrentPosition = Position.resting;
                Combat.InflictDamage(ch, ch, 1, String.Empty, ObjTemplate.WearLocation.none, AttackType.DamageType.bludgeon);
            }

            return;
        }
示例#22
0
        /// <summary>
        /// Attempt to trip a foe.  Can initiate combat with this and can use during combat.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Trip(CharData ch, string[] str)
        {
            if( ch == null ) return;

            int chance;

            /* Check player's level and class, mobs can use this skill */
            if ((!ch.HasSkill("trip")))
            {
                ch.SendText("You would just fall over if you tried to trip someone.\r\n");
                return;
            }

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

            CharData victim = ch.Fighting;

            if (str.Length != 0)
            {
                victim = ch.GetCharRoom(str[0]);
                if (!victim)
                {
                    ch.SendText("You look around, unable to find them.\r\n");
                    return;
                }
            }
            else
            {
                if (!victim)
                {
                    ch.SendText("You aren't fighting anyone.\r\n");
                    return;
                }
            }

            /* anti 'trip me' code */
            if (victim == ch)
            {
                ch.SendText("You don't think you're clumsy enough already?\r\n");
                return;
            }

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

            if (ch.IsNPC())
            {
                chance = (ch.Level * 3) / 2 + 10;
            }
            else
            {
                chance = ((PC)ch).SkillAptitude["trip"];
            }

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

            if ((ch.Fighting == null) && (ch != victim))
            {
                Combat.SetFighting(ch, victim);
            }
            if ((!victim.Fighting) && (victim != ch))
            {
                Combat.SetFighting(victim, ch);
            }

            /* Mobs do NOT auto-trip! */
            if (MUDMath.NumberPercent() < chance)
            {
                victim.WaitState((Skill.SkillList["trip"].Delay * 5 / 6));
                SocketConnection.Act("You trip $N&n and send $M sprawling to the &n&+yearth&n!", ch, null, victim, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$n&n trips you and you go down!", ch, null, victim, SocketConnection.MessageTarget.victim);
                SocketConnection.Act("$n&n trips $N&n and $E falls face-first to the &n&+yground&n!", ch, null, victim, SocketConnection.MessageTarget.room_vict);
                if (victim.CurrentPosition > Position.reclining)
                {
                    victim.CurrentPosition = Position.reclining;
                }
            }
            else
            {
                SocketConnection.Act("You try to trip $N&n and fall down!", ch, null, victim, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$n&n attempts to knock you from your feet, and falls down $sself!", ch, null, victim, SocketConnection.MessageTarget.victim);
                SocketConnection.Act("$n&n tries to trip $N&n and tumbles to the &n&+yground&n!", ch, null, victim, SocketConnection.MessageTarget.room_vict);
                ch.CurrentPosition = Position.reclining;
            }

            return;
        }
示例#23
0
        /// <summary>
        /// Used for dragging corpses into another room.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Drag(CharData ch, string[] str)
        {
            if( ch == null ) return;

            Object obj;
            Object obj2;

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

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

            if (str.Length == 0)
            {
                ch.SendText("You need to specify a direction.\r\n");
                return;
            }

            if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_MEMORIZING))
            {
                ch.RemoveActionBit(PC.PLAYER_MEMORIZING);
                ch.SendText("You abandon your studies.\r\n");
            }

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

            if (obj.ItemType != ObjTemplate.ObjectType.npc_corpse && obj.ItemType != ObjTemplate.ObjectType.pc_corpse)
            {
                ch.SendText("You can only drag corpses.\r\n");
                return;
            }

            if (str.Length > 2 && str[1] == "enter")
            {
                if ((obj2 = ch.GetObjHere(str[3])))
                {
                    switch (obj2.ItemType)
                    {
                        case ObjTemplate.ObjectType.teleport:
                        case ObjTemplate.ObjectType.portal:
                            if (obj2.ItemType == ObjTemplate.ObjectType.teleport && !CommandType.CheckCommandTrigger("enter", obj2.Values[1]))
                            {
                                ch.SendText("Nothing happens.\r\n");
                                return;
                            };
                            Room location;
                            if (Macros.IsSet(obj2.Values[3], ObjTemplate.PORTAL_RANDOM))
                            {
                                location = Movement.GetRandomRoom();
                            }
                            else
                            {
                                location = Room.GetRoom(obj2.Values[0]);
                            }
                            if (!location)
                            {
                                ch.SendText("That portal doesn't seem to go anywhere.\r\n");
                                return;
                            }
                            SocketConnection.Act("You drag the $p&n into $P&n.", ch, obj, obj2, SocketConnection.MessageTarget.character);
                            SocketConnection.Act("$n&n drags the $p&n into $P&n.", ch, obj, obj2, SocketConnection.MessageTarget.room);
                            if (obj2.Values[2] >= 0)
                            {
                                obj2.Values[2] -= 2;
                                if (obj2.Values[2] <= 0)
                                {
                                    SocketConnection.Act("$p&n fades into nothingness.", ch, obj2, null, SocketConnection.MessageTarget.room);
                                    obj2.RemoveFromRoom();
                                }
                            }
                            obj.RemoveFromRoom();
                            ch.RemoveFromRoom();
                            ch.AddToRoom(location);
                            obj.AddToRoom(location);
                            if (obj2.ItemType == ObjTemplate.ObjectType.portal)
                            {
                                SocketConnection.Act("$n&n steps out of $P&n dragging the $p&n.", ch, obj, obj2, SocketConnection.MessageTarget.room);
                            }
                            else
                            {
                                SocketConnection.Act("$n&n appears from elsewhere, dragging the $p&n.", ch, obj, null, SocketConnection.MessageTarget.room);
                            }
                            CommandType.Interpret(ch, "look auto");
                            return;
                        case ObjTemplate.ObjectType.vehicle:
                        case ObjTemplate.ObjectType.ship:
                            break;
                        case ObjTemplate.ObjectType.other:
                            break;
                        default:
                            ch.SendText("That cannot be entered.\r\n");
                            return;
                    }
                }
            }

            Exit.Direction door = Movement.FindExit(ch, str[1]);

            if (door < 0)
            {
                ch.SendText("You can't drag anything that way.\r\n");
                return;
            }
            if (ch.CurrentMoves < 5 && !ch.IsImmortal())
            {
                ch.SendText("You are too exhausted to drag that anywhere.\r\n");
                return;
            }

            string text = String.Format("You drag $p&n {0}.", door.ToString());
            SocketConnection.Act(text, ch, obj, null, SocketConnection.MessageTarget.character);
            text = String.Format("$n&n drags $p&n {0}.", door.ToString());
            SocketConnection.Act(text, ch, obj, null, SocketConnection.MessageTarget.room);

            obj.RemoveFromRoom();
            ch.CurrentMoves -= 5;

            ch.Move(door);
            ch.WaitState(MUDMath.NumberRange(3, 12));

            obj.AddToRoom(ch.InRoom);
            SocketConnection.Act("$n&n drags $p&n along behind $m.", ch, obj, null, SocketConnection.MessageTarget.room);
        }
示例#24
0
        // This function needs to be rewritten to take args!
        public static void Whirlwind(CharData ch, string[] str)
        {
            if( ch == null ) return;

            bool found = false;

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

            Object wield = Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_one);
            if (!wield || wield.ItemType != ObjTemplate.ObjectType.weapon)
            {
                ch.SendText("You need to wield a weapon first.\r\n");
                return;
            }

            SocketConnection.Act("$n&n holds $p&n firmly, and starts spinning round...", ch, wield, null, SocketConnection.MessageTarget.room);
            SocketConnection.Act("You hold $p&n firmly, and start spinning round...", ch, wield, null, SocketConnection.MessageTarget.character);

            foreach (CharData roomChar in ch.InRoom.People)
            {
                if ((roomChar.IsNPC() || (ch.IsRacewar(roomChar) && !roomChar.IsImmortal()))
                        && CharData.CanSee(roomChar, ch))
                {
                    found = true;
                    SocketConnection.Act("$n&n turns towards YOU!", ch, null, roomChar, SocketConnection.MessageTarget.victim);
                    Combat.SingleAttack(ch, roomChar, "whirlwind", ObjTemplate.WearLocation.hand_one);
                    // Added small amount of lag per target hit
                    ch.WaitState(3);
                }
            }

            if (!found)
            {
                SocketConnection.Act("$n&n looks dizzy, and a tiny bit embarrassed.", ch, null, null,
                     SocketConnection.MessageTarget.room);
                SocketConnection.Act("You feel dizzy, and a tiny bit embarrassed.", ch, null, null,
                     SocketConnection.MessageTarget.character);
            }

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

            ch.PracticeSkill("whirlwind");

            if (!found && MUDMath.NumberPercent() < 25)
            {
                SocketConnection.Act("$n&n loses $s balance and colapses into a heap.", ch, null, null,
                     SocketConnection.MessageTarget.room);
                SocketConnection.Act("You lose your balance and fall into a heap.", ch, null, null,
                     SocketConnection.MessageTarget.character);
                ch.CurrentPosition = Position.stunned;
            }

            return;
        }
示例#25
0
        /*
        * Modified to up the damage and allow for a
        * chance to stun victim or self
        *   damage = (level) d2, for an average of 75 hp at level 50
        *   stun damage = (level) d3, for an average of 100 hp at level 50
        * Player vs player damage is reduced in damage()
        */
        /// <summary>
        /// Headbutt. Usable to initiate combat and during combat.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Headbutt(CharData ch, string[] str)
        {
            if( ch == null ) return;

            int chance;
            int ko;
            string text;

            /* Check player's level and class, mobs can use this skill */
            if ((!ch.HasSkill("headbutt")))
            {
                ch.SendText("Your skull is much too soft to headbutt anyone.\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("They are nowhere to be seen.\r\n");
                    return;
                }
            }
            else
            {
                if (!victim || victim.CurrentPosition == Position.dead)
                {
                    ch.SendText("You aren't fighting anyone.\r\n");
                    return;
                }
            }

            /* anti headbutt me code */
            if (ch == victim)
            {
                ch.SendText("You get dizzy as you ponder the mechanics of headbutting yourself.\r\n");
                return;
            }

            if (ch.CurrentPosition < Position.fighting)
            {
                ch.SendText("You need to stand up to do that.\r\n");
                return;
            }
            /* Check size of ch vs. victim. */
            /* If ch is too small. */
            /* Made it 2 sizes */
            if (ch.CurrentSize - 2 > victim.CurrentSize)
            {
                SocketConnection.Act("You would crush such a small and delicate being with your mass.", ch, null, victim, SocketConnection.MessageTarget.character);
                return;
            }
            /* Ch 2 or more sizes larger than victim => bad! */
            if (ch.CurrentSize + 1 < victim.CurrentSize)
            {
                SocketConnection.Act("You can't reach their head!", ch, null, victim, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$n&n slams $s head into your thigh.", ch, null, victim, SocketConnection.MessageTarget.victim);
                SocketConnection.Act("$n&n slams $s head into $N's thigh.", ch, null, victim, SocketConnection.MessageTarget.room_vict);

                ch.WaitState((Skill.SkillList["headbutt"].Delay * 9) / 10);
                if (victim.Fighting == null)
                {
                    Combat.SetFighting(victim, ch);
                }
                return;
            }

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

            if (!ch.Fighting)
            {
                Combat.SetFighting(ch, victim);
            }
            if (!victim.Fighting)
            {
                Combat.SetFighting(victim, ch);
            }

            /* Added a PC skill level
            */
            // Chance was over-downgraded at some point.  Was skill level - 5%,
            // then it was changed to skill level / 2 giving a level 50 a headbutt
            // success rate of about 47%.  I've upped it to 4/5 of skill level,
            // meaning that a level 50 has a success rate of 76%, which is a good
            // target success rate.  Keep in mind minotaur will have a success rate of
            // about 83%.
            if (ch.IsNPC())
            {
                chance = 50 + ch.Level;
            }
            else
            {
                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
                {
                    // just your ordinary headbutt damage
                    // This was previously level d 2 which was fairly pathetic.
                    // Level d 6 = 50 min, 300 max at level 50 with an average of 175
                    // PvP damage is quartered, so headbutt will do about 43 against a player.
                    if (ch.GetRace() != Race.RACE_MINOTAUR)
                    {
                        if (!Combat.InflictDamage(ch, victim, MUDMath.Dice(ch.Level, 6), "headbutt", ObjTemplate.WearLocation.none, AttackType.DamageType.bludgeon))
                        {
                            // Someone blasts you in the head it'll definitely stun you for 3/4 of a second.
                            victim.WaitState(3);
                        }
                    }
                    else
                    {
                        if (!Combat.InflictDamage(ch, victim, MUDMath.Dice(ch.Level, 7), "headbutt", ObjTemplate.WearLocation.none, AttackType.DamageType.bludgeon))
                        {
                            // Someone blasts you in the head with horns it'll definitely stun you for a second.
                            // -- Xangis
                            victim.WaitState(4);
                        }
                    }
                }
            }
            else /* Headbutt failed, possible damgage to self, possible KO of self */
            {    /* Don't allow char to kill self, just mort self */
                /* Give them a chance to not take any damage */
                // Checking chance instead of player's level.  Since this should be based on skill
                // this should be about right (average of 24% chance of screwing yourself at level 50
                // instead of 50%, 17% chance for minos).
                if (MUDMath.NumberPercent() < chance)
                {
                    ch.SendText("Your headbutt fails to strike its target.\r\n");
                    SocketConnection.Act("$n&n tries to headbutt $N&n but can't quite connect.", ch, null,
                        victim, SocketConnection.MessageTarget.everyone_but_victim);
                    SocketConnection.Act("$n&n bobs around you in a feeble attempt at a headbutt.", ch,
                        null, victim, SocketConnection.MessageTarget.victim);
                    return;
                }
                SocketConnection.Act("You bang your head against the brick wall of $N&n.", ch, null,
                    victim, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$n&n tries a headbutt but $N&n gets the best of $m.", ch, null,
                    victim, SocketConnection.MessageTarget.everyone_but_victim);
                SocketConnection.Act("$n&n bangs into you in a feeble attempt at a headbutt.", ch,
                    null, victim, SocketConnection.MessageTarget.victim);
                // KO chance of 24% for normals, 17% for minos.
                // You have to fail three checks to get your ass kicked by KO, one for the actual skill check,
                // one for the damage check and finally one for the KO check.
                // keep in mind this KO does damage of about 100 to self at level 50, which is a hell of a lot
                // for a failed skill.
                // The chance of ko'ing yourself at each skill level is as follows: (after all 3 checks)
                // Skill 25 = 59.2%  Skill 50 = 29.6%  Skill 75 = 14.4%  Skill 95 = 9.38%
                ko = 108 - chance;
                int dam;
                if (MUDMath.NumberPercent() < ko)
                {
                    // doh! This is gonna hurt
                    //deal some decent damage...to self!
                    if (ch.GetRace() != Race.RACE_MINOTAUR)
                    {
                        dam = MUDMath.Dice(ch.Level, 3);
                    }
                    else
                    {
                        dam = MUDMath.Dice(ch.Level, 2);
                    }
                    if (dam > ch.Hitpoints)
                    {
                        dam = ch.Hitpoints + 1;
                    }
                    if (Combat.InflictDamage(ch, ch, dam, "headbutt", ObjTemplate.WearLocation.none, AttackType.DamageType.bludgeon))
                    {
                        // ch invalidated, can't send messages.
                        return;
                    }
                    SocketConnection.Act("$n&n staggers about, then collapses in a heap.", ch, null, null, SocketConnection.MessageTarget.room);
                    ch.SendText("You fall to the ground stunned.\r\n");
                    SocketConnection.Act("$n&n is stunned!", ch, null, null, SocketConnection.MessageTarget.room);
                    ch.CurrentPosition = Position.stunned;
                    ch.WaitState((Skill.SkillList["headbutt"].Delay * 2));
                    text = String.Format("Commandheadbutt: {0}&n stunned self.", ch.Name);
                    ImmortalChat.SendImmortalChat(null, ImmortalChat.IMMTALK_SPAM, 0, text);
                }
                else
                {
                    // Was previously level d 2, which averaged 30 damage at 20 and 75 at 50.  PC to PC
                    // damage is not quartered when it is done to yourself, so this it kind of high at the
                    // upper levels.  This has been reduced by level / 5, so the damage at 50 averages 65
                    // instead of 65.
                    // Keep in mind that the real penalties come from KO and comparitively someone that
                    // fails a bash doesen't take insane damage.
                    dam = MUDMath.Dice(ch.Level, 2) - ch.Level / 5;
                    if (dam > ch.Hitpoints)
                    {
                        dam = ch.Hitpoints + 1;
                    }
                    Combat.InflictDamage(ch, ch, dam, "headbutt", ObjTemplate.WearLocation.none, AttackType.DamageType.bludgeon);
                }
            } //end if() headbutt failed
            return;
        }
示例#26
0
 public static void Yell(CharData ch, string[] str)
 {
     if( ch == null ) return;
     SocketConnection.SendToChannel(ch, String.Join(" ", str), TalkChannel.shout, "shout");
     ch.WaitState(12);
     return;
 }
示例#27
0
        /// <summary>
        /// Hide yourself or an object.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Hide(CharData ch, string[] str)
        {
            if( ch == null ) return;
            /* Check player's skill */
            if (!ch.HasSkill("hide"))
            {
                if(str.Length != 0)
                {
                    HideItem(ch, new[] { str[0] });
                    return;
                }
                ch.SendText("You're far too obvious to hide anywhere.\r\n");
                return;
            }

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

            if (ch.CurrentPosition <= Position.sleeping)
            {
                return;
            }
            ch.SendText("You attempt to hide.\r\n");

            if (ch.IsAffected(Affect.AFFECT_HIDE))
            {
                ch.RemoveAffect(Affect.AFFECT_HIDE);
            }

            if (ch.CheckSkill("hide"))
            {
                ch.SetAffectBit(Affect.AFFECT_HIDE);
            }

            ch.WaitState(12);

            return;
        }
示例#28
0
        /// <summary>
        /// Charge into someone. Helps to have horns on your head.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Charge(CharData ch, string[] str)
        {
            if( ch == null ) return;

            CharData victim;

            /* Check player's level and class, mobs can use this skill */
            if (!ch.HasInnate(Race.RACE_CHARGE))
            {
                ch.SendText("You can't do that.\r\n");
                return;
            }

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

            if (str.Length != 0)
            {
                if (!(victim = ch.GetCharRoom(str[0])) || victim.CurrentPosition == Position.dead)
                {
                    ch.SendText("They aren't here.\r\n");
                    return;
                }
            }
            else
            {
                ch.SendText("Charge who?\r\n");
                return;
            }

            /* charge me trap */
            if (ch == victim)
            {
                ch.SendText("You chase your tail for a while.\r\n");
                return;
            }

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

            if (!ch.Fighting)
            {
                Combat.SetFighting(ch, victim);
            }
            if (!victim.Fighting)
            {
                Combat.SetFighting(victim, ch);
            }

            // Chance is based on level of charger and victim.
            int chance = (ch.Level * 2) - victim.Level + 25;
            if (chance > 95)
            {
                chance = 95;
            }

            if (ch.IsNPC() || MUDMath.NumberPercent() < chance)
            {
                Combat.InflictDamage(ch, victim, MUDMath.NumberRange(1, ch.Level), "charge", ObjTemplate.WearLocation.none, AttackType.DamageType.bludgeon);
            }
            else
            {
                Combat.InflictDamage(ch, victim, 0, "charge", ObjTemplate.WearLocation.none, AttackType.DamageType.bludgeon);
            }

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

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

            CharData tmp = null;

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

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

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

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

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

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

                if (ch.InRoom.ExitData[(int)dir].HasFlag(Exit.ExitFlag.closed))
                {
                    CommandType.Interpret(ch, "open " + dir.ToString());
                    return;
                }
                ImmortalChat.SendImmortalChat(null, ImmortalChat.IMMTALK_HUNTING, 0, String.Format("{0}&n leaves room {1} to the {2}.",
                    ch.ShortDescription, ch.InRoom.IndexNumber, dir.ToString()));
                if (ch.IsAffected(Affect.AFFECT_TRACK))
                {
                    SocketConnection.Act(String.Format("You sense $N&n's trail {0} from here...", dir.ToString()),
                        ch, null, ch.Hunting.Who, SocketConnection.MessageTarget.character);
                }
                ch.Move(dir);
                if (ch.IsAffected(Affect.AFFECT_TRACK))
                    SocketConnection.Act("$n&n peers around looking for tracks.", ch, null, null, SocketConnection.MessageTarget.room);

                if (!ch.Hunting)
                {
                    if (!ch.InRoom)
                    {
                        string text = String.Empty;
                        text = String.Format("Hunt_victim: no ch.in_room!  Mob #{0}, _name: {1}.  Placing mob in limbo (ch.AddToRoom()).",
                                  ch.MobileTemplate.IndexNumber, ch.Name);
                        Log.Error(text, 0);
                        ch.AddToRoom(Room.GetRoom(StaticRooms.GetRoomNumber("ROOM_NUMBER_LIMBO")));
                        text = String.Format("{0}&n has gone to limbo while hunting {1}.", ch.ShortDescription, ch.Hunting.Name);
                        ImmortalChat.SendImmortalChat(null, ImmortalChat.IMMTALK_HUNTING, 0, text);
                        return;
                    }
                    CommandType.Interpret(ch, "say Damn!  Lost my prey!");
                    return;
                }
                if (ch.InRoom == ch.Hunting.Who.InRoom)
                {
                    FoundPrey(ch, ch.Hunting.Who);
                }
                return;
            }
            catch (Exception ex)
            {
                Log.Error("Exception in HuntVictim: " + ex.ToString());
            }
        }
示例#30
0
        public static void ScribeScroll(CharData ch, string[] str)
        {
            if( ch == null ) return;

            Object scroll;
            Spell spell;

            if (String.IsNullOrEmpty(str[0]))
            {
                ch.SendText("Scribe what spell?\r\n");
                return;
            }

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

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

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

            SocketConnection.Act("$n begins writing a &+Wscroll&n.", ch, scroll, null, SocketConnection.MessageTarget.room);
            ch.WaitState(Skill.SkillList["Scribe"].Delay);

            ch.PracticeSkill("Scribe");

            if (!ch.IsNPC()
                    && (MUDMath.NumberPercent() > ((PC)ch).SkillAptitude["brew"] ||
                         MUDMath.NumberPercent() > ((ch.GetCurrInt() - 13) * 5 +
                                               (ch.GetCurrWis() - 13) * 3)))
            {
                SocketConnection.Act("$p&n bursts in &n&+rflames&n!", ch, scroll, null, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$p&n bursts in &+Rflames&n!", ch, scroll, null, SocketConnection.MessageTarget.room);
                scroll.RemoveFromWorld();
                Combat.InflictDamage(ch, ch, ch.GetMaxHit(), "Scribe", ObjTemplate.WearLocation.none, AttackType.DamageType.fire);
                return;
            }

            scroll.Level = ch.Level * 2 / 3;
            scroll.Values[0] = ch.Level / 3;
            ch.ImprintSpell(spell, ch.Level, scroll);
            return;
        }