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 =

ダイスボットの使い方

"\u25A0 \u30AF\u30EA\u30C6\u30A3\u30AB\u30EB\u8868 (whctH, whctA, whctB, whctL, whctHU, whctAU, whctBU, whctLU)\n  \"WH\u90E8\u4F4D \u9811\u5065\u30DC\u30FC\u30CA\u30B9\u4EE5\u4E0B\u30D5\u30E9\u30B0\"\u306E\u5F62\u3067\u6307\u5B9A\u3057\u307E\u3059\u3002\n  \u90E8\u4F4D\u306F\u300CH(\u982D\u90E8)\u300D\u300CA(\u8155)\u300D\u300CB(\u80F4\u4F53)\u300D\u300CL(\u8DB3)\u300D\u306E\uFF14\u30AB\u6240\u3067\u3059\u3002\n  \u9811\u5065\u30DC\u30FC\u30CA\u30B9\u30D5\u30E9\u30B0\u306F\u9811\u5065\u30DC\u30FC\u30CA\u30B9\u4EE5\u4E0B\u306E\u30C0\u30E1\u30FC\u30B8\u306E\u6642\u306BU\u3092\u3064\u3051\u307E\u3059\u3002\n  \u4F8B\uFF09whctH whctAU WHCTL\n\n\u25A0 \u547D\u4E2D\u90E8\u4F4D\u8868 (WHLT)\n  \u547D\u4E2D\u90E8\u4F4D\u3092\u30E9\u30F3\u30C0\u30E0\u306B\u6C7A\u5B9A\u3057\u307E\u3059\u3002(\u30AF\u30EA\u30C6\u30A3\u30AB\u30EB\u7528)\n\n\u25A0 \u3084\u3063\u3061\u307E\u3063\u305F\uFF01\u8868 (WHFT)\n  \u3084\u3063\u3061\u307E\u3063\u305F\uFF01\u8868\u3092\u30ED\u30FC\u30EB\u3057\u3066\u3001\u7D50\u679C\u3092\u8868\u793A\u3057\u307E\u3059\u3002\n\n\u25A0 \u795E\u3005\u306E\u5929\u7F70\u8868 (WHWGTx)\n  \"WHWGT(\u539F\u7F6A\u70B9)\"\u306E\u5F62\u3067\u6307\u5B9A\u3057\u307E\u3059\u3002\n  \u539F\u7F6A\u70B9\u3092\u7701\u7565\u3057\u305F\u5834\u5408\u306F\u3001\u539F\u7F6A\u70B9=0\u3068\u3057\u3066\u51E6\u7406\u3057\u307E\u3059\u3002\n  \u795E\u3005\u306E\u5929\u7F70\u8868\u3092\u30ED\u30FC\u30EB\u3057\u3066\u3001\u7D50\u679C\u3092\u8868\u793A\u3057\u307E\u3059\u3002\n\n\u25A0 \u5C0F\u8AA4\u767A\u52D5\u8868 (WHMIT)\n  \u5C0F\u8AA4\u767A\u52D5\u8868\u3092\u30ED\u30FC\u30EB\u3057\u3066\u3001\u7D50\u679C\u3092\u8868\u793A\u3057\u307E\u3059\u3002\n\n\u25A0 \u5927\u8AA4\u767A\u52D5\u8868 (WHMAT)\n  \u5927\u8AA4\u767A\u52D5\u8868\u3092\u30ED\u30FC\u30EB\u3057\u3066\u3001\u7D50\u679C\u3092\u8868\u793A\u3057\u307E\u3059\u3002\n\n\u25A0 \u547D\u4E2D\u5224\u5B9A (WHx)\n  \"WH(\u547D\u4E2D\u5024)\"\u306E\u5F62\u3067\u6307\u5B9A\u3057\u307E\u3059\u3002\n  \u547D\u4E2D\u5224\u5B9A\u3092\u884C\u3063\u3066\u3001\u30AF\u30EA\u30C6\u30A3\u30AB\u30EB\u304B\u30D5\u30A1\u30F3\u30D6\u30EB\u3067\u306A\u3051\u308C\u3070\u90E8\u4F4D\u3082\u8868\u793A\u3057\u307E\u3059\u3002\n  \u4F8B\uFF09wh60\u3000\u3000wh(43-20)\n"

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.



48
49
50
51
52
# File 'lib/bcdice/game_system/Warhammer4.rb', line 48

def initialize(command)
  super(command)

  @round_type = RoundType::CEIL
end

Instance Method Details

#eval_game_system_specific_command(command) ⇒ Object



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

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



61
62
63
64
65
66
67
68
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
# File 'lib/bcdice/game_system/Warhammer4.rb', line 61

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