Class: BCDice::GameSystem::CyberpunkRed

Inherits:
Base
  • Object
show all
Defined in:
lib/bcdice/game_system/CyberpunkRed.rb,
lib/bcdice/game_system/cyberpunk_red/tables.rb

Defined Under Namespace

Classes: ScreamSheetRandomizerTable, ShopPeopleTable

Constant Summary collapse

ID =

ゲームシステムの識別子

'CyberpunkRed'
NAME =

ゲームシステム名

'サイバーパンクRED'
SORT_KEY =

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

'さいはあはんくれつと'
HELP_MESSAGE =

ダイスボットの使い方

"\u30FB\u5224\u5B9A\u3000CPx+y>z\n\u3000(x\uFF1D\u80FD\u529B\u5024\u3068\u6280\u80FD\u5024\u306E\u5408\u8A08\u3001y\uFF1D\u4FEE\u6B63\u5024\u3001z\uFF1D\u96E3\u6613\u5EA6 or \u53D7\u52D5\u5074\u3000x\u3001y\u3001z\u306F\u7701\u7565\u53EF)\n\u3000\u4F8B\uFF09CP12 CP10+2>12\u3000CP7-1\u3000CP8+4\u3000CP7>12\u3000CP\u3000CP>9\n\n\u5404\u7A2E\u8868\n\u30FB\u81F4\u547D\u7684\u640D\u50B7\u8868\n\u3000FFD\u3000\uFF1A\u8EAB\u4F53\u3078\u306E\u81F4\u547D\u7684\u640D\u50B7\n\u3000HFD\u3000\uFF1A\u982D\u90E8\u3078\u306E\u81F4\u547D\u7684\u640D\u50B7\n\u30FB\u906D\u9047\u8868\n\u3000NCDT\u3000\uFF1A\u30CA\u30A4\u30C8\u30B7\u30C6\u30A3(\u65E5\u4E2D)\n\u3000NCMT\u3000\uFF1A\u30CA\u30A4\u30C8\u30B7\u30C6\u30A3(\u6DF1\u591C)\n\u30FB\u30B9\u30AF\u30EA\u30FC\u30E0\u30B7\u30FC\u30C8\n\u3000SCSR\u3000\uFF1A\u30B9\u30AF\u30EA\u30FC\u30E0\u30B7\u30FC\u30C8(\u30E9\u30F3\u30C0\u30E0)\n\u3000SCST\u3000\uFF1A\u30B9\u30AF\u30EA\u30FC\u30E0\u30B7\u30FC\u30C8\u5206\u985E\n\u3000SCSA\u3000\uFF1A\u30D8\u30C3\u30C9\u30E9\u30A4\u30F3A\n\u3000SCSB\u3000\uFF1A\u30D8\u30C3\u30C9\u30E9\u30A4\u30F3B\n\u3000SCSC\u3000\uFF1A\u30D8\u30C3\u30C9\u30E9\u30A4\u30F3C\n\u30FB\u6700\u5BC4\u308A\u306E\u81EA\u8CA9\u6A5F\n\u3000VMCR\u3000\uFF1A\u6700\u5BC4\u308A\u306E\u81EA\u8CA9\u6A5F\u8868\n\u3000VMCT\u3000\uFF1A\u81EA\u8CA9\u6A5F\u30BF\u30A4\u30D7\u6C7A\u5B9A\u8868\n\u3000VMCE\u3000\uFF1A\u98DF\u54C1\n\u3000VMCF\u3000\uFF1A\u30D5\u30A1\u30C3\u30B7\u30E7\u30F3\n\u3000VMCS\u3000\uFF1A\u5909\u306A\u3082\u306E\n\u30FB\u30DC\u30C7\u30AC\u306E\u5BA2\n\u3000STORE\u3000\uFF1A\u30DC\u30C7\u30AC\u306E\u5BA2\u3068\u5E97\u54E1\n\u3000STOREA\u3000\uFF1A\u5E97\u4E3B\u307E\u305F\u306F\u30EC\u30B8\u4FC2\n\u3000STOREB\u3000\uFF1A\u5909\u308F\u3063\u305F\u5BA2\u305D\u306E1\n\u3000STOREC\u3000\uFF1A\u5909\u308F\u3063\u305F\u5BA2\u305D\u306E2\n\u30FB\u591C\u306E\u5E02\n\u3000NMCT\u3000\uFF1A\u5546\u54C1\u306E\u5206\u91CE\n\u3000NMCFO\u3000\uFF1A\u98DF\u54C1\u3068\u30C9\u30E9\u30C3\u30B0\n\u3000NMCME\u3000\uFF1A\u500B\u4EBA\u7528\u96FB\u5B50\u6A5F\u5668\n\u3000NMCWE\u3000\uFF1A\u6B66\u5668\u3068\u9632\u5177\n\u3000NMCCY\u3000\uFF1A\u30B5\u30A4\u30D0\u30FC\u30A6\u30A7\u30A2\n\u3000NMCFA\u3000\uFF1A\u8863\u6599\u54C1\u3068\u30D5\u30A1\u30C3\u30B7\u30E7\u30F3\u30A6\u30A7\u30A2\n\u3000NMCSU\u3000\uFF1A\u30B5\u30D0\u30A4\u30D0\u30EB\u7528\u54C1\n"
TABLES =
translate_tables(@locale)

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) ⇒ CyberpunkRed

