text: /* Generated by Opal 0.11.4 */
  (function(Opal) {
    function $rb_plus(lhs, rhs) {
      return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs);
    }
    function $rb_gt(lhs, rhs) {
      return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs);
    }
    function $rb_times(lhs, rhs) {
      return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs);
    }
    function $rb_ge(lhs, rhs) {
      return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs);
    }
    function $rb_lt(lhs, rhs) {
      return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs);
    }
    var self = Opal.top, $nesting = [], nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy;
  
    Opal.add_stubs(['$setPrefixes', '$match', '$upcase', '$to_i', '$[]', '$!', '$nil?', '$getValue', '$checkRoll', '$roll', '$+', '$getValueText', '$==', '$collect', '$split', '$count', '$>', '$*', '$>=', '$to_s', '$parren_killer', '$<']);
    return (function($base, $super, $parent_nesting) {
      function $DarkSouls(){};
      var self = $DarkSouls = $klass($base, $super, 'DarkSouls', $DarkSouls);
  
      var def = self.$$proto, $nesting = [self].concat($parent_nesting), TMP_DarkSouls_initialize_1, TMP_DarkSouls_gameName_2, TMP_DarkSouls_gameType_3, TMP_DarkSouls_getHelpMessage_4, TMP_DarkSouls_rollDiceCommand_5, TMP_DarkSouls_checkRoll_8, TMP_DarkSouls_getValue_9, TMP_DarkSouls_getValueText_10;
  
      
      self.$setPrefixes(["(\\d+)?(A)?DS([\\+\\-\\d+]*)(\\@\\d+)?"]);
      
      Opal.defn(self, '$initialize', TMP_DarkSouls_initialize_1 = function $$initialize() {
        var self = this, $iter = TMP_DarkSouls_initialize_1.$$p, $yield = $iter || nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
  
        if ($iter) TMP_DarkSouls_initialize_1.$$p = null;
        // Prepare super implicit arguments
        for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
          $zuper[$zuper_i] = arguments[$zuper_i];
        }
        return $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_DarkSouls_initialize_1, false), $zuper, $iter)
      }, TMP_DarkSouls_initialize_1.$$arity = 0);
      
      Opal.defn(self, '$gameName', TMP_DarkSouls_gameName_2 = function $$gameName() {
        var self = this;
  
        return "ダークソウルTRPG"
      }, TMP_DarkSouls_gameName_2.$$arity = 0);
      
      Opal.defn(self, '$gameType', TMP_DarkSouls_gameType_3 = function $$gameType() {
        var self = this;
  
        return "DarkSouls"
      }, TMP_DarkSouls_gameType_3.$$arity = 0);
      
      Opal.defn(self, '$getHelpMessage', TMP_DarkSouls_getHelpMessage_4 = function $$getHelpMessage() {
        var self = this;
  
        return "" + "・行為判定：[n]DS[a±b][@t]　　[]内のコマンドは省略可\n" + "・能動判定：[n]ADS[a±b][@t]　　FP消費を判定\n" + "　n：ダイス数。省略時は「2」\n" + "　a±b：修正値。「1+2-1」のように、複数定可\n" + "　@t：目標値。省略時は達成値を、指定時は判定の正否を表示\n" + "例）DS → 2D6の達成値を表示\n" + "　　1DS → 1D6の達成値を表示\n" + "　　ADS+2-2 → 2D6+2の達成値を表示（能動判定）\n" + "　　DS+2@10 → 2D6+2で目標値10の判定\n"
      }, TMP_DarkSouls_getHelpMessage_4.$$arity = 0);
      
      Opal.defn(self, '$rollDiceCommand', TMP_DarkSouls_rollDiceCommand_5 = function $$rollDiceCommand(command) {
        var $a, self = this, m = nil, diceCount = nil, isActive = nil, modify = nil, target = nil, output = nil;
  
        
        if ($truthy((m = /(\d+)?(A)?DS([\+\-\d+]*)(\@(\d+))?$/i.$match(command.$upcase())))) {
          } else {
          return nil
        };
        diceCount = ($truthy($a = m['$[]'](1)) ? $a : 2).$to_i();
        isActive = m['$[]'](2)['$nil?']()['$!']();
        modify = self.$getValue(m['$[]'](3));
        target = ($truthy($a = m['$[]'](5)) ? $a : 0).$to_i();
        output = self.$checkRoll(diceCount, isActive, modify, target);
        return output;
      }, TMP_DarkSouls_rollDiceCommand_5.$$arity = 1);
      
      Opal.defn(self, '$checkRoll', TMP_DarkSouls_checkRoll_8 = function $$checkRoll(diceCount, isActive, modify, target) {
        var $a, $b, TMP_6, TMP_7, self = this, dice = nil, diceText = nil, successValue = nil, modifyText = nil, targetText = nil, diceArray = nil, focusDamage = nil, focusText = nil, result = nil;
  
        
        $b = self.$roll(diceCount, 6), $a = Opal.to_ary($b), (dice = ($a[0] == null ? nil : $a[0])), (diceText = ($a[1] == null ? nil : $a[1])), $b;
        successValue = $rb_plus(dice, modify);
        modifyText = self.$getValueText(modify);
        targetText = (function() {if (target['$=='](0)) {
          return ""
          } else {
          return "" + ">=" + (target)
        }; return nil; })();
        if ($truthy(isActive)) {
          
          diceArray = $send(diceText.$split(/,/), 'collect', [], (TMP_6 = function(i){var self = TMP_6.$$s || this;
  if (i == null) i = nil;
          return i.$to_i()}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6));
          focusDamage = $send(diceArray, 'count', [], (TMP_7 = function(i){var self = TMP_7.$$s || this;
  if (i == null) i = nil;
          return i['$=='](1)}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7));
          if ($truthy($rb_gt(focusDamage, 0))) {
            
            focusText = $rb_times("■", focusDamage);
            focusText = "" + "（FP" + (focusText) + "消費）";};};
        result = "" + "(" + (diceCount) + "D6" + (modifyText) + (targetText) + ")";
        result = $rb_plus(result, "" + " ＞ " + (dice) + "(" + (diceText) + ")" + (modifyText));
        result = $rb_plus(result, "" + " ＞ " + (successValue) + (targetText));
        if ($truthy($rb_gt(target, 0))) {
          if ($truthy($rb_ge(successValue, target))) {
            result = $rb_plus(result, " ＞ 【成功】")
            } else {
            result = $rb_plus(result, " ＞ 【失敗】")
          }};
        result = $rb_plus(result, focusText.$to_s());
        return result;
      }, TMP_DarkSouls_checkRoll_8.$$arity = 4);
      
      Opal.defn(self, '$getValue', TMP_DarkSouls_getValue_9 = function $$getValue(text) {
        var $a, self = this;
  
        
        text = ($truthy($a = text) ? $a : "");
        return self.$parren_killer("" + "(0" + (text) + ")").$to_i();
      }, TMP_DarkSouls_getValue_9.$$arity = 1);
      return (Opal.defn(self, '$getValueText', TMP_DarkSouls_getValueText_10 = function $$getValueText(value) {
        var self = this;
  
        
        if (value['$=='](0)) {
          return ""};
        if ($truthy($rb_lt(value, 0))) {
          return value.$to_s()};
        return "" + "+" + (value);
      }, TMP_DarkSouls_getValueText_10.$$arity = 1), nil) && 'getValueText';
    })($nesting[0], Opal.const_get_relative($nesting, 'DiceBot'), $nesting)
  })(Opal);
  
  /* Generated by Opal 0.11.4 */
  (function(Opal) {
    var self = Opal.top, $nesting = [], nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice;
  
    Opal.add_stubs(['$exit']);
    return Opal.const_get_relative($nesting, 'Kernel').$exit()
  })(Opal);
  