Пример #1
0
 public void Roll(string expression)
 {
     if (ui != null) {
         ui.RollingEnabled = false;
         Roller r = new Roller (formulaDatabase);
         try {
             ui.DisplayRollResult (r.Evaluate (expression).ToString ());
         } catch (InvalidExpressionException e) {
             ui.DisplayRollError (e.Message);
         } catch (Exception e) {
             ui.DisplayRollError ("Unknown error");
             ui.DisplayDebug (e.Message);
         }
         ui.DisplayDebug (r.DebugString);
         ui.RollingEnabled = true;
     }
 }
Пример #2
0
 /// <summary>
 /// Constructs a DiceToken using a BigInteger instead of a postfix token list
 /// </summary>
 public DiceToken(BigInteger count, BigInteger type, long keepCount, KeepStrategy strategy, Roller r)
     : this(new List<Token> (), type, keepCount, strategy, r)
 {
     this.countTokens.Add (new NumToken(count));
 }
Пример #3
0
 public ParenToken(List<Token> multiplier, List<Token> contents, Roller r)
 {
     this.multiplier = multiplier;
     this.contents = contents;
     this.r = r;
 }
Пример #4
0
 /// <summary>
 /// Constructs a DiceToken using a postfix token list as the diecount (allowing expressions determining how many dice to roll)
 /// </summary>
 public DiceToken(List<Token> count, BigInteger type, long keepCount, KeepStrategy strategy, Roller r)
 {
     this.countTokens = count;
     this.type = type;
     this.keepCount = keepCount;
     this.strategy = strategy;
     this.r = r;
 }