Beispiel #1
0
        static bool SpecWindsabre(System.Object obj, System.Object owner, bool hit)
        {
            CharData keeper = (CharData)owner;

            if (!keeper || !keeper.Fighting || !hit)
            {
                return(false);
            }

            if (MUDMath.NumberPercent() < 10 + keeper.Level / 10 && (keeper.Fighting.Hitpoints >= -9))
            {
                SocketConnection.Act("&+c$n's&n $p&n &+csummons forth a &+Cgust&n&+c of &+Wstrong winds!&N",
                                     keeper, (Object)obj, keeper.Fighting, SocketConnection.MessageTarget.everyone_but_victim);
                SocketConnection.Act("&+cYour&n $p&n &+csummons forth a &+Cgust&n&+c of &+Wstrong winds&N&+c, cutting into &n$N&n&+c!&N ",
                                     keeper, (Object)obj, keeper.Fighting, SocketConnection.MessageTarget.character);
                SocketConnection.Act("&+c$n's&n $p&n &+csummons forth a &+Cgust&n&+c of &+Wstrong winds&N&+c, cutting into you!&N ",
                                     keeper, (Object)obj, keeper.Fighting, SocketConnection.MessageTarget.victim);
                Spell spell = Spell.SpellList["chill touch"];
                if (spell != null)
                {
                    spell.Invoke(keeper, keeper.Level, keeper.Fighting);
                }
                return(true);
            }

            return(false);
        }
Beispiel #2
0
        static bool SpecWpBonethunder(System.Object obj, System.Object owner, bool hit)
        {
            CharData keeper = (CharData)owner;

            if (keeper == null || keeper.Fighting == null || !hit)
            {
                return(false);
            }

            if (MUDMath.NumberPercent() < 10 && (keeper.Fighting.Hitpoints >= -9))
            {
                Spell spell = StringLookup.SpellLookup("bonethunder");
                if (!spell)
                {
                    Log.Error("SpecWpBonethunder: 'bonethunder' spell not found. Check the spells file.");
                    return(false);
                }
                SocketConnection.Act("&+w$n's&n $p&n &+wemits a horrible &+WCRACKING&n &+wnoise and&n $N&n &+wshreaks in agony!&N",
                                     keeper, (Object)obj, keeper.Fighting, SocketConnection.MessageTarget.everyone_but_victim);
                SocketConnection.Act("&+wYour&n $p&n &+wmakes a horrible&n &+WCRACKING&n &+wnoise and&n $N&n &+wshreaks in pain!", keeper,
                                     (Object)obj, keeper.Fighting, SocketConnection.MessageTarget.character);
                SocketConnection.Act("&+w$n's&n $p&n &+wmakes a horrible&n &+WCRACKING&n &+wnoise and you feel your bones breaking!&N", keeper,
                                     (Object)obj, keeper.Fighting, SocketConnection.MessageTarget.victim);
                spell.Invoke(keeper, keeper.Level, keeper.Fighting);
                return(true);
            }

            return(false);
        }
Beispiel #3
0
        static bool SpecHum(System.Object obj, System.Object owner, bool hit)
        {
            CharData keeper = (CharData)owner;

            if (hit)
            {
                return(false);
            }

            if (!keeper || !keeper.InRoom)
            {
                return(false);
            }

            if (MUDMath.NumberPercent() < 9)
            {
                SocketConnection.Act("&+LA faint hum can be heard from&n $p&n &+Lcarried by&n $n&n.",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.room);
                SocketConnection.Act("&+LA faint hum can be heard from&n $p&n &+Lyou are carrying.&n",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.character);
                return(true);
            }

            return(false);
        }
Beispiel #4
0
        static bool SpecCelestial(System.Object obj, System.Object owner, bool hit)
        {
            CharData keeper = (CharData)owner;

            if (!keeper || !keeper.Fighting || !hit)
            {
                return(false);
            }

            if (MUDMath.NumberPercent() < 10 && (keeper.Fighting.Hitpoints >= -9))
            {
                SocketConnection.Act("&+b$n's&n $p&n &+bs&+Bp&+ca&+Wr&n&+Ck&n&+cl&N&+Be&n&+bs with a &+csoft &+Bblue &n&+wg&+Wl&n&+wi&+Wtt&N&+we&+Wr&n&+b...&N",
                                     keeper, (Object)obj, keeper.Fighting, SocketConnection.MessageTarget.everyone_but_victim);
                SocketConnection.Act("&+bYour&n $p&n &+bs&+Bp&N&+ca&+Cr&+Wk&+Cl&+Be&n&+bs at &n$N&n&+b, &+Bglowing&N&+b with a&+c soft &+Bblue &N&+wg&+Wl&n&+wi&+Wtt&n&+we&+Wr&n&+b!&N ",
                                     keeper, (Object)obj, keeper.Fighting, SocketConnection.MessageTarget.character);
                SocketConnection.Act("&+b$n's&n $p&n &+bs&+Bp&N&+ca&+Cr&+Wk&+Cl&+Be&n&+bs at you, &+Bglowing&N&+b with a&+c soft &+Bblue &N&+wg&+Wl&n&+wi&+Wtt&n&+we&+Wr&n&+b!&N ",
                                     keeper, (Object)obj, keeper.Fighting, SocketConnection.MessageTarget.victim);
                Spell spl = Spell.SpellList["magic missile"];
                if (spl != null)
                {
                    spl.Invoke(keeper, keeper.Level, keeper.Fighting);
                }
                return(true);
            }

            return(false);
        }
