Combat mechanics

**Location:**  Infinite Lagrange Wiki -> Miscellaneous

**TODO:** need some actual text talking about how combat works.

This is a stub/draft/work in progress.

## Summary of combat

When two or more fleets engage in combat, the two main drivers of what happens are **time** and **probability**.

The computer that resolves combat appears to operate at the millisecond level, and everything that happens requires some amount of real time. The visual representation of the game's battle, in spite of being beautiful, provides interesting information on the battle mechanics. But you have to understand that the battle is calculated on the NetEase servers and the informations sent to the game does not represent everything that really happens.

The three main random aspects of combat are **target selection** (which target is a weapon going to attack), **hit resolution** (does a particular shot hit the target), and **critical resolution** (if a shot hits, does it do critical damage). And less frequently: armor or shield disable and critical system damage.

### Attack cycle

   There are two variations of the attack cycle - one for ships that have **return to base** (RTB - applies to some aircraft), and one for all other ships. The difference is that ships with RTB return to the mother ship and break the attack, the attacker will look for a new target. Once a weapon has selected a target, it will continue attacking that target until either the target is destroyed **or** the target performs an RTB - once either of those occurs, the weapon must select a new target and lock-on.

**Please note:** Weapons that are primarily or exclusively Anti-Aircraft may be attempting to lock-on to a target, only to have it RTB, pick a second target, just in time for that target to also go RTB, etc. This is one of the difficulties plague Anti-Aircraft weapons.

The cycle is:

1. Target selection/lock-on (see above) on each new target
2. Attack round in the  duration
3. RTB and/or cooldown

The time required for target lock-on, attack round "duration", and cooldown are all show on the MODULE STATS for each weapon - Click on the "i" button, top right, on the main weapon information panel to get the side panel.

Each weapon has a stat "Attacks Per Round" which is shown a "N x M" where N represents the number of barrels, tubes, or whatever that are part of each weapon installation allowing the weapon to fire that many simultaneous shots, and M represents the number of rounds that are pre-loaded by the weapon so that it fires that many times, with only a short pause between fires. Weapons where M - the number of rounds - are 1 will often have a "Duration" of zero - the weapon fires and then goes right into its cooldown.

The number of **installations** are visible on the top left in information screen. For example: . They are different systems on the ship. Depending on the weapons they can acquire different targets

For aircraft that RTB, the cooldown value of the "main" weapon is the duration of that RTB.

The weapon shown here, the KCCPV-ST-3-700C, has "Attacks Per Round" of 1x3, so over a 6 second period it fires one round of one shot every two seconds, and then goes into a 20 second cooldown.

### Target selection

**Please note:** The **Attack Priority** information provided in-game has been shown - by careful research into the actual mechanics of combat - to be **not entirely accurate**. For example, a particular weapon may show Destroyer as its number one priority and Frigate as its number two priority. In actuality, frigates and destroyers will usually have identical priorities. Expecting or hoping that the weapon will take out the enemies destroyers first may result in disappointment.

Weapons fall roughly into two categories:

* Direct fire weapons - cannons, batteries, casters
* Indirect fire weapons - missiles, torpedoes

Direct fire weapons will mostly attack by **row** and then by **target priority**. For example - on the Taurus - Pulse Cannon Destroyer, the BP-600T Experimental Pulse Turret prioritizes small ships - destroyer and frigate. It will attack any such ships in the front row first, then other ships in the front row until the front row is empty before attacking ships in the middle row. The aircrafts are different, they move on the row of their target and then attack the ship. Their weapons do not use the rows, but only the ship priority.

Indirect fire weapons will target ships by attack priority, regardless of row.

There are other factors that affect which specific ships a weapon attacks. Some weapons have strategy enhancements to target ships of a particular class (i.e. Battlecruisers), size (large ships - cruisers and above), or function (carriers). There also seems to be a preference towards certain ships, and one theory is that priority is given to the ship of the proper type with the largest total number of command points (CP), which could explain why XenoStinger seems to be a preferred target (since they are one of the highest CP frigates in the game).

