Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Endless rangeを使わない #484

Merged
merged 1 commit into from
Jul 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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