<commit_before>(ns obb-rules.actions.damage-calculator
  (:use obb-rules.element obb-rules.unit))

(defn damage
  "Gets the base damage given by a unit to another"
  [attacker-element defender-element]
  (let [attacker-unit (element-unit attacker-element)
        defender-unit (element-unit defender-element)
        attacker-quantity (element-quantity attacker-element)
        attack (unit-attack attacker-unit)
        defender (unit-defense defender-unit)
        distance-factor 1.0]
    (* attack attacker-quantity)))

(defn defense
  "Gets the defense of a given unit from another"
  [attacker-element defender-element]
  (let [unit (element-unit defender-element)]
    (unit-defense unit)))

(defn destroyed
  "Gets how many units an attack will destroy"
  [attacker-element defender-element]
  (let [total-damage (damage attacker-element defender-element)
        total-defense (defense attacker-element defender-element)
        destroyed (/ total-damage total-defense)
        defender-quantity (element-quantity defender-element)]
    (if (> destroyed defender-quantity)
      defender-quantity
      (int destroyed))))<commit_msg>Removed unused fields<commit_after>(ns obb-rules.actions.damage-calculator
  (:use obb-rules.element obb-rules.unit))

(defn damage
  "Gets the base damage given by a unit to another"
  [attacker-element defender-element]
  (let [attacker-unit (element-unit attacker-element)
        defender-unit (element-unit defender-element)
        attacker-quantity (element-quantity attacker-element)
        attack (unit-attack attacker-unit)]
    (* attack attacker-quantity)))

(defn defense
  "Gets the defense of a given unit from another"
  [attacker-element defender-element]
  (let [unit (element-unit defender-element)]
    (unit-defense unit)))

(defn destroyed
  "Gets how many units an attack will destroy"
  [attacker-element defender-element]
  (let [total-damage (damage attacker-element defender-element)
        total-defense (defense attacker-element defender-element)
        destroyed (/ total-damage total-defense)
        defender-quantity (element-quantity defender-element)]
    (if (> destroyed defender-quantity)
      defender-quantity
      (int destroyed))))
{'fraction_non_alphanumeric': 0.10261026102610261, 'fraction_numerical': 0.0009000900090009, 'mean_word_length': 3.63125, 'pattern_counts': {'":': 0, '<': 3, '<?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': '359655', 'n_tokens_mistral': 686, 'n_tokens_neox': 622, 'n_words': 178}