Beispiel #5
0
        static bool SpecSoulMoan(System.Object obj, System.Object owner, bool hit)
        {
            CharData keeper = (CharData)owner;

            if (hit)
            {
                return(false);
            }

            if (!keeper || !keeper.InRoom)
            {
                return(false);
            }

            if (MUDMath.NumberPercent() < 3)
            {
                SocketConnection.Act("The soul in $p&n carried by $n&n moans in agony.",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.room);
                SocketConnection.Act("The soul in $p&n carried by you moans to be set free!",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.character);
                return(true);
            }

            if (MUDMath.NumberPercent() < 2)
            {
                SocketConnection.Act("The soul in $p&n carried by $n&n tries to free itself!",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.room);
                SocketConnection.Act("The soul in $p&n carried by you starts writhing!",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.character);
                return(true);
            }

            return(false);
        }
Beispiel #6
0
        static bool SpecAutumndecay(System.Object obj, System.Object owner, bool hit)
        {
            CharData keeper = (CharData)owner;

            if (!keeper || !keeper.Fighting || !hit)
            {
                return(false);
            }

            if (MUDMath.NumberPercent() < 10 && (keeper.Fighting.Hitpoints >= -9) &&
                !keeper.Fighting.IsAffected(Affect.AFFECT_WITHER))
            {
                SocketConnection.Act("&+y$n's&n $p&n &+ydives into &n$N&n&+y, and a &+Lblack m&N&+wis&+Lt&n&+y flows into the &+rwound!&N",
                                     keeper, (Object)obj, keeper.Fighting, SocketConnection.MessageTarget.everyone_but_victim);
                SocketConnection.Act("&+yYour&n $p&n &+ydives into &n$N&n&+y, and a &+Lblack m&N&+wis&+Lt&n&+y flows into the &+rwound!&N",
                                     keeper, (Object)obj, keeper.Fighting, SocketConnection.MessageTarget.character);
                SocketConnection.Act("&+y$n's&n $p&n &+ydives into you, and a &+Lblack m&N&+wis&+Lt&n&+y flows into the &+rwound!&N",
                                     keeper, (Object)obj, keeper.Fighting, SocketConnection.MessageTarget.victim);
                Spell spl = Spell.SpellList["wither"];
                if (spl != null)
                {
                    spl.Invoke(keeper, keeper.Level, keeper.Fighting);
                }
                return(true);
            }

            return(false);
        }
Beispiel #7
0
        static bool SpecGiggle(System.Object obj, System.Object owner, bool hit)
        {
            CharData keeper = (CharData)owner;

            if (hit)
            {
                return(false);
            }

            if (!keeper || !keeper.InRoom)
            {
                return(false);
            }

            if (MUDMath.NumberPercent() < 5)
            {
                SocketConnection.Act("$p&n carried by $n&n starts giggling to itself!",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.room);
                SocketConnection.Act("$p&n carried by you starts giggling to itself!",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.character);
                return(true);
            }

            return(false);
        }
Beispiel #8
0
        static bool SpecGhoulbane(System.Object obj, System.Object owner, bool hit)
        {
            CharData keeper = (CharData)owner;

            if (!keeper || !keeper.Fighting || !hit)
            {
                return(false);
            }

            CharData victim = keeper.Fighting;

            if (victim.IsUndead())
            {
                if (MUDMath.NumberPercent() < 10 && (keeper.Fighting.Hitpoints >= -9))
                {
                    SocketConnection.Act("&+w$n's&n $p&n &+Wglows&n &+wwith a powerful light!&N",
                                         keeper, (Object)obj, keeper.Fighting, SocketConnection.MessageTarget.everyone_but_victim);
                    SocketConnection.Act("&+wYour&n $p&n &+Wglows&n &+was it bites into its victim!&n", keeper,
                                         (Object)obj, keeper.Fighting, SocketConnection.MessageTarget.character);
                    SocketConnection.Act("&+w$n's&n $p&n &+Wglows&n &+win an angry light as it burns you horribly!&N", keeper,
                                         (Object)obj, keeper.Fighting, SocketConnection.MessageTarget.victim);
                    Spell.SpellList["destroy undead"].Invoke(keeper, 1, keeper.Fighting);
                    return(true);
                }
            }
            return(false);
        }
