Skip to content

Commit

Permalink
Merge pull request #670 from FredGreenfield/vtm_dicepool_over_hungrdice
Browse files Browse the repository at this point in the history
[VampireTheMasquerade5th] ダイスプールよりHungerダイスよりが大きい時に全てのダイスがHungerダイスになるよう変更
  • Loading branch information
ysakasin authored Jan 24, 2024
2 parents f1db21f + 400b443 commit 676fb5e
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 7 deletions.
18 changes: 12 additions & 6 deletions lib/bcdice/game_system/VampireTheMasquerade5th.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ def eval_game_system_specific_command(command)

dice_pool, hunger_dice_pool = get_dice_pools(m)
if dice_pool < 0
return "ダイスプールより多いHungerダイスは指定できません。"
return "ダイスプール0のときにHungerダイスは指定できません。"
end
if hunger_dice_pool && hunger_dice_pool > 5
if hunger_dice_pool > 5
return "Hungerダイス指定は5ダイスが最大です。"
end

dice_text, success_dice, ten_dice, = make_dice_roll(dice_pool)
result_text = "(#{dice_pool}D10"

if hunger_dice_pool
if hunger_dice_pool >= 0
hunger_dice_text, hunger_success_dice, hunger_ten_dice, hunger_botch_dice = make_dice_roll(hunger_dice_pool)

