Skip to content

Commit

Permalink
Update rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
ysakasin committed Dec 27, 2023
1 parent 62126bb commit 0fac3b4
Show file tree
Hide file tree
Showing 25 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ gemspec

group :development, :test do
gem "rake", "~> 13.0.3"
gem "rubocop", "~> 1.39.0", require: false
gem "rubocop", "~> 1.59.0", require: false
gem "simplecov", "~>0.21.2", require: false
gem "simplecov-cobertura", "~> 2.1.0", require: false
gem "test-unit", "~>3.3.7", require: false
Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def command_pattern
@prefixes.freeze
pattarns = CommonCommand::COMMANDS.map { |c| c::PREFIX_PATTERN.source } + @prefixes

@command_pattern = /^S?(#{pattarns.join("|")})/i.freeze
@command_pattern = /^S?(#{pattarns.join('|')})/i.freeze
end

# @param command [String]
Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/game_system/Airgetlamh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def checkRoll(diceCount, target, damage, criticalTrigger, criticalNumber)
totalDamage = totalSuccessCount * damage + totalCriticalCount * criticalTrigger

result += "(#{diceCount}D10\<\=#{target}) > #{text} > Hits:#{totalSuccessCount}*#{damage}"
result += " + Trigger:#{totalCriticalCount}*#{criticalTrigger}" if criticalTrigger > 0
result += " + Trigger:#{totalCriticalCount}*#{criticalTrigger}" if criticalTrigger > 0
result += " > #{totalDamage}ダメージ"
else
result += "(#{diceCount}D10\<\=#{target}) > #{text} > 成功数:#{totalSuccessCount}"
Expand Down
4 changes: 2 additions & 2 deletions lib/bcdice/game_system/Alsetto.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def eval_game_system_specific_command(command)
if command =~ /(\d+)AL(C|G)?(\d+)?((x|\*)(\d+))?$/i
rapid = Regexp.last_match(1).to_i
isCritical = Regexp.last_match(2).nil?
if isCritical
if isCritical
criticalNumber = 1
else
if Regexp.last_match(2) == "G"
Expand Down Expand Up @@ -98,7 +98,7 @@ def checkRoll(rapid, target, damage, isCritical, criticalNumber)
text += "+" unless text.empty?
text += "#{successCount}[#{diceText}]"

break unless isCritical
break unless isCritical

rollCount = criticalCount
end
Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/game_system/Avandner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def checkRoll(diceCount, target, damage, criticalTrigger, criticalNumber)
totalDamage = totalSuccessCount * damage + totalCriticalCount * criticalTrigger

result += "(#{diceCount}D10\<\=#{target}) > #{text} > Hits:#{totalSuccessCount}*#{damage}"
result += " + Trigger:#{totalCriticalCount}*#{criticalTrigger}" if criticalTrigger > 0
result += " + Trigger:#{totalCriticalCount}*#{criticalTrigger}" if criticalTrigger > 0
result += " > #{totalDamage}ダメージ"
else
result += "(#{diceCount}D10\<\=#{target}) > #{text} > 成功数:#{totalSuccessCount}"
Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/game_system/BBN.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def parse(command)
@roll_times = m[1].to_i
@modify_str = m[2] || ''
@modify = m[2].to_i
@difficulty = m[4] ? m[4].to_i : nil
@difficulty = m[4]&.to_i

base = critical_base(@roll_times)
@critical = base + m[7].to_i
Expand Down
6 changes: 3 additions & 3 deletions lib/bcdice/game_system/BadLife.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def judgeDice(command)
fumble = 1

isStormy = (m[2] == 'GL') # 波乱万丈
if isStormy
if isStormy
critical -= 3
fumble += 1
end
Expand All @@ -69,7 +69,7 @@ def judgeDice(command)
critical, fumble = get_critival_fumble(critical, fumble, m[8], m[9])

target = get_value(m[11])
optionalText = (m[13] || '')
optionalText = m[13] || ''

return checkRoll(diceCount, modify, critical, fumble, target, isStormy, optionalText)
end
Expand Down Expand Up @@ -116,7 +116,7 @@ def checkRoll(diceCount, modify, critical, fumble, target, isStormy, optionalTex

if isCritical
result += "成功(クリティカル)"
elsif total >= target
elsif total >= target
result += "成功"
else
result += "失敗"
Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/game_system/BarnaKronika.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def roll_barna_kronika(dice_n, criticalCallDice)
set += 1 if diceCount > 1
end

if criticalCallDice != 0
if criticalCallDice != 0
c_cnt = diceCountList[criticalCallDice - 1]
suc = c_cnt * 2

Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/game_system/DarkSouls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def checkRoll(diceCount, isActive, modify, target)
result += " > #{successValue}#{targetText}"

if target > 0
if successValue >= target
if successValue >= target
result += " > 【成功】"
else
result += " > 【失敗】"
Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/game_system/Elric.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def result_1d100(total, _dice_total, cmp_op, target)
if total <= 1
Result.critical("貫通") # 1は常に貫通
elsif total >= 100
Result.fumble("致命的失敗") # 100は常に致命的失敗
Result.fumble("致命的失敗") # 100は常に致命的失敗
elsif target == '?'
Result.nothing
elsif total <= (target / 5.0).ceil
Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/game_system/Irisbane.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Irisbane < Base
SceneSituation, SSi
HELP

ATTACK_ROLL_REG = %r{^AT(TACK|K)?([+\-*/()\d]+)@([+\-*/()\d]+)<=([+\-*/()\d]+)(\[([+\-])([+\-*/()\d]+)\])?}i.freeze
ATTACK_ROLL_REG = %r{^AT(TACK|K)?([+\-*/()\d]+)@([+\-*/()\d]+)<=([+\-*/()\d]+)(\[([+-])([+\-*/()\d]+)\])?}i.freeze
register_prefix('AT(TACK|K)?')

def initialize(command)
Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/game_system/KillDeathBusiness.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def judgeDice(command)
target = 5
end

if fumble < 2
if fumble < 2
fumble = 2
elsif fumble > 11
result += "【#{command}】 > #{translate('KillDeathBusiness.JD.warning.over_fumble')}\n"
Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/game_system/MetalHead.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def mh_crc_table(suv, num)
'D' => [{'LW' => 2}, {'MW' => 26}, {'HW' => 46}, {'MO' => 76}, {'K' => 96}],
'E' => [{'LW' => 2}, {'MW' => 26}, {'HW' => 39}, {'MO' => 54}, {'K' => 76}],
'F' => [{'LW' => 2}, {'MW' => 16}, {'HW' => 39}, {'MO' => 54}, {'K' => 66}],
'G' => [{'LW' => 2}, {'MW' => 6}, {'HW' => 16}, {'MO' => 26}, {'K' => 39}],
'G' => [{'LW' => 2}, {'MW' => 6}, {'HW' => 16}, {'MO' => 26}, {'K' => 39}],
'M' => [{'0' => 2}, {'1' => 22}, {'2' => 42}, {'3' => 62}, {'4' => 82}, {'5' => 92}, {'6' => 102}, {'8' => 112}],
}

Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/game_system/MetalHeadExtream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def eval_game_system_specific_command(command)
type = m[1]
target = m[2].to_i
modify = get_value(1, m[3])
paramText = (m[5] || '')
paramText = m[5] || ''
isMuse = !m[8].nil? # パンドラ《ミューズ》

accidentValue = 96
Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/game_system/NSSQ.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def roll_sq(command)

dice_count = m[1].to_i
modifier = ArithmeticEvaluator.eval(m[2])
target = m[5].nil? ? nil : m[5].to_i
target = m[5]&.to_i

dice_list = @randomizer.roll_barabara(dice_count, 6)
largest_two = dice_list.sort.reverse.take(2)
Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/game_system/OneWayHeroics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def getRollDiceCommandResult(command)
target = Regexp.last_match(6)
target = target.to_i unless target.nil?

modifyText = (Regexp.last_match(3) || "")
modifyText = Regexp.last_match(3) || ""
modifyText = "+1" if modifyText == "+"
modifyValue = modifyText.to_i

Expand Down
6 changes: 3 additions & 3 deletions lib/bcdice/game_system/Postman.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ def eval_game_system_specific_command(command)
diceCount = 2 if diceCount < 2

modify = (Regexp.last_match(2) || 0).to_i
modifyAddString = (Regexp.last_match(3) || '')
modifyAddString = Regexp.last_match(3) || ''

type = (Regexp.last_match(6) || '')
type = Regexp.last_match(6) || ''
target = (Regexp.last_match(7) || 0).to_i
targetAddString = (Regexp.last_match(8) || '')
targetAddString = Regexp.last_match(8) || ''

modify_list = modifyAddString.scan(/[+-]\d+/)
modify_list.each { |i| modify += i.to_i }
Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/game_system/RecordOfSteam.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def getDiceRollResult(diceCount, targetNumber, criticalValue, specialValue)
end

def getRoundCountText(roundCount)
if roundCount <= 0
if roundCount <= 0
return ""
end

Expand Down
8 changes: 4 additions & 4 deletions lib/bcdice/game_system/Ryutama.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ def getDiceType(dice1, dice2)
end

def isValidDice(dice1, dice2)
return (isValidDiceOne(dice1) &&
isValidDiceOne(dice2))
return isValidDiceOne(dice1) &&
isValidDiceOne(dice2)
end

def isValidDiceOne(dice)
Expand Down Expand Up @@ -144,15 +144,15 @@ def getResultText(value1, value2, dice1, dice2, difficulty, total)
return ''
end

if total >= difficulty
if total >= difficulty
return "成功"
end

return "失敗"
end

def isFamble(value1, value2)
return ((value1 == 1) && (value2 == 1))
return (value1 == 1) && (value2 == 1)
end

def isCritical(value1, value2, dice1, dice2)
Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/game_system/Skynauts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def eval_game_system_specific_command(command)
private

def get_judge_result(command)
return nil unless (m = (/^2D6<=(\d)$/i.match(command) || /^SN(\d*)$/i.match(command)))
return nil unless (m = /^2D6<=(\d)$/i.match(command) || /^SN(\d*)$/i.match(command))

debug("====get_judge_result====")

Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/game_system/Strave.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def checkRoll(diceCount, target, damage)
result = "(#{diceCount}D10\<\=#{target}) > #{diceText} > Hits:#{successCount}*#{damage}#{totalDamage}ダメージ"
else
result = "(#{diceCount}D10\<\=#{target}) > #{diceText}"
if successCount > 0
if successCount > 0
result += " > 【成功】"
else
result += " > 【失敗】"
Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/game_system/TherapieSein.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def checkRoll(hasCritical, modify, target)

return result if target == 0

if successValue >= target
if successValue >= target
result += " > 【成功】"
else
result += " > 【失敗】"
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 @@ -355,7 +355,7 @@ def roll_name(command)
'武器防具の名前(ソード、メイルなど)',
'自然現象の名前(カザンハリケーンなど)',
'機械の名前(洗濯機、テレビなど)',
'目についた物の名前(シャーペン、メガネなど)', # 100
'目についた物の名前(シャーペン、メガネなど)', # 100
]
)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/game_system/cthulhu7th/full_auto.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def getFullAutoResult(command)
bullet_count = m[1].to_i
diff = m[2].to_i
broken_number = m[3].to_i
bonus_dice_count = m[4]&.to_i || 0
bonus_dice_count = m[4].to_i
stop_count = m[5]&.downcase || ""
bullet_set_count_cap = m[6]&.to_i || diff / 10

Expand Down
2 changes: 1 addition & 1 deletion lib/bcdice/loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class << self
# @param id [String] ID
# @return [Class, nil]
def game_system_class(id)
all_game_systems.find { |game_system| game_system::ID == id }
all_game_systems.find { |game_system| id == game_system::ID }
end

# ゲームシステムのクラス一覧を返す
Expand Down

0 comments on commit 0fac3b4

Please sign in to comment.