Combat

Combat takes place when an attacking fleet reaches its destination.

Sides
In combat, there are two sides: the attacker and the defender. There is the possibility that the attacker has launched his fleets against a planet with no defense or ships, in which case he automatically wins the combat. But otherwise, if the defender has ships or defense on his planet, each side will fire upon the enemy.

If Alliance Combat System is enabled in the universe, there can be multiple attackers and defenders.

How it works
Before we can understand how combat works, we have to know that every battle has four basic parameters that affect combat: Weapon Power (aka Weaponry), Shield Power (aka Shielding), and Hull plating, and Rapid Fire, which can be significant to the outcome.

Each combat can have 3 outcomes: attacker wins, draw, and defender wins; Each combat is organized in rounds. There are at most 6 rounds, which means that if the attacker is not able to destroy all the defender's units in 6 rounds, the combat ends with a draw. Either the "draw" and the "defender wins" causes the attacker to not be able to steal the resources in the planet/moon where the attack was made.

In the beginning of each round, every unit starts with its Weaponry (with value W) and Shielding (with value S) at its initial value (specific of each ship plus technology upgrades). The Hull Plating (with value H) has the value of previous round (initial value of the ship if it is the first round).

In each round, all participating units(defenses+ships) randomly choose a target enemy unit.

For each shooting unit: It is worth to mention that the probability to explode is calculated at each shot (as long as the ship is under 70% hull), and not only once at the end of the round. This is the reason why a lot of small shots received under 70% create a very high chance of explosion even if the hull remains at a high percentage.
 * If the Weaponry of the shooting unit is less than 1% of the Shielding of the target unit, the shot is bounced, and the target unit does not lose anything (i.e. shot is wasted).
 * Else, if the weaponry is lower than the Shielding, then the shield absorbs the shot, and the unit does not lose Hull Plating: S = S - W.
 * Else, the weaponry is sufficiently strong, i.e. W > S. Then the shield only absorbs part of the shoot and the rest is dealt to the hull: H = H - (W - S) and S = 0.
 * If the Hull of the target ship is less than 70% of the initial Hull (H_i) of the ship (initial of the combat), then the ship has a probability of 1 - H/H_i of exploding. If it explodes, the hull is set to zero: H = 0. (but it can still be shot by the other units on this round, because they already target it.)
 * Finally, if the shooting unit has rapid fire (with value r) against the target unit, it has a chance of (r-1)/r of choosing another target at random, and repeating the above steps for that new target.

For every unit that has exploded during the round, it is removed and thus does not appear in the next round. If every unit of a side (attacker or defender) is destroyed at the end of the round, the battle ends with the opposite side winning.

After the combat, each defensive structure of the defender has a 70% chance of being immediately rebuilt without additional costs.

Combat example
As an example, let's consider an attacking fleet of 1 Cruiser vs 2 Missile Launchers + 1 Heavy Laser. Both teams have 0 technology of weaponry, shield and hull plating. With these technologies, Cruiser for instance will have 2700 Hull Plating, 50 Shield and 400 Weaponry (2700:50:400 using an abbreviated notation). Hull plating = structural integrity divided by 10.

One possible outcome could be the following:

attacker fires at defender
Cruiser with 2700:50:400 fires at Missile Launcher with 200:20:80; result is Missile Launcher with -180:0:80

Rapid Fire:


 * Cruiser has rapid fire against Missile Launcher.


 * dice was 0.62, comparing with 0.90: Cruiser gets another shot.

Cruiser with 2700:50:400 fires at Missile Launcher with 200:20:80; result is Missile Launcher with -180:0:80

Rapid Fire:


 * Cruiser has rapid fire against Missile Launcher.


 * dice was 0.09, comparing with 0.90: Cruiser gets another shot.

Cruiser with 2700:50:400 fires at Missile Launcher with -180:0:80; result is Missile Launcher with -580:0:80

Rapid Fire:


 * Cruiser has rapid fire against Missile Launcher.


 * dice was 0.83, comparing with 0.90: Cruiser gets another shot.

