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


C# CharData.SetPermRace方法代码示例

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


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

示例1: CreateMobile

        /// <summary>
        /// Create an instance of a mobile from the provided template.
        /// </summary>
        /// <param name="mobTemplate"></param>
        /// <returns></returns>
        public static CharData CreateMobile( MobTemplate mobTemplate )
        {
            int count;

            if( !mobTemplate )
            {
                Log.Error("CreateMobile: null MobTemplate.", 0);
                throw new NullReferenceException();
            }

            CharData mob = new CharData();

            mob.MobileTemplate = mobTemplate;
            mob.Followers = null;
            mob.Name = mobTemplate.PlayerName;
            mob.ShortDescription = mobTemplate.ShortDescription;
            mob.FullDescription = mobTemplate.FullDescription;
            mob.Description = mobTemplate.Description;
            mob.SpecialFunction = mobTemplate.SpecFun;
            mob.SpecialFunctionNames = mobTemplate.SpecFunNames;
            mob.CharacterClass = mobTemplate.CharacterClass;
            mob.Level = MUDMath.FuzzyNumber( mobTemplate.Level );
            mob.ActionFlags = mobTemplate.ActionFlags;
            mob.CurrentPosition = mobTemplate.DefaultPosition;
            mob.ChatterBotName = mobTemplate.ChatterBotName;
            // TODO: Look up the chatter bot name and load a runtime bot into the variable.
            mob.ChatBot = null;
            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 = 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
//.........这里部分代码省略.........
开发者ID:ramseur,项目名称:ModernMUD,代码行数:101,代码来源:Database.cs

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

示例3: KillingBlow

        /// <summary>
        /// Deliver a killing blow to the victim.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="victim"></param>
        public static void KillingBlow( CharData ch, CharData victim )
        {
            Event eventdata;
            Room room;
            bool noCorpse = false;

            StopFighting( victim, true );

            if( victim.GroupLeader || victim.NextInGroup )
            {
                victim.RemoveFromGroup( victim );
            }
            if( ch != victim )
            {
                if( victim.IsNPC() && victim.MobileTemplate.DeathFun.Count > 0 )
                {
                    victim.MobileTemplate.DeathFun[0].SpecFunction( victim, MobFun.PROC_NORMAL );
                }
                //        prog_death_trigger( victim );
            }
            if( victim.IsNPC() && victim.DeathFunction != null )
            {
                noCorpse = victim.DeathFunction.SpecFunction( victim, MobFun.PROC_DEATH );
            }
            if( !noCorpse )
            {
                MakeCorpse( victim );
            }

            /* Strip all event-spells from victim! */
            for( int i = (Database.EventList.Count - 1); i >= 0; i-- )
            {
                eventdata = Database.EventList[i];

                if( eventdata.Type == Event.EventType.immolate || eventdata.Type == Event.EventType.acid_arrow )
                {
                    if( (CharData)eventdata.Target2 == victim )
                    {
                        Database.EventList.Remove( eventdata );
                    }
                }
            }

            if( victim.Rider )
            {
                SocketConnection.Act( "$n&n dies suddenly, and you topple to the &n&+yground&n.", victim, null, victim.Rider, SocketConnection.MessageTarget.victim );
                victim.Rider.Riding = null;
                victim.Rider.CurrentPosition = Position.resting;
                victim.Rider = null;
            }

            if( victim.Riding )
            {
                SocketConnection.Act( "$n&n topples from you, &+Ldead&n.", victim, null, victim.Riding, SocketConnection.MessageTarget.victim );
                victim.Riding.Rider = null;
                victim.Riding = null;
            }

            if (!victim.IsNPC() && victim.IsAffected(Affect.AFFECT_VAMP_BITE))
            {
                victim.SetPermRace( Race.RACE_VAMPIRE );
            }

            for (int i = (victim.Affected.Count - 1); i >= 0; i--)
            {
                /* Keep the ghoul affect */
                if (!victim.IsNPC() && victim.IsAffected(Affect.AFFECT_WRAITHFORM))
                {
                    continue;
                }

                victim.RemoveAffect(victim.Affected[i]);
            }

            if( victim.IsNPC() )
            {
                victim.MobileTemplate.NumberKilled++;
                // This may invalidate the char list.
                CharData.ExtractChar( victim, true );
                return;
            }
            CharData.ExtractChar( victim, false );
            //save corpses, don't wait til next save_corpse event
            Database.CorpseList.Save();
            // Character has died in combat, extract them to repop point and put
            // them at the menu.
            /*
                 * Pardon crimes once justice system is complete
                 */
            // This is where we send them to the menu.
            victim.DieFollower( victim.Name );

            if( victim.InRoom )
            {
                room = victim.InRoom;
//.........这里部分代码省略.........
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:101,代码来源:Combat.cs

示例4: SendDamageMessage


//.........这里部分代码省略.........
                {
                    vp1 = "maims";
                }
                else if( damage <= 30 )
                {
                    vp1 = "mutilates";
                }
                else if( damage <= 40 )
                {
                    vp1 = "disembowels";
                }
                else if( damage <= 50 )
                {
                    vp1 = "eviscerates";
                }
                else if( damage <= 75 )
                {
                    vp1 = "enshrouds";
                    vp2 = " in a mist of blood";
                }
                else
                {
                    vp1 = "beats the crap out of";
                }
            }

            string punct = ( damage <= 40 ) ? "." : "!";

            if (skill == "barehanded fighting")
            {
                if( ch.GetRace() >= Race.RaceList.Length )
                {
                    Log.Error( "SendDamageMessage:  {0} invalid race", ch.GetRace() );
                    ch.SetPermRace( 0 );
                }

                attack = Race.RaceList[ ch.GetRace() ].DamageMessage;

                buf1 = String.Format( "Your{0} {1} {2} $N&n{3}{4}", adjective, attack, vp1, vp2, punct );
                buf2 = String.Format("$n&n's{0} {1} {2} you{3}{4}", adjective, attack, vp1, vp2, punct);
                buf3 = String.Format("$n&n's{0} {1} {2} $N&n{3}{4}", adjective, attack, vp1, vp2, punct);
                buf4 = String.Format("You{0} {1} {2} yourself{3}{4}", adjective, attack, vp1, vp2, punct);
                buf5 = String.Format("$n&n's{0} {1} {2} $m{3}{4}", adjective, attack, vp1, vp2, punct);
            }
            else
            {
                if (!String.IsNullOrEmpty(skill))
                    attack = Skill.SkillList[skill].DamageText;
                else
                {
                    string buf = String.Format( "SendDamageMessage: bad damage type {0} for {1} damage caused by {2} to {3} with weapon {4}.",
                                                skill,
                                                damage,
                                                ch.Name,
                                                victim.Name,
                                                weapon );
                    Log.Error( buf, 0 );
                    skill = "barehanded fighting";
                    attack = AttackType.Table[ 0 ].Name;
                }

                if( immune )
                {
                    buf1 = String.Format("$N&n seems unaffected by your {0}!", attack);
                    buf2 = String.Format("$n&n's {0} seems powerless against you.", attack);
                    buf3 = String.Format("$N&n seems unaffected by $n&n's {0}!", attack);
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:67,代码来源:Combat.cs

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


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