Class: BCDice::GameSystem::SwordWorld

Inherits:
Base
  • Object
show all
Defined in:
lib/bcdice/game_system/SwordWorld.rb,
lib/bcdice/game_system/sword_world/rating_lexer.rb,
lib/bcdice/game_system/sword_world/rating_parsed.rb,
lib/bcdice/game_system/sword_world/rating_parser.rb,
lib/bcdice/game_system/sword_world/rating_options.rb

Direct Known Subclasses

SwordWorld2_0, SwordWorld_SimplifiedChinese

Defined Under Namespace

Classes: RatingLexer, RatingOptions, RatingParsed, RatingParser

Constant Summary collapse

ID =

ゲームシステムの識別子

'SwordWorld'
NAME =

ゲームシステム名

'ソード・ワールドRPG'
SORT_KEY =

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

'そおとわあると'
HELP_MESSAGE =

ダイスボットの使い方

"・SW レーティング表 (Kx[c]+m$f) (x:キー, c:クリティカル値, m:ボーナス, f:出目修正)\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

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

#translate

Constructor Details

#initialize(command) ⇒ SwordWorld

Returns a new instance of SwordWorld.



23
24
25
26
# File 'lib/bcdice/game_system/SwordWorld.rb', line 23

def initialize(command)
  super(command)
  @rating_table = 0
end

Instance Method Details

#eval_game_system_specific_command(command) ⇒ Object



42
43
44
# File 'lib/bcdice/game_system/SwordWorld.rb', line 42

def eval_game_system_specific_command(command)
  rating(command)
end

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



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/bcdice/game_system/SwordWorld.rb', line 28

def result_2d6(total, dice_total, _dice_list, cmp_op, target)
  if dice_total >= 12
    Result.critical(translate('SwordWorld.critical'))
  elsif dice_total <= 2
    Result.fumble(translate('SwordWorld.fumble'))
  elsif cmp_op != :>= || target == "?"
    nil
  elsif total >= target
    Result.success(translate('success'))
  else
    Result.failure(translate('failure'))
  end
end