Method: BCDice::GameSystem::Torg#eval_game_system_specific_command

Defined in:
lib/bcdice/game_system/Torg.rb

#eval_game_system_specific_command(command) ⇒ Object



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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/bcdice/game_system/Torg.rb', line 111

def eval_game_system_specific_command(command)
  string = command.upcase
  string = replace_text(string)

  if (result = torg_check(string))
    return result
  end

  output = '1'
  ttype = ""
  value = 0

  return nil unless /([RITMDB]T)(\d+([+-]\d+)*)/i =~ string

  type = Regexp.last_match(1)
  num = Regexp.last_match(2)

  case type
  when 'RT'
    value = ArithmeticEvaluator.eval(num)
    output = get_torg_success_level(value)
    ttype = '一般結果'
  when 'IT'
    value = ArithmeticEvaluator.eval(num)
    output = get_torg_interaction_result_intimidate_test(value)
    ttype = '威圧/威嚇'
  when 'TT'
    value = ArithmeticEvaluator.eval(num)
    output = get_torg_interaction_result_taunt_trick(value)
    ttype = '挑発/トリック'
  when 'MT'
    value = ArithmeticEvaluator.eval(num)
    output = get_torg_interaction_result_maneuver(value)
    ttype = '間合い'
  when 'DT'
    value = ArithmeticEvaluator.eval(num)
    if string =~ /ODT/i
      output = get_torg_damage_ords(value)
      ttype = 'オーズダメージ'
    else
      output = get_torg_damage_posibility(value)
      ttype = 'ポシビリティ能力者ダメージ'
    end
  when 'BT'
    output, value = get_torg_bonus_text(num)
    ttype = 'ボーナス'
  end

  if ttype != ''
    output = "#{ttype}表[#{value}] > #{output}"
  end

  return output
end