Class: BCDice::GameSystem::InfiniteFantasia

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

Constant Summary collapse

ID =

ゲームシステムの識別子

'InfiniteFantasia'
NAME =

ゲームシステム名

'無限のファンタジア'
SORT_KEY =

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

'むけんのふあんたしあ'
HELP_MESSAGE =

ダイスボットの使い方

<<~INFO_MESSAGE_TEXT
  1D20に目標値を設定した場合に、成功レベルの自動判定を行います。
  例: 1D20<=16
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

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

#result_1d20(total, _dice_total, cmp_op, target) ⇒ Object

ゲーム別成功度判定(1d20)



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/bcdice/game_system/InfiniteFantasia.rb', line 22

def result_1d20(total, _dice_total, cmp_op, target)
  return Result.nothing if target == '?'
  return nil unless cmp_op == :<=

  if total > target
    return Result.failure("失敗")
  end

  output =
    if total <= (target / 32)
      "32レベル成功(32Lv+)"
    elsif total <= (target / 16)
      "16レベル成功(16Lv+)"
    elsif total <= (target / 8)
      "8レベル成功"
    elsif total <= (target / 4)
      "4レベル成功"
    elsif total <= (target / 2)
      "2レベル成功"
    else
      "1レベル成功"
    end

  Result.new.tap do |r|
    r.text = output
    r.success = true
    if total <= 1
      r.critical = true
      r.text += "/クリティカル"
    end
  end
end