Class: BCDice::GameSystem::CthulhuTech::Contest

Inherits:
Test
  • Object
show all
Defined in:
lib/bcdice/game_system/CthulhuTech.rb

Overview

対抗判定のノード

Constant Summary collapse

COMPARE_OP =

判定で用いる比較演算子

:>

Instance Method Summary collapse

Methods inherited from Test

#execute, #initialize

Constructor Details

This class inherits a constructor from BCDice::GameSystem::CthulhuTech::Test

Instance Method Details

#result_str(success, _fumble, _critical, diff) ⇒ String

判定結果の文字列を返す

成功した場合(クリティカルを含む)、ダメージロールのコマンドを末尾に 追加する。

Parameters:

  • success (Boolean)

    成功したか

  • diff (Integer)

    判定値と難易度の差

Returns:

  • (String)


201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/bcdice/game_system/CthulhuTech.rb', line 201

def result_str(success, _fumble, _critical, diff)
  formatted = super

  if success
    damage_roll_num = (diff / 5.0).ceil
    damage_roll = "#{damage_roll_num}D10"

    "#{formatted}(ダメージ:#{damage_roll})"
  else
    formatted
  end
end