Class: BCDice::GameSystem::Aionia
- Defined in:
- lib/bcdice/game_system/Aionia.rb
Constant Summary collapse
- ID =
ゲームシステムの識別子
"Aionia"- NAME =
ゲームシステム名
"慈悲なきアイオニア"- SORT_KEY =
ゲームシステム名の読みがな
"しひなきあいおにあ"- HELP_MESSAGE =
<<~INFO_MESSAGE_TEXT - 技能判定(クリティカル・ファンブルなし) AB{n}>={dif} n=10面ダイスの数、dif=難易度 - 技能判定(クリティカル・ファンブルあり) ABT{n}>={dif} n=10面ダイスの数、dif=難易度 - ダメージチェック DMG>={dif} dif=ダメージ難易度 ※ 技能判定、ダメージチェックともにダイス結果、難易度に対して四則演算(+ - * /)を用いた複数ボーナスを含めることが可能です。計算結果の小数は切り捨てられます。 例:AB2>=5 (一般技能を活用して難易度5の技能判定。 クリファンなし。) 例:ABT3>=15 (専門技能を活用して難易度15の技能判定。クリファンあり。) 例:AB1+1+2>=8 (一般技能を活用せず難易度8の技能判定。 ボーナスとして+1と+2点の補正あり。 クリファンなし。) 例:ABT3-3>=10+2 (専門技能を活用して難易度10+2の技能判定。ペナルティとして-3点の補正あり。クリファンあり。) 例:ABT2>=4/8/12 (一般技能を活用して難易度4/8/12の段階的な技能判定。クリファンあり。) 例:DMG>=50 (難易度50の判定。) 例:DMG>=20+50 (難易度20+50の判定。) 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
- #eval_game_system_specific_command(command) ⇒ Object
- #roll_damage_check(command) ⇒ Object
- #roll_skills(command) ⇒ Object
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
Constructor Details
This class inherits a constructor from BCDice::Base
Instance Method Details
#eval_game_system_specific_command(command) ⇒ Object
36 37 38 |
# File 'lib/bcdice/game_system/Aionia.rb', line 36 def eval_game_system_specific_command(command) return roll_skills(command) || roll_damage_check(command) end |
#roll_damage_check(command) ⇒ Object
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/bcdice/game_system/Aionia.rb', line 137 def roll_damage_check(command) parser = Command::Parser.new("DMG", round_type: BCDice::RoundType::FLOOR).restrict_cmp_op_to(:>=) parsed = parser.parse(command) return nil unless parsed # 値の計算 dif = parsed.target_number return nil unless dif # ダイスロール dice_result = @randomizer.roll_once(100) # Result用変数宣言 is_success = false # 結果判定 if dice_result < (dif / 5) is_success = false second_result = @randomizer.roll_once(100) if second_result >= dif result_str = "失敗 > 弱点追加 > #{second_result} > 戦闘不能状態" else result_str = "失敗 > 弱点追加 > #{second_result} > 死亡状態" end elsif dice_result < (dif / 2) result_str = "失敗 > 弱点追加 > 戦闘不能状態" is_success = false elsif dice_result < dif result_str = "失敗 > 戦闘不能状態" is_success = false else result_str = "成功" is_success = true end Result.new.tap do |r| r.text = "(#{command}) > #{dice_result} > #{result_str}" r.success = is_success r.failure = !is_success end end |
#roll_skills(command) ⇒ Object
40 41 42 43 44 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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 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 129 130 131 132 133 134 135 |
# File 'lib/bcdice/game_system/Aionia.rb', line 40 def roll_skills(command) m = %r{^AB(T?)(\d+)((?:[-+]\d+)*)>=(\d+(?:/\d+)*)((?:[-+]\d+)*)$}.match(command) return nil unless m # 値の取得 use_cf = m[1] != '' times = m[2].to_i # 値の計算 bonus = m[3] != '' ? Arithmetic.eval(m[3], RoundType::FLOOR) : 0 return nil unless bonus base_targets = m[4].split('/').map(&:to_i) target_bonus = m[5] != '' ? Arithmetic.eval(m[5], RoundType::FLOOR) : 0 return nil unless target_bonus targets = base_targets.map { |t| t + target_bonus } target = targets[0] min_target = targets.min max_target = targets.max # ダイスロール dice_list = @randomizer.(times, 10) dice_total = dice_list.sum total = dice_total + bonus # Result用変数宣言 is_success = false has_critical = false has_fumble = false # 結果判定 # 難易度が一つの場合 if targets.count == 1 if total >= target is_success = true if total >= target + 20 && use_cf result = 'クリティカル' has_critical = true elsif target <= times result = '自動成功' else result = '成功' end else is_success = false if dice_list.count(1) == times && use_cf result = 'ファンブル' has_fumble = true elsif target > 10 * times result = '自動失敗' else result = '失敗' end end # 段階的な難易度判定の場合 else if total >= min_target is_success = true if total >= max_target + 20 && use_cf result = 'クリティカル' has_critical = true elsif max_target <= times result = '自動成功' elsif total >= max_target result = '全成功' else times_suc = targets.count { |x| x <= total } result = "#{times_suc}段階成功" end else is_success = false if dice_list.count(1) == times && use_cf result = 'ファンブル' has_fumble = true elsif min_target > 10 * times result = '自動失敗' else result = '失敗' end end end # ボーナスがある場合の処理 bonus_text = m[3] bonus_result = m[3] == '' ? '' : "#{total} > " # Resultクラスに結果を入れる Result.new.tap do |r| r.text = "(#{command}) > #{dice_total}[#{dice_list.join(',')}]#{bonus_text} > #{bonus_result}#{result}" r.critical = has_critical r.fumble = has_fumble r.success = is_success r.failure = !is_success end end |