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 =

ダイスボットの使い方

<<~MESSAGETEXT
  ・行為判定(xAN<=y±z)
   十面ダイスをx個振って判定します。達成値が算出されます(クリティカル発生時は2増加)。
   x:振るダイスの数。魂魄値や攻撃値。
   y:成功値。
   z:成功値への補正。省略可能。
   (例) 2AN<=3+1 5AN<=7
  ・各種表
   情報収集表 IGT/喪失表 LT
MESSAGETEXT
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