Class: BCDice::GameSystem::AnimaAnimus

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

Direct Known Subclasses

AnimaAnimus_Korean

Constant Summary collapse

ID =

ゲームシステムの識別子

'AnimaAnimus'
NAME =

ゲームシステム名

'アニマアニムス'
SORT_KEY =

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

「ゲームシステム名の読みがなの設定方法」(docs/dicebot_sort_key.md)を参考にして 設定してください

'あにまあにむす'
HELP_MESSAGE =

ダイスボットの使い方

"\u30FB\u884C\u70BA\u5224\u5B9A(xAN<=y\u00B1z)\n\u3000\u5341\u9762\u30C0\u30A4\u30B9\u3092x\u500B\u632F\u3063\u3066\u5224\u5B9A\u3057\u307E\u3059\u3002\u9054\u6210\u5024\u304C\u7B97\u51FA\u3055\u308C\u307E\u3059(\u30AF\u30EA\u30C6\u30A3\u30AB\u30EB\u767A\u751F\u6642\u306F2\u5897\u52A0)\u3002\n\u3000x\uFF1A\u632F\u308B\u30C0\u30A4\u30B9\u306E\u6570\u3002\u9B42\u9B44\u5024\u3084\u653B\u6483\u5024\u3002\n\u3000y\uFF1A\u6210\u529F\u5024\u3002\n\u3000z\uFF1A\u6210\u529F\u5024\u3078\u306E\u88DC\u6B63\u3002\u7701\u7565\u53EF\u80FD\u3002\n\u3000(\u4F8B) 2AN<=3+1 5AN<=7\n\u30FB\u5404\u7A2E\u8868\n\u3000\u60C5\u5831\u53CE\u96C6\u8868\u3000IGT/\u55AA\u5931\u8868\u3000LT\n"
TABLES =
translate_tables(:ja_jp).freeze

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

#check_action(match_data) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/bcdice/game_system/AnimaAnimus.rb', line 45

def check_action(match_data)
  dice_cnt = Arithmetic.eval(match_data[1], RoundType::FLOOR)
  target = Arithmetic.eval(match_data[2], RoundType::FLOOR)
  debug("dice_cnt", dice_cnt)
  debug("target", target)

  dice_arr = @randomizer.roll_barabara(dice_cnt, 10)
  dice_str = dice_arr.join(",")
  suc_cnt = dice_arr.count { |x| x <= target }
  has_critical = dice_arr.include?(1)
  result = has_critical ? suc_cnt + 2 : suc_cnt

  Result.new.tap do |r|
    r.text = "(#{dice_cnt}B10<=#{target}) > #{dice_str} > #{result > 0 ? translate('success') : translate('failure')}(#{translate('AnimaAnimus.achievement_value')}:#{result})#{has_critical ? " (#{translate('AnimaAnimus.critical')})" : ''}"
    r.critical = has_critical
    r.success = result > 0
    r.failure = !r.success?
  end
end

#eval_game_system_specific_command(command) ⇒ Object



34
35
36
37
38
39
40
41
42
43
# File 'lib/bcdice/game_system/AnimaAnimus.rb', line 34

def eval_game_system_specific_command(command)
  m = /(\d+)AN<=(\d+([+-]\d+)*)/i.match(command)
  if self.class::TABLES.key?(command)
    return roll_tables(command, self.class::TABLES)
  elsif m
    return check_action(m)
  else
    return nil
  end
end