当前位置: 首页>>代码示例>>C#>>正文


C# CharData.HasAffect方法代码示例

本文整理汇总了C#中MUDEngine.CharData.HasAffect方法的典型用法代码示例。如果您正苦于以下问题:C# CharData.HasAffect方法的具体用法?C# CharData.HasAffect怎么用?C# CharData.HasAffect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MUDEngine.CharData的用法示例。


在下文中一共展示了CharData.HasAffect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckSpellup

        // 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;
        }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:38,代码来源:MobFun.cs

示例2: Heighten

        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;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:32,代码来源:Command.cs

示例3: Fortitude

        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");
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:36,代码来源:Command.cs

示例4: Endurance

        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");
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:36,代码来源:Command.cs

示例5: Charm

        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");
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:36,代码来源:Command.cs

示例6: Savvy

        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");
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:36,代码来源:Command.cs


注:本文中的MUDEngine.CharData.HasAffect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。