Beispiel #9
0
        static bool SpecInferno(System.Object obj, System.Object owner, bool hit)
        {
            CharData keeper = (CharData)owner;

            /* check to make sure the object has an owner and he's in the room */

            if (!keeper || !keeper.InRoom)
            {
                return(false);
            }

            if (MUDMath.NumberPercent() < 10)
            {
                SocketConnection.Act("&+LA faint hum can be heard from&n $p&n &+Lcarried by&n $n&n.",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.room);
                SocketConnection.Act("&+LA faint hum can be heard from&n $p&n &+Lyou are carrying.&n",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.character);
                return(true);
            }

            /* check to see if the weapon is in combat */
            if (!keeper.Fighting || !hit)
            {
                return(false);
            }


            if (keeper.Fighting && keeper.InRoom && MUDMath.NumberPercent() < 10 &&
                keeper.Fighting.Hitpoints >= -9)
            {
                SocketConnection.Act("&+r$n&+r's $p&+r glows brightly and emits a storm of fire!&n",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.room);
                SocketConnection.Act("Your $p&+r glows brightly and emits a storm of fire!&n",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.character);
                int dam = MUDMath.Dice(10, 10) + 150;
                foreach (CharData victim in keeper.InRoom.People)
                {
                    if (victim.IsSameGroup(keeper) ||
                        victim == keeper || victim.Hitpoints < -9)
                    {
                        continue;
                    }
                    if (victim.FlightLevel != keeper.FlightLevel)
                    {
                        continue;
                    }
                    if (Magic.SpellSavingThrow(((Object)obj).Level, victim, AttackType.DamageType.fire))
                    {
                        Combat.InflictSpellDamage(keeper, victim, dam / 2, "inferno", AttackType.DamageType.fire);
                    }
                    else
                    {
                        Combat.InflictSpellDamage(keeper, victim, dam, "inferno", AttackType.DamageType.fire);
                    }
                }
            }

            return(false);
        }
Beispiel #10
0
        static bool SpecSki(System.Object obj, System.Object owner, bool hit)
        {
            CharData keeper = (CharData)owner;

            /* check to make sure the object has an owner and he's in the room */

            if (!keeper || !keeper.InRoom)
            {
                return(false);
            }

            if (MUDMath.NumberPercent() < 20)
            {
                SocketConnection.Act("&+LA faint hum can be heard from&n $p&n &+Lcarried by&n $n&n.",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.room);
                SocketConnection.Act("&+LA faint hum can be heard from&n $p&n &+Lyou are carrying.&n",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.character);
                return(true);
            }

            /* chance of weapon screaming */

            if (MUDMath.NumberPercent() < 20)
            {
                SocketConnection.Act("&+LThe soul in&n $p&n &+Lcarried b&ny $n&n &+Lmoans in&n &+Ragony&n&+L.&n",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.room);
                SocketConnection.Act("&+LThe soul in&n $p&n &+Lcarried by you&n &+Rmoans&n &+Lto be set free!&n",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.character);
                return(true);
            }

            if (MUDMath.NumberPercent() < 20)
            {
                SocketConnection.Act("&+LThe soul in&n $p&n &+Lcarried by&n $n&n &+Ltries to free itself!&n",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.room);
                SocketConnection.Act("&+LThe soul in&n $p&n &+Lcarried by you starts&n &+Bwrithing!&n",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.character);
                return(true);
            }

            /* check to see if the weapon is in combat */

            if (!keeper.Fighting || !hit)
            {
                return(false);
            }

            /* harm proc - note that there has to be a spec_wp_harm above before this
             * will work */

            if (MUDMath.NumberPercent() < 20 && (keeper.Fighting.Hitpoints >= -9))
            {
                Spell.SpellList["harm"].Invoke(keeper, keeper.Level, keeper.Fighting);
                return(true);
            }

            return(false);
        }
Beispiel #11
0
        /// <summary>
        /// Generates a random sentence.
        /// </summary>
        /// <returns></returns>
        public static string RandomSentence()
        {
            string text;

            NounType noun = Table[MUDMath.NumberRange(0, Table.Length - 1)];
            VerbType verb = VerbType.Table[MUDMath.NumberRange(0, VerbType.Table.Length - 1)];

            while (noun.Animate == false)
            {
                noun = Table[MUDMath.NumberRange(0, Table.Length - 1)];
            }

            if (MUDMath.NumberPercent() > 50)
            {
                if (MUDString.IsVowel(noun.Name))
                {
                    text = String.Format("An ");
                }
                else
                {
                    text = String.Format("A ");
                }
            }
            else
            {
                text = String.Format("The ");
            }

            text += noun.Name;
            text += " ";
            text += verb.Name;
            if (verb.DirectObject != VerbType.DirectObjectType.none)
            {
                noun = Table[MUDMath.NumberRange(0, Table.Length - 1)];

                if (MUDString.IsVowel(noun.Name))
                {
                    text += " an ";
                }
                else
                {
                    text += " a ";
                }

                text += noun.Name;
            }

            if (MUDMath.NumberPercent() > 80)
            {
                text += "!";
            }
            else
            {
                text += ".";
            }

            return(text);
        }
