====== Counterintelligence AI ======
This is a feature of [[:mods:programs_extended|Programs Extended]] mod that introduces new mechanic to the game - hostile artificial intelligence. This is a perpetual [[:daemon]] that installs on first enemy turn of the [[:mission]] and lasts until mission ends. Unlike all other daemons, AI effects are not fixed, and instead are dependent on what set of [[:mods:programs_extended:hostile_ai#subroutines]] AI has. Operator will have to adapt to different situations, of which there are many - AI could improve [[:firewalls]], buff [[:guards]], debuff or even attack [[:agents]], both proactively or in responce to agency actions. Additionally, [[:mods:programs_extended:hostile_ai#subroutines|Subroutines]] are not initially known to the operator and require identification, adding element of uncertainity until more information can be revealed.
----
===== Campaign Options =====
When creating a new campaign, operator can choose one of the following options under **Hostile AI - Starting Difficulty** setting:
* **DISABLED** - hostile AI is disabled and won't appear at all. Default setting.
* **OMNI ONLY** - hostile AI will only appear in 2 story [[:missions]] with [[:corporations:omni|OMNI]].
* **(NUMBER)** - choosing a number option will make AI start appearing at specified [[:mission_difficulty|mission difficulty]]. Available range is 1 to 5.
If a number option was chosen, additional setting will appear, called **Hostile AI - Scaling**. This setting lets operator choose the upper limit on [[:mods:programs_extended:hostile_ai#subroutines]] AI can have in each mission, ranging from 1 to 15. This limit does not apply to AI in [[:corporations:omni|OMNI]] [[:missions]] which have a fixed amount of Subroutines. Default limit is shown in the table below.
^ Difficulty ^ Default Subroutine Limit ^
| Beginner | 4 |
| Experienced | 6 |
| Expert | 8 |
| Expert+ | 12 |
| Endless | 8 |
| Endless+ | 12 |
| Time Attack | 8 |
----
===== Difficulty Scaling =====
AI has its own internal difficulty value that determines general power level of the AI:
AI Difficulty = Mission Difficulty - Starting Difficulty + 1
Mission Difficulty is the number shown at infiltration target summary on the map screen.
Starting Difficulty is set with **Hostile AI - Starting Difficulty** setting.
Hard limit of AI Difficulty is 15, with a soft limit specified by **Hostile AI - Scaling** setting.
AI Difficulty affects following properties:
* Total amount of [[:mods:programs_extended:hostile_ai#subroutines]] AI has, which matches //AI Difficulty//.
* Available subroutine pool.
Additionally, each [[:corporation]] has different amount of each [[:mods:programs_extended:hostile_ai#subroutines|type]] of subroutines (PWR, Proactive, Reactive, Enhancement) within that subroutine limit, specified in table below.
^ **FTM** ^^^^^^^^^^^^^^^^
^ **AI Difficulty** ^ **1** ^ **2** ^ **3** ^ **4** ^ **5** ^ **6** ^ **7** ^ **8** ^ **9** ^ **10** ^ **11** ^ **12** ^ **13** ^ **14** ^ **15** ^
^ **PWR** | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 2 | 2 | 2 | 2 | 2 |
^ **Proactive** | 1 | 1 | 1 | 1 | 2 | 2 | 2 | 3 | 3 | 3 | 3 | 4 | 4 | 4 | 5 |
^ **Reative** | 0 | 1 | 1 | 1 | 1 | 2 | 2 | 2 | 3 | 3 | 3 | 3 | 4 | 4 | 4 |
^ **Enhancement** | 0 | 0 | 1 | 1 | 1 | 1 | 2 | 2 | 2 | 3 | 3 | 3 | 3 | 4 | 4 |
^ **K&O** ^^^^^^^^^^^^^^^^
^ **AI Difficulty** ^ **1** ^ **2** ^ **3** ^ **4** ^ **5** ^ **6** ^ **7** ^ **8** ^ **9** ^ **10** ^ **11** ^ **12** ^ **13** ^ **14** ^ **15** ^
^ **PWR** | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 2 | 2 | 2 | 2 | 2 |
^ **Proactive** | 0 | 1 | 1 | 1 | 1 | 2 | 2 | 2 | 3 | 3 | 3 | 3 | 4 | 4 | 4 |
^ **Reative** | 0 | 0 | 1 | 1 | 1 | 1 | 2 | 2 | 2 | 3 | 3 | 3 | 3 | 4 | 4 |
^ **Enhancement** | 1 | 1 | 1 | 1 | 2 | 2 | 2 | 3 | 3 | 3 | 3 | 4 | 4 | 4 | 5 |
^ **Plastech** ^^^^^^^^^^^^^^^^
^ **AI Difficulty** ^ **1** ^ **2** ^ **3** ^ **4** ^ **5** ^ **6** ^ **7** ^ **8** ^ **9** ^ **10** ^ **11** ^ **12** ^ **13** ^ **14** ^ **15** ^
^ **PWR** | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 2 | 2 | 2 | 2 | 2 |
^ **Proactive** | 1 | 1 | 1 | 1 | 2 | 2 | 2 | 3 | 3 | 3 | 3 | 4 | 4 | 4 | 5 |
^ **Reative** | 0 | 0 | 1 | 1 | 1 | 1 | 2 | 2 | 2 | 3 | 3 | 3 | 3 | 4 | 4 |
^ **Enhancement** | 0 | 1 | 1 | 1 | 1 | 2 | 2 | 2 | 3 | 3 | 3 | 3 | 4 | 4 | 4 |
^ **Sankaku** ^^^^^^^^^^^^^^^^
^ **AI Difficulty** ^ **1** ^ **2** ^ **3** ^ **4** ^ **5** ^ **6** ^ **7** ^ **8** ^ **9** ^ **10** ^ **11** ^ **12** ^ **13** ^ **14** ^ **15** ^
^ **PWR** | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 2 | 2 | 2 | 2 | 2 |
^ **Proactive** | 0 | 1 | 1 | 1 | 1 | 2 | 2 | 2 | 3 | 3 | 3 | 3 | 4 | 4 | 4 |
^ **Reative** | 1 | 1 | 1 | 1 | 2 | 2 | 2 | 3 | 3 | 3 | 3 | 4 | 4 | 4 | 5 |
^ **Enhancement** | 0 | 0 | 1 | 1 | 1 | 1 | 2 | 2 | 2 | 3 | 3 | 3 | 3 | 4 | 4 |
^ **OMNI - Foundry** ^^^
^ **AI Difficulty** ^ **All** ^^
^ **PWR** | 1 ||
^ **Proactive** | 1 ||
^ **Reative** | 1 ||
^ **Enhancement** | 1 ||
^ **OMNI - Mainframe** ^^^
^ **AI Difficulty** ^ **1 - 6** ^ **7+** ^
^ **PWR** | 1 | 1 |
^ **Proactive** | 1 | 2 |
^ **Reative** | 1 | 2 |
^ **Enhancement** | 1 | 2 |
When AI activates, it randomly selects subroutines from the set available to it according to **AI Difficulty** and corporation subroutine type amounts. For example, an AI with AI Difficulty of 2 in [[:corporations:plastech|Plastech]] will have 1 proactive and 1 enhancement subroutine, from available pool of 4 proactive and 4 enhancement subroutines. For details which subroutine is available at which point, see [[:mods:programs_extended:subroutines|here]].
----
===== Hash Keys =====
[{{ :mods:programs_extended:hostile_ai:hostile_ai_console.png?nolink&200|Internationale ready to take Hash Keys from a Console.}}]
[[:incognita|Incognita]] has access to a new resource called **Hash Keys**. This resource is required to interact with hostile AI in several ways. Mission always starts with no hash keys stored, and a maximum storage of 8. Operator can acquire hash keys in following ways:
* Capturing a Console will grant 1 hash key, provided that hostile AI is present.
* Using {{:mods:programs_extended:hostile_ai:hostile_ai_action1.png?nolink|Acquire Hash Keys (Single)}} ability at a [[:console]] will provide 1 hash key and [[:rebooting|reboot]] that console for amount of turns determined by [[:agent]]'s [[:skill#hacking]] skill. Using this ability requires at least [[:skill#hacking]] skill of 2.
^ Hacking Skill Level ^ Reboot Time (Turns) ^
| 2 | 4 |
| 3 | 3 |
| 4 | 2 |
| 5 | 1 |
* Using {{:mods:programs_extended:hostile_ai:hostile_ai_action2.png?nolink|Acquire Hash Keys (Multiple)}} ability at a [[:console]] will provide hash keys based on [[:skill#hacking]] skill of the [[:agent]]. This will permanently shut down the [[:console]]. Requires at least [[:skill#hacking]] skill of 3.
^ Hacking Skill Level ^ Hash Keys Gained ^
| 3 | 2 |
| 4 | 3 |
| 5 | 4 |
* Use [[:mods:programs_extended:programs:decryptor|Decryptor]] program to gain 4 hash keys for 2 [[:pwr|PWR]].
Additionally maximum storage of hash keys can be increased by acquiring [[:mods:programs_extended:programs:decryptor|Decryptor]] program or any of the [[:mods:programs_extended:programs:hushpuppy|Hushpuppy]] line of programs.
Amount of hash keys can be viewed at any time by any of these:
* Counterintelligence AI daemon tooltip
* Any subroutine tooltip in mainframe view
* In tooltip of any ability that provides hash keys.
----
===== Mechanics =====
[{{ :mods:programs_extended:hostile_ai:hostile_ai_daemon.png?nolink&200|Counterintelligence AI is active, represented as a daemon on the right side of the screen.}}]
==== Turn 1 ====
Counterintelligence AI installs when enemy turn 1 begins. All proactive [[:mods:programs_extended:hostile_ai#subroutines]] start with 1 cooldown and can't be used during that first turn. However, PWR and reactive subroutines are available, and enhancement subroutines are applied immiedately.
==== PWR ====
AI has its own reserve of [[:pwr|PWR]], which can be seen by inspecting AIs daemon icon tooltip on the right side of the screen, or in subroutine tooltips in mainframe view. Amount of PWR it starts with is determined by **Starting PWR** campaign setting as follows:
AI starting PWR = 20 - **Starting PWR** setting
This gives AI on [[:modes:expert|Expert]] 10 PWR, and on [[:modes:expert_plus|Expert+]] 15 PWR. Default PWR limit is 20, same as for [[:incognita|Incognita]]'s PWR.
AI can generate PWR in following ways:
* By subroutines of the **PWR** type it has, if any.
* From **AI PWR Core** [[:mainframe_devices|mainframe devices]] added by [[:mods:worldgen_extended|Worldgen Extended]] mod. Each device generates 1 PWR per turn.
* Passively generate 1 PWR per turn by itself if AI Difficulty is at least 2 and no **AI PWR Cores** are present.
AI spends PWR by activating proactive and reactive subroutines it has.
PWR can be removed by the player as well, with following methods:
* By using **Drain AI PWR** {{ :mods:programs_extended:hostile_ai:icon-action_chargeweapon_small.png?nolink|}} action at the console. This will remove 3 PWR from the AI and reboot the [[:console|Console]] for 3 to 5 turns, based on [[:skill#hacking|Hacking]] skill of the agent.
* By using specific Incognita [[mods:programs_extended:programs|programs]].
==== Subroutines ====
Subroutines are essencially [[:programs]], but only available to AI, and function in exact same way - cost [[:pwr|PWR]] and have cooldown, or operate passively for free. For detailed list of subroutines, look [[:mods:programs_extended:subroutines|here]].
[{{ :mods:programs_extended:hostile_ai:hostile_ai_unidentified.png?nolink&200|Knowledge is power. Identify those ASAP.}}]
Operator can see subroutines AI has by clicking on the red button next to Access [[:incognita|Incognita]] button, or use a keybind (//Z// by default, rebindable in options menu). However, there is a catch. All subroutines start **unidentified**, with their icon being **???**. To identify a subroutine, click on it while having at least 1 [[:mods:programs_extended:hostile_ai#hash_keys|hash key]] available. This will spend that key and identify that subroutine permanently. Alternatively, if operator does not have any hash keys, subroutines can be guessed by careful observation of the level.
Each time a subroutine activates, [[:incognita|Incognita]] will warn you about it with a yellow text message. If subroutine in question is identified, operator will receive detailed message about what subroutine it was and what it did. Otherwise message will be a generic warning that may clue you in, by comparing the state of the level before and after the message.
While programs can be roughly categorized as [[:programs#generators|generators]], [[:programs#breakers|breakers]] and [[:programs#utilities|utilities]], subroutines have formal categories that determine several of key properties.
=== PWR Subroutines ===
These subroutines are always passive, and operate without any costs. Their only purpose it to generate PWR for the AI. However, most PWR subroutines are conditional, and operator can negate that generation by forcing that condition to become false, most of the time. PWR is generated at start of enemy turn, although there are exceptions.
Operator can spend 1 [[:mods:programs_extended:hostile_ai#hash_keys|hash key]] to add 2 turns of cooldown, temporarily disabling that subroutine, by clicking on the subroutine icon after it's been identified.
=== Proactive Subroutines ===
As name suggests, AI will use these subroutines proactively, activating them on its own. Proactives always cost PWR and have cooldown, and can't be used if AI does not have PWR required for activation or subroutine is on cooldown.
Because proactives do not have activation condition other than their costs, it would seem hard to predict when they would activate due to randomness. However, there are few rules how AI activates its proactives:
* Always at the end of enemy turn.
* If that proactive subroutine is the only subroutine that requires [[:mods:programs_extended:hostile_ai#pwr|PWR]] to run, it will be activated at every possible opportunity.
* If there are at least two subroutines requiring [[:mods:programs_extended:hostile_ai#pwr|PWR]], it rolls a random number between its current PWR and maximum PWR (inclusive), and if result is 15 or more, proactive subroutine is activated. For example, at 4/20 PWR, chance to activate a proactive subroutine is 26%. This is checked for all proactive subroutines individually, so one activation will reduce odds (due to spent PWR) of another proactive activating that turn.
Operator can spend 1 [[:mods:programs_extended:hostile_ai#hash_keys|hash key]] to increase that subroutine's cooldown by 1, by clicking on the subroutine icon after it's been identified.
=== Reactive Subroutines ===
Reactives will never activate by themselves - instead, they have a condition agency must fulfill first, after which they immiedately activate - for example, hacking a firewall. If several reactive subroutines share a condition, all of them will activate when that condition is fulfilled. Reactives always cost PWR and have cooldown, and can't be used if AI does not have PWR required for activation or subroutine is on cooldown.
Operator can spend 1 [[:mods:programs_extended:hostile_ai#hash_keys|hash key]] to increase that subroutine's cooldown by 1, by clicking on the subroutine icon after it's been identified.
=== Enhancement Subroutines===
These subroutines are always passive and do not cost anything. Their effects can't be interrupted. Some are similar to reactive subroutines, in that they react to a condition being fulfilled. Others are always active, such as [[:guard]] buffs.
Unlike other subroutine types, enhancements can be permanently deleted, and their effects cancelled due to said deletion. To delete an enhancement subroutine, Operator has to spend 2 [[:mods:programs_extended:hostile_ai#hash_keys|hash keys]] and 1 [[:pwr|PWR]] by clicking on the subroutine icon after it's been identified, four separate times for a total of 8 hash keys and 4 PWR.