diff --git a/.rubocop.yml b/.rubocop.yml index a2f9efe1a..be78ea0dd 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -28,6 +28,10 @@ Style/SpecialGlobalVars: Style/FormatStringToken: Enabled: false +# Due to Opal +Style/SlicingWithRange: + Enabled: false + Layout/EndOfLine: EnforcedStyle: lf diff --git a/lib/bcdice/base.rb b/lib/bcdice/base.rb index 566926e3c..1ab62a7d6 100644 --- a/lib/bcdice/base.rb +++ b/lib/bcdice/base.rb @@ -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) diff --git a/lib/bcdice/game_system/BattleTech.rb b/lib/bcdice/game_system/BattleTech.rb index af441ac6e..7d8094a94 100644 --- a/lib/bcdice/game_system/BattleTech.rb +++ b/lib/bcdice/game_system/BattleTech.rb @@ -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 diff --git a/lib/bcdice/game_system/DesperateRun.rb b/lib/bcdice/game_system/DesperateRun.rb index 042c8b729..269ba3d7b 100644 --- a/lib/bcdice/game_system/DesperateRun.rb +++ b/lib/bcdice/game_system/DesperateRun.rb @@ -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 diff --git a/lib/bcdice/game_system/SkynautsBouken.rb b/lib/bcdice/game_system/SkynautsBouken.rb index 62a6c2c75..7fab218c4 100644 --- a/lib/bcdice/game_system/SkynautsBouken.rb +++ b/lib/bcdice/game_system/SkynautsBouken.rb @@ -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 diff --git a/lib/bcdice/game_system/StellarKnights.rb b/lib/bcdice/game_system/StellarKnights.rb index cef822fcc..bf457ba1b 100644 --- a/lib/bcdice/game_system/StellarKnights.rb +++ b/lib/bcdice/game_system/StellarKnights.rb @@ -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) { diff --git a/lib/bcdice/game_system/TrinitySeven.rb b/lib/bcdice/game_system/TrinitySeven.rb index 9491903c9..00082f67f 100644 --- a/lib/bcdice/game_system/TrinitySeven.rb +++ b/lib/bcdice/game_system/TrinitySeven.rb @@ -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