text: /* Generated by Opal 0.10.5 */
  (function(Opal) {
    function $rb_ge(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_plus(lhs, rhs) {
      return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs);
    }
    function $rb_le(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);
    }
    var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $gvars = Opal.gvars;
  
    Opal.add_stubs(['$setPrefixes', '$=~', '$to_i', '$>=', '$getDiceRollResult', '$>', '$length', '$getRoundCountText', '$getSuccessText', '$getSpecialText', '$getFumbleText', '$roll', '$debug', '$!=', '$+', '$collect', '$split', '$==', '$uniq', '$<=', '$first', '$*', '$map']);
    return (function($base, $super) {
      function $RecordOfSteam(){};
      var self = $RecordOfSteam = $klass($base, $super, 'RecordOfSteam', $RecordOfSteam);
  
      var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11;
  
      self.$setPrefixes(["\\d+S\\d+.*"]);
  
      Opal.defn(self, '$gameType', TMP_1 = function $$gameType() {
        var self = this;
  
        return "RecordOfSteam";
      }, TMP_1.$$arity = 0);
  
      Opal.defn(self, '$gameName', TMP_2 = function $$gameName() {
        var self = this;
  
        return "Record of Steam";
      }, TMP_2.$$arity = 0);
  
      Opal.defn(self, '$getHelpMessage', TMP_3 = function $$getHelpMessage() {
        var self = this;
  
        return "2S2@1\nRecordOfSteam : (2S2@1) ＞ 1,2,3,4 ＞ 1回転 ＞ 成功数2\n\n4S3@2\nRecordOfSteam : (4S3@2) ＞ 2,1,2,4,4,4,2,3,4,5,6,6 ＞ 4回転 ＞ 成功数5\n";
      }, TMP_3.$$arity = 0);
  
      Opal.defn(self, '$rollDiceCommand', TMP_4 = function $$rollDiceCommand(command) {
        var $a, $b, self = this, diceCount = nil, targetNumber = nil, criticalValue = nil, specialValue = nil, rollResult = nil, successCount = nil, roundCount = nil, specialCount = nil, fumbleCount = nil, output = nil, roundCountText = nil, successText = nil, specialText = nil, fumbleText = nil, result = nil;
        if ($gvars.SEND_STR_MAX == null) $gvars.SEND_STR_MAX = nil;
  
        if ((($a = (/(\d+)[sS](\d+)(@(\d+))?/i['$=~'](command))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
          } else {
          return "1"
        };
        diceCount = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)).$to_i();
        targetNumber = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)).$to_i();
        criticalValue = (($a = $gvars['~']) === nil ? nil : $a['$[]'](4));
        ((($a = criticalValue) !== false && $a !== nil && $a != null) ? $a : criticalValue = 1);
        criticalValue = criticalValue.$to_i();
        if ((($a = ($rb_ge(diceCount, 150))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
          return "(多分)無限個なので振れません！ ヤメテクダサイ、(プロセスが)死んでしまいますっ"};
        if ((($a = ($rb_ge(criticalValue, 3))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
          return "(多分)無限個なので振れません！ ヤメテクダサイ、(プロセスが)死んでしまいますっ"};
        specialValue = criticalValue;
        $b = self.$getDiceRollResult(diceCount, targetNumber, criticalValue, specialValue), $a = Opal.to_ary($b), rollResult = ($a[0] == null ? nil : $a[0]), successCount = ($a[1] == null ? nil : $a[1]), roundCount = ($a[2] == null ? nil : $a[2]), specialCount = ($a[3] == null ? nil : $a[3]), fumbleCount = ($a[4] == null ? nil : $a[4]), $b;
        output = "(" + (command) + ") ＞ " + (rollResult);
        if ((($a = ($rb_gt(output.$length(), $gvars.SEND_STR_MAX))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
          output = "(" + (command) + ") ＞ ..."};
        roundCountText = self.$getRoundCountText(roundCount);
        successText = self.$getSuccessText(successCount);
        specialText = self.$getSpecialText(specialCount);
        fumbleText = self.$getFumbleText(fumbleCount);
        result = "" + (output) + (roundCountText) + (specialText) + (successText) + (fumbleText);
        return result;
      }, TMP_4.$$arity = 1);
  
      Opal.defn(self, '$getDiceRollResult', TMP_7 = function $$getDiceRollResult(diceCount, targetNumber, criticalValue, specialValue) {
        var $a, $b, $c, TMP_5, $d, TMP_6, self = this, successCount = nil, roundCount = nil, rollResult = nil, specialCount = nil, specialFlag = nil, fumbleCount = nil, fumbleFlag = nil, _ = nil, diceListText = nil, diceList = nil;
  
        successCount = 0;
        roundCount = 0;
        rollResult = "";
        specialCount = 0;
        specialFlag = false;
        fumbleCount = 0;
        fumbleFlag = false;
        while ((($b = ($rb_gt(diceCount, 0))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) {
        $c = self.$roll(diceCount, 6), $b = Opal.to_ary($c), _ = ($b[0] == null ? nil : $b[0]), diceListText = ($b[1] == null ? nil : $b[1]), $c;
        self.$debug("diceListText", diceListText);
        if ((($b = (rollResult['$!='](""))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) {
          rollResult = $rb_plus(rollResult, ",")};
        rollResult = $rb_plus(rollResult, diceListText);
        diceList = ($b = ($c = diceListText.$split(/,/)).$collect, $b.$$p = (TMP_5 = function(i){var self = TMP_5.$$s || this;
  if (i == null) i = nil;
        return i.$to_i()}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5), $b).call($c);
        if ((($b = (($d = diceList.$uniq().$length()['$=='](1)) ? roundCount['$=='](0) : diceList.$uniq().$length()['$=='](1))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) {
          if ((($b = $rb_le(diceList.$uniq().$first(), specialValue)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) {
            specialFlag = true
          } else if (diceList.$uniq().$first()['$=='](6)) {
            fumbleFlag = true}};
        self.$debug("diceList", diceList);
        if ((($b = (specialFlag)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) {
          specialCount = 1;
          successCount = $rb_times(diceCount, 3);
          return [rollResult, successCount, roundCount, specialCount, fumbleCount];
        } else if ((($b = (fumbleFlag)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) {
          fumbleCount = 1;
          return [rollResult, successCount, roundCount, specialCount, fumbleCount];};
        diceCount = 0;
        ($b = ($d = diceList).$map, $b.$$p = (TMP_6 = function(diceValue){var self = TMP_6.$$s || this, $e;
  if (diceValue == null) diceValue = nil;
        self.$debug("diceValue", diceValue);
          self.$debug("criticalValue", criticalValue);
          self.$debug("specialValue", specialValue);
          if ((($e = ($rb_le(diceValue, criticalValue))) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) {
            diceCount = $rb_plus(diceCount, 2);
            roundCount = $rb_plus(roundCount, 1);};
          if ((($e = ($rb_le(diceValue, targetNumber))) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) {
            return successCount = $rb_plus(successCount, 1)
            } else {
            return nil
          };}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6), $b).call($d);};
        return [rollResult, successCount, roundCount, specialCount, fumbleCount];
      }, TMP_7.$$arity = 4);
  
      Opal.defn(self, '$getRoundCountText', TMP_8 = function $$getRoundCountText(roundCount) {
        var $a, self = this;
  
        if ((($a = ($rb_le(roundCount, 0))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
          return ""};
        return " ＞ " + (roundCount) + "回転";
      }, TMP_8.$$arity = 1);
  
      Opal.defn(self, '$getSuccessText', TMP_9 = function $$getSuccessText(successCount) {
        var $a, self = this;
  
        if ((($a = ($rb_gt(successCount, 0))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
          return " ＞ 成功数" + (successCount)};
        return " ＞ 失敗";
      }, TMP_9.$$arity = 1);
  
      Opal.defn(self, '$getSpecialText', TMP_10 = function $$getSpecialText(specialCount) {
        var $a, self = this;
  
        if ((($a = (specialCount['$=='](1))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
          return " ＞ スペシャル"
          } else {
          return nil
        };
      }, TMP_10.$$arity = 1);
  
      return (Opal.defn(self, '$getFumbleText', TMP_11 = function $$getFumbleText(fumbleCount) {
        var $a, self = this;
  
        if ((($a = (fumbleCount['$=='](1))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
          return " ＞ ファンブル"
          } else {
          return nil
        };
      }, TMP_11.$$arity = 1), nil) && 'getFumbleText';
    })($scope.base, $scope.get('DiceBot'))
  })(Opal);
  
  /* Generated by Opal 0.10.5 */
  (function(Opal) {
    var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice;
  
    Opal.add_stubs(['$exit']);
    return $scope.get('Kernel').$exit()
  })(Opal);
  