Beispiel #12
0
        static bool SpecHornofplenty(System.Object obj, System.Object owner, bool hit)
        {
            CharData keeper = (CharData)owner;

            /* check to make sure the object has an owner and he's in the room */

            if (!keeper || !keeper.InRoom)
            {
                return(false);
            }

            if (MUDMath.NumberPercent() < 2)
            {
                SocketConnection.Act("&+LA faint hum can be heard from&n $p&n &+Lcarried by&n $n&n.",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.room);
                SocketConnection.Act("&+LA faint hum can be heard from&n $p&n &+Lyou are carrying.&n",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.character);
                return(true);
            }

            /* we need to make sure it doesn't check for hunger on an NPC/
             *
             * /* check for the hunger level of the holder */

            if (((PC)keeper).Hunger < 1 || ((PC)keeper).Thirst < 1)
            {
                SocketConnection.Act("$n's $p&n &+mglows&n&+y softly.&n",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.room);
                SocketConnection.Act("&+yYour&n $p&n &+mglows&n&+y softly.&n",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.character);

                foreach (CharData victim in keeper.InRoom.People)
                {
                    if (victim.IsNPC())
                    {
                        continue;
                    }

                    if (((PC)victim).Hunger < 30)
                    {
                        ((PC)victim).Hunger = 30;
                        victim.SendText("You feel full.\r\n");
                    }

                    if (((PC)victim).Thirst < 30)
                    {
                        ((PC)victim).Thirst = 30;
                        victim.SendText("You do not feel thirsty.\r\n");
                    }
                }
                return(true);
            }

            return(false);
        }
Beispiel #13
0
        static bool SpecWpCuttingBreeze(System.Object obj, System.Object owner, bool hit)
        {
            CharData keeper = (CharData)owner;

            if (!keeper || !keeper.Fighting || !hit)
            {
                return(false);
            }

            if (MUDMath.NumberPercent() < 10 && (keeper.Fighting.Hitpoints >= -9))
            {
                Spell.SpellList["cutting breeze"].Invoke(keeper, keeper.Level, keeper.Fighting);
                return(true);
            }

            return(false);
        }
Beispiel #14
0
 /// <summary>
 /// Checks whether a spell cast by the player is swallowed by one of the starshell types.
 /// </summary>
 /// <param name="ch">The caster</param>
 /// <returns>true if the spell was eaten.</returns>
 public bool CheckStarshell(CharData ch)
 {
     if (!ch.IsClass(CharClass.Names.bard))
     {
         if (ch.InRoom.HasFlag(ROOM_EARTHEN_STARSHELL))
         {
             ch.SendText("You start casting...\r\n");
             ch.SendText("&+lThe &+yearth&n &+lcomes up &+yand engulfs &+lyour spell.\r\n");
             Combat.InflictSpellDamage(ch, ch, 1, "earthen starshell", AttackType.DamageType.fire);
             ch.WaitState(6);
             return(true);
         }
         if (ch.InRoom.HasFlag(ROOM_AIRY_STARSHELL))
         {
             ch.SendText("You start casting...\r\n");
             ch.SendText("&+CAir swir&n&+cls a&+Cnd absorbs y&n&+cour spell.&n\r\n");
             ch.WaitState(6);
             if (ch.CurrentPosition > Position.reclining && MUDMath.NumberPercent() + 50 > ch.GetCurrAgi())
             {
                 ch.CurrentPosition = Position.reclining;
                 ch.WaitState(6);
                 ch.SendText("You are knocked over!\r\n");
             }
             return(true);
         }
         if (ch.InRoom.HasFlag(ROOM_WATERY_STARSHELL))
         {
             ch.SendText("You start casting...\r\n");
             ch.SendText("&+bWater b&+Bursts up a&n&+bnd absor&+Bbs your spell.&n\r\n");
             ch.WaitState(6);
             ch.CurrentMoves -= 20;
             ch.SendText("You feel tired!\r\n");
             return(true);
         }
         if (ch.InRoom.HasFlag(ROOM_FIERY_STARSHELL))
         {
             ch.SendText("You start casting...\r\n");
             ch.SendText("&+RFire&n&+r engu&+Rlfs y&n&+rour s&+Rpell.&n\r\n");
             Combat.InflictSpellDamage(ch, ch, 1, "fiery starshell", AttackType.DamageType.fire);
             ch.WaitState(6);
             return(true);
         }
     }
     return(false);
 }
Beispiel #15
0
        static bool SpecWpDestroyUndead(System.Object obj, System.Object owner, bool hit)
        {
            CharData keeper = (CharData)owner;

            if (!keeper || !keeper.Fighting || !hit)
            {
                return(false);
            }

            if (keeper.Fighting.IsUndead())
            {
                if (MUDMath.NumberPercent() < 10 && (keeper.Fighting.Hitpoints >= -9))
                {
                    Spell.SpellList["destroy undead"].Invoke(keeper, 1, keeper.Fighting);
                    return(true);
                }
            }
            return(false);
        }
