Method: Unit#destroy!

Defined in:
lib/lib/units/unit.rb

#destroy!Object

Add <value> to the other faction and remove links to given unit



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/lib/units/unit.rb', line 81

def destroy!
  @armour_left = 0 # for non-attack damage

  # If you are transporting somebody, destroy them first
  @cargo.each { |uu| uu.destroy! }

  @infopane.add_score(3 - @faction - 1, self.class.value) # TODO more factions?

  if is_transported?
    coords_unit = @map.get_unit(@x, @y)
    coords_unit.cargo -= [self]
  else
    @map.set_unit(@x, @y, nil)
  end
end