<commit_before>require_relative 'battle_command.rb'

# Allows an Entity to try to escape from the opponent.
class Escape < BattleCommand
  def initialize
    super(name: "Escape")
  end

  # Samples a probability to determine if the user will escape from battle.
  #
  # @param [Entity] user the one who is trying to escape.
  # @param [Entity] monster the one from whom the user wants to escape.
  def run(user, enemy)
    sum = enemy.agility + user.agility
    random_number = Random.rand(0..sum - 1)

    # Higher probability of escape when the enemy has low agility.
    if (random_number < user.agility)
      user.escaped = true
      type("#{user.name} successfully escapes the clutches of the #{enemy.name}!\n\n")
      return
    end

    # Should already be false.
    user.escaped = false
    type("#{user.name} is cornered!\n\n")
  end

end<commit_msg>changed enemy param back<commit_after>require_relative 'battle_command.rb'

# Allows an Entity to try to escape from the opponent.
class Escape < BattleCommand
  def initialize
    super(name: "Escape")
  end

  # Samples a probability to determine if the user will escape from battle.
  #
  # @param [Entity] user the one who is trying to escape.
  # @param [Entity] enemy the one from whom the user wants to escape.
  def run(user, enemy)
    sum = enemy.agility + user.agility
    random_number = Random.rand(0..sum - 1)

    # Higher probability of escape when the enemy has low agility.
    if (random_number < user.agility)
      user.escaped = true
      type("#{user.name} successfully escapes the clutches of the #{enemy.name}!\n\n")
      return
    end

    # Should already be false.
    user.escaped = false
    type("#{user.name} is cornered!\n\n")
  end

end
{'fraction_non_alphanumeric': 0.09096142774899252, 'fraction_numerical': 0.002302820955670697, 'mean_word_length': 3.07981220657277, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '2344658', 'n_tokens_mistral': 542, 'n_tokens_neox': 521, 'n_words': 200}