Class SimulationAttack
java.lang.Object
edu.ntnu.idatt2001.carljgu.battle.SimulationAttack
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 Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Gets the attacker.Deprecated.Gets the attacking army with the attacking unit.int
Deprecated.Gets the damage done by the attacker to the defender.Deprecated.Gets the defender.Deprecated.Gets the defending army with the defending unit.Deprecated.Gets the terrain where the attack occurs.toString()
Deprecated.Overrides the toString() method and returns an output used in the GUI.
-
Field Details
-
attackingArmy
Deprecated. -
defendingArmy
Deprecated. -
attacker
Deprecated. -
defender
Deprecated. -
terrain
Deprecated. -
damageDealt
private final int damageDealtDeprecated.
-
-
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 defenderattacker
- Unit - the attacker performing its attack on the defenderdefendingArmy
- Army - the army with the unit defending from the attackerdefender
- Unit - the unit defending from the attackers attackterrain
- 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
Deprecated.Gets the attacking army with the attacking unit.- Returns:
- attackingArmy - Army - the army with the attacking unit.
-
getAttacker
Deprecated.Gets the attacker.- Returns:
- attacker - Unit - the attacker
-
getDefendingArmy
Deprecated.Gets the defending army with the defending unit.- Returns:
- defendingArmy - Army - the army with the defending 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
Deprecated.Gets the terrain where the attack occurs.- Returns:
- terrain - Terrain - the specified terrain.
-
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
-