Class: Sc2::Data

Inherits:
Object
  • Object
show all
Defined in:
lib/sc2ai/api/data.rb

Overview

Holds game data from tech tree and Api::ResponseData Called once on game start

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Data

Returns a new instance of Data.

Parameters:



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/sc2ai/api/data.rb', line 33

def initialize(data)
  return unless data

  @abilities = abilities_from_proto(data.abilities)
  @units = units_from_proto(data.units)
  @upgrades = upgrades_from_proto(data.upgrades)
  @buffs = buffs_from_proto(data.buffs)
  @effects = effects_from_proto(data.effects)

  override_unit_data
end

Instance Attribute Details

#abilitiesHash<Integer, Api::AbilityData>

Returns AbilityId => AbilityData.

Returns:



16
17
18
# File 'lib/sc2ai/api/data.rb', line 16

def abilities
  @abilities
end

#buffsObject

Not particularly useful data. Just use BuffId directly

@return [Hash<Integer, Api::BuffData>] BuffId => BuffData


26
27
28
# File 'lib/sc2ai/api/data.rb', line 26

def buffs
  @buffs
end

#effectsObject

Not particularly useful data. Just use EffectId directly

@return [Hash<Integer, Api::EffectData>] EffectId => EffectData


30
31
32
# File 'lib/sc2ai/api/data.rb', line 30

def effects
  @effects
end

#unitsHash<Integer, Api::UnitTypeData>

Returns UnitId => UnitTypeData.

Returns:



19
20
21
# File 'lib/sc2ai/api/data.rb', line 19

def units
  @units
end

#upgradesHash<Integer, Api::UpgradeData>

Returns UpgradeId => UpgradeData.

Returns:



22
23
24
# File 'lib/sc2ai/api/data.rb', line 22

def upgrades
  @upgrades
end