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


C# GameLiving.GetBaseStat方法代码示例

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


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

示例1: CalcValue

        public override int CalcValue(GameLiving living, eProperty property)
        {
            int propertyIndex = (int)property;

            // Base stats/abilities/debuffs/death.

            int baseStat = living.GetBaseStat((eStat)property);
            int abilityBonus = living.AbilityBonus[propertyIndex];
            int debuff = living.DebuffCategory[propertyIndex];
			int deathConDebuff = 0;

            int itemBonus = CalcValueFromItems(living, property);
            int buffBonus = CalcValueFromBuffs(living, property);

			// Special cases:
			// 1) ManaStat (base stat + acuity, players only).
			// 2) As of patch 1.64: - Acuity - This bonus will increase your casting stat, 
			//    whatever your casting stat happens to be. If you're a druid, you should get an increase to empathy, 
			//    while a bard should get an increase to charisma.  http://support.darkageofcamelot.com/kb/article.php?id=540
			// 3) Constitution lost at death, only affects players.

			if (living is GamePlayer)
			{
				GamePlayer player = living as GamePlayer;
				if (property == (eProperty)(player.CharacterClass.ManaStat))
				{
					if (player.CharacterClass.ID != (int)eCharacterClass.Scout && player.CharacterClass.ID != (int)eCharacterClass.Hunter && player.CharacterClass.ID != (int)eCharacterClass.Ranger)
					{
						abilityBonus += player.AbilityBonus[(int)eProperty.Acuity];
					}
				}

				deathConDebuff = player.TotalConstitutionLostAtDeath;
			}

			// Apply debuffs, 100% effectiveness for player buffs, 50% effectiveness
			// for item and base stats

			int unbuffedBonus = baseStat + itemBonus;
			buffBonus -= Math.Abs(debuff);

			if (buffBonus < 0)
			{
				unbuffedBonus += buffBonus / 2;
				buffBonus = 0;
				if (unbuffedBonus < 0)
					unbuffedBonus = 0;
			}

			// Add up and apply any multiplicators.

			int stat = unbuffedBonus + buffBonus + abilityBonus;
			stat = (int)(stat * living.BuffBonusMultCategory1.Get((int)property));

			// Possibly apply constitution loss at death.

			stat -= (property == eProperty.Constitution)? deathConDebuff : 0;

			return Math.Max(1, stat);
        }
开发者ID:dol-leodagan,项目名称:DOLSharp,代码行数:60,代码来源:StatCalculator.cs


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