Class: BCDice::GameSystem::VampireTheMasquerade5th

Inherits:
Base
  • Object
show all
Defined in:
lib/bcdice/game_system/VampireTheMasquerade5th.rb

Constant Summary collapse

ID =

ゲームシステムの識別子

'VampireTheMasquerade5th'
NAME =

ゲームシステム名

'Vampire: The Masquerade 5th Edition'
SORT_KEY =

ゲームシステム名の読みがな

'うあんはいあさますかれえと5'
HELP_MESSAGE =

ダイスボットの使い方

<<~MESSAGETEXT
  ・判定コマンド(nVMFx+x)
    注意:難易度は必要成功数を表す

    難易度指定:判定成功と失敗、Critical判定、
               (Hungerダイスがある場合)Messy CriticalとBestial Failureチェックを行う
    例) (難易度)VMF(ダイスプール)+(Hungerダイス)
        (難易度)VMF(ダイスプール)

    難易度省略:判定失敗、Critical、(Hungerダイスがある場合)Bestial Failureチェックを行う
                判定成功、Messy Criticalのチェックを行わない
    例) VMF(ダイスプール)+(Hungerダイス)
        VMF(ダイスプール)

    難易度0指定:全てのチェックを行わない
    例) 0VMF(ダイスプール)+(Hungerダイス)
        0VMF(ダイスプール)

MESSAGETEXT
DIFFICULTY_INDEX =
1
DICE_POOL_INDEX =
3
HUNGER_DICE_INDEX =
5
NOT_CHECK_SUCCESS =

難易度に指定可能な特殊値

-1 # 判定成功にかかわるチェックを行わない(判定失敗に関わるチェックは行う)

Instance Attribute Summary

Attributes inherited from Base

#d66_sort_type, #default_cmp_op, #default_target_number, #randomizer, #reroll_dice_reroll_threshold, #round_type, #sides_implicit_d, #upper_dice_reroll_threshold

Instance Method Summary collapse

Methods inherited from Base

#change_text, #check_result, command_pattern, #enable_debug, #enabled_d9?, #eval, eval, #grich_text, #initialize, prefixes_pattern, register_prefix, register_prefix_from_super_class, #sort_add_dice?, #sort_barabara_dice?

Methods included from Translate

#translate

Constructor Details

This class inherits a constructor from BCDice::Base

Instance Method Details

#eval_game_system_specific_command(command) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/bcdice/game_system/VampireTheMasquerade5th.rb', line 46

def eval_game_system_specific_command(command)
  m = /\A(\d+)?(VMF)(\d+)(\+(\d+))?/.match(command)
  unless m
    return ''
  end

  dice_pool = m[DICE_POOL_INDEX].to_i
  dice_text, success_dice, ten_dice, = make_dice_roll(dice_pool)
  result_text = "(#{dice_pool}D10"

  hunger_dice_pool = m[HUNGER_DICE_INDEX]&.to_i
  if hunger_dice_pool
    hunger_dice_text, hunger_success_dice, hunger_ten_dice, hunger_botch_dice = make_dice_roll(hunger_dice_pool)

    ten_dice += hunger_ten_dice
    success_dice += hunger_success_dice

    result_text = "#{result_text}+#{hunger_dice_pool}D10) > [#{dice_text}]+[#{hunger_dice_text}] "
  else
    hunger_ten_dice = 0
    hunger_botch_dice = 0
    result_text = "#{result_text}) > [#{dice_text}] "
  end

  success_dice += get_critical_success(ten_dice)

  difficulty = m[DIFFICULTY_INDEX] ? m[DIFFICULTY_INDEX].to_i : NOT_CHECK_SUCCESS

  result_text = "#{result_text} 成功数=#{success_dice}"

  if difficulty > 0
    if success_dice >= difficulty
      judgment_result = get_success_result(ten_dice >= 2, hunger_ten_dice)
    else
      judgment_result = get_fail_result(hunger_botch_dice)
    end
    result_text = "#{result_text} 難易度=#{difficulty}#{judgment_result}"
  elsif difficulty < 0
    if success_dice == 0
      judgment_result = get_fail_result(hunger_botch_dice)
    else
      judgment_result = ""
    end
    result_text = "#{result_text}#{judgment_result}"
  end

  return result_text
end

#get_critical_success(ten_dice) ⇒ Object



95
96
97
98
# File 'lib/bcdice/game_system/VampireTheMasquerade5th.rb', line 95

def get_critical_success(ten_dice)
  # 10の目が2個毎に追加2成功
  return ((ten_dice / 2) * 2)
end

#get_fail_result(hunger_botch_dice) ⇒ Object



122
123
124
125
126
127
128
129
# File 'lib/bcdice/game_system/VampireTheMasquerade5th.rb', line 122

def get_fail_result(hunger_botch_dice)
  judgment_result = ":判定失敗!"
  if hunger_botch_dice > 0
    return "#{judgment_result} [Bestial Failure]"
  end

  return judgment_result
end

#get_success_result(is_critical, hunger_ten_dice) ⇒ Object



111
112
113
114
115
116
117
118
119
120
# File 'lib/bcdice/game_system/VampireTheMasquerade5th.rb', line 111

def get_success_result(is_critical, hunger_ten_dice)
  judgment_result = ":判定成功!"
  if hunger_ten_dice > 0 && is_critical
    return "#{judgment_result} [Messy Critical]"
  elsif is_critical
    return "#{judgment_result} [Critical Win]"
  end

  return judgment_result
end

#make_dice_roll(dice_pool) ⇒ Object



100
101
102
103
104
105
106
107
108
109
# File 'lib/bcdice/game_system/VampireTheMasquerade5th.rb', line 100

def make_dice_roll(dice_pool)
  dice_list = @randomizer.roll_barabara(dice_pool, 10)

  dice_text = dice_list.join(',')
  success_dice = dice_list.count { |x| x >= 6 }
  ten_dice = dice_list.count(10)
  botch_dice = dice_list.count(1)

  return dice_text, success_dice, ten_dice, botch_dice
end