Returns a new instance of CyberpunkRed.



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

def initialize(command)
  super(command)

  @sort_add_dice = false
  @d66_sort_type = D66SortType::NO_SORT
end

Instance Method Details

#cp_roll_result(command) ⇒ Object



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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/bcdice/game_system/CyberpunkRed.rb', line 77

def cp_roll_result(command)
  parser = Command::Parser.new('CP', round_type: RoundType::FLOOR)
                          .enable_suffix_number
                          .restrict_cmp_op_to(nil, :>)
  parsed = parser.parse(command)
  return nil if parsed.nil?

  dice_cnt = 1
  dice_face = 10
  modify_number = 0
  total = 0

  result = Result.new

  dices = [@randomizer.roll_once(dice_face)]
  total += dices.first
  modify_number += parsed.suffix_number if parsed.suffix_number
  modify_number += parsed.modify_number if parsed.modify_number
  total += modify_number

  case dices.first
  when 10 # critical
    dices << @randomizer.roll_once(dice_face)
    total += dices.last
    result.critical = true
  when 1 # fumble
    dices << @randomizer.roll_once(dice_face)
    total -= dices.last
    result.fumble = true
  end

  if parsed.target_number
    result.condition = total > parsed.target_number
  end

  result.text = "(#{dice_cnt}D#{dice_face}#{Format.modifier(modify_number)}#{parsed.cmp_op}#{parsed.target_number})"
  result.text += ' > '
  result.text += "#{dices.first}[#{dices.first}]#{Format.modifier(modify_number)}"
  result.text += ' > '

  if result.critical?
    result.text += "#{translate('CyberpunkRed.critical')} > "
    result.text += "#{dices.last}[#{dices.last}] > "
  end
  if result.fumble?
    result.text += "#{translate('CyberpunkRed.fumble')} > "
    result.text += "#{dices.last}[#{dices.last}] > "
  end

  result.text += total.to_s

  if result.success?
    result.text += " > #{translate('success')}"
  end
  if result.failure?
    result.text += " > #{translate('failure')}"
  end

  return result
end

#eval_game_system_specific_command(command) ⇒ Object



69
70
71
72
73
# File 'lib/bcdice/game_system/CyberpunkRed.rb', line 69

def eval_game_system_specific_command(command)
  debug("eval_game_system_specific_command begin string", command)

  cp_roll_result(command) || roll_tables(command, TABLES)
end