var pattern = /^([0-9]+)P/i
  , dice = require('./dice.js')

exports.isPicker = function(msg) {
  return !! pattern.exec(msg)
}

exports.format = function(dices, log) {
  var number = 0
    , d = dices.join(", ")
  for ( var i in dices ) { ++number }
  var dices = dices.sort().reverse()
    , dice = [dices[0], dices[1]]
  for ( var i in dice ) {
    if ( typeof dice[i] == 'undefined' ) dice[i] = 1
  }
  return "Pickup: "+number+"D6 ( "+d+" ) ... [ 選択: "+dice[0]+"・"+dice[1]+" ]"
}

exports.apply = function(data) {
  var number = 1*(pattern.exec(data.msg)[1])
  data.dice.push(dice.roll(number+"D6", exports.format))
  return data
}

@@ -18,16 +18,34 @@
 %5B0-9%5D+)P
+((?:%5C+%7C%5C-)%5B0-9%5D+)?
 /i%0A  , d
@@ -156,16 +156,117 @@
 format =
+ function(suffix) %7B%0A  if ( typeof suffix == 'undefined' ) suffix = 0%0A  var suffix = 1*suffix%0A  return
  functio
@@ -277,24 +277,26 @@
 ces, log) %7B%0A
+  
   var number
@@ -300,16 +300,18 @@
 ber = 0%0A
+  
     , d 
@@ -329,16 +329,18 @@
 n(%22, %22)%0A
+  
   for ( 
@@ -369,16 +369,18 @@
 umber %7D%0A
+  
   var di
@@ -412,16 +412,18 @@
 e()%0A    
+  
 , dice =
@@ -444,16 +444,18 @@
 ces%5B1%5D%5D%0A
+  
   for ( 
@@ -476,16 +476,18 @@
 ) %7B%0A    
+  
 if ( typ
@@ -531,12 +531,16 @@
 = 1%0A
+  
   %7D%0A
+  
   re
@@ -612,12 +612,91 @@
 %5B1%5D+
-%22 %5D%22
+(suffix %3E 0 ? %22 + %22+suffix : %22%22)+%22 = %22%0A      +(1*dice%5B0%5D+1*dice%5B1%5D+suffix)+%22 %5D%22%0A  %7D
 %0A%7D%0A%0A
@@ -773,16 +773,57 @@
 sg)%5B1%5D)%0A
+    , suffix = pattern.exec(data.msg)%5B2%5D%0A
   data.d
@@ -868,16 +868,24 @@
 s.format
+(suffix)
 ))%0A  ret

support picker and add