Class: BCDice::GameSystem::AngelGear

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

Constant Summary collapse

ID =

ゲームシステムの識別子

'AngelGear'
NAME =

ゲームシステム名

'エンゼルギア 天使大戦TRPG The 2nd Editon'
SORT_KEY =

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

'えんせるきあ2'
HELP_MESSAGE =

ダイスボットの使い方

<<~MESSAGETEXT
  ・判定 nAG[s][±a]
  []内は省略可能。
  n:判定値
  s:技能値
  a:修正
  (例)
  12AG 10AG3±20

  ・感情表 ET
MESSAGETEXT
TABLES =
{
  'ET' => DiceTable::D66GridTable.new(
    '感情表',
    [
      [
        '好奇心(好奇心)',
        '憧れ(あこがれ)',
        '尊敬(そんけい)',
        '仲間意識(なかまいしき)',
        '母性愛(ぼせいあい)',
        '感心(かんしん)'
      ],
      [
        '純愛(じゅんあい)',
        '友情(ゆうじょう)',
        '同情(どうじょう)',
        '父性愛(ふせいあい)',
        '幸福感(こうふくかん)',
        '信頼(しんらい)'
      ],
      [
        '競争心(きょうそうしん)',
        '親近感(しんきんかん)',
        'まごころ',
        '好意(こうい)',
        '有為(ゆうい)',
        '崇拝(すうはい)'
      ],
      [
        '大嫌い(だいきらい)',
        '妬み(ねたみ)',
        '侮蔑(ぶべつ)',
        '腐れ縁(くされえん)',
        '恐怖(きょうふ)',
        '劣等感(れっとうかん)'
      ],
      [
        '偏愛(へんあい)',
        '寂しさ(さびしさ)',
        '憐憫(れんびん)',
        '闘争心(とうそうしん)',
        '食傷(しょくしょう)',
        '嘘つき(うそつき)'
      ],
      [
        '甘え(あまえ)',
        '苛立ち(いらだち)',
        '下心(したごころ)',
        '憎悪(ぞうお)',
        '疑惑(ぎわく)',
        '支配(しはい)'
      ],
    ]
  )
}.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, prefixes_pattern, register_prefix, register_prefix_from_super_class, #sort_add_dice?, #sort_barabara_dice?

Methods included from Translate

#translate

Constructor Details

#initialize(command) ⇒ AngelGear

Returns a new instance of AngelGear.



32
33
34
35
36
# File 'lib/bcdice/game_system/AngelGear.rb', line 32

def initialize(command)
  super(command)

  @sort_barabara_dice = true # バラバラロール(Bコマンド)でソート有
end

Instance Method Details

#eval_game_system_specific_command(command) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/bcdice/game_system/AngelGear.rb', line 38

def eval_game_system_specific_command(command)
  if (m = /^(\d+)AG(\d+)?(([+-]\d+)*)$/.match(command))
    resolute_action(m[1].to_i, m[2]&.to_i, m[3], command)
  else
    roll_tables(command, TABLES)
  end
end

#resolute_action(num_dice, skill_value, modify, command) ⇒ Object



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

def resolute_action(num_dice, skill_value, modify, command)
  dice = @randomizer.roll_barabara(num_dice, 6).sort
  dice_text = dice.join(",")
  modify_n = 0
  success = 0
  if skill_value
    success = dice.count { |val| val <= skill_value }
    modify_n = Arithmetic.eval(modify, RoundType::FLOOR) unless modify.empty?
  end

  gospel = '(福音発生)' if success + modify_n >= 100

  output = "(#{command}) > #{success}[#{dice_text}]#{format('%+d', modify_n)} > 成功数: #{success + modify_n}#{gospel}"

  if success + modify_n >= 100
    Result.critical(output)
  elsif 0 < success + modify_n
    Result.success(output)
  else
    Result.failure(output)
  end
end