Skip to content

Commit

Permalink
remove INI roll command.
Browse files Browse the repository at this point in the history
  • Loading branch information
saronpasu committed Apr 17, 2022
1 parent 6075fcb commit b807fe7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 57 deletions.
36 changes: 3 additions & 33 deletions lib/bcdice/game_system/CyberpunkRed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ class CyberpunkRed < Base
・判定 CPx+y>=z
 (x=能力値と技能値の合計、y=修正値、z=難易度 or 受動側 x、y、zは省略可)
 例)CP12 CP10+2>=12 CP7-1 CP8+4 CP7>=12 CP CP>=9
・イニシアティブを振る INIx
 (x=反応)
 例)INI8
各種表
・致命的損傷表
Expand Down Expand Up @@ -52,9 +49,6 @@ class CyberpunkRed < Base
# 判定の正規表現
CP_RE = /^CP(?<ability>\d+)?(?<modifier>[+-]\d+)?(?<target>>=\d+)?/.freeze

# イニシアティブロールの正規表現
INI_RE = /^INI(?<initiative>\d+)/.freeze

def initialize(command)
super(command)

Expand All @@ -65,10 +59,10 @@ def initialize(command)
def eval_game_system_specific_command(command)
debug("eval_game_system_specific_command begin string", command)

cp_roll_result(command) || ini_roll_result(command) || roll_tables(command, TABLES)
cp_roll_result(command) || roll_tables(command, TABLES)
end

private_constant :CP_RE, :INI_RE
private_constant :CP_RE

def cp_roll_result(command)
parser = Command::Parser.new('CP', round_type: RoundType::FLOOR)
Expand Down Expand Up @@ -135,31 +129,7 @@ def cp_roll_result(command)
return result
end

def ini_roll_result(command)
result = "(#{command})"
total = 0

ini_match = INI_RE.match(command)
ini = nil
ini ||= ini_match[:initiative].to_i if ini_match

return nil if ini.nil?

dice = @randomizer.roll_once(10)
total += dice

result += " > #{dice}[#{dice}]"
if ini
total += ini
result += "+#{ini}"
end

result += " > #{total}"

return result
end

register_prefix('CP', 'INI', TABLES.keys)
register_prefix('CP', TABLES.keys)
end
end
end
24 changes: 0 additions & 24 deletions test/data/CyberpunkRed.toml
Original file line number Diff line number Diff line change
Expand Up @@ -124,30 +124,6 @@ rands = [
{ sides = 10, value = 3 }
]

[[ test ]]
game_system = "CyberpunkRed"
input = "INI6"
output = "(INI6) > 8[8]+6 > 14"
rands = [
{ sides = 10, value = 8 }
]

[[ test ]]
game_system = "CyberpunkRed"
input = "INI4"
output = "(INI4) > 10[10]+4 > 14"
rands = [
{ sides = 10, value = 10 }
]

[[ test ]]
game_system = "CyberpunkRed"
input = "INI7"
output = "(INI7) > 1[1]+7 > 8"
rands = [
{ sides = 10, value = 1 }
]

[[ test ]]
game_system = "CyberpunkRed"
input = "FFD"
Expand Down

0 comments on commit b807fe7

Please sign in to comment.