lib/strategy_game_backend/behaviours/destructable.rb
def take_damage(amount)
        if @primary_health.nil?
          raise StrategyGameBackend::Behaviours::Destructable::Error,
                "#{self.class.name} has not had its health set. Missing set_initial_health call?"
        end

        @tertiary_health -= amount
        @secondary_health -= @tertiary_health.abs if @tertiary_health.negative?
        @primary_health -= @secondary_health.abs if @secondary_health.negative?
      end
# When destructable things take damage, the default behaviour
# is to deplete the health starting from tertiary and going down
# to primary.
#
# In the future, I want to have things with a base health, an armour
# value, and also a shield value, which is why there is space for
# 3 here and the default behaviour is kinda dumb.
When destructable things take damage, the default behaviour
is to deplete the health starting from tertiary and going down
to primary.

In the future, I want to have things with a base health, an armour
value, and also a shield value, which is why there is space for
3 here and the default behaviour is kinda dumb.
When destructable things take damage the default behaviour is to deplete the health starting from tertiary and going down to primary . In the future I want to have things with a base health an armour value and also a shield value which is why there is space for 3 here and the default behaviour is kinda dumb .
def take_damage(amount)
        if @primary_health.nil?
          raise StrategyGameBackend::Behaviours::Destructable::Error,
                "#{self.class.name} has not had its health set. Missing set_initial_health call?"
        end
        @tertiary_health -= amount
        @secondary_health -= @tertiary_health.abs if @tertiary_health.negative?
        @primary_health -= @secondary_health.abs if @secondary_health.negative?
      end
def take_damage ( amount ) if @primary_health . nil? raise StrategyGameBackend :: Behaviours :: Destructable :: Error , "#{self.class.name} has not had its health set. Missing set_initial_health call?" end @tertiary_health -= amount @secondary_health -= @tertiary_health . abs if @tertiary_health . negative? @primary_health -= @secondary_health . abs if @secondary_health . negative? end
When destructable things take damage, the default behaviour
is to deplete the health starting from tertiary and going down
to primary.
When destructable things take damage the default behaviour is to deplete the health starting from tertiary and going down to primary .
amount