ten_dice += hunger_ten_dice
Expand All @@ -100,11 +100,17 @@ def get_dice_pools(m)
hunger_dice_included_command = m[COMMAND_HUNGER_DICE_INCLUDED_INDEX]
if hunger_dice_included_command && hunger_dice_included_command == "VMI"
# Hunger Diceを内数処理するの場合
hunger_dice_pool = m[HUNGER_DICE_INCLUDED_INDEX]&.to_i
dice_pool = m[DICE_POOL_HUNGER_DICE_INCLUDED_INDEX].to_i - (hunger_dice_pool || 0)
hunger_dice_pool = m[HUNGER_DICE_INCLUDED_INDEX].nil? ? -1 : m[HUNGER_DICE_INCLUDED_INDEX].to_i
dice_pool_value = m[DICE_POOL_HUNGER_DICE_INCLUDED_INDEX].to_i
dice_pool = dice_pool_value - (hunger_dice_pool < 0 ? 0 : hunger_dice_pool)
if dice_pool_value > 0 && hunger_dice_pool >= dice_pool_value
# 1 以上のダイスプール、かつ、Hungerダイスがダイスプール以上のとき、ダイスプールが全てHungerダイスになる。
dice_pool = 0
hunger_dice_pool = dice_pool_value
end
else
# Hunger DiceがPLによる内数指定の場合
hunger_dice_pool = m[HUNGER_DICE_NO_INCLUDED_INDEX]&.to_i
hunger_dice_pool = m[HUNGER_DICE_NO_INCLUDED_INDEX].nil? ? -1 : m[HUNGER_DICE_NO_INCLUDED_INDEX].to_i
dice_pool = m[DICE_POOL_HUNGER_DICE_NO_INCLUDED_INDEX].to_i
end
return dice_pool, hunger_dice_pool
Expand Down
126 changes: 125 additions & 1 deletion test/data/VampireTheMasquerade5th.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2011,7 +2011,7 @@ rands = [
[[ test ]]
game_system = "VampireTheMasquerade5th"
input = "3VMI0H3"
output = "ダイスプールより多いHungerダイスは指定できません"
output = "ダイスプール0のときにHungerダイスは指定できません"
rands = [
{ sides = 10, value = 4 },
{ sides = 10, value = 10 },
Expand Down Expand Up @@ -2118,4 +2118,128 @@ rands = [
{ sides = 10, value = 5 },
{ sides = 10, value = 3 },
{ sides = 10, value = 10 },
]

# 内数指定とHungerダイスが同じ(難易度あり)
[[ test ]]
game_system = "VampireTheMasquerade5th"
input = "2VMI5H5"
output = "(0D10+5D10) > []+[4,6,6,6,1] 成功数=3 難易度=2 差分=1:判定成功!"
success = true
rands = [
{ sides = 10, value = 4 },
{ sides = 10, value = 6 },
{ sides = 10, value = 6 },
{ sides = 10, value = 6 },
{ sides = 10, value = 1 },
]

# 内数指定とHungerダイスが同じ(難易度なし)
[[ test ]]
game_system = "VampireTheMasquerade5th"
input = "VMI5H5"
output = "(0D10+5D10) > []+[4,6,6,6,1] 成功数=3\n 判定失敗なら [Bestial Failure]"
rands = [
{ sides = 10, value = 4 },
{ sides = 10, value = 6 },
{ sides = 10, value = 6 },
{ sides = 10, value = 6 },
{ sides = 10, value = 1 },
]

# 内数指定においてHungerダイスがダイスプールを上回る指定(難易度あり)
[[ test ]]
game_system = "VampireTheMasquerade5th"
input = "2VMI3H5"
output = "(0D10+3D10) > []+[4,6,6] 成功数=2 難易度=2 差分=0:判定成功!"
success = true
rands = [
{ sides = 10, value = 4 },
{ sides = 10, value = 6 },
{ sides = 10, value = 6 },
]

# 内数指定においてHungerダイスがダイスプールを上回る指定(難易度なし)
[[ test ]]
game_system = "VampireTheMasquerade5th"
input = "VMI3H5"
output = "(0D10+3D10) > []+[4,6,6] 成功数=2"
rands = [
{ sides = 10, value = 4 },
{ sides = 10, value = 6 },
{ sides = 10, value = 6 },
]

# 内数指定においてHungerダイスがダイスプールを上回る指定(難易度あり、Messy Critical)
[[ test ]]
game_system = "VampireTheMasquerade5th"
input = "2VMI3H5"
output = "(0D10+3D10) > []+[4,10,10] 成功数=4 難易度=2 差分=2:判定成功! [Messy Critical]"
success = true
critical = true
rands = [
{ sides = 10, value = 4 },
{ sides = 10, value = 10 },
{ sides = 10, value = 10 },
]

# 内数指定においてHungerダイスがダイスプールを上回る指定(難易度なし、Messy Critical)
[[ test ]]
game_system = "VampireTheMasquerade5th"
input = "VMI3H5"
output = "(0D10+3D10) > []+[4,10,10] 成功数=4\n 判定成功なら [Messy Critical]"
rands = [
{ sides = 10, value = 4 },
{ sides = 10, value = 10 },
{ sides = 10, value = 10 },
]

# 内数指定においてHungerダイスがダイスプールを上回る指定(難易度あり、Bestial Failure)
[[ test ]]
game_system = "VampireTheMasquerade5th"
input = "2VMI3H4"
output = "(0D10+3D10) > []+[4,1,10] 成功数=1 難易度=2:判定失敗! [Bestial Failure]"
failure = true
fumble = true
rands = [
{ sides = 10, value = 4 },
{ sides = 10, value = 1 },
{ sides = 10, value = 10 },
]

# 内数指定においてHungerダイスがダイスプールを上回る指定(難易度なし、Bestial Failure)
[[ test ]]
game_system = "VampireTheMasquerade5th"
input = "VMI3H4"
output = "(0D10+3D10) > []+[4,1,10] 成功数=1\n 判定失敗なら [Bestial Failure]"
rands = [
{ sides = 10, value = 4 },
{ sides = 10, value = 1 },
{ sides = 10, value = 10 },
]

# 内数指定においてHungerダイスがダイスプールを上回る指定(難易度あり、Total Failure)
[[ test ]]
game_system = "VampireTheMasquerade5th"
input = "2VMI3H4"
output = "(0D10+3D10) > []+[4,2,5] 成功数=0 難易度=2:判定失敗! [Total Failure]"
failure = true
fumble = true
rands = [
{ sides = 10, value = 4 },
{ sides = 10, value = 2 },
{ sides = 10, value = 5 },
]

# 内数指定においてHungerダイスがダイスプールを上回る指定(難易度なし、Total Failure)
[[ test ]]
game_system = "VampireTheMasquerade5th"
input = "VMI3H4"
output = "(0D10+3D10) > []+[4,2,5] 成功数=0:判定失敗! [Total Failure]"
failure = true
fumble = true
rands = [
{ sides = 10, value = 4 },
{ sides = 10, value = 2 },
{ sides = 10, value = 5 },
]

0 comments on commit 676fb5e

Please sign in to comment.