Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Finds an exit based on a keyword.  Use FindDoor if you are looking for a door.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="arg"></param>
        /// <returns></returns>
        public static Exit.Direction FindExit(CharData ch, string arg)
        {
            Exit exit;

            Exit.Direction door = Exit.DoorLookup(arg);
            if (door == Exit.Direction.invalid)
            {
                for (int doornum = 0; doornum < Limits.MAX_DIRECTION; doornum++)
                {
                    if ((exit = ch.InRoom.ExitData[doornum]) && exit.HasFlag(Exit.ExitFlag.is_door) &&
                        !(ch.Level < Limits.LEVEL_AVATAR && exit.ExitFlags != 0 &&
                          (exit.HasFlag(Exit.ExitFlag.secret) || exit.HasFlag(Exit.ExitFlag.blocked))) &&
                        exit.Keyword.Length != 0 && ("door".Equals(arg, StringComparison.CurrentCultureIgnoreCase) ||
                                                     MUDString.NameContainedIn(arg, exit.Keyword)))
                    {
                        return((Exit.Direction)doornum);
                    }
                }
                SocketConnection.Act("I see no $T here.", ch, null, arg, SocketConnection.MessageTarget.character);
                return(Exit.Direction.invalid);
            }

            if (!(exit = ch.InRoom.ExitData[(int)door]))
            {
                SocketConnection.Act("I see no door $T here.", ch, null, arg, SocketConnection.MessageTarget.character);
                return(Exit.Direction.invalid);
            }

            return(door);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Song of weakness.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongWeakling(CharData ch, Spell spell, int level, Target target)
        {
            Affect af = new Affect();

            foreach (CharData victim in ch.InRoom.People)
            {
                if (victim.IsAffected(Affect.AFFECT_STRENGTH_REDUCED) ||
                    Magic.SpellSavingThrow(level, victim, AttackType.DamageType.black_magic))
                {
                    continue;
                }

                af.Type     = Affect.AffectType.song;
                af.Value    = spell.Name;
                af.Duration = level / 7;
                af.AddModifier(Affect.Apply.strength, -(level / 2));
                af.SetBitvector(Affect.AFFECT_STRENGTH_REDUCED);

                if (level > 25)
                {
                    af.AddModifier(Affect.Apply.damroll, 0 - (level / 7));
                }

                victim.AddAffect(af);

                SocketConnection.Act("$n&n looks weaker.", victim, null, null, SocketConnection.MessageTarget.room);
                victim.SendText("You feel weaker.\r\n");
            }
            return(true);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Song of nightmares.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongNightmares(CharData ch, Spell spell, int level, Target target)
        {
            Affect af = new Affect();

            foreach (CharData victim in ch.InRoom.People)
            {
                if (victim.IsAffected(Affect.AFFECT_FEAR) || Magic.SpellSavingThrow(level, victim,
                                                                                    AttackType.DamageType.black_magic))
                {
                    ch.SendText("You have failed.\r\n");
                    ch.SendText("You resist the urge to panic.\r\n");
                    continue;
                }

                af.Type     = Affect.AffectType.song;
                af.Value    = spell.Name;
                af.Duration = 1 + (level / 7);
                af.SetBitvector(Affect.AFFECT_FEAR);
                victim.AddAffect(af);

                SocketConnection.Act("$N&n is scared!", ch, null, victim, SocketConnection.MessageTarget.character);
                victim.SendText("You are scared!\r\n");
                SocketConnection.Act("$N&n is scared!", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);

                CommandType.Interpret(victim, "flee");
                if (victim.IsNPC())
                {
                    Combat.StartFearing(victim, ch);
                }
            }
            return(true);
        }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Song of idiocy.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongIdiocy(CharData ch, Spell spell, int level, Target target)
        {
            Affect af = new Affect();

            foreach (CharData victim in ch.InRoom.People)
            {
                if (victim.IsAffected(Affect.AFFECT_FEEBLEMIND) ||
                    Magic.SpellSavingThrow(level, victim, AttackType.DamageType.black_magic))
                {
                    ch.SendText("You failed!\r\n");
                    continue;
                }

                af.Type     = Affect.AffectType.song;
                af.Value    = spell.Name;
                af.Duration = level / 9;
                af.AddModifier(Affect.Apply.intelligence, 0 - (level + 15));
                af.SetBitvector(Affect.AFFECT_FEEBLEMIND);
                victim.AddAffect(af);

                SocketConnection.Act("A dumb look crosses $n&n's face and $e starts to drool.", victim, null, null, SocketConnection.MessageTarget.room);
                victim.SendText("You feel _REALLY_ dumb.\r\n");
            }
            return(true);
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
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);
        }
Exemplo n.º 12
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);
        }
