Class: Deckstrings::Hero

Inherits:
Object
  • Object
show all
Defined in:
lib/deckstrings/deckstrings.rb

Overview

A Hearthstone hero with basic metadata.

See Also:

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, name, hero_class) ⇒ Hero

Returns a new instance of Hero.

Raises:

  • (ArgumentError)


90
91
92
93
94
95
# File 'lib/deckstrings/deckstrings.rb', line 90

def initialize(id, name, hero_class)
  @id = id
  @name = name
  @hero_class = HeroClass.parse(hero_class)
  raise ArgumentError, "Invalid hero class: #{hero_class}." if @hero_class.nil?
end

Instance Attribute Details

#hero_classHeroClass (readonly)

Returns Class of the hero.

Returns:



257
258
259
# File 'lib/deckstrings/deckstrings.rb', line 257

def hero_class
  @hero_class
end

#idInteger (readonly)

Returns Hearthstone DBF ID of the hero.

Returns:

  • (Integer)

    Hearthstone DBF ID of the hero.

See Also:



251
252
253
# File 'lib/deckstrings/deckstrings.rb', line 251

def id
  @id
end

#nameString (readonly)

Returns Name of the hero.

Returns:

  • (String)

    Name of the hero.



254
255
256
# File 'lib/deckstrings/deckstrings.rb', line 254

def name
  @name
end

Class Method Details

.alleriaHero

Returns Alleria Windrunner.

Returns:

  • (Hero)

    Alleria Windrunner.



183
184
185
# File 'lib/deckstrings/deckstrings.rb', line 183

def self.alleria
  self.from_id(2826)
end

.anduinHero

Returns Anduin Wrynn.

Returns:

  • (Hero)

    Anduin Wrynn.



163
164
165
# File 'lib/deckstrings/deckstrings.rb', line 163

def self.anduin
  self.from_id(813)
end

.arthasHero

Returns Prince Arthas.

Returns:

  • (Hero)

    Prince Arthas.



223
224
225
# File 'lib/deckstrings/deckstrings.rb', line 223

def self.arthas
  self.from_id(46116)
end

.druidHero

Returns Malfurion Stormrage.

Returns:

  • (Hero)

    Malfurion Stormrage.



128
129
130
# File 'lib/deckstrings/deckstrings.rb', line 128

def self.druid
  self.malfurion
end

.from_id(id) ⇒ Hero

Returns Hero corresponding to DBF ID.

Parameters:

  • id (Integer)

    Hero's Hearthstone DBF ID.

Returns:

  • (Hero)

    Hero corresponding to DBF ID.



244
245
246
247
# File 'lib/deckstrings/deckstrings.rb', line 244

def self.from_id(id)
  hero = Database.instance.heroes[id]
  Hero.new(id, hero['name'], hero['class'])
end

.garroshHero

Returns Garrosh Hellscream.

Returns:

  • (Hero)

    Garrosh Hellscream.



233
234
235
# File 'lib/deckstrings/deckstrings.rb', line 233

def self.garrosh
  self.from_id(7)
end

.guldanHero

Returns Gul'dan.

Returns:

  • (Hero)

    Gul'dan.



193
194
195
# File 'lib/deckstrings/deckstrings.rb', line 193

def self.guldan
  self.from_id(893)
end

.hunterHero

Returns Rexxar.

Returns:

  • (Hero)

    Rexxar.



173
174
175
# File 'lib/deckstrings/deckstrings.rb', line 173

def self.hunter
  self.rexxar
end

.jainaHero

Returns Jaina Proudmoore.

Returns:

  • (Hero)

    Jaina Proudmoore.



103
104
105
# File 'lib/deckstrings/deckstrings.rb', line 103

def self.jaina
  self.from_id(637)
end

.khadgarHero

Returns Khadgar.

Returns:

  • (Hero)

    Khadgar.



108
109
110
# File 'lib/deckstrings/deckstrings.rb', line 108

def self.khadgar
  self.from_id(39117)
end

.liadrinHero

Returns Lady Liadrin.

Returns:

  • (Hero)

    Lady Liadrin.



218
219
220
# File 'lib/deckstrings/deckstrings.rb', line 218

def self.liadrin
  self.from_id(2827)
end

.lunaraHero

Returns Lunara.

Returns:

  • (Hero)

    Lunara.



138
139
140
# File 'lib/deckstrings/deckstrings.rb', line 138

