Class: BCDice::GameSystem::Warhammer4

Inherits:
Base
  • Object
show all
Defined in:
lib/bcdice/game_system/Warhammer4.rb

Defined Under Namespace

Classes: CriticalTable, CriticalTable_UIA

Constant Summary collapse

ID =

ゲームシステムの識別子

'Warhammer4'
NAME =

ゲームシステム名

'ウォーハンマーRPG第4版'
SORT_KEY =

ゲームシステム名の読みがな

'うおおはんまあ4'
HELP_MESSAGE =

ダイスボットの使い方

<<~INFO_MESSAGE_TEXT
  ■ クリティカル表 (whctH, whctA, whctB, whctL, whctHU, whctAU, whctBU, whctLU)
    "WH部位 頑健ボーナス以下フラグ"の形で指定します。
    部位は「H(頭部)」「A(腕)」「B(胴体)」「L(足)」の4カ所です。
    頑健ボーナスフラグは頑健ボーナス以下のダメージの時にUをつけます。
    例)whctH whctAU WHCTL

  ■ 『武器を掲げよ!』版クリティカル表 (bkctH, bkctA, bkctB, bkctL, bkctHx, bkctAx, bkctBx, bkctLx)
    "BK部位 超過ダメージ"の形で指定します。
    部位は「H(頭部)」「A(腕)」「B(胴体)」「L(足)」の4カ所です。
    超過ダメージは耐久値を0にして余剰ダメージがある場合の値を入力します(省略可)。
    例)bkctH bkctA4 BKCTL

  ■ 命中部位表 (WHLT)
    命中部位をランダムに決定します。(クリティカル用)

  ■ やっちまった!表 (WHFT)
    やっちまった!表をロールして、結果を表示します。

  ■ 神々の天罰表 (WHWGTx)
    "WHWGT(原罪点)"の形で指定します。
    原罪点を省略した場合は、原罪点=0として処理します。
    神々の天罰表をロールして、結果を表示します。

  ■ 小誤発動表 (WHMIT)
    小誤発動表をロールして、結果を表示します。
    ※Winds of Magic版(WOMMIT)

  ■ 大誤発動表 (WHMAT)
    大誤発動表をロールして、結果を表示します。
    ※Winds of Magic版(WOMMAT)

  ■ 命中判定 (WHx)
    "WH(命中値)"の形で指定します。
    命中判定を行って、クリティカルかファンブルでなければ部位も表示します。
    例)wh60  wh(43-20)
INFO_MESSAGE_TEXT

Instance Attribute Summary

Attributes inherited from Base

#d66_sort_type, #default_cmp_op, #default_target_number, #randomizer, #reroll_dice_reroll_threshold, #round_type, #sides_implicit_d, #upper_dice_reroll_threshold

Instance Method Summary collapse

Methods inherited from Base

#change_text, #check_result, command_pattern, #enable_debug, #enabled_d9?, eval, #eval, #grich_text, prefixes_pattern, register_prefix, register_prefix_from_super_class, #sort_add_dice?, #sort_barabara_dice?

Methods included from Translate

#translate

Constructor Details

#initialize(command) ⇒ Warhammer4

Returns a new instance of Warhammer4.



56
57
58
59
60
# File 'lib/bcdice/game_system/Warhammer4.rb', line 56

def initialize(command)
  super(command)

  @round_type = RoundType::CEIL
end

Instance Method Details

#eval_game_system_specific_command(command) ⇒ Object



62
63
64
65
66
67
# File 'lib/bcdice/game_system/Warhammer4.rb', line 62

def eval_game_system_specific_command(command)
  roll_critical_table(command) ||
    roll_attack(command) ||
    roll_wrath_of_god_table(command) ||
    roll_tables(command, TABLES)
end

#result_1d100(total, _dice_total, cmp_op, target) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/bcdice/game_system/Warhammer4.rb', line 69

def result_1d100(total, _dice_total, cmp_op, target)
  return Result.nothing if target == '?'
  return nil unless cmp_op == :<=

  t10 = total / 10
  d10 = target / 10
  sl = d10 - t10

  if total <= 5 && sl < 1
    # 自動成功時のSLは最低でも1
    sl = 1
  elsif total >= 96 && sl > -1
    # 自動失敗時のSLは最大でも-1
    sl = -1
  end

  result =
    if total <= 5
      Result.success("自動成功")
    elsif total >= 96
      Result.failure("自動失敗")
    elsif total <= target
      Result.success("成功")
    else
      Result.failure("失敗")
    end

  sl_text = format("(SL%+d)", sl)
  if (sl == 0) && (total > target)
    sl_text = "(SL-0)"
  end

  result.text += "#{sl_text}#{result_detail(sl, total, target)}"

  return result
end