Cruiser with 2700:50:400 fires at Heavy Laser with 800:100:250;


 * probability of exploding of 37.50%; dice value of 0.402 comparing with 0.625: unit didn't explode.

result is Heavy Laser with 500:0:250

Rapid Fire:


 * Cruiser doesn't have rapid fire against Heavy Laser.

defender fires at attacker
Missile Launcher with -580:0:80 fires at Cruiser with 2700:50:400; result is Cruiser with 2670:0:400

Missile Launcher with -180:0:80 fires at Cruiser with 2670:0:400; result is Cruiser with 2590:0:400

Heavy Laser with 500:0:250 fires at Cruiser with 2590:0:400; result is Cruiser with 2340:0:400

remove ships and restore shields.
Cruiser still has integrity, restore its shield.

Missile Launcher lost all its integrity, remove it from battle.

Missile Launcher lost all its integrity, remove it from battle.

Heavy Laser still has integrity, restore its shield.

attacker fires at defender
Cruiser with 2340:50:400 fires at Heavy Laser with 500:100:250


 * probability of exploding of 75.00%: dice value of 0.30 comparing with 0.25: unit exploded.

result is Heavy Laser with -1:0:250

Rapid Fire:


 * Cruiser doesn't have rapid fire against Heavy Laser.

defender fires at attacker
Heavy Laser with -1:0:250 fires at Cruiser with 2340:50:400; result is Cruiser with 2090:0:400

remove ships and restore shields.
Cruiser still has integrity, restore its shield.

Heavy Laser lost all its integrity, remove it from battle.

The battle ended after 2 rounds with attacker winning.

Some notes on the simulation.

 * On round 1, part 1.1.1, because Cruiser randomly chose the 2 missile launchers one after another, both were destroyed. However, they are only destroyed in the end of the round; they still fired at the Cruiser.
 * On round 1, part 1.1.1, the 3rd Cruiser's shot was made to an already destroyed Missile Launcher. If the roll of that Rapid Fire dice hadn't given him another shot, it wouldn't have shot the heavy laser on that round.
 * On round 2, part 1.2.1, because Heavy laser only had 500 integrity points, a shot from the Cruiser caused it to have 500-(400 (attack)-100 (shield)) = 200. Because 200 (current integrity)/800 (initial integrity) = 0.25, it had a probability of 75% of exploding, which occurred. Even after exploding, it still fired the shot on the Cruiser.

Outcomes and its consequences
After the combat is over, there can be 3 results:

1) The attacker wins. In this case, the attacker will pillage resources from the defender's planet. The maximum amount of resources he can pillage even if he has sufficient Cargo Capacity, is one half of the total amount of each resource. If there are multiple attackers, resources will be spread evenly. [Note that in v3.0 OGame, the honour point system can result in 75% or 100% of resources being stolen]

3) Draw. If after six rounds there is no winner, a draw is produced. The remaining attacking ships return to the planet they came from without being able to pillage the planet.

2) Defender wins. For the defender there is not much practical difference compared to a draw; for the attacker however it means all his ships are lost.

When the combat is over, the rest of the ships (not defense) destroyed in the clash are thrown into a Debris Field floating near the planet where the combat took place. The exception to this are universes with defense into DF enabled. This field may contain valuable resources (metal or crystal; deuterium cannot be present in the debris) that can be collected by whichever player's recyclers arrive there first (including any other players who did not take part in the battle). The amount of resources in the debris field depends on how many ships were destroyed that battle; defensive units produce no debris. Because the debris field is a separate location from the planet and is only created after the battle, the defender's recyclers have a better chance of getting there first than the attacker's, since the field is right next to the defender's planet and likely far away from the attacker's. The attacker can plan ahead against this by, before the main attack force arrives, attacking the defender with an espionage probe, which will generate a debris field of 300 crystal, and send the recyclers to the field so that they arrive just after the main attack force has decimated the defender's ships. This ensures the attacker gets the debris.

When a combat takes place, all participating parties receive a Combat Report unless the battle was just one round, in which case the attacker does not receive a report [so attacking with an espionage probe no longer reveals defense].