Exemple #1
0
        // This _function should prevent a mob from spamming
        // spellups on itself if it is already affected by the spell.
        // in the Spellup() _function, checks for Affect.AFFECT_WHATEVER
        // still need to be done. - Xangis
        static bool CheckSpellup( CharData ch, string name, int percent )
        {
            if (ch == null) return false;
            if (String.IsNullOrEmpty(name))
                return false;

            Spell spell = Spell.SpellList[name];
            if (spell == null)
            {
                return false;
            }

            // Keep mobs from casting spells they are affected by
            if( ch.HasAffect( Affect.AffectType.spell, spell ) )
                return false;

            if( ( ch.HasSpell( name ) )
                    && ( MUDMath.NumberPercent() < percent ) )
            {
                if (spell.ValidTargets != TargetType.singleCharacterDefensive &&
                        spell.ValidTargets != TargetType.self)
                    Log.Error( "CheckSpellup:  Mob casting spell {0} which is neither TargetType.self nor TargetType.defensive.", spell );

                SocketConnection.Act( "$n&n starts casting...", ch, null, null, SocketConnection.MessageTarget.room );
                ch.SetAffectBit( Affect.AFFECT_CASTING );
                CastData caster = new CastData();
                caster.Who = ch;
                caster.Eventdata = Event.CreateEvent(Event.EventType.spell_cast, spell.CastingTime, ch, ch, spell);
                Database.CastList.Add( caster );
                return true;
            }

            return false;
        }
Exemple #2
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;
        }
Exemple #3
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");
        }
Exemple #4
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");
        }
Exemple #5
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");
        }
Exemple #6
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");
        }