Beispiel #16
0
        static bool SpecWpMagicMissile(System.Object obj, System.Object owner, bool hit)
        {
            CharData keeper = (CharData)owner;

            if (!keeper || !keeper.Fighting || !hit)
            {
                return(false);
            }

            if (MUDMath.NumberPercent() < 10 && (keeper.Fighting.Hitpoints >= -9))
            {
                Spell spl = Spell.SpellList["magic missile"];
                if (spl != null)
                {
                    spl.Invoke(keeper, keeper.Level, keeper.Fighting);
                }
                return(true);
            }

            return(false);
        }
Beispiel #17
0
        static bool SpecTrident(System.Object obj, System.Object owner, bool hit)
        {
            CharData keeper = (CharData)owner;

            if (!keeper || !keeper.Fighting || !hit)
            {
                return(false);
            }

            // Hum
            if (MUDMath.NumberPercent() < 10)
            {
                SocketConnection.Act("&+LA faint hum can be heard from&n $p&n &+Lcarried by&n $n&n.",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.room);
                SocketConnection.Act("&+LA faint hum can be heard from&n $p&n &+Lyou are carrying.&n",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.character);
                return(true);
            }

            // Weapon proc
            if (keeper.Fighting && MUDMath.NumberPercent() < 15)
            {
                Spell spell = StringLookup.SpellLookup("lightanddark");
                if (!spell)
                {
                    Log.Error("SpecTrident: 'lightanddark' spell not found. Check the spells file.");
                    return(false);
                }
                SocketConnection.Act("&n$n&+c's &n&+Ctr&n&+cident &n&+bglows &+Bblue&n&+c as &n&+Csur&n&+crea&n&+Cl &n&+Bwat&n&+bers " +
                                     "&n&+Bbeg&n&+bin &n&+cto &n&+Cg&n&+cath&n&+Cer &n&+bat i&n&+Bt&n&+bs &n&+Cti&n&+cp.&n",
                                     keeper, (Object)obj, keeper.Fighting, SocketConnection.MessageTarget.room);
                spell.Invoke(keeper, keeper.Level, keeper.Fighting);
                return(true);
            }

            return(false);
        }
Beispiel #18
0
        static bool SpecLightanddark(System.Object obj, System.Object owner, bool hit)
        {
            CharData keeper = (CharData)owner;

            if (!keeper || !keeper.Fighting || !hit)
            {
                return(false);
            }

            //Hum
            if (MUDMath.NumberPercent() < 10)
            {
                SocketConnection.Act("&+LA faint hum can be heard from&n $p&n &+Lcarried by&n $n&n.",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.room);
                SocketConnection.Act("&+LA faint hum can be heard from&n $p&n &+Lyou are carrying.&n",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.character);
                return(true);
            }

            // Weapon proc
            if (keeper.Fighting && MUDMath.NumberPercent() < 15)
            {
                Spell spell = StringLookup.SpellLookup("lightanddark");
                if (!spell)
                {
                    Log.Error("SpecLightanddark: 'lightanddark' spell not found. Check the spells file.");
                    return(false);
                }
                SocketConnection.Act("&n$n&+L's sword fulgurates fiercely as a &+Csearing &+clight &+Lcollects at the blade's end. ",
                                     keeper, (Object)obj, keeper.Fighting, SocketConnection.MessageTarget.room);
                spell.Invoke(keeper, keeper.Level, keeper.Fighting);
                return(true);
            }

            return(false);
        }
