Class: BCDice::GameSystem::Raisondetre

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

Constant Summary collapse

ID =

ゲームシステムの識別子

'Raisondetre'
NAME =

ゲームシステム名

'叛逆レゾンデートル'
SORT_KEY =

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

'はんきやくれそんてとおる'
HELP_MESSAGE =

ダイスボットの使い方

"\u5224\u5B9A\uFF1A[\u5224\u5B9A\u5024]RD[\u6280\u80FD][@\u76EE\u6A19\u5024]\n\u30C0\u30E1\u30FC\u30B8\u30ED\u30FC\u30EB\uFF1A[\u30C0\u30A4\u30B9\u6570]DD[\u88C5\u7532]\n\n[]\u5185\u306E\u30B3\u30DE\u30F3\u30C9\u306F\u7701\u7565\u53EF\u80FD\u3002\n\u300C\u5224\u5B9A\u5024\u300D\u3067\u5224\u5B9A\u306B\u4F7F\u7528\u3059\u308B\u30C0\u30A4\u30B9\u6570\u3092\u6307\u5B9A\u3002\u7701\u7565\u6642\u306F\u300C1\u300D\u30020\u4EE5\u4E0B\u3082\u6307\u5B9A\u53EF\u3002\n\u300C\u6280\u80FD\u300D\u3067\u6709\u52B9\u306A\u30C0\u30A4\u30B9\u6570\u3092\u6307\u5B9A\u3002\u7701\u7565\u6642\u306F\u300C1\u300D\u3002\n\u9054\u6210\u5024\u306F\u30AF\u30EA\u30C6\u30A3\u30AB\u30EB\u3092\u542B\u3081\u3066\u3001\u300C\u6700\u3082\u9AD8\u304F\u306A\u308B\u300D\u3088\u3046\u306B\u8A08\u7B97\u3057\u307E\u3059\u3002\n\u300C@\u76EE\u6A19\u5024\u300D\u6307\u5B9A\u3067\u3001\u5224\u5B9A\u306E\u6210\u5426\u3092\u8FFD\u52A0\u8868\u793A\u3057\u307E\u3059\u3002\n\n\u30C0\u30E1\u30FC\u30B8\u30ED\u30FC\u30EB\u306F[\u88C5\u7532]\u6307\u5B9A\u3067\u3001\u6709\u52B9\u306A\u30C0\u30A4\u30B9\u6570\u30680\u306E\u51FA\u76EE\u306E\u6570\u3092\u8868\u793A\u3057\u307E\u3059\u3002\n[\u88C5\u7532]\u7701\u7565\u6642\u306F\u3001\u30C0\u30A4\u30B9\u7D50\u679C\u306E\u307F\u8868\u793A\u3057\u307E\u3059\u3002\uFF08\u8907\u6570\u306E\u5BFE\u8C61\u3078\u306E\u653B\u6483\u6642\u7528\uFF09\n\n\u3010\u66F8\u5F0F\u4F8B\u3011\n\u30FBRD \u2192 1D\u3067\u9054\u6210\u5024\u3092\u8868\u793A\u3002\n\u30FB2RD1@8 \u2192 2D\uFF081\u500B\u9078\u629E\uFF09\u3067\u76EE\u6A19\u50248\u306E\u5224\u5B9A\u3002\n\u30FB-3RD \u2192 1D\u3067\u30C0\u30A4\u30B9\u30DA\u30CA\u30EB\u30C6\u30A3-4\u306E\u5224\u5B9A\u3002\n\u30FB4DD2 \u2192 4D\u3067\u88C5\u75322\u306E\u30C0\u30E1\u30FC\u30B8\u30ED\u30FC\u30EB\u3002\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) ⇒ Raisondetre



36
37
38
39
# File 'lib/bcdice/game_system/Raisondetre.rb', line 36

def initialize(command)
  super(command)
  @sort_add_dice = true # ダイスのソート有
end

