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


C# CharData.CheckRIS方法代码示例

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


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

示例1: InflictSpellDamage


//.........这里部分代码省略.........
                        && !( 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 ) )
                    StopFighting( victim, true );

                /*
                * Hunting stuff...
                */
                if( dam != 0 && victim.IsNPC()
                        && !( 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 ) )
                {
                    StartGrudge( victim, ch, false );
                }

                /*
                * Damage modifiers.
                */
                if (victim.IsAffected( Affect.AFFECT_SANCTUARY))
                    dam /= 2;

                if ((victim.IsAffected( Affect.AFFECT_PROTECT_EVIL)) && ch.IsEvil())
                    dam -= dam / 8;
                else if ((victim.IsAffected( Affect.AFFECT_PROTECT_GOOD)) && ch.IsGood())
                    dam -= dam / 8;

                if( dam < 0 )
                    dam = 0;
            }

            switch( victim.CheckRIS( damType ) )
            {
                case Race.ResistanceType.resistant:
                    dam -= dam / 3;
                    break;
                case Race.ResistanceType.immune:
                    immune = true;
                    dam = 0;
                    break;
                case Race.ResistanceType.susceptible:
                    dam += dam / 2;
                    break;
                case Race.ResistanceType.vulnerable:
                    dam *= 2;
                    break;
            }

            if( ( damType == AttackType.DamageType.wind || damType == AttackType.DamageType.gas || damType == AttackType.DamageType.asphyxiation )
                    && victim.IsAffected( Affect.AFFECT_DENY_AIR))
            {
                if( MUDMath.NumberPercent() < 50 )
                {
                    victim.SendText( "&+CYou deny the damage.&n\r\n" );
                    immune = true;
                    dam = 0;
                }
                else
                    dam -= dam / 5;
            }
            if (damType == AttackType.DamageType.fire && victim.IsAffected( Affect.AFFECT_DENY_FIRE))
            {
                if( MUDMath.NumberPercent() < 50 )
                {
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:67,代码来源:Combat.cs

示例2: InflictDamage


//.........这里部分代码省略.........
                        if( dam >= 8 && MUDMath.NumberPercent() <= ( dam / 8 ) )
                        {
                            victim.SendText( "&+LYour stoneskin is shattered by the massive blow!&n\r\n" );
                            SocketConnection.Act( "$n&n's massive blow shatters $N&n's stoneskin!", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim );
                            SocketConnection.Act( "Your massive blow shatters $N&n's stoneskin!", ch, null, victim, SocketConnection.MessageTarget.character );
                            victim.RemoveAffect( Affect.AFFECT_STONESKIN );
                        }
                        else
                        {
                            dam = dam / 15 != 0 ? dam / 15 : 1;
                        }
                    }

                }

                if( dam < 0 )
                    dam = 0;

                /*
                * Check for disarm, trip, parry, dodge and shield block.
                */
                if (skill != "barehanded fighting" || skill == "kick")
                {
                    // Trip and disarm removed because those should be handled
                    // by each individual mob's special function.
                    if( ch.IsNPC()
                            && ch.HasInnate( Race.RACE_WEAPON_WIELD )
                            && MUDMath.NumberPercent() < Math.Min( 25, Math.Max( 10, ch.Level ) )
                            && !victim.IsNPC() )
                        UseMagicalItem( ch );
                }
            }

            switch( victim.CheckRIS( damType ) )
            {
                case Race.ResistanceType.resistant:
                    dam -= dam / 3;
                    break;
                case Race.ResistanceType.immune:
                    immune = true;
                    dam = 0;
                    break;
                case Race.ResistanceType.susceptible:
                    dam += dam / 2;
                    break;
                case Race.ResistanceType.vulnerable:
                    dam *= 2;
                    break;
                default:
                    break;
            }

            if( ( damType == AttackType.DamageType.wind || damType == AttackType.DamageType.gas || damType == AttackType.DamageType.asphyxiation )
                    && victim.IsAffected(Affect.AFFECT_DENY_AIR))
            {
                if( MUDMath.NumberPercent() < 50 )
                {
                    ch.SendText( "&+CYou deny the damage.&n\r\n" );
                    immune = true;
                    dam = 0;
                }
                else
                    dam -= dam / 5;
            }
            if (damType == AttackType.DamageType.fire && victim.IsAffected( Affect.AFFECT_DENY_FIRE))
            {
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:67,代码来源:Combat.cs

示例3: SpellSavingThrow

        /// <summary>
        /// Compute a saving throw.  Negative apply's make saving throw better.
        /// </summary>
        /// <param name="level"></param>
        /// <param name="victim"></param>
        /// <param name="damType"></param>
        /// <returns></returns>
        public static bool SpellSavingThrow( int level, CharData victim, AttackType.DamageType damType )
        {
            int ibase = 50;

            if( victim == null )
            {
                Log.Error("SpellSavingThrow called without CharData argument for victim.", 0);
                return false;
            }

            if (victim.IsAffected(Affect.AFFECT_DENY_WATER) && damType == AttackType.DamageType.water)
                return true;
            if (victim.IsAffected(Affect.AFFECT_DENY_FIRE) && damType == AttackType.DamageType.fire)
                return true;
            if (victim.IsAffected(Affect.AFFECT_DENY_EARTH) && damType == AttackType.DamageType.earth)
                return true;
            if (victim.IsAffected(Affect.AFFECT_DENY_AIR) && damType == AttackType.DamageType.wind)
                return true;

            // Keep in mind that *negative* saving throw improves the chance.
            // positive saving throw is a bad thing
            /* Thus, we want a - save to increase the save chance, not decrease
            * it.  So, we subtract the saving throw.
            */
            int save = ibase + ( victim.Level - level - victim.SavingThrows[ 4 ] ) * 2;

            if( victim.IsNPC() && victim.Level > 55 )
                ibase += 20;

            // We aren't too harsh on our save penalties because the victim is already
            // automatically taking augmented damage.
            switch( victim.CheckRIS( damType ) )
            {
                case Race.ResistanceType.resistant:
                    save += 12;
                    break;
                case Race.ResistanceType.immune:
                    return true;
                case Race.ResistanceType.susceptible:
                    save -= 12;
                    break;
                case Race.ResistanceType.vulnerable:
                    save -= 25;
                    break;
            }

            /* Note that protection spells aren't quite as good as a natural resistance
            * ( +10% save -25% damage as opposed to +12% save -33% damage), but they
            * are cumulative, so a natural resistance and a protection spell will give
            * +22% save and -50% damage overall.
            */

            // TODO: This is duplicated in SavesBreath. Don't do that.
            if (damType == AttackType.DamageType.fire && victim.IsAffected(Affect.AFFECT_PROTECT_FIRE))
                save += 10;
            else if (damType == AttackType.DamageType.cold && victim.IsAffected(Affect.AFFECT_PROTECT_COLD))
                save += 10;
            else if (damType == AttackType.DamageType.gas && victim.IsAffected(Affect.AFFECT_PROTECT_GAS))
                save += 10;
            else if (damType == AttackType.DamageType.acid && victim.IsAffected(Affect.AFFECT_PROTECT_ACID))
                save += 10;
            else if (damType == AttackType.DamageType.electricity && victim.IsAffected(Affect.AFFECT_PROTECT_LIGHTNING))
                save += 10;

            save = Macros.Range( 5, save, 95 );
            if( MUDMath.NumberPercent() < save )
                return true;
            return false;
        }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:76,代码来源:Magic.cs

示例4: Disbelieve

        /// <summary>
        /// Save against illusionist spells, intelligence and level-based.  Base save 50% with a
        /// bonus/penalty of 2% per level of difference between spell power (typically caster level
        /// but capped on most spells) and victim level.  Also has a 1% bonus/penalty per 5 int
        /// points of difference between caster and victim.
        /// </summary>
        /// <param name="level"></param>
        /// <param name="victim"></param>
        /// <param name="ch"></param>
        /// <returns></returns>
        public static bool Disbelieve( int level, CharData victim, CharData ch )
        {
            int ibase = 50;

            if( !victim )
            {
                Log.Error( "Magic.Disbelieve called without CharData argument for victim.", 0 );
                return false;
            }

            // Level has an effect on illusions.
            int save = ibase + ( victim.Level - level ) * 2;

            // Will cause a 100 int player to get a 5% bonus against a 50 int mob.
            save += ( victim.GetCurrInt() / 5 );
            save -= ( ch.GetCurrInt() / 5 );

            // Figure in spell saving throw adjustment.
            save -= victim.SavingThrows[4];

            // Even though we already figured in intelligence, also take into account mental
            // damage type resistance and susceptibility.
            switch (victim.CheckRIS(AttackType.DamageType.mental))
            {
                case Race.ResistanceType.resistant:
                    save += 10;
                    break;
                case Race.ResistanceType.immune:
                    return true;
                case Race.ResistanceType.susceptible:
                    save -= 10;
                    break;
                case Race.ResistanceType.vulnerable:
                    save -= 20;
                    break;
            }

            save = Macros.Range( 5, save, 95 );
            return MUDMath.NumberPercent() < save;
        }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:50,代码来源:Magic.cs

示例5: SavesBreath

        /// <summary>
        /// Compute a saving throw versus breath weapon (saving_throw[3]).
        /// Negative apply's make saving throw better.
        ///
        /// This is basically identical to Magic.SavesSpell, except that it uses
        /// a different saving throw as its base.
        /// </summary>
        /// <param name="level"></param>
        /// <param name="victim"></param>
        /// <param name="damType"></param>
        /// <returns></returns>
        public static bool SavesBreath( int level, CharData victim, AttackType.DamageType damType )
        {
            int ibase = 50;

            string lfbuf = String.Format( "Magic.SavesBreath: dt: {0}, level: {1}", damType, level );
            Log.Trace( lfbuf );

            if( !victim )
            {
                Log.Error( "Magic.SavesBreath called without CharData argument for victim.", 0 );
                return false;
            }

            int save = ibase + ( victim.Level - level - victim.SavingThrows[ 3 ] ) * 2;

            switch( victim.CheckRIS( damType ) )
            {
                case Race.ResistanceType.resistant:
                    save += 12;
                    break;
                case Race.ResistanceType.immune:
                    return true;
                case Race.ResistanceType.susceptible:
                    save -= 12;
                    break;
                case Race.ResistanceType.vulnerable:
                    save -= 25;
                    break;
            }

            /* Note that protection spells aren't quite as good as a natural resistance
            * ( +10% save -25% damage as opposed to +12% save -33% damage), but they
            * are cumulative, so a natural resistance and a protection spell will give
            * +22% save and -50% damage overall.
            */

            // TODO: This is duplicated in SpellSavingThrow. Don't do that.
            if (damType == AttackType.DamageType.fire && victim.IsAffected(Affect.AFFECT_PROTECT_FIRE))
                save += 10;
            else if (damType == AttackType.DamageType.cold && victim.IsAffected(Affect.AFFECT_PROTECT_COLD))
                save += 10;
            else if (damType == AttackType.DamageType.gas && victim.IsAffected(Affect.AFFECT_PROTECT_GAS))
                save += 10;
            else if (damType == AttackType.DamageType.acid && victim.IsAffected(Affect.AFFECT_PROTECT_ACID))
                save += 10;
            else if (damType == AttackType.DamageType.electricity && victim.IsAffected(Affect.AFFECT_PROTECT_LIGHTNING))
                save += 10;

            save = Macros.Range( 5, save, 95 );
            if( MUDMath.NumberPercent() < save )
                return true;
            else
                return false;
        }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:65,代码来源:Magic.cs


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