Class: BCDice::GameSystem::Cthulhu::CompareResult

Inherits:
Object
  • Object
show all
Includes:
Translate
Defined in:
lib/bcdice/game_system/Cthulhu.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Translate

#translate

Constructor Details

#initialize(locale) ⇒ CompareResult

Returns a new instance of CompareResult.



130
131
132
133
134
135
136
137
138
139
# File 'lib/bcdice/game_system/Cthulhu.rb', line 130

def initialize(locale)
  @locale = locale

  @success = false
  @failure = false
  @critical = false
  @fumble = false
  @special = false
  @broke = false
end

Instance Attribute Details

#brokenObject

Returns the value of attribute broken.



128
129
130
# File 'lib/bcdice/game_system/Cthulhu.rb', line 128

def broken
  @broken
end

#criticalObject

Returns the value of attribute critical.



128
129
130
# File 'lib/bcdice/game_system/Cthulhu.rb', line 128

def critical
  @critical
end

#failureObject

Returns the value of attribute failure.



128
129
130
# File 'lib/bcdice/game_system/Cthulhu.rb', line 128

def failure
  @failure
end

#fumbleObject

Returns the value of attribute fumble.



128
129
130
# File 'lib/bcdice/game_system/Cthulhu.rb', line 128

def fumble
  @fumble
end

#specialObject

Returns the value of attribute special.



128
129
130
# File 'lib/bcdice/game_system/Cthulhu.rb', line 128

def special
  @special
end

#successObject

Returns the value of attribute success.



128
129
130
# File 'lib/bcdice/game_system/Cthulhu.rb', line 128

def success
  @success
end

Instance Method Details

#textObject



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/bcdice/game_system/Cthulhu.rb', line 141

def text
  if critical && special
    translate("Cthulhu.critical_special")
  elsif critical
    translate("Cthulhu.critical")
  elsif special
    translate("Cthulhu.special")
  elsif success
    translate("success")
  elsif broken && fumble
    "#{translate('Cthulhu.fumble')}/#{translate('Cthulhu.broken')}"
  elsif broken
    translate("Cthulhu.broken")
  elsif fumble
    translate("Cthulhu.fumble")
  elsif failure
    translate("failure")
  end
end

#to_resultObject



161
162
163
164
165
166
167
168
# File 'lib/bcdice/game_system/Cthulhu.rb', line 161

def to_result
  Result.new.tap do |r|
    r.success = success
    r.failure = failure
    r.critical = critical
    r.fumble = fumble
  end
end