Instance Method Details

#checkDamage(diceCount, armor) ⇒ Object



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/bcdice/game_system/Raisondetre.rb', line 127

def checkDamage(diceCount, armor)
  if diceCount <= 0
    correction = 1 + diceCount * -1
    rollCount = 1
  else
    correction = 0
    rollCount = diceCount
  end

  dice_list = @randomizer.roll_barabara(rollCount, 10).sort
  diceText = dice_list.join(",")

  diceArray = dice_list.map { |x| x == 10 ? 0 : x }.sort
  criticalCount = diceArray.count(0)
  diceArray.map! { |i| i - correction }
  diceText2 = diceArray.join(",")

  result = "#{rollCount}D10"
  result += "-#{correction}" if correction > 0
  result += " > [#{diceText}] > [#{diceText2}]"

  if armor > 0
    resultArray = []
    success = 0

    diceArray.each do |i|
      if i >= armor
        resultArray.push(i)
        success += 1
      else
        resultArray.push("×")
      end
    end
    resultText = resultArray.join(',')

    result += " > [#{resultText}]>=#{armor} 有効数:#{success}"
  end

  result += " 0=#{criticalCount}個"

  return result
end

#checkRoll(diceCount, choiceCount, target) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/bcdice/game_system/Raisondetre.rb', line 72

def checkRoll(diceCount, choiceCount, target)
  if diceCount <= 0
    correction = 1 + diceCount * -1
    rollCount = 1
  else
    correction = 0
    rollCount = diceCount
  end

  diceArray = @randomizer.roll_barabara(rollCount, 10).sort
  diceText = diceArray.join(',')

  diceArray.map! { |x| x == 10 ? 0 : x }
  diceArray.map! { |i| i - correction }
  diceText2 = diceArray.sort.join(',')

  funbleArray = diceArray.select { |i| i <= 1 }
  isFunble = (funbleArray.size >= rollCount)

  dice = 0
  success = 0
  unless isFunble
    criticalCount = diceArray.count(0)
    critical = criticalCount * 10

    choiceArray = diceArray.reverse
    choiceArray.delete(0)
    choiceArray = choiceArray.slice(0..(choiceCount - 1))
    choiceText = choiceArray.join(',')
    dice = choiceArray.inject(:+)
    success = dice + critical
  end

  result = "#{rollCount}D10"
  result += "-#{correction}" if correction > 0
  result += " > [#{diceText}] > [#{diceText2}] > "

  if isFunble
    result += "達成値:0 (Funble)"
  else
    result += "#{dice}[#{choiceText}]"
    result += "+#{critical}" if critical > 0
    result += "=達成値:#{success}"
    result += " (#{criticalCount}Critical)" if critical > 0
  end

  if target > 0
    result += ">=#{target} "
    result += "【成功】" if  success >= target
    result += "【失敗】" if  success < target
  end

  return result
end

#eval_game_system_specific_command(command) ⇒ Object



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

def eval_game_system_specific_command(command)
  if command =~ /(-)?(\d+)?RD(\d+)?(@(\d+))?$/i
    diceCount = (Regexp.last_match(2) || 1).to_i
    diceCount *= -1 unless Regexp.last_match(1).nil?
    choiceCount = (Regexp.last_match(3) || 1).to_i
    target = (Regexp.last_match(5) || 0).to_i

    return checkRoll(diceCount, choiceCount, target)

  elsif command =~ /(-)?(\d+)?DD([1-9])?([+-]\d+)?$/i
    diceCount = (Regexp.last_match(2) || 1).to_i
    diceCount *= -1 unless Regexp.last_match(1).nil?
    armor = (Regexp.last_match(3) || 0).to_i
    if armor > 0
      armor += (Regexp.last_match(4) || 0).to_i
      armor = 1 if  armor < 1
      armor = 9 if  armor > 9
    end

    return checkDamage(diceCount, armor)

  end

  return nil
end