Class: BCDice::GameSystem::SharedFantasia

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

Constant Summary collapse

ID =

ゲームシステムの識別子

'SharedFantasia'
NAME =

ゲームシステム名

'Shared†Fantasia'
SORT_KEY =

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

'しえああとふあんたしあ'
HELP_MESSAGE =

ダイスボットの使い方

<<~MESSAGETEXT
  2D6の成功判定に 自動成功、自動失敗、致命的失敗、劇的成功 の判定があります。

  SF/ST = 2D6のショートカット

  例) SF+4>=9 : 2D6して4を足した値が9以上なら成功
MESSAGETEXT

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

#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

#change_text(string) ⇒ Object



26
27
28
# File 'lib/bcdice/game_system/SharedFantasia.rb', line 26

def change_text(string)
  string.gsub(/S[FT]/i, "2D6")
end

#result_2d6(total, dice_total, _dice_list, cmp_op, target) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/bcdice/game_system/SharedFantasia.rb', line 30

def result_2d6(total, dice_total, _dice_list, cmp_op, target)
  return Result.nothing if target == '?'
  return nil unless [:>=, :>].include?(cmp_op)

  critical = false
  fumble   = false

  if dice_total == 12
    critical = true
  elsif dice_total == 2
    fumble = true
  end

  totalValueBonus = (cmp_op == :>= ? 1 : 0)

  if (total + totalValueBonus) > target
    if critical
      Result.critical("自動成功(劇的成功)")
    elsif fumble
      Result.failure("自動失敗")
    else
      Result.success("成功")
    end
  else
    if critical
      Result.success("自動成功")
    elsif fumble
      Result.fumble("自動失敗(致命的失敗)")
    else
      Result.failure("失敗")
    end
  end
end