Class: BCDice::GameSystem::Utakaze
- Defined in:
- lib/bcdice/game_system/Utakaze.rb
Constant Summary collapse
- ID =
ゲームシステムの識別子
'Utakaze'- NAME =
ゲームシステム名
'ウタカゼ'- SORT_KEY =
ゲームシステム名の読みがな
'うたかせ'- HELP_MESSAGE =
ダイスボットの使い方
"\u30FB\u884C\u70BA\u5224\u5B9A\u30ED\u30FC\u30EB\uFF08nUK\uFF09\n n\u500B\u306E\u30B5\u30A4\u30B3\u30ED\u3067\u884C\u70BA\u5224\u5B9A\u30ED\u30FC\u30EB\u3002\u30BE\u30ED\u76EE\u306E\u6700\u5927\u500B\u6570\u3092\u6210\u529F\u30EC\u30D9\u30EB\u3068\u3057\u3066\u8868\u793A\u3002n\u3092\u7701\u7565\u3059\u308B\u30682UK\u6271\u3044\u3002\n \u4F8B\uFF093UK \uFF1A\u30B5\u30A4\u30B3\u30ED3\u500B\u3067\u884C\u70BA\u5224\u5B9A\n \u4F8B\uFF09UK \uFF1A\u30B5\u30A4\u30B3\u30ED2\u500B\u3067\u884C\u70BA\u5224\u5B9A\n \u4E0D\u7B49\u53F7\u7528\u3044\u305F\u6210\u5426\u5224\u5B9A\u306F\u73FE\u6642\u70B9\u3067\u306F\u5B9F\u88C5\u3057\u3066\u307E\u305B\u3093\u3002\n\u30FB\u30AF\u30EA\u30C6\u30A3\u30AB\u30EB\u30B3\u30FC\u30EB\u4ED8\u304D\u884C\u70BA\u5224\u5B9A\u30ED\u30FC\u30EB\uFF08nUK@c or nUKc\uFF09\n\u3000c\u306B\u300C\u9F8D\u306E\u30C0\u30A4\u30B9\u76EE\u300D\u3092\u6307\u5B9A\u3057\u305F\u884C\u70BA\u5224\u5B9A\u30ED\u30FC\u30EB\u3002\n \u30BE\u30ED\u76EE\u3067\u306F\u306A\u304F\u3001c\u3068\u540C\u3058\u5024\u306E\u51FA\u76EE\u6570x2\u304C\u6210\u529F\u30EC\u30D9\u30EB\u3068\u306A\u308A\u307E\u3059\u3002\n \u4F8B\uFF093UK@5 \uFF1A\u9F8D\u306E\u30C0\u30A4\u30B9\u300C\u6708\u300D\u3067\u30AF\u30EA\u30C6\u30A3\u30AB\u30EB\u30B3\u30FC\u30EB\u5BA3\u8A00\u3057\u305F\u30B5\u30A4\u30B3\u30ED3\u500B\u306E\u884C\u70BA\u5224\u5B9A\n"
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(base, crit, diff = 0) ⇒ Object
- #eval_game_system_specific_command(command) ⇒ Object
-
#getDiceCountHash(dice_list, critical) ⇒ Object
各ダイスの個数を数えてHashにする.
- #getRollResultString(diceList, crit, diff) ⇒ Object
- #getSuccessInfo(diceList, crit, _diff) ⇒ Object
- #getValue(number) ⇒ Object
-
#initialize(command) ⇒ Utakaze
constructor
A new instance of Utakaze.
- #isDragonDice(crit) ⇒ Object
- #isNomalDice(crit) ⇒ 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) ⇒ Utakaze
Returns a new instance of Utakaze.
30 31 32 33 34 |
# File 'lib/bcdice/game_system/Utakaze.rb', line 30 def initialize(command) super(command) @arrayDragonDiceName = ['', '風', '雨', '雲', '影', '月', '歌'] @enabled_upcase_input = false end |
Instance Method Details
#checkRoll(base, crit, diff = 0) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/bcdice/game_system/Utakaze.rb', line 54 def checkRoll(base, crit, diff = 0) result = "" base = getValue(base) crit = getValue(crit) return result if base < 1 crit = 6 if crit > 6 result += "(#{base}d6)" diceList = @randomizer.(base, 6).sort result += " > [#{diceList.join(',')}] > " result += getRollResultString(diceList, crit, diff) return result end |
#eval_game_system_specific_command(command) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/bcdice/game_system/Utakaze.rb', line 36 def eval_game_system_specific_command(command) debug('eval_game_system_specific_command command', command) result = '' case command when /(\d+)?UK(@?(\d))?(>=(\d+))?/i base = (Regexp.last_match(1) || 2).to_i crit = Regexp.last_match(3).to_i diff = Regexp.last_match(5).to_i result = checkRoll(base, crit, diff) end return nil if result.empty? return "#{command} > #{result}" end |
#getDiceCountHash(dice_list, critical) ⇒ Object
各ダイスの個数を数えてHashにする
131 132 133 134 135 136 |
# File 'lib/bcdice/game_system/Utakaze.rb', line 131 def getDiceCountHash(dice_list, critical) dice_list .select { |dice| isNomalDice(critical) || dice == critical } .group_by(&:itself) .transform_values(&:size) end |
#getRollResultString(diceList, crit, diff) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/bcdice/game_system/Utakaze.rb', line 74 def getRollResultString(diceList, crit, diff) success, maxnum, setCount = getSuccessInfo(diceList, crit, diff) result = "" if isDragonDice(crit) result += "龍のダイス「#{@arrayDragonDiceName[crit]}」(#{crit})を使用 > " end if success result += "成功レベル:#{maxnum} (#{setCount}セット)" if diff != 0 diffSuccess = (maxnum >= diff) if diffSuccess result += " > 成功" else result += " > 失敗" end end else result += "失敗" end return result end |
#getSuccessInfo(diceList, crit, _diff) ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/bcdice/game_system/Utakaze.rb', line 101 def getSuccessInfo(diceList, crit, _diff) debug("checkSuccess diceList, crit", diceList, crit) diceCountHash = getDiceCountHash(diceList, crit) debug("diceCountHash", diceCountHash) maxnum = 0 successDiceList = [] countThreshold = (isDragonDice(crit) ? 1 : 2) diceCountHash.each do |dice, count| maxnum = count if count > maxnum successDiceList << dice if count >= countThreshold end debug("successDiceList", successDiceList) if successDiceList.size <= 0 # 失敗:ゾロ目無し(全部違う) return false, 0, 0 end # 竜のダイスの場合 maxnum *= 2 if isDragonDice(crit) # 成功:ゾロ目あり return true, maxnum, successDiceList.size end |
#getValue(number) ⇒ Object
146 147 148 149 150 |
# File 'lib/bcdice/game_system/Utakaze.rb', line 146 def getValue(number) return 0 if number > 100 return number end |
#isDragonDice(crit) ⇒ Object
142 143 144 |
# File 'lib/bcdice/game_system/Utakaze.rb', line 142 def isDragonDice(crit) (crit != 0) end |
#isNomalDice(crit) ⇒ Object
138 139 140 |
# File 'lib/bcdice/game_system/Utakaze.rb', line 138 def isNomalDice(crit) !isDragonDice(crit) end |