diff --git a/i18n/ZombiLine/ja_jp.yml b/i18n/ZombiLine/ja_jp.yml new file mode 100644 index 000000000..69f1b1096 --- /dev/null +++ b/i18n/ZombiLine/ja_jp.yml @@ -0,0 +1,27 @@ +ja_jp: + ZombiLine: + success_critical: "成功(クリティカル)" + success_fumble: "成功(ファンブル)" + success: "成功" + failure_fumble: "失敗(ファンブル)" + failure: "失敗" + SST: + name: "ストレス症状表" + type: "1D10" + items: + - '憤怒:一番近い敵を攻撃(成功率+20%)しにいきます。近くに敵がいない場合、誰かのストレスを+1させます。 頭に血が上り、誰かに怒りをぶつけます。' + - '逃避:落下してでも敵から逃げるように移動します。周囲に敵が居ない場合、現実逃避します。 耐えられなくなり、逃げ出します。' + - '幻覚:戦闘中は、「行動放棄(全AP)」します。戦闘以外なら、幻覚を見て笑います。 自分が望む幻覚が見えます。' + - '絶叫:戦闘中は、「注目を集める(2AP)」をします。戦闘以外なら、無意味に叫びます。 思わず叫んでしまいます。' + - '自傷:自ら【怪我】を負います。戦闘中は「自傷行為(1AP)」をして自分が【怪我】します。 思わず自分を傷つけます。' + - '不安:誰かのストレスを1上げます。近くに誰も居ない場合、泣き出します。 不安にかられて余計なことを言います。' + - '忌避:その場から一番近い対象に「石(1AP)」を投げます。それができない場合、【転倒】してうずくまります。 嫌悪感から全てを拒みます。' + - '暴走:一番近い敵を攻撃しにいきます。近くに敵がいない場合、周りの意見も聞かずに安直な行動をします。 冷静でいられなくなり、直情的になります。' + - '混乱:近くにいるランダムな対象に格闘で攻撃しにいきます。それができない場合、「行動放棄(全 AP)」します。 世界全てが敵に見えて攻撃します。' + - '開眼:ストレスは0まで下がります。あなたは教祖となって教義をひとつつくって「布教」できます。次の症状が出るまで効果は続きます。 ゾンビだらけの世界の真理を見つけます。' + IT: + name: "食材表" + items: + raw: '生モノ食材' + suspicious: '怪しい食材' + dangerous: '危ない食材' diff --git a/i18n/ZombiLine/ko_kr.yml b/i18n/ZombiLine/ko_kr.yml new file mode 100644 index 000000000..92c4307aa --- /dev/null +++ b/i18n/ZombiLine/ko_kr.yml @@ -0,0 +1,27 @@ +ko_kr: + ZombiLine: + success_critical: "성공(크리티컬)" + success_fumble: "성공(펌블)" + success: "성공" + failure_fumble: "실패(펌블)" + failure: "실패" + SST: + name: "스트레스 증상표" + type: "1D10" + items: + - '[분노] 가장 가까이 있는 적을 공격(성공률 +20%)합니다. 가까이 적이 없는 경우, 누군가의 스트레스를 +1시킵니다. / 설명: 머리에 피가 몰려 누군가에게 화를 터트립니다.' + - '[도피] 낙하하더라도 적에게서 도망치려 이동합니다. 주변에 적이 없는 경우, 현실도피를 하려 합니다. / 설명: 견딜 수 없게 되어 도망칩니다.' + - '[환상] 전투 중에는 「행동방치(전AP)」를 합니다. 전투 이외의 경우, 환상을 보며 웃음을 흘립니다. / 설명: 자신이 꿈꾸는 환상을 봅니다.' + - '[절규] 전투 중에는 비명을 지르며 「주목을 모은다(2AP)」를 합니다. 전투 이외의 경우, 무의미한 소리를 지릅니다. / 설명: 생각없이 비명을 지릅니다.' + - '[자해] 스스로 【상처】를 입습니다. 전투 중에는 「자해행위(1AP)」로 스스로에게 【상처】를 입힙니다. / 설명: 생각없이 자신에게 상처를 입힙니다.' + - '[불안] 누군가의 스트레스를 1 올립니다. 근처에 아무도 없는 경우, 울음을 터트립니다. / 설명: 불안해져 쓸데없는 말을 지껄입니다.' + - '[기피] 그 자리에서 가장 가까이 있는 대상에게 「돌(1AP)」을 던집니다. 그게 불가능한 경우, 【넘어짐】상태가 됩니다. / 설명: 혐오감으로 모든 것을 거부합니다.' + - '[폭주] 가장 가까이 있는 적에게 공격을 가합니다. 가까이 적이 없는 경우 주변의 의견을 듣지 않고 제멋대로 행동을 합니다. / 설명: 냉정을 찾지 못하고 제멋대로 행동합니다.' + - '[혼란] 가까이 있는 무작위 대상에게 격투로 공격을 가합니다. 그게 불가능한 경우 「행동방치(전AP)」를 합니다. / 설명: 세상 모든 것이 적으로 보여 공격합니다.' + - '[개안] 스트레스가 0까지 떨어집니다. 당신은 교조가 되어 교의를 한가지 정해 「포교」할 수 있습니다. 다음 증상이 나올 때까지 효과가 지속됩니다. / 설명: 좀비투성이 세상의 진리를 보았습니다.' + IT: + name: "식재료 표" + items: + raw: '신선 식재료' + suspicious: '수상한 식재료' + dangerous: '위험한 식재료' diff --git a/lib/bcdice/game_system.rb b/lib/bcdice/game_system.rb index 88a896aee..5dd88a9c2 100644 --- a/lib/bcdice/game_system.rb +++ b/lib/bcdice/game_system.rb @@ -293,6 +293,7 @@ require "bcdice/game_system/YuMyoKishi" require "bcdice/game_system/ZettaiReido" require "bcdice/game_system/ZombiLine" +require "bcdice/game_system/ZombiLine_Korean" require "bcdice/game_system/FinalFantasyXIV" require "bcdice/game_system/FinalFantasyXIV_English" require "bcdice/game_system/Garactier" diff --git a/lib/bcdice/game_system/ZombiLine.rb b/lib/bcdice/game_system/ZombiLine.rb index 25d966b5d..6e3234f3e 100644 --- a/lib/bcdice/game_system/ZombiLine.rb +++ b/lib/bcdice/game_system/ZombiLine.rb @@ -28,7 +28,7 @@ def initialize(command) end def eval_game_system_specific_command(command) - return check_action(command) || roll_tables(command, TABLES) + return check_action(command) || roll_tables(command, self.class::TABLES) end def check_action(command) @@ -37,9 +37,7 @@ def check_action(command) .disable_modifier .restrict_cmp_op_to(:<=) parsed = parser.parse(command) - unless parsed - return nil - end + return nil unless parsed dice_count = parsed.prefix_number || 1 target_num = parsed.target_number @@ -50,6 +48,7 @@ def check_action(command) is_success = dice_list.any? { |i| i <= target_num } is_critical = dice_list.any? { |i| i <= 5 } is_fumble = dice_list.any? { |i| i >= 96 && i > target_num } + if is_critical && is_fumble is_critical = false is_fumble = false @@ -57,16 +56,17 @@ def check_action(command) success_message = if is_success && is_critical - "成功(クリティカル)" + translate("ZombiLine.success_critical") elsif is_success && is_fumble - "成功(ファンブル)" + translate("ZombiLine.success_fumble") elsif is_success - "成功" + translate("ZombiLine.success") elsif is_fumble - "失敗(ファンブル)" + translate("ZombiLine.failure_fumble") else - "失敗" + translate("ZombiLine.failure") end + sequence = [ "(#{parsed})", "[#{dice_list.join(',')}]", @@ -81,33 +81,26 @@ def check_action(command) end end - TABLES = { - 'SST' => DiceTable::Table.new( - 'ストレス症状表', - '1D10', - [ - '憤怒:一番近い敵を攻撃(成功率+20%)しにいきます。近くに敵がいない場合、誰かのストレスを+1させます。 頭に血が上り、誰かに怒りをぶつけます。', - '逃避:落下してでも敵から逃げるように移動します。周囲に敵が居ない場合、現実逃避します。 耐えられなくなり、逃げ出します。', - '幻覚:戦闘中は、「行動放棄(全AP)」します。戦闘以外なら、幻覚を見て笑います。 自分が望む幻覚が見えます。', - '絶叫:戦闘中は、「注目を集める(2AP)」をします。戦闘以外なら、無意味に叫びます。 思わず叫んでしまいます。', - '自傷:自ら【怪我】を負います。戦闘中は「自傷行為(1AP)」をして自分が【怪我】します。 思わず自分を傷つけます。', - '不安:誰かのストレスを1上げます。近くに誰も居ない場合、泣き出します。 不安にかられて余計なことを言います。', - '忌避:その場から一番近い対象に「石(1AP)」を投げます。それができない場合、【転倒】してうずくまります。 嫌悪感から全てを拒みます。', - '暴走:一番近い敵を攻撃しにいきます。近くに敵がいない場合、周りの意見も聞かずに安直な行動をします。 冷静でいられなくなり、直情的になります。', - '混乱:近くにいるランダムな対象に格闘で攻撃しにいきます。それができない場合、「行動放棄(全 AP)」します。 世界全てが敵に見えて攻撃します。', - '開眼:ストレスは0まで下がります。あなたは教祖となって教義をひとつつくって「布教」できます。次の症状が出るまで効果は続きます。 ゾンビだらけの世界の真理を見つけます。', - ] - ), - 'IT' => DiceTable::RangeTable.new( - '食材表', - '1d100', - [ - [1..50, '生モノ食材'], - [51..80, '怪しい食材'], - [81..100, '危ない食材'] - ] - ) - }.freeze + class << self + private + + def translate_tables(locale) + { + 'SST' => DiceTable::Table.from_i18n("ZombiLine.SST", locale), + 'IT' => DiceTable::RangeTable.new( + I18n.t("ZombiLine.IT.name", locale: locale), + '1d100', + [ + [1..50, I18n.t("ZombiLine.IT.items.raw", locale: locale)], + [51..80, I18n.t("ZombiLine.IT.items.suspicious", locale: locale)], + [81..100, I18n.t("ZombiLine.IT.items.dangerous", locale: locale)] + ] + ) + } + end + end + + TABLES = translate_tables(:ja_jp).freeze register_prefix('\d*ZL', TABLES.keys) end diff --git a/lib/bcdice/game_system/ZombiLine_Korean.rb b/lib/bcdice/game_system/ZombiLine_Korean.rb new file mode 100644 index 000000000..ddf009317 --- /dev/null +++ b/lib/bcdice/game_system/ZombiLine_Korean.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +module BCDice + module GameSystem + class ZombiLine_Korean < ZombiLine + # ゲームシステムの識別子 + ID = "ZombiLine:Korean" + + # ゲームシステム名 + NAME = "좀비 라인" + + # ゲームシステム名の読みがな + SORT_KEY = "国際化:Korean:좀비 라인" + + HELP_MESSAGE = <<~TEXT + ■ 판정 (xZL<=y) +  x:주사위 개수(생략 시 1) +  y:성공률 + + ■ 각종 표 +  스트레스 증상표 SST +  식재료 표 IT + TEXT + + register_prefix_from_super_class() + + def initialize(command) + super(command) + @locale = :ko_kr + end + + TABLES = translate_tables(:ko_kr).freeze + end + end +end diff --git a/test/data/ZombiLine_Korean.toml b/test/data/ZombiLine_Korean.toml new file mode 100644 index 000000000..c799fd3d6 --- /dev/null +++ b/test/data/ZombiLine_Korean.toml @@ -0,0 +1,210 @@ +[[test]] +game_system = "ZombiLine:Korean" +input = "1ZL<=50" +output = "(1ZL<=50) > [20] > 성공" +success = true +rands = [ + { sides = 100, value = 20 }, +] + +[[test]] +game_system = "ZombiLine:Korean" +input = "1ZL<=50" +output = "(1ZL<=50) > [50] > 성공" +success = true +rands = [ + { sides = 100, value = 50 }, +] + +[[test]] +game_system = "ZombiLine:Korean" +input = "1ZL<=50" +output = "(1ZL<=50) > [51] > 실패" +failure = true +rands = [ + { sides = 100, value = 51 }, +] + +[[test]] +game_system = "ZombiLine:Korean" +input = "1ZL<=50" +output = "(1ZL<=50) > [6] > 성공" +success = true +rands = [ + { sides = 100, value = 6 }, +] + +[[test]] +game_system = "ZombiLine:Korean" +input = "1ZL<=50" +output = "(1ZL<=50) > [5] > 성공(크리티컬)" +success = true +critical = true +rands = [ + { sides = 100, value = 5 }, +] + +[[test]] +game_system = "ZombiLine:Korean" +input = "1ZL<=50" +output = "(1ZL<=50) > [95] > 실패" +failure = true +rands = [ + { sides = 100, value = 95 }, +] + +[[test]] +game_system = "ZombiLine:Korean" +input = "1ZL<=50" +output = "(1ZL<=50) > [96] > 실패(펌블)" +failure = true +fumble = true +rands = [ + { sides = 100, value = 96 }, +] + +[[test]] +game_system = "ZombiLine:Korean" +input = "1ZL<=98" +output = "(1ZL<=98) > [98] > 성공" +success = true +rands = [ + { sides = 100, value = 98 }, +] + +[[test]] +game_system = "ZombiLine:Korean" +input = "1ZL<=98" +output = "(1ZL<=98) > [99] > 실패(펌블)" +failure = true +fumble = true +rands = [ + { sides = 100, value = 99 }, +] + +[[test]] +game_system = "ZombiLine:Korean" +input = "ZL<=70" +output = "(ZL<=70) > [65] > 성공" +success = true +rands = [ + { sides = 100, value = 65 }, +] + +[[test]] +game_system = "ZombiLine:Korean" +input = "2ZL<=70" +output = "(2ZL<=70) > [36,82] > 성공" +success = true +rands = [ + { sides = 100, value = 36 }, + { sides = 100, value = 82 }, +] + +[[test]] +game_system = "ZombiLine:Korean" +input = "2ZL<=70" +output = "(2ZL<=70) > [74,91] > 실패" +failure = true +rands = [ + { sides = 100, value = 91 }, + { sides = 100, value = 74 }, +] + +[[test]] +game_system = "ZombiLine:Korean" +input = "2ZL<=70" +output = "(2ZL<=70) > [12,28] > 성공" +success = true +rands = [ + { sides = 100, value = 28 }, + { sides = 100, value = 12 }, +] + +[[test]] +game_system = "ZombiLine:Korean" +input = "2ZL<=70" +output = "(2ZL<=70) > [8,97] > 성공(펌블)" +success = true +fumble = true +rands = [ + { sides = 100, value = 97 }, + { sides = 100, value = 8 }, +] + +[[test]] +game_system = "ZombiLine:Korean" +input = "2ZL<=70" +output = "(2ZL<=70) > [4,97] > 성공" +success = true +rands = [ + { sides = 100, value = 4 }, + { sides = 100, value = 97 }, +] + +[[test]] +game_system = "ZombiLine:Korean" +input = "2ZL<=70" +output = "(2ZL<=70) > [3,78] > 성공(크리티컬)" +success = true +critical = true +rands = [ + { sides = 100, value = 3 }, + { sides = 100, value = 78 }, +] + +[[test]] +game_system = "ZombiLine:Korean" +input = "SST" +output = "스트레스 증상표(2) > [도피] 낙하하더라도 적에게서 도망치려 이동합니다. 주변에 적이 없는 경우, 현실도피를 하려 합니다. / 설명: 견딜 수 없게 되어 도망칩니다." +rands = [ + { sides = 10, value = 2 } +] + +[[test]] +game_system = "ZombiLine:Korean" +input = "SST" +output = "스트레스 증상표(3) > [환상] 전투 중에는 「행동방치(전AP)」를 합니다. 전투 이외의 경우, 환상을 보며 웃음을 흘립니다. / 설명: 자신이 꿈꾸는 환상을 봅니다." +rands = [ + { sides = 10, value = 3 } +] + +[[test]] +game_system = "ZombiLine:Korean" +input = "IT" +output = "식재료 표(13) > 신선 식재료" +rands = [ + { sides = 100, value = 13 } +] + +[[test]] +game_system = "ZombiLine:Korean" +input = "IT" +output = "식재료 표(50) > 신선 식재료" +rands = [ + { sides = 100, value = 50 } +] + +[[test]] +game_system = "ZombiLine:Korean" +input = "IT" +output = "식재료 표(51) > 수상한 식재료" +rands = [ + { sides = 100, value = 51 } +] + +[[test]] +game_system = "ZombiLine:Korean" +input = "IT" +output = "식재료 표(80) > 수상한 식재료" +rands = [ + { sides = 100, value = 80 } +] + +[[test]] +game_system = "ZombiLine:Korean" +input = "IT" +output = "식재료 표(81) > 위험한 식재료" +rands = [ + { sides = 100, value = 81 } +]