java.lang.Object
edu.ntnu.idatt2001.carljgu.battle.SimulationAttack

@Deprecated public class SimulationAttack extends Object
Deprecated.
Provided no extra functionality and made the program harder to read. Additionally, it had high unnecessary coupling with Army and Unit. 06.05.2022
This class is deprecated. A class for keeping track of which unit has attacked which unit. Helpful when logging out this information.
Version:
1.2 09.04.2022
Author:
Carl Gützkow
  • Field Details

    • attackingArmy

      private final Army attackingArmy
      Deprecated.
    • defendingArmy

      private final Army defendingArmy
      Deprecated.
    • attacker

      private final Unit attacker
      Deprecated.
    • defender

      private final Unit defender
      Deprecated.
    • terrain

      private final Terrain terrain
      Deprecated.
    • damageDealt

      private final int damageDealt
      Deprecated.
  • Constructor Details

    • SimulationAttack

      public SimulationAttack(Army attackingArmy, Unit attacker, Army defendingArmy, Unit defender, Terrain terrain) throws IllegalArgumentException
      Deprecated.
      The constructor for a simulation attack. After checking the units are actually in their corresponding army, the attacker will perform its attack on the defender. The return value of this method is then put into the damage attribute. If the attack gets a defender to less than zero health, it is removed from the army
      Parameters:
      attackingArmy - Army - the army with the unit attacking the defender
      attacker - Unit - the attacker performing its attack on the defender
      defendingArmy - Army - the army with the unit defending from the attacker
      defender - Unit - the unit defending from the attackers attack
      terrain - Terrain - the terrain where the attack occurs.
      Throws:
      IllegalArgumentException - thrown if the attacker is not part of the attacking army or the defender is not part of the defending army.
  • Method Details

    • getAttackingArmy

      public Army getAttackingArmy()
      Deprecated.
      Gets the attacking army with the attacking unit.
      Returns:
      attackingArmy - Army - the army with the attacking unit.
    • getAttacker

      public Unit getAttacker()
      Deprecated.
      Gets the attacker.
      Returns:
      attacker - Unit - the attacker
    • getDefendingArmy

      public Army getDefendingArmy()
      Deprecated.
      Gets the defending army with the defending unit.
      Returns:
      defendingArmy - Army - the army with the defending unit.
    • getDefender

      public Unit getDefender()
      Deprecated.
      Gets the defender.
      Returns:
      defender - Unit - the defender
    • getDamageDealt

      public int getDamageDealt()
      Deprecated.
      Gets the damage done by the attacker to the defender.
      Returns:
      damageDone - int - the damage done by the attacker to the defender
    • getTerrain

      public Terrain getTerrain()
      Deprecated.
      Gets the terrain where the attack occurs.
      Returns:
      terrain - Terrain - the specified terrain.
    • toString

      public String toString()
      Deprecated.
      Overrides the toString() method and returns an output used in the GUI. Information displayed is the name of the attacking and defending army, unit information like name and class as well as how much damage was outputted from the attack. In addition, the defender's health after the attack is shown
      Overrides:
      toString in class Object
      Returns:
      String - string representation of an attack