Skip to content

Commit

Permalink
Merge pull request #484 from bcdice/remove_endless_range
Browse files Browse the repository at this point in the history
Endless rangeを使わない
  • Loading branch information
ysakasin authored Jul 14, 2021
2 parents ebe0133 + cf09176 commit 914e101
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ Style/SpecialGlobalVars:
Style/FormatStringToken:
Enabled: false

# Due to Opal
Style/SlicingWithRange:
Enabled: false

Layout/EndOfLine:
EnforcedStyle: lf

Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def dice_command(command)
end

secret = !m[1].nil?
command = command[1..] if secret # 先頭の 'S' をとる
command = command[1..-1] if secret # 先頭の 'S' をとる

output = eval_game_system_specific_command(command)

Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/game_system/BattleTech.rb
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ def execute_ppc(parse_result)
# TODO: 攻撃を表すクラスに変える

# "PPC" 以降の部位指定
side = parse_result.command[3..]
side = parse_result.command[3..-1]

modifier = Format.modifier(parse_result.modify_number)
target = parse_result.target_number
Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/game_system/DesperateRun.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def check_roll(string)
d1, d2 = @randomizer.roll_barabara(2, 6)
dice_total = d1 + d2
total = d1 + d2 + cmd.modify_number
target = cmd.command[2..].to_i
target = cmd.command[2..-1].to_i

modifier_str = " 修正値:#{cmd.modify_number}" if cmd.modify_number != 0

Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/game_system/SkynautsBouken.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def command_sn(command)
debug("SN Parsed", dice_count, target, fumble)

dice_list = @randomizer.roll_barabara(dice_count, 6)
dice_top_two = dice_list.sort[-2..]
dice_top_two = dice_list.sort[-2..-1]
res = if dice_top_two == [6, 6]
Result.critical("スペシャル(【生命点】1d6回復)")
elsif dice_list.max <= fumble
Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/game_system/StellarKnights.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def parse_dice_change_rules(text)
return [] if text.nil?

# 正規表現の都合で先頭に ',' が残っているので取っておく
text = text[1..]
text = text[1..-1]
text.split(',').map do |rule|
v = rule.split('>').map(&:to_i)
{
Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/game_system/TrinitySeven.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def roll_hit(command)
cmd = parser.parse(command)
return nil unless cmd

modify = cmd.command[2..].to_i + cmd.modify_number
modify = cmd.command[2..-1].to_i + cmd.modify_number
critical = 7 + modify
target = cmd.target_number

Expand Down

0 comments on commit 914e101

Please sign in to comment.