def self.lunara
  self.from_id(50484)
end

.mageHero

Returns Jaina Proudmoore.

Returns:

  • (Hero)

    Jaina Proudmoore.



98
99
100
# File 'lib/deckstrings/deckstrings.rb', line 98

def self.mage
  self.jaina
end

.magniHero

Returns Magni Bronzebeard.

Returns:

  • (Hero)

    Magni Bronzebeard.



238
239
240
# File 'lib/deckstrings/deckstrings.rb', line 238

def self.magni
  self.from_id(2828)
end

.maievHero

Returns Maiev Shadowsong.

Returns:

  • (Hero)

    Maiev Shadowsong.



123
124
125
# File 'lib/deckstrings/deckstrings.rb', line 123

def self.maiev
  self.from_id(40195)
end

.malfurionHero

Returns Malfurion Stormrage.

Returns:

  • (Hero)

    Malfurion Stormrage.



133
134
135
# File 'lib/deckstrings/deckstrings.rb', line 133

def self.malfurion
  self.from_id(274)
end

.mecha_jaraxxusHero

Returns Mecha-Jaraxxus.

Returns:

  • (Hero)

    Mecha-Jaraxxus.



203
204
205
# File 'lib/deckstrings/deckstrings.rb', line 203

def self.mecha_jaraxxus
  self.from_id(51834)
end

.morglHero

Returns Morgl the Oracle.

Returns:

  • (Hero)

    Morgl the Oracle.



153
154
155
# File 'lib/deckstrings/deckstrings.rb', line 153

def self.morgl
  self.from_id(40183)
end

.nemsyHero

Returns Nemsy Necrofizzle.

Returns:

  • (Hero)

    Nemsy Necrofizzle.



198
199
200
# File 'lib/deckstrings/deckstrings.rb', line 198

def self.nemsy
  self.from_id(47817)
end

.paladinHero

Returns Uther Lightbringer.

Returns:

  • (Hero)

    Uther Lightbringer.



208
209
210
# File 'lib/deckstrings/deckstrings.rb', line 208

def self.paladin
  self.uther
end

.priestHero

Returns Anduin Wrynn.

Returns:

  • (Hero)

    Anduin Wrynn.



158
159
160
# File 'lib/deckstrings/deckstrings.rb', line 158

def self.priest
  self.anduin
end

.rexxarHero

Returns Rexxar.

Returns:

  • (Hero)

    Rexxar.



178
179
180
# File 'lib/deckstrings/deckstrings.rb', line 178

def self.rexxar
  self.from_id(31)
end

.rogueHero

Returns Valeera Sanguinar.

Returns:

  • (Hero)

    Valeera Sanguinar.



113
114
115
# File 'lib/deckstrings/deckstrings.rb', line 113

def self.rogue
  self.valeera
end

.shamanHero

Returns Thrall.

Returns:

  • (Hero)

    Thrall.



143
144
145
# File 'lib/deckstrings/deckstrings.rb', line 143

def self.shaman
  self.thrall
end

.thrallHero

Returns Thrall.

Returns:

  • (Hero)

    Thrall.



148
149
150
# File 'lib/deckstrings/deckstrings.rb', line 148

def self.thrall
  self.from_id(1066)
end

.tyrandeHero

Returns Tyrande Whisperwind.

Returns:

  • (Hero)

    Tyrande Whisperwind.



168
169
170
# File 'lib/deckstrings/deckstrings.rb', line 168

def self.tyrande
  self.from_id(41887)
end

.utherHero

Returns Uther Lightbringer.

Returns:

  • (Hero)

    Uther Lightbringer.



213
214
215
# File 'lib/deckstrings/deckstrings.rb', line 213

def self.uther
  self.from_id(671)
end

.valeeraHero

Returns Valeera Sanguinar.

Returns:

  • (Hero)

    Valeera Sanguinar.



118
119
120
# File 'lib/deckstrings/deckstrings.rb', line 118

def self.valeera
  self.from_id(930)
end

.warlockHero

Returns Gul'dan.

Returns:

  • (Hero)

    Gul'dan.



188
189
190
# File 'lib/deckstrings/deckstrings.rb', line 188

def self.warlock
  self.guldan
end

.warriorHero

Returns Garrosh Hellscream.

Returns:

  • (Hero)

    Garrosh Hellscream.



228
229
230
# File 'lib/deckstrings/deckstrings.rb', line 228

def self.warrior
  self.garrosh
end