Example #1
0
		/// <summary>
		/// determine race-dependent base resist
		/// </summary>
		/// <param name="race">Value must be greater than 0</param>
		/// <param name="type"></param>
		/// <returns></returns>
		public static int GetRaceResist(int race, eResist type)
		{
			if( race == 0 )
				return 0;

			int resistValue = 0;
			
			if (m_raceResists.ContainsKey(race))
			{
				int resistIndex;

				if (type == eResist.Natural)
					resistIndex = 9;
				else
					resistIndex = (int)type - (int)eProperty.Resist_First;

				if (resistIndex < m_raceResists[race].Length)
				{
					resistValue = m_raceResists[race][resistIndex];
				}
				else
				{
					log.WarnFormat("No resists defined for type:  {0}", type.ToString());
				}
			}
			else
			{
				log.WarnFormat("No resists defined for race:  {0}", race);
			}

			return resistValue;
		}
Example #2
0
		/// <summary>
		/// determine race-dependent base resist
		/// </summary>
		/// <param name="race">Value must be greater than 0</param>
		/// <param name="type"></param>
		/// <returns></returns>
		public static int GetRaceResist(int race, eResist type)
		{
			if( race == 0 )
				return 0;

			int resistValue = 0;

			m_raceResistLock.EnterReadLock();

			try
			{
				if( m_raceResists.ContainsKey( race ) )
				{
					int resistIndex;

					if( type == eResist.Natural )
						resistIndex = 9;
					else
						resistIndex = (int)type - (int)eProperty.Resist_First;

					if( resistIndex < m_raceResists[race].Length )
					{
						resistValue = m_raceResists[race][resistIndex];
					}
					else
					{
						log.Warn( "No resists defined for type:  " + type.ToString() );
					}
				}
				else
				{
					log.Warn( "No resists defined for race:  " + race );
				}
			}
			finally
			{
				m_raceResistLock.ExitReadLock();
			}

			return resistValue;
		}