<commit_before>// Kamikaze.cpp

// AOS Includes
#include "Kamikaze.hpp"
#include "Player.hpp"

Kamikaze::Kamikaze(const std::string& keyname) : Enemy(keyname)
{
  pointValue = KamikazePointValue;
  health = KamikazeHealth;
  speed = KamikazeIdleSpeed;
  idleDelay = KamikazeIdleDelay;
  foundTarget = false;
}

void Kamikaze::Update(float deltaTime)
{
  if (!foundTarget)
  {
    idleDelay -= deltaTime;

    if (idleDelay < 0)
    {
      GameObject* target = PickRandomObject(&PlayerShip::PlayerShipList);
      direction = target->position - position;

      speed = KamikazeAttackSpeed;
      foundTarget = true;
    }
  }

  Enemy::Update(deltaTime);
}<commit_msg>Fix crash that happened when Kamikazes tried to attack a dead Player.<commit_after>// Kamikaze.cpp

// AOS Includes
#include "Kamikaze.hpp"
#include "Player.hpp"

Kamikaze::Kamikaze(const std::string& keyname) : Enemy(keyname)
{
  pointValue = KamikazePointValue;
  health = KamikazeHealth;
  speed = KamikazeIdleSpeed;
  idleDelay = KamikazeIdleDelay;
  foundTarget = false;
}

void Kamikaze::Update(float deltaTime)
{
  if (!foundTarget)
  {
    idleDelay -= deltaTime;

    if (idleDelay < 0)
    {
      GameObject* target = PickRandomObject(&PlayerShip::PlayerShipList);
      if (target != nullptr)
      {
        direction = target->position - position;
      }

      speed = KamikazeAttackSpeed;
      foundTarget = true;
    }
  }

  Enemy::Update(deltaTime);
}
{'fraction_non_alphanumeric': 0.11450381679389313, 'fraction_numerical': 0.0013879250520471894, 'mean_word_length': 3.577777777777778, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5676386', 'n_tokens_mistral': 497, 'n_tokens_neox': 495, 'n_words': 100}