Class: BCDice::GameSystem::GeishaGirlwithKatana

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

Constant Summary collapse

ID =

ゲームシステムの識別子

'GeishaGirlwithKatana'
NAME =

ゲームシステム名

'ゲイシャ・ガール・ウィズ・カタナ'
SORT_KEY =

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

'けいしやかあるういすかたな'
HELP_MESSAGE =

ダイスボットの使い方

<<~MESSAGETEXT
  ・判定 (GK#n)
    役やチョムバを含めて1回分のダイスロールを判定します。
   役は (通常判定)/(戦闘時) の順で両方出力されます。
    GK のみの場合5%の確率でチョムバます。
    GK#3 の様に #n をつけることによってチョムバの確率をn%にすることができます。
   例)GK GK#10
  ・隠しコマンド (GL)
    必ずチョムバします。GMが空気を読んでチョムバさせたいときや、
    GKコマンドを打ち間違えてチョムバするを想定してます。
   例)GL
MESSAGETEXT

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

#eval_game_system_specific_command(command) ⇒ Object

[View source]

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/bcdice/game_system/GeishaGirlwithKatana.rb', line 31

def eval_game_system_specific_command(command)
  output = nil

  if /^GL$/i =~ command
    return getChombaResultText()
  end

  unless /^GK(#(\d+))?$/i =~ command
    return output
  end

  chomba_counter = Regexp.last_match(2)

  if isChomba(chomba_counter)
    return getChombaResultText()
  end

  diceList = @randomizer.roll_barabara(3, 6).sort

  yakuResult = getYaku(diceList)
  unless yakuResult.nil?
    return getResultTextByDice(diceList, "【役】#{yakuResult}")
  end

  deme, zorome = getDemeZorome(diceList)
  if deme == 0
    return getResultTextByDice(diceList, "失敗")
  end

  yp = (zorome == 1 ? " YPが1増加" : "")
  output = getResultTextByDice(diceList, "達成値#{deme}#{yp}")
  debug("getGGwKResult(command) result", output)

  return output
end

#getChombaResultTextObject

[View source]

76
77
78
# File 'lib/bcdice/game_system/GeishaGirlwithKatana.rb', line 76

def getChombaResultText()
  getResultText("チョムバ!!")
end

#getDemeZorome(diceList) ⇒ Object

[View source]

96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/bcdice/game_system/GeishaGirlwithKatana.rb', line 96

def getDemeZorome(diceList)
  deme = 0
  zorome = 0

  if diceList[0] == diceList[1]
    deme = diceList[2]
    zorome = diceList[0]
  elsif diceList[1] == diceList[2]
    deme = diceList[0]
    zorome = diceList[1]
  end

  return deme, zorome
end

#getResultText(result) ⇒ Object

[View source]

115
116
117
# File 'lib/bcdice/game_system/GeishaGirlwithKatana.rb', line 115

def getResultText(result)
  "(3B6) > #{result}"
end

#getResultTextByDice(diceList, result) ⇒ Object

[View source]

111
112
113
# File 'lib/bcdice/game_system/GeishaGirlwithKatana.rb', line 111

def getResultTextByDice(diceList, result)
  getResultText("#{diceList.join(',')}#{result}")
end

#getYaku(diceList) ⇒ Object

[View source]

80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/bcdice/game_system/GeishaGirlwithKatana.rb', line 80

def getYaku(diceList)
  rule = {
    [1, 2, 3] => "自動失敗/自分の装甲効果無しでダメージを受けてしまう",
    [4, 5, 6] => "自動成功/敵の装甲を無視してダメージを与える",
    [1, 1, 1] => "10倍成功 YPが10増加/10倍ダメージ YPが10増加",
    [2, 2, 2] => "2倍成功/2倍ダメージ",
    [3, 3, 3] => "3倍成功/3倍ダメージ",
    [4, 4, 4] => "4倍成功/4倍ダメージ",
    [5, 5, 5] => "5倍成功/5倍ダメージ",
    [6, 6, 6] => "6倍成功/6倍ダメージ",
  }

  yaku = rule[diceList]
  return yaku
end

#isChomba(chomba_counter) ⇒ Object

[View source]

67
68
69
70
71
72
73
74
# File 'lib/bcdice/game_system/GeishaGirlwithKatana.rb', line 67

def isChomba(chomba_counter)
  chomba_counter ||= 5
  chomba_counter = chomba_counter.to_i

  chomba = @randomizer.roll_once(100)

  return (chomba <= chomba_counter)
end