Exemplo n.º 13
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);
        }
Exemplo n.º 14
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);
        }
Exemplo n.º 15
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);
        }
Exemplo n.º 16
0
 /// <summary>
 /// Song of revelation.
 /// </summary>
 /// <param name="ch"></param>
 /// <param name="spell"></param>
 /// <param name="level"></param>
 /// <param name="target"></param>
 /// <returns></returns>
 public static bool SongRevelation(CharData ch, Spell spell, int level, Target target)
 {
     foreach (CharData victim in ch.InRoom.People)
     {
         victim.AffectStrip(Affect.AffectType.skill, "shadow form");
         victim.RemoveAffect(Affect.AFFECT_HIDE);
         victim.RemoveAffect(Affect.AFFECT_INVISIBLE);
         SocketConnection.Act("$n&n is revealed!", victim, null, null, SocketConnection.MessageTarget.room);
         victim.SendText("You are revealed!\r\n");
     }
     return(true);
 }
Exemplo n.º 17
0
        /// <summary>
        /// Song of heroism.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongHeroism(CharData ch, Spell spell, int level, Target target)
        {
            foreach (CharData victim in ch.InRoom.People)
            {
                Affect af = new Affect(Affect.AffectType.song, spell.Name, (level / 8), Affect.Apply.hitroll, (level / 6 + 1), Affect.AFFECT_NONE);
                victim.AddAffect(af);
                af = new Affect(Affect.AffectType.song, spell.Name, (level / 8), Affect.Apply.damroll, (level / 11 + 1), Affect.AFFECT_NONE);
                victim.AddAffect(af);

                SocketConnection.Act("$n&n looks more courageous.", victim, null, null, SocketConnection.MessageTarget.room);
                victim.SendText("You feel righteous.\r\n");
            }
            return(true);
        }
Exemplo n.º 18
0
 /// <summary>
 /// Find a door based on its name.
 /// </summary>
 /// <param name="ch"></param>
 /// <param name="argument"></param>
 /// <returns></returns>
 public static Room FindRoom(CharData ch, string argument)
 {
     Exit.Direction dir = FindExit(ch, argument);
     if (dir == Exit.Direction.invalid)
     {
         SocketConnection.Act("I see no door $T here.", ch, null, argument, SocketConnection.MessageTarget.character);
         return(null);
     }
     if (ch.InRoom.ExitData[(int)dir])
     {
         Room room = Room.GetRoom(ch.InRoom.ExitData[(int)dir].IndexNumber);
         return(room);
     }
     return(null);
 }
Exemplo n.º 19
0
        /// <summary>
        /// Song of cowardice.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongCowardice(CharData ch, Spell spell, int level, Target target)
        {
            foreach (CharData victim in ch.InRoom.People)
            {
                if (!victim.IsSameGroup(ch))
                {
                    Affect af = new Affect(Affect.AffectType.song, spell.Name, (level / 6 + 1), Affect.Apply.hitroll, (0 - (level / 3)), Affect.AFFECT_COWARDLY);
                    victim.AddAffect(af);

                    SocketConnection.Act("$n&n looks unsure of $mself.", victim, null, null, SocketConnection.MessageTarget.room);
                    victim.SendText("You feel less confident about your battle skills.\r\n");
                }
            }
            return(true);
        }
Exemplo n.º 20
0
        /// <summary>
        /// Song of flight.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongFlight(CharData ch, Spell spell, int level, Target target)
        {
            foreach (CharData victim in ch.InRoom.People)
            {
                if (victim.IsAffected(Affect.AFFECT_FLYING))
                {
                    return(true);
                }

                Affect af = new Affect(Affect.AffectType.song, spell.Name, (level / 6), Affect.Apply.none, 0, Affect.AFFECT_FLYING);
                victim.AddAffect(af);

                victim.SendText("&+WYour feet rise off the ground.&n\r\n");
                SocketConnection.Act("$n&n rises off the ground.", victim, null, null, SocketConnection.MessageTarget.room);
            }
            return(true);
        }
