Class: BCDice::GameSystem::Avandner

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

Constant Summary collapse

ID =

ゲームシステムの識別子

'Avandner'
NAME =

ゲームシステム名

'黒絢のアヴァンドナー'
SORT_KEY =

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

'こつけんのあうあんとなあ'
HELP_MESSAGE =

ダイスボットの使い方

"\u30FB\u8ABF\u67FB\u5224\u5B9A\uFF1AnAVm[Cx]\n\u30FB\u547D\u4E2D\u5224\u5B9A\uFF1AnAVm*p[+t][Cx]\n[]\u5185\u306F\u7701\u7565\u53EF\u80FD\u3002\n\n\u30AF\u30EA\u30C6\u30A3\u30AB\u30EB\u30D2\u30C3\u30C8\u306E\u5206\u3060\u3051\u3001\u81EA\u52D5\u3067\u632F\u308A\u8DB3\u3057\u51E6\u7406\u3092\u884C\u3044\u307E\u3059\u30020\n\u300Cn\u300D\u3067\u30C0\u30A4\u30B9\u6570\u3092\u6307\u5B9A\u3002\n\u300Cm\u300D\u3067\u76EE\u6A19\u5024\u3092\u6307\u5B9A\u3002\u7701\u7565\u306F\u51FA\u6765\u307E\u305B\u3093\u3002\n\u300CCx\u300D\u3067\u30AF\u30EA\u30C6\u30A3\u30AB\u30EB\u5024\u3092\u6307\u5B9A\u3002\u7701\u7565\u6642\u306F\u300C1\u300D\u3001\u6700\u5927\u5024\u306F\u300C2\u300D\u3001\u300C0\u300D\u3067\u30AF\u30EA\u30C6\u30A3\u30AB\u30EB\u7121\u3057\u3002\n\u300Cp\u300D\u3067\u653B\u6483\u529B\u3092\u6307\u5B9A\u3002\u300C*\u300D\u306F\u300Cx\u300D\u3067\u3082\u53EF\u3002\n\u300C+t\u300D\u3067\u30AF\u30EA\u30C6\u30A3\u30AB\u30EB\u30C8\u30EA\u30AC\u30FC\u3092\u6307\u5B9A\u3002\u7701\u7565\u53EF\u80FD\u3067\u3059\u3002\n\u653B\u6483\u529B\u6307\u5B9A\u3067\u547D\u4E2D\u5224\u5B9A\u3068\u306A\u308A\u3001\u6210\u529F\u6570\u3067\u306F\u306A\u304F\u3001\u30C0\u30E1\u30FC\u30B8\u3092\u7D50\u679C\u8868\u793A\u3057\u307E\u3059\u3002\n\n\u3010\u66F8\u5F0F\u4F8B\u3011\n\u30FB5AV3 \u2192 5d10\u3067\u76EE\u6A19\u50243\u3002\n\u30FB6AV2C0 \u2192 6d10\u3067\u76EE\u6A19\u50242\u3002\u30AF\u30EA\u30C6\u30A3\u30AB\u30EB\u7121\u3057\u3002\n\u30FB4AV3*5 \u2192 4d10\u3067\u76EE\u6A19\u50243\u3001\u653B\u6483\u529B5\u306E\u547D\u4E2D\u5224\u5B9A\u3002\n\u30FB7AV2x10 \u2192 7d10\u3067\u76EE\u6A19\u50242\u3001\u653B\u6483\u529B10\u306E\u547D\u4E2D\u5224\u5B9A\u3002\n\u30FB8av4*7+10 \u2192 8d10\u3067\u76EE\u6A19\u50244\u3001\u653B\u6483\u529B7\u3001\u30AF\u30EA\u30C6\u30A3\u30AB\u30EB\u30C8\u30EA\u30AC\u30FC10\u306E\u547D\u4E2D\u5224\u5B9A\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) ⇒ Avandner



39
40
41
42
# File 'lib/bcdice/game_system/Avandner.rb', line 39

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

Instance Method Details

#checkRoll(diceCount, target, damage, criticalTrigger, criticalNumber) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
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
# File 'lib/bcdice/game_system/Avandner.rb', line 59

def checkRoll(diceCount, target, damage, criticalTrigger, criticalNumber)
  totalSuccessCount = 0
  totalCriticalCount = 0
  text = ""

  rollCount = diceCount

  while rollCount > 0
    diceArray = @randomizer.roll_barabara(rollCount, 10).sort
    diceText = diceArray.join(",")

    successCount = diceArray.count { |i| i <= target }
    criticalCount = diceArray.count { |i| i <= criticalNumber }

    totalSuccessCount += successCount
    totalCriticalCount += criticalCount

    text += "+" unless text.empty?
    text += "#{successCount}[#{diceText}]"

    rollCount = criticalCount
  end

  result = ""
  isDamage = (damage != 0)

  if isDamage
    totalDamage = totalSuccessCount * damage + totalCriticalCount * criticalTrigger

    result += "(#{diceCount}D10\<\=#{target}) > #{text} > Hits:#{totalSuccessCount}*#{damage}"
    result += " + Trigger:#{totalCriticalCount}*#{criticalTrigger}" if  criticalTrigger > 0
    result += " > #{totalDamage}ダメージ"
  else
    result += "(#{diceCount}D10\<\=#{target}) > #{text} > 成功数:#{totalSuccessCount}"
  end

  result += " / #{totalCriticalCount}クリティカル" if totalCriticalCount > 0

  return result
end

#eval_game_system_specific_command(command) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/bcdice/game_system/Avandner.rb', line 44

def eval_game_system_specific_command(command)
  # AVコマンド:調査判定, 成功判定
  if command =~ /(\d+)AV(\d+)((x|\*)(\d+))?(\+(\d+))?(C(\d+))?$/i
    diceCount = Regexp.last_match(1).to_i
    target = Regexp.last_match(2).to_i
    damage = (Regexp.last_match(5) || 0).to_i
    criticalTrigger = (Regexp.last_match(7) || 0).to_i
    criticalNumber = (Regexp.last_match(9) || 1).to_i
    criticalNumber = 2 if criticalNumber > 3
    return checkRoll(diceCount, target, damage, criticalTrigger, criticalNumber)
  end

  return nil
end