bcdice / BCDice

The most popular TRPG dice command engine in Japan
https://bcdice.org
BSD 3-Clause "New" or "Revised" License
140 stars 184 forks source link

SwordWorld2.0の2d6でエラー #191

Closed GenKuzumochi closed 4 years ago

GenKuzumochi commented 4 years ago

SwordWorld2.0のテストパターンに以下を追加で再現

============================
input:
2D6
output:
SwordWorld2.0 : (2d6) > 9[6,3] > 9
rand:6/6,3/6
============================

rakeの出力(抜粋)

ruby 2.7.1

[Failures]
Game type: SwordWorld2_0
Index: 13
Input:
  2D6
Expected:
  SwordWorld2.0 : (2d6) > 9[6,3] > 9
Result:
  SwordWorld2.0 error undefined method `<=' for nil:NilClass/BCDice/src/diceBot/SwordWorld2_0.rb:146:in `check2dCritical'
  /BCDice/src/dice/add_dice/randomizer.rb:39:in `roll'
  /BCDice/src/dice/add_dice/node.rb:302:in `eval'
  /BCDice/src/dice/AddDice.rb:27:in `rollDice'
  /BCDice/src/bcdiceCore.rb:773:in `checkAddRoll'
  /BCDice/src/bcdiceCore.rb:746:in `dice_command'
  /BCDice/src/bcdiceCore.rb:694:in `executeDiceRoll'
  /BCDice/src/bcdiceCore.rb:600:in `recievePublicMessageCatched'
  /BCDice/src/bcdiceCore.rb:569:in `recievePublicMessage'
  /BCDice/src/cgiDiceBot.rb:122:in `executeDiceBot'
  /BCDice/src/cgiDiceBot.rb:74:in `roll'
  /BCDice/src/test/DiceBotTest.rb:143:in `block in executeCommand'
  /BCDice/src/test/DiceBotTest.rb:142:in `each'
  /BCDice/src/test/DiceBotTest.rb:142:in `executeCommand'
  /BCDice/src/test/DiceBotTest.rb:111:in `block in doTests'
  /BCDice/src/test/DiceBotTest.rb:109:in `each'
  /BCDice/src/test/DiceBotTest.rb:109:in `doTests'
  /BCDice/src/test/DiceBotTest.rb:37:in `execute'
  /BCDice/src/test/testDiceBots.rb:6:in `<top (required)>'
  /ruby/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
  /ruby/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
  /ruby/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/rake_test_loader.rb:17:in `block in <main>'
  /ruby/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/rake_test_loader.rb:5:in `select'
  /ruby/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/rake_test_loader.rb:5:in `<main>'
Rands: 6/6, 3/6

その他

原因

check2dCriticalの地点でcriticalがnilになっているためエラーとなります。多分共通のパーサ処理を変更したときにクリティカル値未指定の処理が抜けたのではないでしょうか。

ysakasin commented 4 years ago

@GenKuzumochi 報告ありがとうございます! 表示されているように、先ほど修正しました。 数日中に次バージョンをリリースして、そこに含まれる予定です。