Exemplo n.º 21
0
        /// <summary>
        /// Song of invisibility.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongInvisibility(CharData ch, Spell spell, int level, Target target)
        {
            int total = 0;

            int max = level / 8;

            foreach (CharData victim in ch.InRoom.People)
            {
                if (!victim.IsSameGroup(ch) || victim.IsAffected(Affect.AFFECT_INVISIBLE))
                {
                    continue;
                }

                if (total >= max)
                {
                    return(true);
                }

                victim.SendText("You slowly fade out of existence.\r\n");
                SocketConnection.Act("$n&n slowly fades out of existence.", victim, null, null, SocketConnection.MessageTarget.room);

                Affect af = new Affect(Affect.AffectType.song, spell.Name, (level / 6), Affect.Apply.none, 0, Affect.AFFECT_INVISIBLE);
                victim.AddAffect(af);
                total++;
            }
            foreach (Object obj in ch.InRoom.Contents)
            {
                if (obj.HasFlag(ObjTemplate.ITEM_INVIS))
                {
                    continue;
                }

                if (total >= max)
                {
                    return(true);
                }

                SocketConnection.Act("&+L$p&+L fades away.", ch, obj, null, SocketConnection.MessageTarget.room);
                SocketConnection.Act("&+L$p&+L fades away.", ch, obj, null, SocketConnection.MessageTarget.character);
                obj.AddFlag(ObjTemplate.ITEM_INVIS);
                total++;
            }
            return(true);
        }
Exemplo n.º 22
0
        /// <summary>
        /// Song of obscrurement.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongObscurement(CharData ch, Spell spell, int level, Target target)
        {
            Affect af = new Affect();

            foreach (CharData victim in ch.InRoom.People)
            {
                if (victim.IsAffected(Affect.AFFECT_MINOR_INVIS) || victim.IsAffected(Affect.AFFECT_INVISIBLE))
                {
                    return(true);
                }

                SocketConnection.Act("$n&n fades out of existence.", ch, null, null, SocketConnection.MessageTarget.room);
                ch.SendText("You vanish.\r\n");

                af.Type     = Affect.AffectType.song;
                af.Value    = spell.Name;
                af.Duration = level / 6;
                af.SetBitvector(Affect.AFFECT_MINOR_INVIS);
                victim.AddAffect(af);
            }
            return(true);
        }
Exemplo n.º 23
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);
        }
Exemplo n.º 24
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);
        }
Exemplo n.º 25
0
        /// <summary>
        /// Song of slowness.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongSlowness(CharData ch, Spell spell, int level, Target target)
        {
            Affect af = new Affect();

            foreach (CharData victim in ch.InRoom.People)
            {
                if (Magic.SpellSavingThrow(level, victim, AttackType.DamageType.magic_other))
                {
                    ch.SendText("You failed!\r\n");
                    continue;
                }

                // Removes haste, takes two castings to make a hasted person slowed
                if (victim.IsAffected(Affect.AFFECT_HASTE))
                {
                    victim.RemoveAffect(Affect.AFFECT_HASTE);
                    victim.SendText("You slow to your normal speed.\r\n");
                    continue;
                }

                if (victim.IsAffected(Affect.AFFECT_SLOWNESS))
                {
                    continue;
                }

                af.Type     = Affect.AffectType.song;
                af.Value    = spell.Name;
                af.Duration = 6;
                af.SetBitvector(Affect.AFFECT_SLOWNESS);
                victim.AddAffect(af);

                SocketConnection.Act("&+R$n&+R moves much more slowly.&n", victim, null, null, SocketConnection.MessageTarget.room);
                victim.SendText("&+RYou feel yourself slowing down.&n\r\n");
            }
            return(true);
        }
Exemplo n.º 26
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;
        }
Exemplo n.º 27
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);
        }
Exemplo n.º 28
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());
            }
        }
