<commit_before>
#include "units/enemy-unit.h"

#include "engine/game.h"


void EnemyUnit::Load() {
  sprite_.set_texture(Game::GetResourcesManager()->Enemy());
  set_movement_speed(50.f);
  set_rotation(180);
  life_ = 3;
}


void EnemyUnit::Attack() {
  life_--;
  if (life_ == 0) {
    Remove_(ENEMY_DIED);
    return;
  }
}


void EnemyUnit::Remove_(GameEventType type) {
  auto events = Game::GetEventsManager();
  events->Trigger(GameEvent(type));
  auto instances = Game::GetInstancesManager();
  instances->MarkToRemoveAndDelete(this);
  auto map_controller = Game::GetMapController();
  map_controller->RemoveEnemy(this);
}


void EnemyUnit::Step(sf::Time elapsed) {
  Unit::Step(elapsed);
<commit_msg>Don't step an enemy when it has no life.<commit_after>
#include "units/enemy-unit.h"

#include "engine/game.h"


void EnemyUnit::Load() {
  sprite_.set_texture(Game::GetResourcesManager()->Enemy());
  set_movement_speed(50.f);
  set_rotation(180);
  life_ = 3;
}


void EnemyUnit::Attack() {
  life_--;
  if (life_ == 0) {
    Remove_(ENEMY_DIED);
    return;
  }
}


void EnemyUnit::Remove_(GameEventType type) {
  auto events = Game::GetEventsManager();
  events->Trigger(GameEvent(type));
  auto instances = Game::GetInstancesManager();
  instances->MarkToRemoveAndDelete(this);
  auto map_controller = Game::GetMapController();
  map_controller->RemoveEnemy(this);
}


void EnemyUnit::Step(sf::Time elapsed) {
  if (life_ == 0) {
    return;
  }

  Unit::Step(elapsed);

{'fraction_non_alphanumeric': 0.158355795148248, 'fraction_numerical': 0.010107816711590296, 'mean_word_length': 4.987903225806452, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4003415', 'n_tokens_mistral': 548, 'n_tokens_neox': 526, 'n_words': 90}