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

Ruby 3.3のサポートと依存関係の更新 #665

Merged
merged 5 commits into from
Jan 24, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ jobs:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
ruby-version: "3.3"
bundler-cache: true
- run: bundle exec rake rubocop
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ["2.6", "2.7", "3.0", "3.1", "3.2"]
ruby: ["2.7", "3.0", "3.1", "3.2", "3.3"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -20,4 +20,4 @@ jobs:
uses: codecov/codecov-action@v3
with:
file: coverage/coverage.xml
if: matrix.ruby == '3.2'
if: matrix.ruby == '3.3'
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.6
TargetRubyVersion: 2.7
NewCops: disable
Exclude:
- 'node_modules/**/*'
Expand Down
13 changes: 6 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ source "https://rubygems.org"
gemspec

group :development, :test do
gem "racc", "~> 1.6.2"
gem "rake", "~> 13.0.3"
gem "rubocop", "~> 1.39.0", require: false
gem "simplecov", "~>0.21.2", require: false
gem "rake", "~> 13.1.0"
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
gem "tomlrb", "~>2.0.3"
gem "yard"
gem "test-unit", "~> 3.6.1", require: false
gem "tomlrb", "~> 2.0.3", require: false
gem "yard", "~> 0.9.34", require: false
end
3 changes: 2 additions & 1 deletion bcdice.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
spec.description = "BCDice is a rolling dice engine for TRPG"
spec.homepage = "https://bcdice.org"
spec.license = "BSD-3-Clause"
spec.required_ruby_version = Gem::Requirement.new(">= 2.6")
spec.required_ruby_version = Gem::Requirement.new(">= 2.7")

spec.metadata["allowed_push_host"] = "https://rubygems.org/"

Expand All @@ -22,4 +22,5 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]

spec.add_runtime_dependency "i18n", "~> 1.8.5"
spec.add_runtime_dependency "racc", "~> 1.7.3"
end
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
8 changes: 4 additions & 4 deletions lib/bcdice/game_system/AniMalus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ def resolute_attacking(command)
dice = @randomizer.roll_barabara(3, 6).sort
dice_text = dice.join(",")
success_num = dice.count { |val| val <= num_target }
is_critical = (dice[0] == 1 && dice[1] == 2 && dice[2] == 3)
is_fumble = (dice[0] == 4 && dice[1] == 5 && dice[2] == 6)
is_critical = dice[0] == 1 && dice[1] == 2 && dice[2] == 3
is_fumble = dice[0] == 4 && dice[1] == 5 && dice[2] == 6
damage1 = dice.max
damage2 = dice.max
if dice[0] == dice[1] && dice[1] == dice[2] && dice[2] <= num_target
Expand Down Expand Up @@ -161,8 +161,8 @@ def resolute_guarding(command)
dice = @randomizer.roll_barabara(3, 6).sort
dice_text = dice.join(",")
success_num = dice.count(num_target)
is_critical = (dice[0] == 1 && dice[1] == 2 && dice[2] == 3)
is_fumble = (dice[0] == 4 && dice[1] == 5 && dice[2] == 6)
is_critical = dice[0] == 1 && dice[1] == 2 && dice[2] == 3
is_fumble = dice[0] == 4 && dice[1] == 5 && dice[2] == 6

return Result.new.tap do |result|
result.critical = is_critical
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
Loading