public bool RollSuccess(DepositMiningDifficulty difficulty) { var successValue = GetSuccessValue(difficulty); var rollValue = _dice.Roll2D6(); return(rollValue >= successValue); }
public PropDepositModule(IPropContainer propContainer, IDropTableScheme dropTableScheme, IDropResolver dropResolver, string[] toolTags, int exhaustingValue, DepositMiningDifficulty depositMiningDifficulty) { _propContainer = propContainer ?? throw new ArgumentNullException(nameof(propContainer)); _dropTableScheme = dropTableScheme ?? throw new ArgumentNullException(nameof(dropTableScheme)); _dropResolver = dropResolver ?? throw new ArgumentNullException(nameof(dropResolver)); _toolTags = toolTags ?? throw new ArgumentNullException(nameof(toolTags)); _exhaustingValue = exhaustingValue; _exhaustingCounter = exhaustingValue; Difficulty = depositMiningDifficulty; }
private static int GetSuccessValue(DepositMiningDifficulty difficulty) { switch (difficulty) { case DepositMiningDifficulty.Easy: return(3); case DepositMiningDifficulty.Moderately: return(6); case DepositMiningDifficulty.Hard: return(9); case DepositMiningDifficulty.Impossible: return(13); case DepositMiningDifficulty.Undefined: default: throw new InvalidOperationException($"Неизвестная сложность добычи {difficulty}"); } }