## Hit Probability, Evasion and Jamming

Please note that everything known by the players regarding hit probability and subjects that affect it is based on statistical analysis of combats, and not on any actual knowledge of the inner workings of the game. None of the stats for hit probability are published anywhere. While the stats for evasion are displayed on the ship blueprint screens, there is not explanation as to how they affect combat.

The base chance of a particular weapon system hitting a target is influenced by the **class** of the target - larger ships are easier to hit. Many weapon systems have enhancements that increase the hit probability for that system **but** the effect of these enhancements are **multiplicative** with the base probability. For example, if a weapon system has an 80% base hit probability, then a 20% enhancement improves hit probability by (20% times 80%) = 16%. On the other hand, if the weapon has a 10% hit probability, then a 20% enhancement only improved the hit probability by (20% times 10%) = 2%. There are quite a few weapons with very low hit probabilities against fighters - as low as 2% - and so there are many hit rate enhancements that are nearly meaningless as a result.

Evasion reduces the hit probability. The research performed shows that evasion appears to be multiplicative as well - under the current theory, the modified hit probability = (base hit rate) \* (1 - evasion). So a weapon with a base hit rate of 80%, against a ship with 35% evasion, the hit rate would be reduced to 80% \* (1 - 35%) = 52%.

Jamming, in theory, is supposed to reduce the hit rate of weapons and/or evasion of the target ship. Battle analysis did not show any statistically significant effect from the use of jamming in combat. It may be either bugged or not well implemented.

## Damage per hit

When a weapon hits a target, the amount of damage done is determined by the **damager per hit** of the weapon and the  **armor** (for  **projectile** damage weapons) or  **energy resistance** (for  **energy** damage weapons). Armor directly reduces the damage (but with a 10% minimum). Energy resistance reduces by the given percentage.

See the referenced article for a detailed explanation and examples.

## System Damage

Some weapons have a chance to damage individual systems on the ships they attack. The  hit points are given for every system on every ship. If a system is reduced to 0 hit points, then the effect is as follows, per the patch notes for 2022-04-06.

* Destroy a weapon system: Weapon modules within the system will not work, and the enhanced items for the system will be disabled.
* Destroy a hangar system: The aircraft carried by the system will not be able to properly take off and land. The outside aircraft will not be able to launch strikes again after returning to their hangar, and the enhanced items for the system will be disabled.
* Destroy a propulsion system: Evasion provided by the system and the enhanced items for the system will be disabled. For example, the ship will not be able to exit battles by performing Emergency Evasion when its primary propulsion system is destroyed.
* Destroy a command system: All the strategic skills owned by the ship will not take effect. The command system will complete emergency repairs within a certain period of time after being damaged and return to the working status. When a command system has been destroyed several times, its repair speed will be increased. After being repaired multiple times, it will no longer become the attack target of the opponent.

System damage is immediately repaired if, at any point, the affected ship is not longer in combat. A fleet being attacked by multiple enemy fleets is considered to be in continuous combat until all of one side or the other is destroyed or has retreated.

## Pages on individual topics

* AA Weapon Ratio - Modifier to the DPH for a weapon when attacking Fighter and Corvette targets
* Aircraft Summary
* Anti-Aircraft Cooperative Efficiency - Modifier to the weapon hit rates against Fighter and Corvette targets
* Damage per hit - (theoretical) damage caused by a single hit from a weapon, aka **DPH** or **alpha damage**
* Damage per minute - (theoretical) damage caused during one minute of firing by a weapon
* Emergency Evasion (Escape) - Ships whose hit points have been reduced to zero can sometimes escape combat before being destroyed
* Emergency Evasion (Row Change) - Front row ships that are reduced to a very low hit point threshold (such as 10%) may be able to temporarily move to the middle row
* Installations - the number of full instances of a particular weapon system on a specific ship
* Target priority - Preferred targets for a weapon