Class: BCDice::GameSystem::Warhammer4

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

Defined Under Namespace

Classes: CriticalTable

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

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

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

  ■ 命中判定 (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.



37
38
39
40
41
# File 'lib/bcdice/game_system/Warhammer4.rb', line 37

def initialize(command)
  super(command)

  @round_type = RoundType::CEIL
end

Instance Method Details

#eval_game_system_specific_command(command) ⇒ Object



43
44
45
# File 'lib/bcdice/game_system/Warhammer4.rb', line 43

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

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



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/bcdice/game_system/Warhammer4.rb', line 47

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