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


C# CharData.AddAffect方法代码示例

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


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

示例1: 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

示例2: Aware

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

示例5: 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

示例6: Sneak

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

示例7: SummonMount

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

示例8: 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

示例9: Shadow

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

示例10: Berzerk

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

示例11: LayHands

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

示例12: Innate

        /// <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;
//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Command.cs

示例13: CloneMobile

        /// <summary>
        /// Creates a duplicate of a mobile minus its inventory.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="clone"></param>
        public static void CloneMobile( CharData parent, CharData clone )
        {
            int i;

            if( parent == null || clone == null || !parent.IsNPC() )
                return;

            // Fix values.
            clone.Name = parent.Name;
            clone.ShortDescription = parent.ShortDescription;
            clone.FullDescription = parent.FullDescription;
            clone.Description = parent.Description;
            clone.Gender = parent.Gender;
            clone.CharacterClass = parent.CharacterClass;
            clone.SetPermRace( parent.GetRace() );
            clone.Level = parent.Level;
            clone.TrustLevel = 0;
            clone.SpecialFunction = parent.SpecialFunction;
            clone.SpecialFunctionNames = parent.SpecialFunctionNames;
            clone.Timer = parent.Timer;
            clone.Wait = parent.Wait;
            clone.Hitpoints = parent.Hitpoints;
            clone.MaxHitpoints = parent.MaxHitpoints;
            clone.CurrentMana = parent.CurrentMana;
            clone.MaxMana = parent.MaxMana;
            clone.CurrentMoves = parent.CurrentMoves;
            clone.MaxMoves = parent.MaxMoves;
            clone.SetCoins( parent.GetCopper(), parent.GetSilver(), parent.GetGold(), parent.GetPlatinum() );
            clone.ExperiencePoints = parent.ExperiencePoints;
            clone.ActionFlags = parent.ActionFlags;
            clone.Affected = parent.Affected;
            clone.CurrentPosition = parent.CurrentPosition;
            clone.Alignment = parent.Alignment;
            clone.Hitroll = parent.Hitroll;
            clone.Damroll = parent.Damroll;
            clone.Wimpy = parent.Wimpy;
            clone.Deaf = parent.Deaf;
            clone.Hunting = parent.Hunting;
            clone.Hating = parent.Hating;
            clone.Fearing = parent.Fearing;
            clone.Resistant = parent.Resistant;
            clone.Immune = parent.Immune;
            clone.Susceptible = parent.Susceptible;
            clone.CurrentSize = parent.CurrentSize;
            clone.PermStrength = parent.PermStrength;
            clone.PermIntelligence = parent.PermIntelligence;
            clone.PermWisdom = parent.PermWisdom;
            clone.PermDexterity = parent.PermDexterity;
            clone.PermConstitution = parent.PermConstitution;
            clone.PermAgility = parent.PermAgility;
            clone.PermCharisma = parent.PermCharisma;
            clone.PermPower = parent.PermPower;
            clone.PermLuck = parent.PermLuck;
            clone.ModifiedStrength = parent.ModifiedStrength;
            clone.ModifiedIntelligence = parent.ModifiedIntelligence;
            clone.ModifiedWisdom = parent.ModifiedWisdom;
            clone.ModifiedDexterity = parent.ModifiedDexterity;
            clone.ModifiedConstitution = parent.ModifiedConstitution;
            clone.ModifiedAgility = parent.ModifiedAgility;
            clone.ModifiedCharisma = parent.ModifiedCharisma;
            clone.ModifiedPower = parent.ModifiedPower;
            clone.ModifiedLuck = parent.ModifiedLuck;
            clone.ArmorPoints = parent.ArmorPoints;
            //clone._mpactnum = parent._mpactnum;

            for (i = 0; i < 6; i++)
            {
                clone.SavingThrows[i] = parent.SavingThrows[i];
            }

            // Now add the affects.
            foreach (Affect affect in parent.Affected)
            {
                clone.AddAffect(affect);
            }
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:81,代码来源:Database.cs

示例14: ApplyPoison

        public static void ApplyPoison( CharData ch )
        {
            Affect af = new Affect();
            bool isSpell = false;

            foreach (Affect aff in ch.Affected)
            {
                if( aff.Type == Affect.AffectType.spell && aff.Value == "poison" )
                {
                    isSpell = true;
                }
                else if ((aff.Type == Affect.AffectType.skill && aff.Value == "poison weapon" || aff.Value == "poison bite") )
                {
                    foreach (AffectApplyType apply in aff.Modifiers)
                    {
                        if (apply.Location != Affect.Apply.none || ch.IsAffected(Affect.AFFECT_SLOW_POISON) && MUDMath.NumberBits(1) == 0)
                            continue;
                        Poison.Type poisonType = (Poison.Type)apply.Amount;
                        int dam;
                        switch (poisonType)
                        {
                            case Poison.Type.damage:
                                SocketConnection.Act("$n&n goes into a brief siezure as the poison courses through $s body.", ch, null, null, SocketConnection.MessageTarget.room);
                                ch.SendText("Your muscles twitch randomly as the poison courses through your body.\r\n");
                                dam = MUDMath.Dice(1, 10);
                                if (!Magic.SpellSavingThrow(aff.Level, ch, AttackType.DamageType.poison))
                                    InflictDamage(ch, ch, dam, "poison weapon", ObjTemplate.WearLocation.none, AttackType.DamageType.poison);
                                else
                                    InflictDamage(ch, ch, dam / 2, "poison weapon", ObjTemplate.WearLocation.none, AttackType.DamageType.poison);
                                return;
                            case Poison.Type.attributes:
                                if (!Magic.SpellSavingThrow(aff.Level, ch, AttackType.DamageType.poison))
                                {
                                    int lev = aff.Level;
                                    ch.AffectStrip(Affect.AffectType.skill, "poison weapon");
                                    af.Type = Affect.AffectType.skill;
                                    af.Value = "poison";
                                    af.Duration = lev / 4;
                                    af.Level = lev;
                                    af.AddModifier(Affect.Apply.strength, 0 - MUDMath.Dice(1, 20));
                                    af.AddModifier(Affect.Apply.dexterity, 0 - MUDMath.Dice(1, 20));
                                    af.AddModifier(Affect.Apply.agility, 0 - MUDMath.Dice(1, 20));
                                    af.AddModifier(Affect.Apply.constitution, 0 - MUDMath.Dice(1, 20));
                                    af.SetBitvector(Affect.AFFECT_POISON);
                                    ch.AddAffect(af);
                                    ch.SendText("You suddenly feel quite weak as the poison is distributed through your body.&n\r\n");
                                    SocketConnection.Act("$n&n pales visibly and looks much weaker.", ch, null, null, SocketConnection.MessageTarget.room);
                                    return;
                                }
                                ch.SendText("You feel the poison working its way into your system.\r\n");
                                InflictDamage(ch, ch, 2, "poison weapon", ObjTemplate.WearLocation.none, AttackType.DamageType.poison);
                                break;
                            case Poison.Type.damage_major:
                                dam = MUDMath.Dice(10, 10);
                                SocketConnection.Act("$n&n screams in agony as the poison courses through $s body.", ch, null, null, SocketConnection.MessageTarget.room);
                                ch.SendText("&+RYour blood is on fire!&n\r\n");

                                if (!Magic.SpellSavingThrow(aff.Level, ch, AttackType.DamageType.poison))
                                    InflictDamage(ch, ch, dam, "poison weapon", ObjTemplate.WearLocation.none, AttackType.DamageType.poison);
                                else
                                    InflictDamage(ch, ch, dam / 2, "poison weapon", ObjTemplate.WearLocation.none, AttackType.DamageType.poison);
                                return;
                            case Poison.Type.minor_para:
                                if (!Magic.SpellSavingThrow(aff.Level, ch, AttackType.DamageType.poison))
                                {
                                    ch.AffectStrip(Affect.AffectType.skill, "poison_weapon");
                                    af.Value = "poison";
                                    af.Type = Affect.AffectType.skill;
                                    af.Duration = MUDMath.NumberRange(1, 10);
                                    af.SetBitvector(Affect.AFFECT_MINOR_PARA);
                                    ch.AddAffect(af);
                                    ch.SendText("&+YYou are paralyzed!&n\r\n");
                                    StopFighting(ch, false);
                                    SocketConnection.Act("$n&n&+y is suddenly overcome with rigor and cannot move.&n",
                                        ch, null, null, SocketConnection.MessageTarget.room);
                                }
                                break;
                            case Poison.Type.minor_para_extended:
                                if (!Magic.SpellSavingThrow(aff.Level, ch, AttackType.DamageType.poison))
                                {
                                    ch.AffectStrip(Affect.AffectType.skill, "poison_weapon");
                                    af.Value = "poison";
                                    af.Type = Affect.AffectType.skill;
                                    af.Duration = MUDMath.NumberRange(5, 30);
                                    af.SetBitvector(Affect.AFFECT_MINOR_PARA);
                                    ch.AddAffect(af);
                                    ch.SendText("&+YYou are paralyzed!&n\r\n");
                                    StopFighting(ch, false);
                                    SocketConnection.Act("$n&n&+y is suddenly overcome with rigor and cannot move.&n",
                                        ch, null, null, SocketConnection.MessageTarget.room);
                                }
                                break;
                            case Poison.Type.major_para:
                                if (!Magic.SpellSavingThrow(aff.Level, ch, AttackType.DamageType.poison))
                                {
                                    ch.AffectStrip(Affect.AffectType.skill, "poison_weapon");
                                    af.Value = "poison";
                                    af.Type = Affect.AffectType.skill;
                                    af.Duration = MUDMath.NumberRange(1, 10);
                                    af.SetBitvector(Affect.AFFECT_HOLD);
//.........这里部分代码省略.........
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:101,代码来源:Combat.cs


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