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


C# Monster.SetBareHandsAttackName方法代码示例

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


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

示例1: CreateArchetypedMonster

        private Monster CreateArchetypedMonster(int monsterMinLevel, int monsterMaxLevel)
        {
            var newMonster = new Monster();

            var targetMonsterLevel = _dice.Random(monsterMinLevel, monsterMaxLevel);

            var modifierMinimum = 0;
            var modifierMaximum = 0;

            bool targetMonsterHasModifier = _dice.Random(1, 3) == 1; // 1/3 chance of having a modifier

            if (targetMonsterHasModifier)
            {
                modifierMinimum = monsterModifiers.Select(x => x.LevelModifier.GetMinimumValue()).OrderBy(x => x).First();
                modifierMaximum = monsterModifiers.Select(x => x.LevelModifier.GetMaximumValue()).OrderByDescending(x => x).First();
            }

            int targetMonsterMaxLevel = Math.Max(1, targetMonsterLevel - modifierMinimum);
            int targetMonsterMinLevel = Math.Max(1, targetMonsterLevel - modifierMaximum);

            var archetype = ChooseArchetypeInLevelRange(targetMonsterMinLevel, targetMonsterMaxLevel);

            // We now have the archetype. Figure out what level it's going to be
            int monsterLevel = _dice.Random(archetype.Level.MinValue, archetype.Level.MaxValue);

            if (targetMonsterHasModifier)
            {
                // If we're going to have a modifier, start applying random modifiers until we get a monster in our level range.
                var modifier = ChooseModifierInLevelRange(monsterMinLevel - monsterLevel, monsterMaxLevel - monsterLevel);
                monsterLevel += _dice.Roll(modifier.LevelModifier);
                newMonster.Name = modifier.Prefix + " " + archetype.Name;
            }
            else
            {
                // Otherwise, force the monster to be within our level range if the randomly generated level is out of range.
                newMonster.Name = archetype.Name;
            }

            newMonster.Level = Math.Max(Math.Min(monsterLevel, monsterMaxLevel), monsterMinLevel);

            newMonster.SetBareHandsAttackName(archetype.AttackName);

            return newMonster;
        }
开发者ID:ServerGame,项目名称:NullQuest,代码行数:44,代码来源:MonsterFactory.cs


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