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
[View source]
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 |
# File 'lib/bcdice/game_system/StrangerOfSwordCity.rb', line 47 def checkRoll(command) debug("checkRoll begin command", command) result = Result.new result.text = '' 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.text += "(#{command}) > #{dice}[#{diceList.join(',')}]#{modifyText} > #{totalValue}" criticalResult = getCriticalResult(diceList) unless criticalResult.nil? result.critical = true result.success = true result.text += " > クリティカル(+#{criticalResult}D6)" return result end if isFumble(diceList, diceCount) result.fumble = true result.failure = true result.text += ' > ファンブル' return result end unless difficulty.nil? if totalValue >= difficulty result.success = true result.text += ' > 成功' else result.failure = true result.text += ' > 失敗' end end return result end |
#eval_game_system_specific_command(command) ⇒ Object
[View source]
34 35 36 37 38 39 40 41 42 43 44 45 |
# 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 if result.instance_of?(Result) return result unless result.empty? return result end |
#getCriticalResult(diceList) ⇒ Object
[View source]
100 101 102 103 104 105 106 107 108 |
# File 'lib/bcdice/game_system/StrangerOfSwordCity.rb', line 100 def getCriticalResult(diceList) dice6Count = diceList.select { |i| i == 6 }.size if dice6Count >= 2 return dice6Count.to_s end return nil end |
#getModifyText(modify) ⇒ Object
[View source]
93 94 95 96 97 98 |
# File 'lib/bcdice/game_system/StrangerOfSwordCity.rb', line 93 def getModifyText(modify) return "" if modify == 0 return modify.to_s if modify < 0 return "+#{modify}" end |
#isFumble(diceList, diceCount) ⇒ Object
[View source]
110 111 112 |
# File 'lib/bcdice/game_system/StrangerOfSwordCity.rb', line 110 def isFumble(diceList, diceCount) (diceList.select { |i| i == 1 }.size >= diceCount) end |