Beispiel #19
0
        static bool SpecHammer(System.Object obj, System.Object owner, bool hit)
        {
            CharData keeper = (CharData)owner;
            bool     retval = false;

            if (!keeper)
            {
                return(false);
            }

            //Hum
            if ((!keeper.Fighting && MUDMath.NumberPercent() < 10) ||
                (keeper.Fighting && MUDMath.NumberPercent() < 2))
            {
                SocketConnection.Act("&+LA faint hum can be heard from&n $p&n &+Lcarried by&n $n&n.",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.room);
                SocketConnection.Act("&+LA faint hum can be heard from&n $p&n &+Lyou are carrying.&n",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.character);
                if (!keeper.IsAffected(Affect.AFFECT_STONESKIN) && MUDMath.NumberPercent() < 30)
                {
                    Spell spl = Spell.SpellList["stoneskin"];
                    if (spl != null)
                    {
                        spl.Invoke(keeper, 60, keeper);
                    }
                }
                retval = true;
            }

            if (!keeper.Fighting)
            {
                return(retval);
            }

            // it fires off 1 in 12 times
            if (MUDMath.NumberPercent() > 8)
            {
                return(false);
            }

            // if not wielded as primary, do nothing
            if (Object.GetEquipmentOnCharacter(keeper, ObjTemplate.WearLocation.hand_one) != obj)
            {
                return(false);
            }

            // grumbar's hammer needs to be grounded to work
            if (keeper.FlightLevel != 0)
            {
                return(false);
            }

            // need to have some earthly elements around
            //    if ( keeper.in_room.sector == RoomIndex.TerrainType.plane_of_air ||
            //         keeper.in_room.sector == RoomIndex.TerrainType.plane_of_water ||
            //         keeper.in_room.sector == RoomIndex.TerrainType.plane_of_fire )
            //        return false;

            CharData vict = keeper.Fighting;

            switch (MUDMath.NumberRange(1, 3))
            {
            case 1:
                //throw a wall
                int dir = MUDMath.NumberRange(0, Limits.MAX_DIRECTION - 1);
                if (keeper.InRoom.ExitData[dir])
                {
                    Spell spl = Spell.SpellList["wall of stone"];
                    if (spl != null)
                    {
                        spl.Invoke(keeper, 50, dir.ToString());
                    }
                }
                retval = true;
                break;

            case 2:
                // earthen rain
                if (!keeper.IsOutside())
                {
                    retval = false;
                    break;
                }
                SocketConnection.Act("Your $p crushes $N in a rain of &+yearth&N and &+Lstone&N!", keeper,
                                     (Object)obj, vict, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$n's $p crushes you under a rain of &+yearth&N and &+Lstone&N!", keeper,
                                     (Object)obj, vict, SocketConnection.MessageTarget.victim);
                SocketConnection.Act("$n's $p crushes $N under a rain of &+yearth&N and &+Lstone&N!.", keeper,
                                     (Object)obj, vict, SocketConnection.MessageTarget.everyone_but_victim);
                // same damage as earthen rain at level 50
                int dam = MUDMath.Dice(150, 3) + 100;
                Combat.InflictSpellDamage(keeper, vict, dam, "earthen rain", AttackType.DamageType.crushing);
                retval = true;
                break;

            case 3:
                // cause an earthquake
                SocketConnection.Act("Your $p causes the ground to rise up!",
                                     keeper, (Object)obj, vict, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$n's $p blasts the ground with a &+yshockwave&N!",
                                     keeper, (Object)obj, null, SocketConnection.MessageTarget.room);
                foreach (CharData targetChar in keeper.InRoom.People)
                {
                    if ((targetChar == keeper) || targetChar.IsImmortal())
                    {
                        continue;
                    }
                    if (keeper.IsSameGroup(targetChar))
                    {
                        continue;
                    }
                    if (targetChar.IsAffected(Affect.AFFECT_FLYING))
                    {
                        continue;
                    }
                    if (keeper.IsNPC() && targetChar.IsNPC() && !vict.IsSameGroup(targetChar))
                    {
                        continue;
                    }
                    if (Magic.SpellSavingThrow(60, targetChar, AttackType.DamageType.earth))
                    {
                        SocketConnection.Act("You wobble precipitously, but keep your feet.",
                                             keeper, null, targetChar, SocketConnection.MessageTarget.victim);
                        SocketConnection.Act("$n&n stumbles slightly but keeps $s balance.", targetChar, null, null, SocketConnection.MessageTarget.room);
                    }
                    else
                    {
                        SocketConnection.Act("You are knocked to the ground!",
                                             keeper, null, targetChar, SocketConnection.MessageTarget.victim);
                        SocketConnection.Act("$n&n is knocked to the ground!", targetChar, null, null, SocketConnection.MessageTarget.room);
                        targetChar.CurrentPosition = Position.kneeling;
                        targetChar.WaitState(Event.TICK_COMBAT);
                    }
                }     // end for
                retval = true;
                break;

            default:
                break;
            } //end switch
            return(retval);
        }
