Class: BCDice::GameSystem::StrangerOfSwordCity
- Defined in:
- lib/bcdice/game_system/StrangerOfSwordCity.rb
Constant Summary collapse
- ID =
ゲームシステムの識別子
'StrangerOfSwordCity'- NAME =
ゲームシステム名
'剣の街の異邦人TRPG'- SORT_KEY =
ゲームシステム名の読みがな
'つるきのまちのいほうしんTRPG'- HELP_MESSAGE =
ダイスボットの使い方
<<~INFO_MESSAGE_TEXT ・判定 xSR or xSRy or xSR+y or xSR-y or xSR+y>=z x=ダイス数、y=修正値(省略可、±省略時は+として扱う)、z=難易度(省略可) 判定時はクリティカル、ファンブルの自動判定を行います。 ・通常のnD6ではクリティカル、ファンブルの自動判定は行いません。 ・D66ダイスあり INFO_MESSAGE_TEXT
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
- #checkRoll(command) ⇒ Object
- #eval_game_system_specific_command(command) ⇒ Object
- #getCriticalResult(diceList) ⇒ Object
- #getModifyText(modify) ⇒ Object
-
#initialize(command) ⇒ StrangerOfSwordCity
constructor
A new instance of StrangerOfSwordCity.
- #isFumble(diceList, diceCount) ⇒ Object
Methods inherited from Base
#change_text, #check_result, command_pattern, #enable_debug, #enabled_d9?, #eval, eval, #grich_text, prefixes_pattern, register_prefix, register_prefix_from_super_class, #sort_add_dice?, #sort_barabara_dice?
Methods included from Translate
Constructor Details
#initialize(command) ⇒ StrangerOfSwordCity
Returns a new instance of StrangerOfSwordCity.
26 27 28 29 30 31 32 |
# File 'lib/bcdice/game_system/StrangerOfSwordCity.rb', line 26 def initialize(command) super(command) @sort_add_dice = true @d66_sort_type = D66SortType::NO_SORT @round_type = RoundType::FLOOR end |
Instance Method Details
#checkRoll(command) ⇒ Object
45 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 |
# File 'lib/bcdice/game_system/StrangerOfSwordCity.rb', line 45 def checkRoll(command) debug("checkRoll begin command", command) result = '' return result unless command =~ /^(\d+)SR([+\-]?\d+)?(>=(\d+))?$/i diceCount = Regexp.last_match(1).to_i modify = Regexp.last_match(2).to_i difficulty = Regexp.last_match(4).to_i if Regexp.last_match(4) diceList = @randomizer.(diceCount, 6).sort dice = diceList.sum() totalValue = (dice + modify) modifyText = getModifyText(modify) result += "(#{command}) > #{dice}[#{diceList.join(',')}]#{modifyText} > #{totalValue}" criticalResult = getCriticalResult(diceList) unless criticalResult.nil? result += " > クリティカル(+#{criticalResult}D6)" return result end if isFumble(diceList, diceCount) result += ' > ファンブル' return result end unless difficulty.nil? result += totalValue >= difficulty ? ' > 成功' : ' > 失敗' end return result end |
#eval_game_system_specific_command(command) ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/bcdice/game_system/StrangerOfSwordCity.rb', line 34 def eval_game_system_specific_command(command) debug('eval_game_system_specific_command command', command) command = command.upcase result = checkRoll(command) return result unless result.empty? return result end |
#getCriticalResult(diceList) ⇒ Object
87 88 89 90 91 92 93 94 95 |
# File 'lib/bcdice/game_system/StrangerOfSwordCity.rb', line 87 def getCriticalResult(diceList) dice6Count = diceList.select { |i| i == 6 }.size if dice6Count >= 2 return dice6Count.to_s end return nil end |
#getModifyText(modify) ⇒ Object
80 81 82 83 84 85 |
# File 'lib/bcdice/game_system/StrangerOfSwordCity.rb', line 80 def getModifyText(modify) return "" if modify == 0 return modify.to_s if modify < 0 return "+#{modify}" end |
#isFumble(diceList, diceCount) ⇒ Object
97 98 99 |
# File 'lib/bcdice/game_system/StrangerOfSwordCity.rb', line 97 def isFumble(diceList, diceCount) (diceList.select { |i| i == 1 }.size >= diceCount) end |