private static Dictionary <PropType, double> PropDrawLogic(PropType propLevel) { var probList = new Dictionary <PropType, double>(); var minMaxPropType = Helpers.GetEnumFirstLast <PropType>(); var minProp = minMaxPropType.Item1; var maxProp = minMaxPropType.Item2; var currentPropLevelProbability = 1.0; var propLevelHash = propLevel.GetHashCode(); var baseN = propLevelHash == minProp || propLevelHash == maxProp ? 2 : 3; var nIndex = baseN; for (var i = propLevelHash + 1; i <= maxProp; i++) { var problility = GetProbability(nIndex++); currentPropLevelProbability -= problility; probList[(PropType)i] = problility; } nIndex = baseN; for (var i = propLevelHash - 1; i >= minProp; i--) { var problility = GetProbability(nIndex++); currentPropLevelProbability -= problility; probList[(PropType)i] = problility; } probList[propLevel] = currentPropLevelProbability; return(probList); }
protected PropBase(PropType propLevel, long level) : this() { EffectList = new List <PropValue.EffectType>(); for (var i = 0; i < propLevel.GetHashCode(); i++) { var minMax = Helpers.GetEnumFirstLast <PropValue.EffectType>(); EffectList.Add((PropValue.EffectType)Startup.Ran.Next(minMax.Item1, minMax.Item2 + 1)); } PropLevel = propLevel; Level = level; ForgeLevel = 1; InitSpecEffect(); }
public override int GetHashCode() { int hash = 1; if (MessageType != global::Communication.Proto.MessageType.AddPlayer) { hash ^= MessageType.GetHashCode(); } if (PlayerID != 0L) { hash ^= PlayerID.GetHashCode(); } if (TeamID != 0L) { hash ^= TeamID.GetHashCode(); } if (JobType != global::Communication.Proto.JobType.Job0) { hash ^= JobType.GetHashCode(); } if (PropType != global::Communication.Proto.PropType.Null) { hash ^= PropType.GetHashCode(); } if (TimeInMilliseconds != 0) { hash ^= TimeInMilliseconds.GetHashCode(); } if (Angle != 0D) { hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Angle); } if (ToPlayerID != 0L) { hash ^= ToPlayerID.GetHashCode(); } if (Message.Length != 0) { hash ^= Message.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
/// <summary> /// /// </summary> /// <param name="baseValue">每级增长的属性值</param> /// <returns></returns> private double GetValue(double baseValue) { return(Level * baseValue * PropLevel.GetHashCode() * ForgeLevel); }
public int[] ToIntArrary() { return(new int[2] { type.GetHashCode(), value }); }