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


C# CharData.GetMaxHit方法代码示例

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


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

示例1: Report

        /// <summary>
        /// Reports current condition verbally.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Report(CharData ch, string[] str)
        {
            string arg = String.Empty;

            if (ch == null)
            {
                Log.Error("Commandreport: null ch.", 0);
                return;
            }

            if (!ch.CanSpeak())
            {
                ch.SendText("Your lips move but no sound comes out.\r\n");
                return;
            }

            string buf = String.Empty;
            if (str.Length == 0)
            {
                buf += "&nYou report: " + ch.Hitpoints + "/" + ch.GetMaxHit() + " hp " + ch.CurrentMana + "/" +
                       ch.MaxMana + " mana " + ch.CurrentMoves + "/" + ch.MaxMoves + " mv.\r\n";
                ch.SendText(buf);

                buf += "$n&n reports: " + ch.Hitpoints + "/" + ch.GetMaxHit() + " hp " + ch.CurrentMana + "/" +
                       ch.MaxMana + " mana " + ch.CurrentMoves + "/" + ch.MaxMoves + " mv.\r\n";
                SocketConnection.Act(buf, ch, null, null, SocketConnection.MessageTarget.room);
                return;
            }
            //report is essentially a tell, why not use that code?

            buf += arg + " reporting: " + ch.Hitpoints + "/" + ch.GetMaxHit() + " hp " + ch.CurrentMana + "/" +
                   ch.MaxMana + " mana " + ch.CurrentMoves + "/" + ch.MaxMoves + " mv.\r\n";
            CommandType.Interpret(ch, "tell " + buf);
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:40,代码来源:Command.cs

示例2: Score

        /// <summary>
        /// Shows a character's score screen.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Score(CharData ch, string[] str)
        {
            if( ch == null ) return;

            string text = String.Empty;

            if (ch == null)
            {
                Log.Error("Command.Score(): null ch.", 0);
                return;
            }

            Affect prev;

            text += "&+WName: &+G" + ch.Name + "&n" + (ch.IsNPC() ? String.Empty : ((PC)ch).Title) + "\r\n";
            text += "&+WRace:&n " + MUDString.PadStr(Race.RaceList[ch.GetRace()].ColorName, 16);
            text += "&+WClass:&n " + MUDString.PadStr(ch.CharacterClass.WholistName, 32) + "&n\r\n";
            text += "&+WLevel: " + MUDString.PadInt(ch.Level, 5) + "     Played: " + (ch.TimePlayed.Hours) + " hours       &+WSex: ";
            text += System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(ch.GetSexString()) + "\r\n";
            if (ch.Fighting == null)
            {
                text += "&+WExperience: &+B" + StringConversion.ExperienceString(ch) + "&n\r\n\r\n";
            }
            text += "&+WCurrent/Max Health: [&n&+g" + MUDString.PadInt(ch.Hitpoints, 5) + "&+W / &n&+g" + MUDString.PadInt(ch.GetMaxHit(), 5);
            text += "&+W]     Coins:     Carried     In Bank\r\n";
            text += "&+WCurrent/Max Moves:  [&n&+g" + MUDString.PadInt(ch.CurrentMoves, 5) + "&+W / &n&+g" + MUDString.PadInt(ch.MaxMoves, 5);
            text += "&+W]     &+WPlatinum      " + MUDString.PadInt(ch.GetPlatinum(), 5) + "        ";
            text += (ch.IsNPC() ? 0 : ((PC)ch).Bank.Platinum) + "\r\n";
            text += "Current/Max Mana:   [&n&+g" + MUDString.PadInt(ch.CurrentMana, 5) + "&+W / &n&+g" + MUDString.PadInt(ch.MaxMana, 5);
            text += "&+W]     &+YGold          " + MUDString.PadInt(ch.GetGold(), 5) + "        " + (ch.IsNPC() ? 0 : ((PC)ch).Bank.Gold) + "\r\n";
            text += "                                        &n&+wSilver        " + MUDString.PadInt(ch.GetSilver(), 5) + "        ";
            text += (ch.IsNPC() ? 0 : ((PC)ch).Bank.Silver) + "\r\n";
            text += "&+WFrags: &+W" + MUDString.PadInt((ch.IsNPC() ? 0 : ((PC)ch).Frags), 3) + "&n                               &n&+yCopper        ";
            text += MUDString.PadInt(ch.GetCopper(), 5) + "        " + (ch.IsNPC() ? 0 : ((PC)ch).Bank.Copper) + "\r\n";
            if (!ch.IsNPC())
            {
                text += "&+WTotal Deaths: &+W" + MUDString.PadInt(((PC)ch).MobDeaths + ((PC)ch).PlayerDeaths, 5) + "&n     &+WMobs Killed: &+W";
                text += MUDString.PadInt(((PC)ch).MobKills, 5) + "&n\r\n&+WPlayers Killed: &+W" + MUDString.PadInt(((PC)ch).PlayerKills, 5);
                text += "&n   &+WPlayer Deaths: &+W" + MUDString.PadInt(((PC)ch).PlayerDeaths, 5) + "&n\r\n";
            }

            if (!ch.IsNPC())
            {
                int divisor = ((PC)ch).Created.Quantity;
                if (divisor == 0)
                    divisor = 1;
                text += String.Format("&+WItems Created: &n{0}    &+WTotal Value: &n{1}  &+WBest: &n{2}  &+WAvg: &n{3}\r\n",
                    MUDString.PadInt(((PC)ch).Created.Quantity, 5),
                    MUDString.PadInt(((PC)ch).Created.TotalCost, 5),
                    MUDString.PadInt(((PC)ch).Created.MaxCost, 5),
                    MUDString.PadInt((((PC)ch).Created.TotalCost / divisor), 5));
                divisor = ((PC)ch).Destroyed.Quantity;
                if (divisor == 0)
                    divisor = 1;
                text += String.Format("&+WItems Destroyed: &n{0}  &+WTotal Value: &n{1}  &+WBest: &n{2}  &+WAvg: &n{3}\r\n",
                    MUDString.PadInt(((PC)ch).Destroyed.Quantity, 5),
                    MUDString.PadInt(((PC)ch).Destroyed.TotalCost, 5),
                    MUDString.PadInt(((PC)ch).Destroyed.MaxCost, 5),
                    MUDString.PadInt((((PC)ch).Destroyed.TotalCost / divisor), 5));
            }

            if (!ch.IsNPC())
            {
                text += "&+WTotal Score: &+W" + ((PC)ch).Score + "&n\r\n";
            }

            if (ch.IsClass(CharClass.Names.monk) || ch.IsClass(CharClass.Names.mystic))
            {
                text += "&+WTradition: &+B" + TraditionData.Names[((PC)ch).Tradition] + "&n\r\n";
                text += "&+WTraining Points: &+B" + (ch.IsNPC() ? 0 : ((PC)ch).SkillPoints) + "&n\r\n";
            }

            if (ch.Followers != null && ch.Followers.Count > 0)
            {
                text += "&+BFollowers:&n\r\n";
                foreach (CharData follower in ch.Followers)
                {
                    if (follower == null)
                    {
                        continue;
                    }
                    text += follower.ShowNameTo(ch, true) + " &n\r\n";
                }
                text += "\r\n";
            }
            if (ch.IsAffected( Affect.AFFECT_POISON))
            {
                text += "&+GYou are poisoned.&n\r\n";
            }

            if ((ch.IsAffected( Affect.AFFECT_DETECT_MAGIC) || ch.IsImmortal())
                    && MUDString.StringsNotEqual(BitvectorFlagType.AffectString(ch.AffectedBy, true), "none"))
            {
                text += "&+BEnchantments: &+W" + BitvectorFlagType.AffectString(ch.AffectedBy, true) + "&n\r\n\r\n";
            }
//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Command.cs

示例3: ConditionString

        /// <summary>
        /// Builds a condition string for a player.
        /// </summary>
        /// <param name="ch"></param>
        /// <returns></returns>
        public static string ConditionString( CharData ch )
        {
            int percent;

            if( ch.GetMaxHit() > 0 )
                percent = ( 100 * ch.Hitpoints ) / ch.GetMaxHit();
            else
                percent = -1;

            if( percent >= 100 )
                return "&+gexcellent&n";
            if( percent >= 90 )
                return "&+ybarely &n&+gscratched&n";
            if( percent >= 79 )
                return "&+yslightly&+L &n&+gbruised&n";
            if( percent >= 69 )
                return "&+ylightly wounded&n";
            if( percent >= 58 )
                return "&+ymoderately &n&+mwou&+rnded&n";
            if( percent >= 48 )
                return "&+mseverely &n&+rwo&n&+yu&+rn&+yde&n&+rd&n";
            if( percent >= 37 )
                return "&n&+rbleeding&+y copiously&n";
            if( percent >= 27 )
                return "&+rbadly &n&+rwo&+Ru&n&+rn&+Rded&n";
            if( percent >= 16 )
                return "&+yin &n&+R awful shape&n";
            if( ch.Hitpoints > -3 )
                return "&+Rnearly&+L &n&+rdead&n";
            if( ch.Hitpoints > -5 )
                return "&+Lincapacitated, and &+Rbl&n&+re&+Re&n&+rdi&+Rn&n&+rg&+L to death&n";
            if( ch.Hitpoints >= -10 )
                return "&+rmortally &+Rw&n&+rou&+Rnd&N&+re&+Rd&n";
            return "&+Wdead&n";
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:40,代码来源:SocketConnection.cs

示例4: Aggressive

        /// <summary>
        /// Command to set your level of aggressiveness.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="str"></param>
        public static void Aggressive(CharData ch, string[] str)
        {
            if( ch == null ) return;

            string arg1 = String.Empty;

            if (ch.IsNPC())
                return;
            if (ch.IsClass(CharClass.Names.paladin))
            {
                ch.SendText("Your beliefs prevent you from acting in such a manner.\r\n");
                return;
            }

            if (arg1.Length > 0)
            {
                if (MUDString.NameContainedIn("off", arg1) || MUDString.NameContainedIn("none", arg1))
                {
                    ((PC)ch).AggressiveLevel = -1;
                }
                else
                {
                    int aggr;
                    Int32.TryParse(arg1, out aggr);
                    if (aggr < -1 || aggr > ch.GetMaxHit())
                    {
                        ch.SendText("Value out of range.\r\n");
                        return;
                    }
                    ((PC)ch).AggressiveLevel = aggr;
                }
            }
            string buf;
            if (((PC)ch).AggressiveLevel == -1)
            {
                buf = "You are not aggressive.\r\n";
            }
            else
            {
                buf = "You are aggressive to creatures if hit points above " + ((PC)ch).AggressiveLevel + ".\r\n";
            }
            ch.SendText(buf);
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:49,代码来源:Command.cs

示例5: Drink


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

示例6: CreateCharacterFromObject

        /// <summary>
        /// Creates a character based on an object. Used for animate-object-type spells.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public CharData CreateCharacterFromObject( ref Object obj )
        {
            int count;

            MobTemplate mobTemplate = Database.GetMobTemplate( StaticMobs.MOB_NUMBER_OBJECT );
            if( !mobTemplate )
            {
                Log.Error( "CreateCharacterFromObject: null object template.", 0 );
                return null;
            }

            CharData mob = new CharData();

            mob.MobileTemplate = mobTemplate;
            mob.Name = obj._name;
            mob.ShortDescription = obj._shortDescription;
            mob.FullDescription = obj._fullDescription;
            mob.Description = obj._fullDescription;
            mob.CharacterClass = mobTemplate.CharacterClass;
            mob.Level = Math.Max( obj._level, 1 );
            mob.ActionFlags = mobTemplate.ActionFlags;
            mob.CurrentPosition = mobTemplate.DefaultPosition;
            for( count = 0; count < Limits.NUM_AFFECT_VECTORS; ++count )
            {
                mob.AffectedBy[ count ] = mobTemplate.AffectedBy[ count ];
            }
            mob.Alignment = mobTemplate.Alignment;
            mob.Gender = mobTemplate.Gender;
            mob.SetPermRace( mobTemplate.Race );
            mob.CurrentSize = Race.RaceList[ mob.GetRace() ].DefaultSize;
            if (mob.HasActionBit(MobTemplate.ACT_SIZEMINUS))
                mob.CurrentSize--;
            if (mob.HasActionBit(MobTemplate.ACT_SIZEPLUS))
                mob.CurrentSize++;

            mob.CastingSpell = 0;
            mob.CastingTime = 0;
            mob.PermStrength = 55;
            mob.PermIntelligence = 55;
            mob.PermWisdom = 55;
            mob.PermDexterity = 55;
            mob.PermConstitution = 55;
            mob.PermAgility = 55;
            mob.PermCharisma = 55;
            mob.PermPower = 55;
            mob.PermLuck = 55;
            mob.ModifiedStrength = 0;
            mob.ModifiedIntelligence = 0;
            mob.ModifiedWisdom = 0;
            mob.ModifiedDexterity = 0;
            mob.ModifiedConstitution = 0;
            mob.ModifiedAgility = 0;
            mob.ModifiedCharisma = 0;
            mob.ModifiedPower = 0;
            mob.ModifiedLuck = 0;
            mob.Resistant = mobTemplate.Resistant;
            mob.Immune = mobTemplate.Immune;
            mob.Susceptible = mobTemplate.Susceptible;
            mob.Vulnerable = mobTemplate.Vulnerable;
            mob.SetCoins( 0, 0, 0, 0 );
            mob.ArmorPoints = MUDMath.Interpolate( mob.Level, 100, -100 );

            // * MOB HITPOINTS *
            //
            // Was level d 8, upped it to level d 13
            // considering mobs *still* won't have as many hitpoints as some players until
            // at least lvl 10, this shouldn't be too big an upgrade.
            //
            // Mob hitpoints are not based on constitution *unless* they have a
            // constitution modifier from an item, spell, or other affect

            mob.MaxHitpoints = mob.Level * 100;
            mob.Hitpoints = mob.GetMaxHit();

            /*
            * Insert in list.
            */
            Database.CharList.Add( mob );
            // Increment in-game count of mob.
            mobTemplate.NumActive++;
            mob.AddToRoom( obj._inRoom );
            return mob;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:88,代码来源:Object.cs

示例7: ConditionMeter

        /// <summary>
        /// Builds condition meter of style #1 for a player.
        /// </summary>
        /// <param name="ch"></param>
        /// <returns></returns>
        static string ConditionMeter( CharData ch )
        {
            int percent;

            if( ch.GetMaxHit() > 0 )
                percent = ( 100 * ch.Hitpoints ) / ch.GetMaxHit();
            else
                percent = -1;

            if( percent >= 100 )
                return "&+L(&n&+c=&+C-&n&+c=&+C-&n&+c=&+C-&n&+c=&+C-&n&+c=&+C-&+L)&n";
            if( percent >= 90 )
                return "&+L(&+C-&n&+c=&+C-&n&+c=&+C-&n&+c=&+C-&n&+c=&+C-&+R=&+L)&n";
            if( percent >= 79 )
                return "&+L(&n&+c=&+C-&n&+c=&+C-&n&+c=&+C-&n&+c=&+C-&+R=&n&+r-&+L)&n";
            if( percent >= 69 )
                return "&+L(&+C-&n&+c=&+C-&n&+c=&+C-&n&+c=&+C-&+R=&n&+r-&+R=&+L)&n";
            if( percent >= 58 )
                return "&+L(&n&+c=&+C-&n&+c=&+C-&n&+c=&+C-&+R=&n&+r-&+R=&n&+r-&+L)&n";
            if( percent >= 48 )
                return "&+L(&+C-&n&+c=&+C-&n&+c=&+C-&+R=&n&+r-&+R=&n&+r-&+R=&+L)&n";
            if( percent >= 37 )
                return "&+L(&n&+c=&+C-&n&+c=&+C-&+R=&n&+r-&+R=&n&+r-&+R=&n&+r-&+L)&n";
            if( percent >= 27 )
                return "&+L(&+C-&n&+c=&+C-&+R=&n&+r-&+R=&n&+r-&+R=&n&+r-&+R=&+L)&n";
            if( percent >= 16 )
                return "&+L(&n&+c=&+C-&+R=&n&+r-&+R=&n&+r-&+R=&n&+r-&+R=&n&+r-&+L)&n";
            if( percent >= 6 )
                return "&+L(&+C-&+R=&n&+r-&+R=&n&+r-&+R=&n&+r-&+R=&n&+r-&+R=&+L)&n";
            return "&+L(&+R=&n&+r-&+R=&n&+r-&+R=&n&+r-&+R=&n&+r-&+R=&n&+r-&+L)&n";
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:36,代码来源:SocketConnection.cs

示例8: Wimpy

        public static void Wimpy(CharData ch, string[] str)
        {
            if( ch == null ) return;

            int wimpy;

            if (str.Length == 0)
            {
                wimpy = ch.Wimpy;
            }
            else
            {
                Int32.TryParse(str[0], out wimpy);
            }

            if (wimpy < 0)
            {
                ch.SendText("&nYour courage exceeds your wisdom.\r\n");
                return;
            }

            if (wimpy > ch.GetMaxHit())
            {
                ch.SendText("&nSuch cowardice ill becomes you.\r\n");
                return;
            }

            ch.Wimpy = wimpy;
            string text = String.Format("&nWimpy set to {0} hit points.\r\n", wimpy);
            ch.SendText(text);
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:32,代码来源:Command.cs

示例9: InflictSpellDamage


//.........这里部分代码省略.........

            /*
            * Hurt the victim.
            * Inform the victim of his new state.
            */
            if( !( victim.GetRace() == Race.RACE_FIRE_ELE && damType == AttackType.DamageType.fire )
                    && !( victim.GetRace() == Race.RACE_WATER_ELE && damType == AttackType.DamageType.water )
                    && !( victim.GetRace() == Race.RACE_EARTH_ELE && damType == AttackType.DamageType.earth )
                    && !( victim.GetRace() == Race.RACE_AIR_ELE && damType == AttackType.DamageType.wind ) )
            {
                /* Added damage exp! */
                // chance added because people level faster and faster as they get higher level...
                // you can now only get damage exp on mobs that con easy or better
                // and there's only a 25% chance per hit of you evern being eligible for damage exp.
                if( MUDMath.NumberPercent() < 25 && victim.Level >= ( ch.Level - 3 ) )
                    ch.GainExperience( Math.Max( 1, dam / 20 ) );
                victim.Hitpoints -= dam;
            }
            else
            {
                string attack;

                if( spell != null && spell != Spell.SpellList["none"] )
                    attack = spell.Name;
                else
                    attack = "it";

                SocketConnection.Act( "$N&n absorbs your $t!", ch, attack, victim, SocketConnection.MessageTarget.character );
                SocketConnection.Act( "You absorb $n&n's $t!", ch, attack, victim, SocketConnection.MessageTarget.victim );
                SocketConnection.Act( "$N&n absorbs $n&n's $t", ch, attack, victim, SocketConnection.MessageTarget.room_vict );
                if( ch.IsImmortal() )
                {
                    string buf4 = String.Format( "You healed {0} damage.",
                                                 victim.GetMaxHit() >= dam + victim.Hitpoints ? dam : victim.GetMaxHit() - victim.Hitpoints );
                    ch.SendText( buf4 );
                }

                victim.Hitpoints = Math.Min( victim.GetMaxHit(), victim.Hitpoints + dam );

                return false;
            }

            if( !victim.IsNPC()
                    && victim.Level >= Limits.LEVEL_AVATAR
                    && victim.Hitpoints < 1 )
                victim.Hitpoints = 1;

            if (victim.IsAffected(Affect.AFFECT_BERZERK)
                    && victim.CurrentPosition <= Position.stunned )
                victim.RemoveAffect(Affect.AFFECT_BERZERK);

            victim.UpdatePosition();

            switch( victim.CurrentPosition )
            {
                case Position.mortally_wounded:
                    victim.SendText(
                        "&+LYou are &+Rmo&n&+rr&+Rt&n&+ral&+Rl&n&+ry&+L wounded, and will die soon, if not aided.&n\r\n" );
                    SocketConnection.Act( "$n&+L is &+Rmo&n&+rr&+Rt&n&+ral&+Rl&n&+ry&+L wounded, and will die soon, if not aided.&n",
                         victim, null, null, SocketConnection.MessageTarget.room, true );
                    StopNotVicious( victim );
                    break;

                case Position.incapacitated:
                    victim.SendText(
                        "&+LYou are incapacitated and will slowly &n&+rbl&+Re&n&+re&+Rd&+L to death, if not aided.\r\n" );
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:67,代码来源:Combat.cs

示例10: CreateMobile


//.........这里部分代码省略.........
            mob.CurrentSize = Race.RaceList[ mob.GetRace() ].DefaultSize;
            if (mob.HasActionBit(MobTemplate.ACT_SIZEMINUS))
                mob.CurrentSize--;
            if (mob.HasActionBit(MobTemplate.ACT_SIZEPLUS))
                mob.CurrentSize++;

            mob.CastingSpell = 0;
            mob.CastingTime = 0;
            mob.PermStrength = MUDMath.Dice( 2, 46 ) + 8;
            mob.PermIntelligence = MUDMath.Dice( 2, 46 ) + 8;
            mob.PermWisdom = MUDMath.Dice( 2, 46 ) + 8;
            mob.PermDexterity = MUDMath.Dice( 2, 46 ) + 8;
            mob.PermConstitution = MUDMath.Dice( 2, 46 ) + 7;
            mob.PermAgility = MUDMath.Dice( 2, 46 ) + 8;
            mob.PermCharisma = MUDMath.Dice( 2, 46 ) + 8;
            mob.PermPower = MUDMath.Dice( 2, 46 ) + 8;
            mob.PermLuck = MUDMath.Dice( 2, 46 ) + 8;
            mob.ModifiedStrength = 0;
            mob.ModifiedIntelligence = 0;
            mob.ModifiedWisdom = 0;
            mob.ModifiedDexterity = 0;
            mob.ModifiedConstitution = 0;
            mob.ModifiedAgility = 0;
            mob.ModifiedCharisma = 0;
            mob.ModifiedPower = 0;
            mob.ModifiedLuck = 0;
            mob.Resistant = mobTemplate.Resistant;
            mob.Immune = mobTemplate.Immune;
            mob.Susceptible = mobTemplate.Susceptible;
            mob.Vulnerable = mobTemplate.Vulnerable;
            mob.MaxMana = mob.Level * 10;
            if( Race.RaceList[mobTemplate.Race].Coins )
            {
                int level = mobTemplate.Level;
                mob.ReceiveCopper( MUDMath.Dice( 12, level ) / 32 );
                mob.ReceiveSilver( MUDMath.Dice( 9, level ) / 32 );
                mob.ReceiveGold( MUDMath.Dice( 5, level ) / 32 );
                mob.ReceivePlatinum( MUDMath.Dice( 2, level ) / 32 );
            }
            else
            {
                mob.SetCoins( 0, 0, 0, 0 );
            }
            mob.ArmorPoints = MUDMath.Interpolate( mob.Level, 100, -100 );

            // * MOB HITPOINTS *
            //
            // Was level d 8, upped it to level d 13
            // considering mobs *still* won't have as many hitpoints as some players until
            // at least level 10, this shouldn't be too big an upgrade.
            //
            // Mob hitpoints are not based on constitution *unless* they have a
            // constitution modifier from an item, spell, or other affect

            // In light of recent player dissatisfaction with the
            // mob hitpoints, I'm implementing a log curve, using
            //  hp = exp( 2.15135 + level*0.151231)
            // This will will result in the following hp matrix:
            //     Level    Hitpoints
            //      20        175
            //      30        803
            //      40        3643
            //      50        16528
            //      55        35207
            //      60        75000
            mob.MaxHitpoints = MUDMath.Dice( mob.Level, 13 ) + 1;
            // Mob hps are non-linear above level 10.
            if( mob.Level > 20 )
            {
                int upper = (int)Math.Exp( 1.85 + mob.Level * 0.151231 );
                int lower = (int)Math.Exp( 1.80 + mob.Level * 0.151231 );
                mob.MaxHitpoints += MUDMath.NumberRange( lower, upper );
            }
            else if (mob.Level > 10)
            {
                mob.MaxHitpoints += MUDMath.NumberRange(mob.Level * 2, ((mob.Level - 8) ^ 2 * mob.Level) / 2);
            }

            // Demons/devils/dragons gain an extra 30 hitpoints per level (+1500 at lvl 50).
            if (mob.GetRace() == Race.RACE_DEMON || mob.GetRace() == Race.RACE_DEVIL || mob.GetRace() == Race.RACE_DRAGON)
            {
                mob.MaxHitpoints += (mob.Level * 30);
            }

            mob.Hitpoints = mob.GetMaxHit();

            // Horses get more moves, necessary for mounts.
            if(Race.RaceList[ mob.GetRace() ].Name.Equals( "Horse", StringComparison.CurrentCultureIgnoreCase ))
            {
                mob.MaxMoves = 290 + MUDMath.Dice( 4, 5 );
                mob.CurrentMoves = mob.MaxMoves;
            }
            mob.LoadRoomIndexNumber = 0;

            // Insert in list.
            CharList.Add( mob );
            // Increment count of in-game instances of mob.
            mobTemplate.NumActive++;
            return mob;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Database.cs

示例11: InflictDamage


//.........这里部分代码省略.........
                else
                    dam -= dam / 5;
            }

            // Check for protection spells that give 25% damage reduction - Xangis
            if (damType == AttackType.DamageType.fire && victim.IsAffected( Affect.AFFECT_PROTECT_FIRE))
                dam = ( dam * 3 ) / 4;
            else if (damType == AttackType.DamageType.cold && victim.IsAffected( Affect.AFFECT_PROTECT_COLD))
                dam = ( dam * 3 ) / 4;
            else if (damType == AttackType.DamageType.acid && victim.IsAffected( Affect.AFFECT_PROTECT_ACID))
                dam = ( dam * 3 ) / 4;
            else if (damType == AttackType.DamageType.gas && victim.IsAffected( Affect.AFFECT_PROTECT_GAS))
                dam = ( dam * 3 ) / 4;
            else if (damType == AttackType.DamageType.electricity && victim.IsAffected( Affect.AFFECT_PROTECT_LIGHTNING))
                dam = ( dam * 3 ) / 4;

            // Barkskin protects from 8% of slash and 12% of pierce damage.
            if (victim.IsAffected( Affect.AFFECT_BARKSKIN))
            {
                if (skill == "1h slashing" || skill == "2h slashing")
                    dam = dam * 11 / 12;
                else if (skill == "1h piercing" || skill == "2h piercing")
                    dam = dam * 7 / 8;
            }

            // Check for vampiric touch for anti-paladins and vampires
            if( weapon == ObjTemplate.WearLocation.hand_one || weapon == ObjTemplate.WearLocation.hand_two || weapon == ObjTemplate.WearLocation.hand_three || weapon == ObjTemplate.WearLocation.hand_four )
            {
                if( ( ( ch.IsClass(CharClass.Names.antipaladin) || ch.GetRace() == Race.RACE_VAMPIRE )
                        && skill == "barehanded fighting" && !Object.GetEquipmentOnCharacter(ch, weapon)) || (ch.IsAffected( Affect.AFFECT_VAMP_TOUCH)
                             && ( !( obj = Object.GetEquipmentOnCharacter( ch, weapon ) ) || obj.HasAffect( Affect.AFFECT_VAMP_TOUCH ) ) ) )
                {
                    ch.Hitpoints += dam / 3;
                    if( ch.Hitpoints > ( ch.GetMaxHit() + 50 + ch.Level * 5 ) )
                    {
                        ch.Hitpoints = ch.GetMaxHit() + 50 + ch.Level * 5;
                    }
                }
            }

            /* PC to PC damage quartered.
            *  NPC to PC damage divided by 3.
            */
            if( dam > 0 && !victim.IsNPC() && victim != ch )
            {
                if( !ch.IsNPC() )
                    dam /= 4;
                else
                    dam /= 3;
            }

            /*
            * Just a check for anything that is excessive damage
            * Send a log message, keeping the imms on their toes
            * Changed this from 300 to 250 'cause hitters get more than one
            *  attack/round and w/haste that's 1000 possible in the time one fist
            *  goes off.  That's more than the fist might do and it has to be
            *  memmed.
            */
            if (dam > 250 && skill != "backstab" )
            {
                string buf4;
                if (!string.IsNullOrEmpty(skill))
                {
                    buf4 = String.Format("Excessive damage: {0} attacking {1} for {2}, skill = {3}({4}).",
                              ch.Name, victim.Name, dam, Skill.SkillList[skill].DamageText, skill);
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:67,代码来源:Combat.cs

示例12: Restore

        public void Restore(CharData victim)
        {
            if (victim == null) return;

            if (victim.Hitpoints < victim.GetMaxHit())
                victim.Hitpoints = victim.GetMaxHit();
            victim.CurrentMana = victim.MaxMana;
            victim.CurrentMoves = victim.MaxMoves;
            if (!victim.IsNPC())
            {
                ((PC)victim).Hunger = 48;
                ((PC)victim).Thirst = 48;
                ((PC)victim).Drunk = 0;
                victim.PurgeInnateTimers();
            }
            if (victim.IsAffected(Affect.AFFECT_BLIND))
                victim.RemoveBlindness();
            if (victim.IsAffected(Affect.AFFECT_POISON))
                victim.RemovePoison();
            victim.UpdatePosition();
            SocketConnection.Act("$n has restored you.", this, null, victim, SocketConnection.MessageTarget.victim);
            return;
        }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:23,代码来源:CharData.cs

示例13: HitGain


//.........这里部分代码省略.........
            int gain;
            int percent = 0;

            if( ch == null )
            {
                Log.Error( "HitGain(): null ch", 0 );
                return 0;
            }

            // They aren't going to gain hits in a no heal room...
            if (ch.InRoom.HasFlag(RoomTemplate.ROOM_NO_HEAL))
            {
                return 0;
            }

            gain = 1;
            percent = 100;

            if (ch.CheckSkill("fast healing", PracticeType.none))
            {
                gain += 1;
            }
            if (MUDMath.NumberPercent() < 3)
            {
                ch.PracticeSkill("fast healing");
            }

            switch( ch.CurrentPosition )
            {
                case Position.sleeping:
                    gain += 3;
                    break;
                case Position.reclining:
                    gain += 2;
                    break;
                case Position.resting:
                    gain += 1;
                    break;
                case Position.fighting:
                    gain = 0;
                    break;
            }

            if( ch.HasInnate( Race.RACE_REGENERATE ) )
            {
                // Automatically one extra hp, two at level 30.
                gain += 1 + (ch.Level / 30);
                // One percent chance of gaining another per level.
                percent += (ch.Level);
            }

            // Hunger and thirst for PCs.
            if (!ch.IsNPC())
            {
                if (((PC)ch).Hunger == 0)
                {
                    gain /= 2;
                    gain -= 1;
                    percent -= 25;
                    ch.SendText("&nYou double over from &+Rhunger pains&n!\r\n");
                }

                if (((PC)ch).Thirst == 0)
                {
                    gain /= 2;
                    gain -= 1;
                    percent -= 25;
                    ch.SendText("&nYou suffer from severe &+cth&+Ci&n&+cr&+Cst&n!\r\n");
                }
            }

            if( ch.IsAffected( Affect.AFFECT_POISON ) )
            {
                gain /= 4;
                percent /= 2;
            }

            if( gain == 0 )
                if( MUDMath.NumberPercent() < percent )
                    gain = 1;

            // Heal rooms heal you a little quicker
            if (ch.InRoom.HasFlag(RoomTemplate.ROOM_HEAL))
            {
                gain += Math.Max(1, gain / 2);
            }

            if( ( ch.InRoom.TerrainType != TerrainType.underwater_has_ground
                    && ch.InRoom.TerrainType != TerrainType.unswimmable_water
                    && ch.InRoom.TerrainType != TerrainType.swimmable_water
                    && ch.HasInnate( Race.RACE_WATERBREATH )
                    && MUDString.StringsNotEqual( Race.RaceList[ ch.GetRace() ].Name, "Object" )
                    && ch.GetRace() != Race.RACE_GOD )
                    || ( ch.InRoom.TerrainType == TerrainType.underwater_has_ground
                         && ( !ch.IsImmortal() && !ch.IsAffected( Affect.AFFECT_BREATHE_UNDERWATER )
                              && !ch.HasInnate( Race.RACE_WATERBREATH ) ) ) )
                gain = 0;

            return Math.Min( gain, ch.GetMaxHit() - ch.Hitpoints );
        }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:101,代码来源:CharData.cs

示例14: ScribeScroll

        public static void ScribeScroll(CharData ch, string[] str)
        {
            if( ch == null ) return;

            Object scroll;
            Spell spell;

            if (String.IsNullOrEmpty(str[0]))
            {
                ch.SendText("Scribe what spell?\r\n");
                return;
            }

            if (!(scroll = Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_one)))
            {
                ch.SendText("You hold nothing in your hand.\r\n");
                return;
            }

            if (scroll.ItemType != ObjTemplate.ObjectType.scroll)
            {
                ch.SendText("You are not holding a &+Wparchment&n.\r\n");
                return;
            }

            if ((spell = StringLookup.SpellLookup(str[0])) == null)
            {
                ch.SendText("You don't know any spells by that _name.\r\n");
                return;
            }

            SocketConnection.Act("$n begins writing a &+Wscroll&n.", ch, scroll, null, SocketConnection.MessageTarget.room);
            ch.WaitState(Skill.SkillList["Scribe"].Delay);

            ch.PracticeSkill("Scribe");

            if (!ch.IsNPC()
                    && (MUDMath.NumberPercent() > ((PC)ch).SkillAptitude["brew"] ||
                         MUDMath.NumberPercent() > ((ch.GetCurrInt() - 13) * 5 +
                                               (ch.GetCurrWis() - 13) * 3)))
            {
                SocketConnection.Act("$p&n bursts in &n&+rflames&n!", ch, scroll, null, SocketConnection.MessageTarget.character);
                SocketConnection.Act("$p&n bursts in &+Rflames&n!", ch, scroll, null, SocketConnection.MessageTarget.room);
                scroll.RemoveFromWorld();
                Combat.InflictDamage(ch, ch, ch.GetMaxHit(), "Scribe", ObjTemplate.WearLocation.none, AttackType.DamageType.fire);
                return;
            }

            scroll.Level = ch.Level * 2 / 3;
            scroll.Values[0] = ch.Level / 3;
            ch.ImprintSpell(spell, ch.Level, scroll);
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:53,代码来源:Command.cs

示例15: ConditionMeter2

        /// <summary>
        /// Builds a condition meter of style #2 for a player.
        /// </summary>
        /// <param name="ch"></param>
        /// <returns></returns>
        static string ConditionMeter2( CharData ch )
        {
            if (ch == null) return String.Empty;
            int percent;

            if( ch.GetMaxHit() > 0 )
                percent = ( 100 * ch.Hitpoints ) / ch.GetMaxHit();
            else
                percent = -1;

            if( percent >= 100 )
                return "&+L(&+r+++&+y++&+Y++&n&+g+++&+L)&n";
            if( percent >= 90 )
                return "&+L(&+r+++&+y++&+Y++&n&+g++&+L-&+L)&n";
            if( percent >= 79 )
                return "&+L(&+r+++&+y++&+Y++&n&+g+&+L--&+L)&n";
            if( percent >= 69 )
                return "&+L(&+r+++&+y++&+Y++&+L---&+L)&n";
            if( percent >= 58 )
                return "&+L(&+r+++&+y++&+Y+&+L----&+L)&n";
            if( percent >= 48 )
                return "&+L(&+r+++&+y++&+L-----&+L)&n";
            if( percent >= 37 )
                return "&+L(&+r+++&+y+&+L------&+L)&n";
            if( percent >= 27 )
                return "&+L(&+r+++&+L-------&+L)&n";
            if( percent >= 16 )
                return "&+L(&+r++&+L--------&+L)&n";
            if( percent >= 6 )
                return "&+L(&+r+&+L---------&+L)&n";
            return "&+L(&+L----------&+L)&n";
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:37,代码来源:SocketConnection.cs


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