Beispiel #20
0
        /// <summary>
        /// Tracking mob has found the person its after. Attack or react accordingly.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="victim"></param>
        public static void FoundPrey(CharData ch, CharData victim)
        {
            string victname = String.Empty;
            string text     = String.Empty;
            string lbuf     = String.Empty;

            if (!victim)
            {
                Log.Error("FoundPrey: null victim", 0);
                return;
            }

            if (!victim.InRoom)
            {
                Log.Error("FoundPrey: null victim._inRoom", 0);
                return;
            }
            ImmortalChat.SendImmortalChat(null, ImmortalChat.IMMTALK_HUNTING, 0, string.Format("{0}&n has found {1}.", ch.ShortDescription, victim.Name));

            if (ch.IsAffected(Affect.AFFECT_TRACK))
            {
                ch.RemoveAffect(Affect.AFFECT_TRACK);
                Combat.StopHunting(ch);
                return;
            }
            if (ch.IsAffected(Affect.AFFECT_JUSTICE_TRACKER))
            {
                /* Give Justice the ability to ground flying culprits */
                if (victim.FlightLevel != 0)
                {
                    SocketConnection.Act("$n&n forces you to land!", ch, null, victim, SocketConnection.MessageTarget.victim);
                    SocketConnection.Act("$n&n forces $N&n to land!", ch, null, victim, SocketConnection.MessageTarget.room_vict);
                    victim.FlightLevel = 0;
                }

                SocketConnection.Act("$n&n says, 'Stop, $N&n, you're under ARREST!'", ch, null, victim, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$n&n says, 'Stop, $N&n, you're under ARREST!'", ch, null, victim, SocketConnection.MessageTarget.room);
                SocketConnection.Act("$n&n chains you up.", ch, null, victim, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$n&n binds $N&n so $E can't move.", ch, null, victim, SocketConnection.MessageTarget.room);
                victim.SetAffectBit(Affect.AFFECT_BOUND);
                victim.RemoveFromRoom();

                if (ch.InRoom.Area.JailRoom != 0)
                {
                    victim.AddToRoom(Room.GetRoom(victim.InRoom.Area.JailRoom));
                }
                else
                {
                    victim.SendText("Justice is broken in this town - there is no jail and you're screwed.\r\n");
                }
                Combat.StopHunting(ch);
                return;
            }

            victname = victim.IsNPC() ? victim.ShortDescription : victim.Name;

            if (ch.FlightLevel != victim.FlightLevel)
            {
                if (ch.CanFly())
                {
                    if (ch.FlightLevel < victim.FlightLevel && ch.FlightLevel < CharData.FlyLevel.high)
                    {
                        Command.Fly(ch, new string[] { "up" });
                    }
                    else
                    {
                        Command.Fly(ch, new string[] { "down" });
                    }
                }
                else
                {
                    SocketConnection.Act("$n peers around looking for something.", ch, null, null, SocketConnection.MessageTarget.room);
                }
                return;
            }
            if (!CharData.CanSee(ch, victim))
            {
                if (MUDMath.NumberPercent() < 90)
                {
                    return;
                }
                switch (MUDMath.NumberBits(5))
                {
                case 0:
                    text = String.Format("You can't hide forever, {0}!", victname);
                    Command.Say(ch, new string[] { text });
                    break;

                case 1:
                    SocketConnection.Act("$n&n sniffs around the room.", ch, null, victim, SocketConnection.MessageTarget.room);
                    text = "I can smell your blood!";
                    Command.Say(ch, new string[] { text });
                    break;

                case 2:
                    text = String.Format("I'm going to tear {0} apart!", victname);
                    Command.Yell(ch, new string[] { text });
                    break;

                case 3:
                    Command.Say(ch, new string[] { "Just wait until I find you..." });
                    break;

                default:
                    SocketConnection.Act("$p peers about looking for something.", ch, null, null, SocketConnection.MessageTarget.room);
                    break;
                }
                return;
            }

            if (ch.InRoom.HasFlag(RoomTemplate.ROOM_SAFE) && ch.IsNPC())
            {
                text = String.Format("Hunting mob {0} found a safe room {1}.", ch.MobileTemplate.IndexNumber, ch.InRoom.IndexNumber);
                Log.Trace(text);
                return;
            }

            if (ch.CurrentPosition > Position.kneeling)
            {
                switch (MUDMath.NumberBits(5))
                {
                case 0:
                    text = String.Format("I will eat your heart, {0}!", victname);
                    Command.Say(ch, new string[] { text });
                    break;

                case 1:
                    text = String.Format("You want a piece of me, {0}?", victname);
                    Command.Say(ch, new string[] { text });
                    break;

                case 2:
                    text = String.Format("How does your flesh taste {0}, like chicken?", victname);
                    Command.Say(ch, new string[] { text });
                    break;

                case 3:
                    SocketConnection.Act("$n&n howls gleefully and lunges at $N&n!", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
                    SocketConnection.Act("$n&n howls gleefully and lunges at you!", ch, null, victim, SocketConnection.MessageTarget.victim);
                    break;

                case 4:
                    SocketConnection.Act("$n&n charges headlong into $N&n!", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
                    SocketConnection.Act("$n&n charges headlong into you!", ch, null, victim, SocketConnection.MessageTarget.victim);
                    break;

                default:
                    break;
                }
                Combat.StopHunting(ch);
                Combat.CheckAggressive(victim, ch);
                if (ch.Fighting)
                {
                    return;
                }

                // Backstab if able, otherwise just kill them.
                // Kill if they don't have the skill or if they don't have a stabber.
                if (!ch.HasSkill("backstab"))
                {
                    Combat.CombatRound(ch, victim, String.Empty);
                }
                else if (!Combat.Backstab(ch, victim))
                {
                    Combat.CombatRound(ch, victim, String.Empty);
                }
            }
            return;
        }
Beispiel #21
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());
            }
        }
Beispiel #22
0
        /// <summary>
        /// Show a character to another character.
        /// </summary>
        /// <param name="victim"></param>
        /// <param name="ch"></param>
        public static void ShowCharacterToCharacterFull(CharData victim, CharData ch)
        {
            Object obj;
            string text = String.Empty;
            int    percent;

            if (CharData.CanSee(victim, ch))
            {
                SocketConnection.Act("$n&n looks at you.", ch, null, victim, SocketConnection.MessageTarget.victim);
                if (victim != ch)
                {
                    SocketConnection.Act("$n&n looks at $N&n.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
                }
                else
                {
                    SocketConnection.Act("$n&n looks at $mself.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
                }
            }

            if (victim.Riding != null)
            {
                text += String.Format("&nMounted on {0}, ", victim.Riding.ShowNameTo(ch, false));
            }
            else if (victim.Rider != null)
            {
                text += String.Format("&nRidden by {0}, ", victim.Rider.ShowNameTo(ch, false));
            }

            if (!victim.IsNPC() && victim.IsGuild())
            {
                text += String.Format("&n{0} of {1}.\r\n", ((PC)victim).GuildRank.ToString().ToUpper(),
                                      ((PC)victim).GuildMembership.Name);
            }

            SocketConnection.Act(text, ch, null, victim, SocketConnection.MessageTarget.character);

            if (!String.IsNullOrEmpty(victim.Description))
            {
                ch.SendText(victim.Description);
            }
            else
            {
                SocketConnection.Act("&nYou see nothing special about $M.", ch, null, victim, SocketConnection.MessageTarget.character);
            }

            if (victim.GetMaxHit() > 0)
            {
                percent = (100 * victim.Hitpoints) / victim.GetMaxHit();
            }
            else
            {
                percent = -1;
            }

            text = victim.ShowNameTo(ch, true);

            if (percent >= 100)
            {
                text += " &nis in perfect &n&+ghealth&n.  ";
            }
            else if (percent >= 90)
            {
                text += " &nis slightly &n&+yscratched&n.  ";
            }
            else if (percent >= 80)
            {
                text += " &nhas a &+yfew bruises&n.  ";
            }
            else if (percent >= 70)
            {
                text += " &nhas &+Ysome cuts&n.  ";
            }
            else if (percent >= 60)
            {
                text += " &nhas &+Mseveral wounds&n.  ";
            }
            else if (percent >= 50)
            {
                text += " &nhas &+mmany nasty wounds&n.  ";
            }
            else if (percent >= 40)
            {
                text += " &nis &+Rbleeding freely&n.  ";
            }
            else if (percent >= 30)
            {
                text += " &nis &+Rcovered in blood&n.  ";
            }
            else if (percent >= 20)
            {
                text += " &nis &+rleaking guts&n.  ";
            }
            else if (percent >= 10)
            {
                text += " &nis &+ralmost dead&n.  ";
            }
            else
            {
                text += " &nis &+rDYING&n.  ";
            }

            ch.SendText(text);

            // Show size on look at someone.
            text = MUDString.CapitalizeANSIString(String.Format("{0}&n is a {1} of {2} size.\r\n", victim.GetSexPronoun(),
                                                                Race.RaceList[victim.GetRace()].ColorName, Race.SizeString(victim.CurrentSize)));
            ch.SendText(text);

            ShowAffectLines(ch, victim);

            bool found = false;

            foreach (ObjTemplate.WearLocation location in ObjTemplate.TopDownEquipment)
            {
                obj = Object.GetEquipmentOnCharacter(victim, location);
                if (obj && CharData.CanSeeObj(ch, obj))
                {
                    if (!found)
                    {
                        ch.SendText("\r\n");
                        SocketConnection.Act("&n$E is using:", ch, null, victim, SocketConnection.MessageTarget.character);
                        found = true;
                    }
                    if (obj.ItemType == ObjTemplate.ObjectType.weapon &&
                        (location == ObjTemplate.WearLocation.hand_one ||
                         location == ObjTemplate.WearLocation.hand_three ||
                         location == ObjTemplate.WearLocation.hand_four ||
                         location == ObjTemplate.WearLocation.hand_two) &&
                        obj.HasWearFlag(ObjTemplate.WEARABLE_WIELD))
                    {
                        if (obj.HasFlag(ObjTemplate.ITEM_TWOHANDED) &&
                            !ch.HasInnate(Race.RACE_EXTRA_STRONG_WIELD))
                        {
                            ch.SendText("&+y(wielding twohanded)  &n");
                        }
                        else
                        {
                            ch.SendText("&+y(wielding)            &n");
                        }
                    }
                    else
                    {
                        if (obj.ItemType == ObjTemplate.ObjectType.shield &&
                            (location == ObjTemplate.WearLocation.hand_one ||
                             location == ObjTemplate.WearLocation.hand_three ||
                             location == ObjTemplate.WearLocation.hand_four ||
                             location == ObjTemplate.WearLocation.hand_two) &&
                            obj.HasWearFlag(ObjTemplate.WEARABLE_SHIELD))
                        {
                            ch.SendText("&+y(worn as shield)      &n");
                        }
                        else
                        {
                            ch.SendText(StringConversion.EquipmentLocationDisplay[(int)location]);
                        }
                    }
                    ch.SendText(FormatObjectToCharacter(obj, ch, true));
                    ch.SendText("\r\n");
                }
            }

            // Keep in mind that players can spam looking at someone in order
            // to increase their skill in peek - this will need to be fixed.
            if ((victim != ch && !ch.IsNPC() &&
                 ((((PC)ch).SkillAptitude.ContainsKey("peek") && MUDMath.NumberPercent() < ((PC)ch).SkillAptitude["peek"]) ||
                  ch.Level >= Limits.LEVEL_AVATAR)) || ch.Riding == victim || ch.Rider == victim)
            {
                ch.SendText("\r\n&nYou peek at the inventory:\r\n");
                ch.PracticeSkill("peek");
                ShowListToCharacter(victim.Carrying, ch, true, true);
            }

            return;
        }