Exemplo n.º 1
0
        /// <summary>
        /// Song of armor.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongArmor( CharData ch, Spell spell, int level, Target target )
        {
            ch.SendText( "You Sing a song of protection.\r\n" );

            foreach( CharData victim in ch.InRoom.People )
            {
                if (victim.IsAffected( Affect.AFFECT_ARMOR))
                    continue;

                Affect af = new Affect( Affect.AffectType.song, spell.Name, 4, Affect.Apply.ac, ( 0 - ( 10 + ( level / 5 ) ) ), Affect.AFFECT_ARMOR );
                victim.CombineAffect( af );

                victim.SendText( "You feel someone protecting you.\r\n" );
            }

            return true;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Paladin "lay hands" healing command.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void LayHands(CharData ch, string[] str)
        {
            if( ch == null ) return;
            Affect af = new Affect();

            if (ch.Level <= Limits.LEVEL_AVATAR && !ch.IsClass(CharClass.Names.paladin))
            {
                ch.SendText("&nYou aren't holy enough to do that!\r\n");
                return;
            }

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

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

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

            if (victim != ch && ch.Fighting)
            {
                ch.SendText("&nYou can only layhands on yourself while fighting.\r\n");
                return;
            }

            if (victim.Hitpoints < victim.GetMaxHit())
                victim.Hitpoints = Math.Min(victim.Hitpoints + 300, victim.GetMaxHit());
            victim.UpdatePosition();

            if (ch != victim)
            {
                SocketConnection.Act("You lay your hands upon $N.", ch, null, victim, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$n&n lays $s hands upon you.", ch, null, victim, SocketConnection.MessageTarget.victim);
                SocketConnection.Act("$n&n lays $s hands upon $N&n.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
            }
            else
            {
                ch.SendText("&nYou layhands upon yourself.\r\n");
                SocketConnection.Act("$n&n lays hands upon $mself&n.", ch, null, null, SocketConnection.MessageTarget.room);
            }
            victim.SendText("&+WYou feel a warm glow!&n\r\n");
            if (ch.Level >= Limits.LEVEL_AVATAR)
                return;
            af.Value = "layhands timer";
            af.Type = Affect.AffectType.skill;
            af.Duration = 24;
            af.SetBitvector(Affect.AFFECT_LAYHANDS_TIMER);
            ch.AddAffect(af);
        }
Exemplo n.º 3
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.º 4
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.º 5
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.º 6
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.º 7
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.º 8
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.º 9
0
        /// <summary>
        /// Capture command - restrain another character.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Capture(CharData ch, string[] str)
        {
            if( ch == null ) return;
            CharData victim;
            Affect af = new Affect();

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

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

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

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

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

                victim.AddAffect(af);

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

            /* go for the one who wanted to fight :) */
            if (ch.IsNPC() && ch.IsAffected( Affect.AFFECT_CHARM) && !victim.Fighting)
            {
                victim.AttackCharacter(ch.Master);
            }
            else if (!victim.Fighting)
            {
                victim.AttackCharacter(ch);
            }

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

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

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

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

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

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

            CharData mount = Database.CreateMobile(mobTemplate);

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

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

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

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

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

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

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

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

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

            ch.PracticeSkill("sneak");
            ch.WaitState(10);
            return;
        }
Exemplo n.º 12
0
        public static void Shadow(CharData ch, string[] str)
        {
            if( ch == null ) return;
            Affect af = new Affect();

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

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

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

            return;
        }
Exemplo n.º 13
0
        public static void Savvy(CharData ch, string[] str)
        {
            if( ch == null ) return;

            string arg = String.Empty;
            int amount;

            if (ch.IsNPC() || ((PC)ch).SkillAptitude["savvy"] == 0)
            {
                ch.SendText("Try all you will, but you're still your plain self.\r\n");
                return;
            }

            if (!MUDString.StringsNotEqual(arg, "off"))
            {
                if (ch.HasAffect( Affect.AffectType.skill, "savvy"))
                {
                    //strip the affect
                    ch.AffectStrip( Affect.AffectType.skill, "savvy");
                }
                else
                {
                    ch.SendText("You are not using savvy.\r\n");
                }
                return;
            }
            if (((PC)ch).SkillAptitude["savvy"] >= 95)
                amount = 15;
            else if (((PC)ch).SkillAptitude["savvy"] >= 60)
                amount = 10;
            else
                amount = 5;
            Affect af = new Affect(Affect.AffectType.skill, "savvy", 5 * ch.Level, Affect.Apply.strength, amount, Affect.AFFECT_STRENGTH_INCREASED);
            ch.AddAffect(af);
            ch.SendText("You feel more savvy.\r\n");
        }
Exemplo n.º 14
0
        /// <summary>
        /// Apply poison to a weapon.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void PoisonWeapon(CharData ch, string[] str)
        {
            if (ch == null)
            {
                return;
            }

            Object obj;
            Object pobj = null;
            Affect af = new Affect();

            /* Don't allow mobs or unskilled pcs to do this */
            if (ch.IsNPC() || (!ch.IsNPC() && !ch.HasSkill("poison weapon")))
            {
                ch.SendText("What do you think you are, a thief?\r\n");
                return;
            }

            if (str.Length == 0)
            {
                ch.SendText("What are you trying to poison?\r\n");
                return;
            }
            if (ch.Fighting != null)
            {
                ch.SendText("While you're fighting?  Nice try.\r\n");
                return;
            }
            if (!(obj = ch.GetObjCarrying(str[0])))
            {
                ch.SendText("You do not have that weapon.\r\n");
                return;
            }
            if (obj.ItemType != ObjTemplate.ObjectType.weapon)
            {
                ch.SendText("That item is not a weapon.\r\n");
                return;
            }
            if (obj.HasFlag(ObjTemplate.ITEM_POISONED))
            {
                ch.SendText("That weapon is already poisoned.\r\n");
                return;
            }
            if (obj.Values[0] != 2)
            {
                ch.SendText("You don't have enough poison to cover that!\r\n");
                return;
            }

            /* Now we have a valid weapon...check to see if we have the poison. */
            foreach (Object iobj in ch.Carrying)
            {
                // here is where we should check to see if they have poison
                if (iobj.ItemType == ObjTemplate.ObjectType.drink_container
                        && iobj.Values[2] == 27)
                {
                    pobj = iobj;
                    break;
                }
            }
            if (!pobj)
            {
                ch.SendText("You do not have any poison.\r\n");
                return;
            }

            if (pobj.Values[1] <= 0 && pobj.Values[1] != -1)
            {
                SocketConnection.Act("Sorry, $p&n seems to be empty.", ch, pobj, null, SocketConnection.MessageTarget.character);
                return;
            }

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

            /* Check the skill percentage */
            if (!ch.CheckSkill("poison weapon"))
            {
                ch.SendText("You failed and spill some on yourself.  &+ROuch!&n\r\n");
                Combat.InflictDamage(ch, ch, ch.Level, "poison weapon", ObjTemplate.WearLocation.none, AttackType.DamageType.poison);
                SocketConnection.Act("$n spills the &+Gpoison&n all over!", ch, null, null, SocketConnection.MessageTarget.room);
                pobj.Values[1] -= 2;
                return;
            }

            /* Can't have people smearing gunk on artifacts */
            if (obj.InsultArtifact(ch))
            {
                pobj.Values[1]--;
                return;
            }

            SocketConnection.Act("You apply the &+Gpoison&n to $p&n, which glistens wickedly!",
                 ch, obj, null, SocketConnection.MessageTarget.character);
            SocketConnection.Act("$n&n pours the &+Gli&n&+gq&+Gu&n&+gid&n over $p&n, which glistens wickedly!",
                 ch, obj, null, SocketConnection.MessageTarget.room);

            af.Value = "poison weapon";
            af.Type = Affect.AffectType.skill;
            af.Duration = ch.Level + MUDMath.Dice(4, ch.Level / 2);
            af.AddModifier(Affect.Apply.none, pobj.Values[3]);
            af.Level = ch.Level;
            af.SetBitvector(Affect.AFFECT_POISON);
            obj.AddAffect(af);
            // Consume one unit of the poison source.
            pobj.Values[1]--;
            return;
        }
Exemplo n.º 15
0
        public static void Berzerk(CharData ch, string[] str)
        {
            if( ch == null ) return;

            Affect af = new Affect();

            /* Don't allow charmed mobs to do this, check player's level */
            if ((ch.IsNPC() && ch.IsAffected( Affect.AFFECT_CHARM))
                    || (!ch.IsNPC() && !ch.HasSkill("berzerk")))
            {
                ch.SendText("You're not enough of a warrior to enter a &+RBl&n&+ro&+Ro&n&+rd&+L Rage&n.\r\n");
                return;
            }

            if (ch.IsAffected(Affect.AFFECT_BERZERK))
            {
                if (MUDMath.NumberPercent() + 10 > ((PC)ch).SkillAptitude["berzerk"])
                {
                    ch.SendText("You failed to calm yourself down!\r\n");
                    ch.WaitState(Skill.SkillList["berzerk"].Delay);
                    return;
                }
                ch.SendText("You no longer see targets everywhere.\r\n");
                ch.RemoveAffect(Affect.AFFECT_BERZERK);
                ch.WaitState(Skill.SkillList["berzerk"].Delay);
                return;
            }

            ch.SendText("Your slam your weapon into yourself and &+Rbl&n&+ro&+Ro&n&+rd&n splatters all over!\r\n");
            ch.SendText("The sight of &+Rbl&n&+ro&+Ro&n&+rd&n begins to drive you crazy!\r\n");

            if (ch.CheckSkill("berzerk"))
            {
                af.Value = "berzerk";
                af.Type = Affect.AffectType.skill;
                af.Duration = MUDMath.Dice(1, 2);
                af.AddModifier( Affect.Apply.hitroll, Math.Max(ch.Level / 6, 2));
                af.AddModifier( Affect.Apply.damroll, Math.Max(ch.Level / 6, 2));
                af.AddModifier( Affect.Apply.ac, (ch.Level / 2));
                af.AddModifier( Affect.Apply.max_constitution, MUDMath.Dice(5, 9));
                af.AddModifier( Affect.Apply.agility, 0 - MUDMath.Dice(5, 9));
                af.AddModifier( Affect.Apply.max_strength, MUDMath.Dice(5, 9));
                af.SetBitvector(Affect.AFFECT_BERZERK);
                ch.AddAffect(af);

                ch.SendText("You are overcome by &+RBl&n&+ro&+Ro&n&+rd&+L Rage&n!!\r\n");
                SocketConnection.Act("$n has slipped into a &+RBl&n&+ro&+Ro&n&+rd&+L Rage&n!!", ch, null, null, SocketConnection.MessageTarget.room);

                return;
            }
            ch.SendText("You get a little angry, but fail to call up a &+Rblood rage&n.\r\n");

            return;
        }
Exemplo n.º 16
0
        public static void Heighten(CharData ch, string[] str)
        {
            if( ch == null ) return;
            Affect af = new Affect();

            if (!ch.IsNPC() && !ch.HasSkill("heighten senses"))
            {
                ch.SendText("Your senses are as heightened as they're going to get.\r\n");
                return;
            }

            if (ch.HasAffect( Affect.AffectType.skill, "heighten senses"))
                return;

            if (ch.CheckSkill("heighten senses"))
            {
                af.Value = "heighten senses";
                af.Type = Affect.AffectType.skill;
                af.Duration = 24 + ch.Level;
                af.SetBitvector(Affect.AFFECT_DETECT_INVIS);
                ch.AddAffect(af);

                af.SetBitvector(Affect.AFFECT_SENSE_LIFE);
                ch.AddAffect(af);

                af.SetBitvector(Affect.AFFECT_INFRAVISION);
                ch.AddAffect(af);

                ch.SendText("Your senses are heightened.\r\n");
            }
            return;
        }
Exemplo n.º 17
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.º 18
0
        public static void Charm(CharData ch, string[] str)
        {
            if( ch == null ) return;

            string arg = String.Empty;
            int amount;

            if (!ch.HasSkill("charm of the otter"))
            {
                ch.SendText("Try all you will, but you're still your plain self.\r\n");
                return;
            }

            if (!MUDString.StringsNotEqual(arg, "off"))
            {
                if (ch.HasAffect( Affect.AffectType.skill, "charm of the otter"))
                {
                    //strip the affect
                    ch.AffectStrip( Affect.AffectType.skill, "charm of the otter");
                }
                else
                {
                    ch.SendText("You are not using charm of the otter.\r\n");
                }
                return;
            }
            if (((PC)ch).SkillAptitude["charm of the otter"] >= 95)
                amount = 15;
            else if (((PC)ch).SkillAptitude["charm of the otter"] >= 60)
                amount = 10;
            else
                amount = 5;
            Affect af = new Affect(Affect.AffectType.skill, "charm of the otter", 5 * ch.Level, Affect.Apply.charisma, amount, Affect.AFFECT_NONE);
            ch.AddAffect(af);
            ch.SendText("You feel more charasmatic!\r\n");
        }
Exemplo n.º 19
0
        /// <summary>
        /// Throw dirt in someone's eyes.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void DirtToss(CharData ch, string[] str)
        {
            if( ch == null ) return;

            int percent;

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

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

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

            CharData victim = ch.Fighting;

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

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

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

            if (!ch.IsNPC())
            {
                percent = ((PC)ch).SkillAptitude["dirt toss"];
            }
            else
            {
                percent = (ch.Level * 3) / 2 + 25;
            }

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

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

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

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

            ch.PracticeSkill("dirt toss");

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

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

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

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

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

            Combat.SetFighting(victim, ch);

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

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

            Object obj = null;

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

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

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

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

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

            }

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

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

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

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

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

                    int amount = MUDMath.NumberRange(3, 10);
                    if (obj.Values[0] != -1)
                    {
                        amount = Math.Min(amount, obj.Values[1]);
                    }

                    ch.AdjustDrunk(amount * Liquid.Table[liquid].DrunkValue);

                    if (!ch.IsUndead())
                    {
                        ch.AdjustHunger(amount * Liquid.Table[liquid].HungerValue);
                        if (ch.IsAffected(Affect.AFFECT_THIRST))
                        {
                            ch.AdjustThirst((amount * Liquid.Table[liquid].ThirstValue) / 12);
                            ch.SendText("That doesn't taste as &+bwet&n as it used to.\r\n");
                        }
                        else
                        {
                            ch.AdjustThirst(amount * Liquid.Table[liquid].ThirstValue);
                        }
                    }
                    else
                    {
                        /* If blood */
                        if (Liquid.Table[liquid].Name == "blood")
                        {
                            ch.AdjustHunger(amount * 2);
                            ch.AdjustThirst(amount);
                        }
                    }

                    if (!ch.IsNPC() && ((PC)ch).Drunk > 10)
                    {
                        ch.SendText("You feel &n&+gdrunk&n.\r\n");
                    }
                    if (!ch.IsNPC() && ((PC)ch).Hunger > 20)
                    {
                        ch.SendText("You are &n&+yfull&n.\r\n");
                    }
                    if (!ch.IsNPC() && ((PC)ch).Thirst > 20)
                    {
                        ch.SendText("You do not feel &n&+cth&+Ci&n&+cr&+Cst&n&+cy&n.\r\n");
                    }

                    if (obj.Values[3] != 0 && !CharData.CheckImmune(ch, Race.DamageType.poison))
                    {
                        /* The shit was poisoned ! */
                        Affect af = new Affect();

                        ch.SendText("You choke and gag.\r\n");
                        SocketConnection.Act("$n chokes and gags.", ch, null, null, SocketConnection.MessageTarget.room);
                        af.Type = Affect.AffectType.spell;
                        af.Value = "poison";
                        af.Duration = 3 * amount;
                        af.AddModifier(Affect.Apply.strength, -(obj.Level / 7 + 1));
                        af.SetBitvector(Affect.AFFECT_POISON);
                        ch.CombineAffect(af);
                    }

                    /* HOLY_WATER and UNHOLY_WATER effects */
                    if ((ch.IsGood() && obj.Values[2] == 27) ||
                            (ch.IsEvil() && obj.Values[2] == 28))
                    {
                        int heal = MUDMath.Dice(1, 8);
                        if (ch.Hitpoints < ch.GetMaxHit())
                        {
                            ch.Hitpoints = Math.Min(ch.Hitpoints + heal, ch.GetMaxHit());
                            ch.UpdatePosition();
                            ch.SendText("You feel a little better!\r\n");
                        }
                    }
                    if ((ch.IsEvil() && obj.Values[2] == 27) ||
                            (ch.IsGood() && obj.Values[2] == 28))
                    {
                        int harm = MUDMath.Dice(1, 10);
                        ch.Hitpoints = Math.Max(ch.Hitpoints - harm, -10);
                        ch.SendText("You choke and feel as if you'd swallowed boiling oil!\r\n");
                        ch.UpdatePosition();
                    }
                    /* End (UN)HOLY_WATER effects */

                    // -1 Means a container never goes empty.
                    if (obj.Values[1] != -1)
                    {
                        obj.Values[1] -= amount;
                        if (obj.Values[1] <= 0)
                        {
                            ch.SendText("The container is now &+Lempty&n.\r\n");
                            obj.Values[1] = 0;
                        }
                    }
                    break;
            }

            return;
        }
Exemplo n.º 21
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.º 22
0
        /// <summary>
        /// Eat something.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Eat(CharData ch, string[] str)
        {
            if( ch == null ) return;

            Object obj;

            if (ch.IsBlind())
                return;

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

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

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

            if (!ch.IsImmortal())
            {
                if (obj.ItemType != ObjTemplate.ObjectType.food && obj.ItemType != ObjTemplate.ObjectType.pill)
                {
                    ch.SendText("That's not edible.\r\n");
                    return;
                }

                if (!ch.IsNPC() && ((PC)ch).Hunger > 40)
                {
                    ch.SendText("You are too full to eat more.\r\n");
                    return;
                }
            }

            SocketConnection.Act("You consume $p&n.", ch, obj, null, SocketConnection.MessageTarget.character);
            SocketConnection.Act("$n&n inhales $p&n.", ch, obj, null, SocketConnection.MessageTarget.room);

            switch (obj.ItemType)
            {

                case ObjTemplate.ObjectType.food:
                    if (!ch.IsNPC())
                    {
                        int condition = ((PC)ch).Hunger;
                        if (!ch.IsUndead())
                        {
                            ch.AdjustHunger(obj.Values[0]);
                        }
                        if (((PC)ch).Hunger > 40)
                        {
                            ch.SendText("You are full.\r\n");
                        }
                        else if (condition == 0 && ((PC)ch).Hunger > 0)
                        {
                            ch.SendText("You are no longer hungry.\r\n");
                        }
                    }

                    if (obj.Values[3] != 0 && !CharData.CheckImmune(ch, Race.DamageType.poison))
                    {
                        /* The shit was poisoned! */
                        Affect af = new Affect();

                        SocketConnection.Act("$n chokes and gags.", ch, null, null, SocketConnection.MessageTarget.room);
                        ch.SendText("You choke and gag.\r\n");

                        af.Type = Affect.AffectType.spell;
                        af.Value = "poison";
                        af.Duration = 2 * obj.Values[0];
                        af.AddModifier(Affect.Apply.strength, -(obj.Level / 7 + 2));
                        af.SetBitvector(Affect.AFFECT_POISON);
                        ch.CombineAffect(af);
                    }
                    break;

                case ObjTemplate.ObjectType.pill:
                    {
                        for (int i = 1; i <= 4; i++)
                        {
                            String spellName = SpellNumberToTextMap.GetSpellNameFromNumber(obj.Values[i]);
                            if (String.IsNullOrEmpty(spellName))
                            {
                                Log.Error("Eat: Spell number " + obj.Values[i] + " not found for pill object " + obj.ObjIndexNumber + ". Make sure it's in the SpellNumberToTextMap.");
                            }
                            Spell spell = StringLookup.SpellLookup(spellName);
                            if (!spell)
                            {
                                Log.Error("Eat: Spell '" + spellName + "' not found for pill object " + obj.ObjIndexNumber + ". Make sure it's in the spells file.");
                            }
                            else
                            {
                                spell.Invoke(ch, obj.Values[0], ch);
                            }
                        }
                    }
                    break;
            }

            if (!ch.IsNPC() || (ch.IsNPC() && ch.IsAffected(Affect.AFFECT_CHARM)))
            {
                obj.RemoveFromWorld();
            }
            return;
        }
Exemplo n.º 23
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.º 24
0
        public static void Endurance(CharData ch, string[] str)
        {
            if( ch == null ) return;

            string arg = String.Empty;
            int amount;

            if (ch.IsNPC() || ((PC)ch).SkillAptitude["endurance"] == 0)
            {
                ch.SendText("Try all you will, but you're still your plain self.\r\n");
                return;
            }

            if (!MUDString.StringsNotEqual(arg, "off"))
            {
                if (ch.HasAffect( Affect.AffectType.skill, "endurance"))
                {
                    //strip the affect
                    ch.AffectStrip( Affect.AffectType.skill, "endurance");
                }
                else
                {
                    ch.SendText("You are not using endurance.\r\n");
                }
                return;
            }
            if (((PC)ch).SkillAptitude["endurance"] >= 95)
                amount = 15;
            else if (((PC)ch).SkillAptitude["endurance"] >= 60)
                amount = 10;
            else
                amount = 5;
            Affect af = new Affect(Affect.AffectType.skill, "endurance", 5 * ch.Level, Affect.Apply.move, amount, Affect.AFFECT_MOVEMENT_INCREASED);
            ch.AddAffect(af);
            ch.SendText("You feel the endurance of the mountains in your muscles!\r\n");
        }
Exemplo n.º 25
0
        /// <summary>
        /// Song of sleep.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongSleep( CharData ch, Spell spell, int level, Target target )
        {
            foreach( CharData victim in ch.InRoom.People )
            {
                if (victim.IsAffected(Affect.AFFECT_SLEEP)
                        || Magic.SpellSavingThrow( level, victim, AttackType.DamageType.charm )
                        || victim.GetRace() == Race.RACE_VAMPIRE
                        || ch.IsSameGroup( victim ) )
                {
                    continue;
                }

                Affect af = new Affect(Affect.AffectType.song, spell.Name, level / 8, Affect.Apply.none, 0, Affect.AFFECT_SLEEP);
                victim.CombineAffect(af);

                if( victim.IsAwake() )
                {
                    victim.SendText( "You feel very sleepy... zzzzz.\r\n" );
                    if (ch.Fighting || victim.CurrentPosition == Position.fighting)
                    {
                        Combat.StopFighting(victim, false);
                    }
                    CommandType.Interpret( victim, "sleep" );
                }

            }

            return true;
        }
Exemplo n.º 26
0
        public static void Aware(CharData ch, string[] str)
        {
            if( ch == null ) return;

            Affect af = new Affect();

            if (ch.IsNPC())
                return;

            if (!ch.HasSkill("awareness"))
            {
                ch.SendText("Your general obliviousness prevents your use of this skill.\r\n");
                return;
            }

            if (ch.IsAffected(Affect.AFFECT_SKL_AWARE))
            {
                ch.SendText("You are already about as tense as you can get.\r\n");
                return;
            }

            ch.SendText("You try to become more aware of your surroundings.\r\n");

            ch.PracticeSkill("awareness");

            af.Value = "awareness";
            af.Type = Affect.AffectType.skill;
            af.Duration = (ch.Level / 3) + 3;
            af.SetBitvector(Affect.AFFECT_SKL_AWARE);
            ch.AddAffect(af);

            return;
        }
Exemplo n.º 27
0
        /// <summary>
        /// Song of warding, protective.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongWarding( CharData ch, Spell spell, int level, Target target )
        {
            Affect af = new Affect();

            foreach( CharData victim in ch.InRoom.People )
            {
                af.Type = Affect.AffectType.song;
                af.Value = spell.Name;
                af.Duration = level / 7;
                af.AddModifier(Affect.Apply.save_spell, 0 - ( ( level / 5 ) + 1 ));
                af.AddModifier(Affect.Apply.save_paralysis, 0 - ((level / 5) + 1));
                af.AddModifier(Affect.Apply.save_petrification, 0 - ((level / 5) + 1));
                af.AddModifier(Affect.Apply.save_poison, 0 - ((level / 5) + 1));
                af.AddModifier(Affect.Apply.save_breath, 0 - ((level / 5) + 1));
                af.SetBitvector(Affect.AFFECT_NONE);
                victim.AddAffect(af);
            }
            return true;
        }
Exemplo n.º 28
0
        public static void Fortitude(CharData ch, string[] str)
        {
            if( ch == null ) return;

            string arg = String.Empty;
            int amount;

            if (ch.IsNPC() || ((PC)ch).SkillAptitude["fortitude"] == 0)
            {
                ch.SendText("Try all you will, but you're still your plain self.\r\n");
                return;
            }

            if (!MUDString.StringsNotEqual(arg, "off"))
            {
                if (ch.HasAffect( Affect.AffectType.skill, "fortitude"))
                {
                    //strip the affect
                    ch.AffectStrip( Affect.AffectType.skill, "fortitude");
                }
                else
                {
                    ch.SendText("You are not using fortitude.\r\n");
                }
                return;
            }
            if (((PC)ch).SkillAptitude["fortitude"] >= 95)
                amount = 15;
            else if (((PC)ch).SkillAptitude["fortitude"] >= 60)
                amount = 10;
            else
                amount = 5;
            Affect af = new Affect(Affect.AffectType.skill, "fortitude", 5 * ch.Level, Affect.Apply.constitution, amount, Affect.AFFECT_NONE);
            ch.AddAffect(af);
            ch.SendText("You feel more fortified.\r\n");
        }
Exemplo n.º 29
0
        /// <summary>
        /// Returns the text _name of an affect location.  We use this for printable strings
        /// because the ToString() for the enum has ugly things like underscores.
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        public static string AffectApplyString( Affect.Apply location )
        {
            switch( location )
            {
                case Affect.Apply.none:
                    return "none";
                case Affect.Apply.strength:
                    return "strength";
                case Affect.Apply.dexterity:
                    return "dexterity";
                case Affect.Apply.intelligence:
                    return "intelligence";
                case Affect.Apply.wisdom:
                    return "wisdom";
                case Affect.Apply.constitution:
                    return "constitution";
                case Affect.Apply.sex:
                    return "sex";
                case Affect.Apply.age:
                    return "age";
                case Affect.Apply.height:
                    return "height";
                case Affect.Apply.weight:
                    return "weight";
                case Affect.Apply.size:
                    return "size";
                case Affect.Apply.mana:
                    return "mana";
                case Affect.Apply.hitpoints:
                    return "hp";
                case Affect.Apply.move:
                    return "moves";
                case Affect.Apply.ac:
                    return "armor class";
                case Affect.Apply.hitroll:
                    return "hit roll";
                case Affect.Apply.damroll:
                    return "damage roll";
                case Affect.Apply.save_paralysis:
                    return "save vs paralysis";
                case Affect.Apply.save_poison:
                    return "save vs poison";
                case Affect.Apply.save_petrification:
                    return "save vs petrification";
                case Affect.Apply.save_breath:
                    return "save vs breath";
                case Affect.Apply.save_spell:
                    return "save vs spell";
                case Affect.Apply.fire_protection:
                    return "fire protection";
                case Affect.Apply.agility:
                    return "agility";
                case Affect.Apply.charisma:
                    return "charisma";
                case Affect.Apply.power:
                    return "power";
                case Affect.Apply.luck:
                    return "luck";
                case Affect.Apply.max_strength:
                    return "max strength";
                case Affect.Apply.max_dexterity:
                    return "max dexterity";
                case Affect.Apply.max_intelligence:
                    return "max intelligence";
                case Affect.Apply.max_wisdom:
                    return "max wisdom";
                case Affect.Apply.max_constitution:
                    return "max constitution";
                case Affect.Apply.max_agility:
                    return "max agility";
                case Affect.Apply.max_power:
                    return "max power";
                case Affect.Apply.max_charisma:
                    return "max charisma";
                case Affect.Apply.max_luck:
                    return "max luck";
                case Affect.Apply.race_strength:
                    return "racial strength";
                case Affect.Apply.race_dexterity:
                    return "racial dexterity";
                case Affect.Apply.race_intelligence:
                    return "racial intelligence";
                case Affect.Apply.race_wisdom:
                    return "racial wisdom";
                case Affect.Apply.race_constitution:
                    return "racial constitution";
                case Affect.Apply.race_agility:
                    return "racial agility";
                case Affect.Apply.race_power:
                    return "racial power";
                case Affect.Apply.race_charisma:
                    return "racial charisma";
                case Affect.Apply.race_luck:
                    return "racial luck";
                case Affect.Apply.curse:
                    return "curse";
                case Affect.Apply.resistant:
                    return "resistant";
                case Affect.Apply.immune:
                    return "immune";
                case Affect.Apply.susceptible:
                    return "susceptible";
                case Affect.Apply.vulnerable:
                    return "vulnerable";
                case Affect.Apply.race:
                    return "race";
            }

            Log.Error( "Affect_location_name: unknown location {0}.", location );
            return "(unknown)";
        }
Exemplo n.º 30
0
        /// <summary>
        /// Innate command.  Shows and activates innate abilitiies.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Innate(CharData ch, string[] str)
        {
            if( ch == null ) return;

            string text;
            Affect af = new Affect();

            // Use innates here
            if (str.Length > 0 && !String.IsNullOrEmpty(str[0]))
            {
                if (!MUDString.IsPrefixOf(str[0], "strength"))
                {
                    if (ch.HasInnate(Race.RACE_STRENGTH))
                    {
                        if (ch.IsAffected(Affect.AFFECT_STRENGTH_INCREASED))
                        {
                            ch.SendText("You are already affected by strength.");
                            return;
                        }
                        if (ch.HasInnateTimer(InnateTimerData.Type.strength))
                        {
                            ch.SendText("You need to rest a bit first.\r\n");
                            return;
                        }

                        af.Type = Affect.AffectType.spell;
                        af.Value = "strength";
                        af.Duration = MUDMath.Dice(8, 5);
                        af.AddModifier(Affect.Apply.strength, MUDMath.Dice(2, 4) + 15);
                        af.SetBitvector(Affect.AFFECT_STRENGTH_INCREASED);
                        ch.AddAffect(af);
                        ch.SendText("You feel stronger.\r\n");
                        ch.AddInnateTimer(InnateTimerData.Type.strength, 24);

                        ch.WaitState(14);

                    }
                    else
                    {
                        ch.SendText("You don't know how to do that.\r\n");
                        return;
                    }
                }
                else if (!MUDString.IsPrefixOf(str[0], "levitate"))
                {
                    if (ch.HasInnate(Race.RACE_LEVITATE))
                    {
                        if (ch.IsAffected( Affect.AFFECT_LEVITATE))
                        {
                            ch.SendText("You are already levitating.");
                            return;
                        }
                        if (ch.HasInnateTimer(InnateTimerData.Type.levitate))
                        {
                            ch.SendText("You need to rest a bit first.\r\n");
                            return;
                        }

                        af.Type = Affect.AffectType.spell;
                        af.Value = "levitation";
                        af.Duration = MUDMath.Dice(8, 5);
                        af.SetBitvector(Affect.AFFECT_LEVITATE);
                        ch.AddAffect(af);
                        ch.SendText("Your feet rise off the ground.\r\n");
                        ch.AddInnateTimer(InnateTimerData.Type.levitate, 24);

                        ch.WaitState(6);
                    }
                    else
                    {
                        ch.SendText("You don't know how to do that.\r\n");
                        return;
                    }
                }
                else if (!MUDString.IsPrefixOf(str[0], "faerie"))
                {
                    if (ch.HasInnate(Race.RACE_FAERIE_FIRE))
                    {
                        CharData victim = ch.GetCharRoom(str[0]);

                        if (victim == null)
                            ch.SendText("You do not see them here.");
                        else
                        {
                            Spell spl = Spell.SpellList["faerie fire"];
                            if (spl != null)
                            {
                                spl.Invoke(ch, ch.Level, victim);
                            }
                        }
                    }
                    else
                    {
                        ch.SendText("You don't know how to do that.\r\n");
                        return;
                    }
                }
                else if (!MUDString.IsPrefixOf(str[0], "invisibility"))
                {
                    if (ch.HasInnate(Race.RACE_INVIS))
                    {
                        if (ch.IsAffected( Affect.AFFECT_INVISIBLE))
                        {
                            ch.SendText("You are already invisible!\r\n");
                            return;
                        }
                        if (ch.HasInnateTimer(InnateTimerData.Type.invisibility))
                        {
                            ch.SendText("You need to rest a bit first.\r\n");
                            return;
                        }

                        af.Type = Affect.AffectType.spell;
                        af.Value = "invisibility";
                        af.Duration = MUDMath.Dice(2, 8) + 4;
                        af.SetBitvector(Affect.AFFECT_INVISIBLE);

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

                        ch.AddAffect(af);
                        ch.AddInnateTimer(InnateTimerData.Type.invisibility, 24);

                        ch.WaitState(24);
                    }
                    else
                    {
                        ch.SendText("You don't know how to do that.\r\n");
                        return;
                    }
                }
                else if (!MUDString.IsPrefixOf(str[0], "enlarge"))
                {
                    if (ch.HasInnate(Race.RACE_ENLARGE))
                    {
                        if (ch.IsAffected(Affect.AFFECT_ENLARGED))
                        {
                            ch.SendText("You are already enlarged.\r\n");
                            return;
                        }
                        if (ch.HasInnateTimer(InnateTimerData.Type.enlarge))
                        {
                            ch.SendText("You need to rest a bit first.\r\n");
                            return;
                        }

                        af.Type = Affect.AffectType.spell;
                        af.Value = "enlarge";
                        af.Duration = MUDMath.Dice(8, 5);
                        af.AddModifier(Affect.Apply.size, 1);
                        af.SetBitvector(Affect.AFFECT_NONE);
                        ch.AddAffect(af);

                        ch.SendText("&nYou grow to almost twice your normal size!\r\n");
                        SocketConnection.Act("$n&n grows to almost twice $s normal size!&n", ch, null, null, SocketConnection.MessageTarget.room);
                        ch.AddInnateTimer(InnateTimerData.Type.enlarge, 24);

                        ch.WaitState(10);
                    }
                    else
                    {
                        ch.SendText("You don't know how to do that.\r\n");
                        return;
                    }
                }
                else if (!MUDString.IsPrefixOf(str[0], "shift"))
                {
                    if (str.Length > 1 && !MUDString.IsPrefixOf(str[1], "astral"))
                    {
                        if (ch.HasInnate(Race.RACE_SHIFT_ASTRAL))
                        {
                            if (ch.HasInnateTimer(InnateTimerData.Type.shift_astral))
                            {
                                ch.SendText("You need to rest a bit first.\r\n");
                                return;
                            }
                            Spell spell = StringLookup.SpellLookup("plane shift");
                            if (!spell)
                            {
                                ch.SendText("Something seems to be blocking your ability to shift.");
                                Log.Error("Innate Shift: 'plane shift' spell not found. Check the spells file.");
                                return;
                            }
                            spell.Invoke(ch, ch.Level, new Target(str[1]));
                            ch.AddInnateTimer(InnateTimerData.Type.shift_astral, 8);

                            ch.WaitState(10);
                        }
                        else
                        {
                            ch.SendText("You don't know how to do that.\r\n");
                            return;
                        }
                    }
                    else if (str.Length > 1 && !MUDString.IsPrefixOf(str[1], "prime"))
                    {
                        if (ch.HasInnate(Race.RACE_SHIFT_PRIME))
                        {
                            if (ch.HasInnateTimer(InnateTimerData.Type.shift_prime))
                            {
                                ch.SendText("You need to rest a bit first.\r\n");
                                return;
                            }
                            Spell spell = StringLookup.SpellLookup("plane shift");
                            if (!spell)
                            {
                                ch.SendText("Something seems to be blocking your ability to shift.");
                                Log.Error("Innate Shift: 'plane shift' spell not found. Check the spells file.");
                                return;
                            }
                            spell.Invoke(ch, ch.Level, new Target(str[1]));
                            ch.AddInnateTimer(InnateTimerData.Type.shift_prime, 8);

                            ch.WaitState(10);
                        }
                        else
                        {
                            ch.SendText("You don't know how to do that.\r\n");
                            return;
                        }
                    }
                }
                else
                {
                    ch.SendText("That's not implemented yet. :(\r\n");
                }
                return;
            }

            text = String.Format("&+BInnate abilities available to your race and class:&n\r\n");

            if (ch.HasInnate(Race.RACE_BODYSLAM))
                text += "&n  bodyslam\r\n";
            if (ch.HasInnate(Race.RACE_CHARGE))
                text += "&n  charge\r\n";
            if (ch.HasInnate(Race.RACE_FLY))
                text += "&n  fly\r\n";
            if (ch.HasInnate(Race.RACE_PASSDOOR))
                text += "&n  pass door\r\n";
            if (ch.HasInnate(Race.RACE_SWIM))
                text += "&n  swim\r\n";
            if (ch.HasInnate(Race.RACE_WATERBREATH))
                text += "&n  water breathing\r\n";
            if (ch.HasInnate(Race.RACE_INFRAVISION))
                text += "&n  infravision\r\n";
            if (ch.HasInnate(Race.RACE_ULTRAVISION))
                text += "&n  ultravision\r\n";
            if (ch.HasInnate(Race.RACE_DETECT_ALIGN)
                    || ch.IsClass(CharClass.Names.antipaladin)
                    || ch.IsClass(CharClass.Names.paladin))
                text += "&n  detect align\r\n";
            if (ch.HasInnate(Race.RACE_DETECT_INVIS))
                text += "&n  detect invis\r\n";
            if (ch.HasInnate(Race.RACE_DETECT_HIDDEN))
                text += "&n  detect hidden\r\n";
            if (ch.HasInnate(Race.RACE_MUTE))
                text += "&n  mute\r\n";
            if (ch.HasInnate(Race.RACE_DOORBASH))
                text += "&n  doorbash\r\n";
            if (ch.HasInnate(Race.RACE_SHRUG))
                text += "&n  shrug\r\n";
            if (ch.HasInnate(Race.RACE_ODSNEAK))
                text += "&n  outdoor sneak\r\n";
            if (ch.HasInnate(Race.RACE_UDSNEAK))
                text += "&n  underdark sneak\r\n";
            if (ch.HasInnate(Race.RACE_STRENGTH))
                text += "&n  strength\r\n";
            if (ch.HasInnate(Race.RACE_FAERIE_FIRE))
                text += "&n  faerie fire\r\n";
            //    if( ch.HasInnate( Race.RACE_STEAL ))
            //      buf += "&n  steal\r\n" );
            if (ch.HasInnate(Race.RACE_ENLARGE))
                text += "&n  enlarge\r\n";
            if (ch.HasInnate(Race.RACE_INVIS))
                text += "&n  invisibility\r\n";
            //    if( ch.HasInnate( Race.RACE_SUMMON_HOARDE ))
            //      buf += "&n  summon hoarde\r\n" );
            if (ch.HasInnate(Race.RACE_SHIFT_PRIME))
                text += "&n  shift prime\r\n";
            if (ch.HasInnate(Race.RACE_SHIFT_ASTRAL))
                text += "&n  shift astral\r\n";
            if (ch.HasInnate(Race.RACE_LEVITATE))
                text += "&n  levitate\r\n";
            if (ch.HasInnate(Race.RACE_BITE))
                text += "&n  bite\r\n";

            ch.SendText(text);

            return;
        }