Exemplo n.º 29
0
        /// <summary>
        /// The main social action processing routine.  Sends the social strings and any associated sounds.
        /// </summary>
        /// <param name="ch">Character acting out the social.</param>
        /// <param name="command">Command entered by the character.</param>
        /// <param name="argument">Additional modifiers to the command entered.</param>
        /// <returns></returns>
        public bool CheckSocial(CharData ch, string command, string argument)
        {
            string arg = String.Empty;

            Social soc = FindSocial(command);

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

            if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_NO_EMOTE))
            {
                ch.SendText("You are anti-social!\r\n");
                return(true);
            }

            if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_MEDITATING))
            {
                ch.RemoveActionBit(PC.PLAYER_MEDITATING);
                ch.SendText("You stop meditating.\r\n");
            }

            // Performing a social action removes hide and conceal.
            if (ch.IsAffected(Affect.AFFECT_MINOR_INVIS))
            {
                ch.SendText("You appear.\r\n");
            }
            ch.AffectStrip(Affect.AffectType.skill, "shadow form");
            ch.AffectStrip(Affect.AffectType.spell, "concealment");
            ch.RemoveAffect(Affect.AFFECT_MINOR_INVIS);
            ch.RemoveAffect(Affect.AFFECT_HIDE);

            switch (ch.CurrentPosition)
            {
            case Position.dead:
                ch.SendText("Lie still; you are DEAD.\r\n");
                return(true);

            case Position.incapacitated:
            case Position.mortally_wounded:
                ch.SendText("You are hurt far too badly for that.\r\n");
                return(true);

            case Position.stunned:
                ch.SendText("You are too stunned to do that.\r\n");
                return(true);

            case Position.sleeping:
                // Special exception - only social when you're using when asleep is "snore".
                if (!"snore".StartsWith(soc.Name, StringComparison.CurrentCultureIgnoreCase))
                {
                    break;
                }
                ch.SendText("In your dreams, or what?\r\n");
                return(true);
            }

            MUDString.OneArgument(argument, ref arg);
            CharData victim = null;

            if (arg.Length == 0)
            {
                SocketConnection.Act(soc.CharNoArgument, ch, null, victim, SocketConnection.MessageTarget.character);
                SocketConnection.Act(soc.OthersNoArgument, ch, null, victim, SocketConnection.MessageTarget.room);
                if (!String.IsNullOrEmpty(soc.AudioFile) && ch.InRoom != null)
                {
                    foreach (CharData cd in ch.InRoom.People)
                    {
                        cd.SendSound(soc.AudioFile);
                    }
                }
                return(true);
            }
            victim = ch.GetCharWorld(arg);
            if (!victim || (ch.IsRacewar(victim) && ch.InRoom != victim.InRoom))
            {
                ch.SendText("They aren't here.\r\n");
            }
            else if (victim == ch)
            {
                SocketConnection.Act(soc.CharSelf, ch, null, victim, SocketConnection.MessageTarget.character);
                SocketConnection.Act(soc.OthersSelf, ch, null, victim, SocketConnection.MessageTarget.room);
                if (!String.IsNullOrEmpty(soc.AudioFile) && ch.InRoom != null)
                {
                    foreach (CharData cd in ch.InRoom.People)
                    {
                        cd.SendSound(soc.AudioFile);
                    }
                }
            }
            else if (!ch.GetCharRoom(arg) && CharData.CanSee(ch, victim) &&
                     soc.CharFound.Length > 0 && soc.VictimFound.Length > 0)
            {
                if (!ch.IsImmortal())
                {
                    ch.SendText("You don't see them here.\r\n");
                    return(true);
                }
                if (!victim.IsNPC())
                {
                    const string ldbase = "From far away, ";

                    if (victim.IsIgnoring(ch))
                    {
                        ch.SendText("They are ignoring you.\r\n");
                        return(false);
                    }
                    Room original = ch.InRoom;
                    ch.RemoveFromRoom();
                    ch.AddToRoom(victim.InRoom);

                    string ldmsg = ldbase;
                    ldmsg += soc.CharFound;
                    SocketConnection.Act(ldmsg, ch, null, victim, SocketConnection.MessageTarget.character);

                    ldmsg  = ldbase;
                    ldmsg += soc.VictimFound;
                    SocketConnection.Act(ldmsg, ch, null, victim, SocketConnection.MessageTarget.victim);

                    if (!String.IsNullOrEmpty(soc.AudioFile) && ch.InRoom != null)
                    {
                        foreach (CharData cd in ch.InRoom.People)
                        {
                            cd.SendSound(soc.AudioFile);
                        }
                    }

                    ch.RemoveFromRoom();
                    ch.AddToRoom(original);
                }
                else
                {
                    ch.SendText("They aren't here.\r\n");
                }
            }
            else
            {
                SocketConnection.Act(soc.CharFound, ch, null, victim, SocketConnection.MessageTarget.character);
                SocketConnection.Act(soc.VictimFound, ch, null, victim, SocketConnection.MessageTarget.victim);
                SocketConnection.Act(soc.OthersFound, ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
                if (!String.IsNullOrEmpty(soc.AudioFile) && ch.InRoom != null)
                {
                    foreach (CharData cd in ch.InRoom.People)
                    {
                        cd.SendSound(soc.AudioFile);
                    }
                }

                // If mobs are to respond to socials, it should be inserted here.
                // This might be useful for some quests, mob functions, or other things.
            }

            return(true);
        }
Exemplo n.º 30
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;
        }