AI modding:修订间差异

本页面适用于最新的版本(1.14)。
无编辑摘要
无编辑摘要
 
(未显示同一用户的5个中间版本)
第1行: 第1行:
{{version|1.14.7}}
{{version|1.14}}
{{需要翻译} 译者=霜泽图书馆}
{{需要翻译| 译者=霜泽图书馆}}
The artificial intelligence controlling countries in Hearts of Iron IV can be changed in many different aspects. This includes changing the focuses or technologies it pursues, changing how many units or buildings it should produce and of which type, where it should focus forces, which templates or variants it should aim for, and so on.
《钢铁雄心IV》中的AI能够操纵国家许多方面的事物。其包括变更国家的国策或科技走向,决定国家应该生产多少单位或建筑,以及国家应该生产什么样的模板,应该集中力量在哪里,决定使用哪些模板或变体等等。
以下是AI的mod文件路径:


* {{path|common/ai_areas}}
* {{path|common/ai_areas}}
第16行: 第17行:
__TOC__
__TOC__


== MTTH blocks ==
== MTTH 代码块 ==
{{anchor|ai_will_do}}
{{anchor|ai_will_do}}
{{anchor|AI_will_do}}
{{anchor|AI_will_do}}
{{anchor|AI_chance}}
{{anchor|AI_chance}}
{{SVersion|Timeless}}
{{SVersion|Timeless}}
MTTH blocks, named in the game within {{path|common/mtth/}}, are a way to assign a dynamic value to some block, whether it's a [[National focus modding#Focus tree|country = { ... } in a focus tree to assign which countries can get it]], a dynamically-changing variable value (as in {{path|common/mtth/}}), a [[Event modding#Triggering|mean-time-to-happen value for an event]], et cetera. As MTTH blocks are spread throughout the entire game, it's incredibly important to know how one works. Its most common application, however, is assigning a base AI weight to a database entry such as a national focus or a technology.
MTTH 块,在游戏内命名为 {{path|common/mtth/}} ,是一种为某些块分配动态值的方法,无论是 [[National focus modding#Focus tree|country = { ... } in a focus tree to assign which countries can get it]] ,动态变化的变量值(如在 {{path|common/mtth/}} 中),还是事件的[[Event modding#Triggering|mean-time-to-happen value for an event]] 值等。由于 MTTH 块分布在整个游戏中,了解其工作原理极为重要。然而,它最常见的应用是为数据库条目(例如国策或科研)分配基本的 AI 权重。


In most cases, marked with ai_will_do, the approach taken by the game is generating a decimal number between 0 and the value of the ai_will_do block, and picking the entry with the highest value. There can be other modifiers applied after the ai_will_do value, such as the ones applied within [[#AI strategy plans|AI strategy plans]] towards focuses and research or {{hover|When modifying defines, never copy over the entire 00_defines.lua file, but use overrides as specified within the corresponding article. Otherwise may lead to crashes, as even 'minor' updates commonly add new defines which'll not be in the mod if the entire file is copied.|the ones that get defined within [[Defines]]}}, which'll multiply the value you get. This can include different ai_will_do values such as what's done with country leader traits and with ideas or characters that use them.<br/>
大多数情况下,它会被标记为 ai_will_do ,游戏采用的方法是生成一个介于 0 ai_will_do 块的值之间的十进制数字,然后选择具有最高值的条目。在 ai_will_do 值之后还可以应用其他修正,例如在 [[#AI strategy plans|AI strategy plans]] 中针对国策和科研应用的修正值。或{{hover|When modifying defines, never copy over the entire 00_defines.lua file, but use overrides as specified within the corresponding article. Otherwise may lead to crashes, as even 'minor' updates commonly add new defines which'll not be in the mod if the entire file is copied.|the ones that get defined within [[Defines]]}} 。它会与已经获值进行相乘。这可以包括不同的 `ai_will_do` 值,例如与国家领袖特质以及使用这些特质的idea或角色相关的内容。<br/>
Event options, instead, use ai_chance, which uses [[wp:Sampling_(statistics)#Probability-proportional-to-size_sampling|probability-proportional-to-size sampling]] with a virtual roll of d00 being the final deciding factor. Due to that, in the end, an event option cannot have a probability which isn't a multiple of 1/100 to be picked, although the total sum of each option's weights can be vastly different from 100. In other words, if one option has a value of 1, while the other has a value of 999, the probability for the first option to be picked will be 1% rather than 0.1%.
事件选项则使用 `ai_chance`。即[[wp:Sampling_(statistics)#Probability-proportional-to-size_sampling|probability-proportional-to-size sampling]] 。它采用与大小成比例的概率抽样,用一个虚拟的 d00 掷骰结果作为最终决定因素。因此,最终事件选项的概率不能不是 1/100 的倍数,尽管每个选项权重的总和可以与 100 有很大区别。换句话说,如果一个选项的值为 1 ,而另一个选项的值为 999 ,则第一个选项被选择的概率将是 1% ,而不是 0.1%


A MTTH block begins with an assumed value of 1. Further manipulations are done from that value as a starting point. There are 3 value-modifying arguments that can be done, <code>add</code>, <code>base</code>, and <code>factor</code>, done like <code>factor = 0.3</code>, <code>base = 10</code>, or <code>add = 5</code>. <code>add</code> adds the specified argument to the value, <code>factor</code> ''multiplies'' it, and <code>base</code>, typically done in the start before any changes, sets it to a different number entirely, akin to multiplying by 0 and adding the number.<br/>
MTTH 块的初始值为 1 。从该值出发进行进一步操作。这里可以对三个值进行参数更改,分别是: <code>add</code>, <code>base</code> <code>factor</code> ,例:可以这样<code>factor = 0.3</code>, <code>base = 10</code>, or <code>add = 5</code> <code>add</code> 将指定参数加到该值上,<code>factor</code> 乘以该值,而 <code>base</code> 通常在任何更改之前进行,建议将其设置为完全不同的参数,如乘以 0 并加上这个数。
In order for an operation to apply conditionally, a <code>modifier = { ... }</code> block is used. This also functions as a [[conditions|trigger block]], with the default scope (thus also ROOT) being the country for which the MTTH block is evaluated. Depending on the MTTH block, [[Decision modding#Targeted decisions|there may be additional scopes marked with FROM]] [[#AI peace|or FROM.FROM other than the default.]] The value-modifying arguments function as regular arguments, they can be put in anywhere directly within the <code>modifier = { ... }</code> block with almost no difference, whether it's in the end, the beginning, or between triggers.
为了使操作条件适用,使用 <code>modifier = { ... }</code> block 。其起到的作用于 [[conditions|trigger block]] 相似,默认作用域下(因此也是 ROOT )是评估 MTTH 块的国家。根据 MTTH 块, [[Decision modding#Targeted decisions|there may be additional scopes marked with FROM]] [[#AI peace|or FROM.FROM other than the default.]] 可能还有其他标记为 FROM 的范围或 FROM.FROM 以外的默认范围。值修改参数作为常规参数使用(值修改参数和普通参数一样,拥有相同的使用方式和特性。这种设计可以使得函数在处理输入时具有更大的灵活性。),可以几乎没有区别的放置在 <code>modifier = { ... }</code> block 中的任何位置,无论是在结束时、开始时,还是在trigger触发块之间。


[[Variables]] can be used within the value-modifying arguments as well. If using a temporary variable that is defined within the <code>modifier = { ... }</code> trigger block, then the value-modifying argument of the modifier has to be after the definition of the variable in order for the variable to apply as defined. Variables can also be used outside of the <code>modifier = { ... }</code> block and directly inside of the MTTH block itself.
[[Variables]] 也可以在值修改参数中使用。如果使用在 <code>modifier = { ... }</code> 触发块中定义的临时变量,为了变量能够按定义应用,那么修正值的值修改参数必须放在变量定义之后。变量也可以在 <code>modifier = { ... }</code> 块之外使用,也可直接放在 MTTH 块内部。


=== Example ===
=== 示例 ===
<pre>
<pre>
ai_will_do = {
ai_will_do = {
第55行: 第56行:
    }
    }
}</pre>
}</pre>
Assuming that GER and FRA are major countries, the result is
假设GER和FRA是主要国家,结果是
* 0 for GER: <math>10.5 \cdot 0 = 0</math>
* 德国为0 即<math>10.5 \cdot 0 = 0</math>
* 74 for FRA: <math>((10.5 + 1) \cdot 3 + 2.5) \cdot 2 = 74</math>
* 法国是74 即<math>((10.5 + 1) \cdot 3 + 2.5) \cdot 2 = 74</math>
* 23 for other majors: <math>(10.5 + 1) \cdot 2 = 23</math>
* 其他主要国家为23 即<math>(10.5 + 1) \cdot 2 = 23</math>
* 21 for minors: <math>10.5 \cdot 2 = 21</math>
* 其他非主要国家为21 即<math>10.5 \cdot 2 = 21</math>
After calculating that value, the total number of civilian and military factories within the country, divided by 10 and rounded, will get added to the score. If FRA has a total of 43 civilian and military factories as it does in base game, then this will result in 4 being added to the prior 74 for a total of 78, for example.
计算出该值后,该国民用和军用工厂的总数除以10并四舍五入,将计入得分。例如,如果法国在开局游戏中总共有43家民用和军用工厂,那么这将导致在之前的数值74基础上增加4,总共78。


== AI strategies ==
== AI 策略 ==
{{SVersion|1.11}}
{{SVersion|1.11}}
AI strategies are used in order to pursue AI to do or avoid something. This includes diplomatic actions the AI will do, where and how exactly AI should focus and use its land army and the navy, the production lines for buildings and equipment, how AI should handle the intelligence system within the {{icon|lar|1}} DLC.<br/>
AI strategies ,AI策略,是为了让AI更愿意或更讨厌去采取某些行动。比如开战、保独、志愿军等外交行动,海陆军军事力量的战略部署权重,建造和生产的队列分配,以及{{icon|lar|1}} DLC 中情报系统的运用。<br/>
A value within an AI strategy can be either positive or negative, and it being negative will make AI desire to do it less.
AI strategies中的 value (值)可正可负,正值会增加AI采取行动的倾向,反之则会减少。


Regular AI strategies are stored in {{path|common/ai_strategy/*.txt}} files, however, AI strategies may be defined outside of that file. The [[Effect#add_ai_strategy|add_ai_strategy effect]] can add a permament AI strategy within any effect block, and [[#AI strategy plans|AI strategy plans]] can also include AI strategies defined within of themselves. Overall, {{path|common/ai_strategy/*.txt}} files describe AI strategies that would enable and disable themselves automatically.<br/>
一般的AI策略存储在{{path|common/ai_strategy/*.txt}} 文件中,但是AI策略也可以在该文件夹之外定义。比如[[Effect#add_ai_strategy|add_ai_strategy effect]] 语句可以在任何效果域中添加永久ai策略, [[#AI strategy plans|AI strategy plans]] 中也包含着自己内部定义的AI策略。总之,{{path|common/ai_strategy/*.txt}} 文件中定义/描述的AI策略可以通过满足或不满足条件来自动启用或关闭<br/>
Each entry within a {{path|common/ai_strategy/*.txt}} file is a block with the name of the AI strategy. This name can be anything, even allowing overlap between them: this will only appear in AI dumps and the player will never see it. If an AI strategy modifies the chance for AI to pick a diplomatic option with the player, it will be seen as <code>COUNTRY has strategic reasons to be ...</code> to the player when hovering over the option. This is an example of an AI strategy with the name of BHR_invade_qatar:
 
{{path|common/ai_strategy/*.txt}} 文件中的每个条目都是一个具有 AI 策略名称的域,就像Effect作用域或Trigger条件域一样。条目名称可以任意定义(但为了防止重复,建议在词条后加一个ai_strategy之类的后缀),甚至允许重复定义:这只会出现在 AI dumps 的后台中,玩家是看不到的。如果某个 AI 策略修改了 AI 选择与玩家进行外交行为的权重几率,那么当玩家将鼠标悬停在选项上时,会显示该外交行为的影响因素如下: <code>COUNTRY has strategic reasons to be ...</code> 。以下是一个名为 BHR_invade_qatar 的 AI 策略示例:
<pre>BHR_invade_qatar = {
<pre>BHR_invade_qatar = {
    allowed = {
    allowed = {
第87行: 第89行:
}</pre>
}</pre>


=== Arguments ===
=== 参数说明 ===
These in particular are arguments for {{path|common/ai_strategy/*.txt}} entries, rather for AI strategy entries within them.
以下是针对 {{path|common/ai_strategy/*.txt}} 条目(而非其中的 AI 策略条目)的参数说明。


<code>allowed = { ... }</code> is a trigger block that's '''checked only before the game's start''', permamently allowing or disallowing an AI strategy. Typically, only used for country checks (such as <code>tag = OMA</code>) or DLC checks that can never be unfulfilled once they are met.
<code>allowed = { ... }</code> 是启用域, 该allowed域''' 仅在游戏开始前''' 进行检查,用于永久性地允许或禁止某个 AI 策略。通常这只用于国家检查(例如 <code>tag = OMA</code> )或 DLC 检查,这些检查一旦满足就永远不会失效。


<code>enable = { ... }</code> is a trigger block that must be met in order to enable the AI strategy. By default, this being unmet will ''not'' cancel the AI strategy. However, <code>abort_when_not_enabled = yes</code> can be used as a separate argument in order to make that be no longer the case. Unlike allowed, this is checked continuously.
<code>enable = { ... }</code> 是可用域,必须满足该条件才能启用 AI 策略。默认情况下,即使不满足该条件,也 不会 取消 AI 策略。可以通过使用 <code>abort_when_not_enabled = yes</code> 作为单独的参数来改变其是否可用。与 allowed 不同的是,这个条件会被实时判断。


<code>abort = { ... }</code> is a trigger block that must be met in order to ''remove'' the AI strategy. It being unmet also prevents it from being added in the first place.
<code>abort = { ... }</code> 是一个条件域,满足该条件就能禁用当前 AI 策略。即使不满足该条件,也会阻止该AI策略在游戏开始时被添加。


<code>ai_strategy = { ... }</code> is, itself, the AI strategy that would be applied. The only argument shared for every AI strategy is <code>type = <AI strategy type></code>. [[#Types|The rest depends on the AI strategy]].
<code>ai_strategy = { ... }</code> 内部是要生效的 AI 策略。AI 策略的形式是 <code>type = <AI strategy type></code> [[#Types|The rest depends on the AI strategy]


In addition, reversed AI strategies exist. These are used with AI strategies that use <code>id = TAG</code> to target towards a specific country to swap it around: that strategy will be enabled for TAG towards the country which meets <code>enable = { ... }</code>. In order to mark the AI strategy as reversed, <code>reversed = yes</code> is used. <code>enable_reverse = { ... }</code> is an additional trigger block required to ''enable'' this AI strategy. It does not have a default scope, so scoping into a country is required.<br/>
此外,还有 AI 策略的反转参数。用于有 <code>id = TAG</code> 条件的 AI 策略,以针对特定TAG:该 AI 策略将为满足 <code>enable = { ... }</code> 判断条件的国家启用。并依靠 <code>reversed = yes</code> 来生效。 <code>enable_reverse = { ... }</code> 意为需要满足域内条件才能反转。反转参数无默认条件域,所以需要条件域具体到某个TAG。
An example of a reversed AI strategy is the following:
 
反转 AI 策略的例子如下:
<pre>BHR_support_neutrals = {
<pre>BHR_support_neutrals = {
    allowed = {
    allowed = {
第117行: 第120行:
      value = 100
      value = 100
    }
    }
}</pre>Without <code>reversed = yes</code>, this would make every {{icon|non-aligned|1}} country support BHR. Due to that argument, the strategy is reversed: instead, BHR supports every {{icon|non-aligned|1}} country.
}</pre> 如果没有 <code>reversed = yes</code> ,该例这将使每个 {{icon|non-aligned|1}} 国家支持 BHR 。由于该参数的存在,策略被反转:BHR 将支持每个 {{icon|non-aligned|1}} 国家。


=== Types ===
=== Types ===
{{SVersion|1.11}}
{{SVersion|1.11}}
This list may be outdated. A list of every AI strategy can be found within base game's {{path|common/ai_strategy/documentation.info}} file.<br/>
此列表可能已过时。有关每种人工智能策略的列表可以在原版游戏的 {{path|common/ai_strategy/documentation.info}} 文件中找到。<br/>
 
{| class="wikitable sortable mw-collapsible mw-collapsed" style="display: inline-block; padding: 5px" width="100%"
{| class="wikitable sortable mw-collapsible mw-collapsed" style="display: inline-block; padding: 5px" width="100%"
|+ style="text-align: center;" width = "100%" |{{nowrap| 与外交行动相关的AI策略:}}
|+ style="text-align: center;" width = "100%" |{{nowrap|AI strategies related to diplomatic actions:}}
! width="10%" | 名称 
! width="10%" |Name
! width="25%" | 参数 
! width="25%" |Parameters
! width="25%" | 示例 
! width="25%" |Examples
! width="20%" | 描述 
! width="20%" |Description
! width="20%" | 备注 
! width="20%" |Notes
|-id="alliance"
|-id="alliance"
| 结盟 
|alliance
|<code>value = <int></code><br/> 策略的权重。<br/>
|<code>value = <int></code><br/>The weight of the strategy.<br/>
<code>id = <country></code><br/> 策略的目标。 
<code>id = <country></code><br/>The target of the strategy.
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = alliance
    type = alliance
    id = USA
    id = USA
    value = -100
    value = -100
}</pre>
}</pre>
|AI 会尝试与一个国家结盟,如有可能,将加入同一阵营。 
|Pursues AI to ally with a country, joining the same faction if possible.
|
|
|-id="antagonize"
|-id="antagonize"
| 对抗 
|antagonize
|<code>value = <int></code><br/> 策略的权重。<br/>
|<code>value = <int></code><br/>The weight of the strategy.<br/>
<code>id = <country></code><br/> 策略的目标。 
<code>id = <country></code><br/>The target of the strategy.
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = antagonize
    type = antagonize
    id = USA
    id = USA
    value = -100
    value = -100
}</pre>
}</pre>
|AI 将会与一个国家对抗,拒绝与其进行大多数的外交行动。 
|Pursues AI to antagonize a country, refusing most diplomatic actions with them.
|
|
|-id="asking_foreign_garrison"
|-id="asking_foreign_garrison"
| 请求外国驻军 
|asking_foreign_garrison
|<code>value = <int></code><br/> 策略的权重。<br/>
|<code>value = <int></code><br/>The weight of the strategy.<br/>
<code>id = <country></code><br/> 策略的目标。 
<code>id = <country></code><br/>The target of the strategy.
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = asking_foreign_garrison
    type = asking_foreign_garrison
    id = USA
    id = USA
    value = 100
    value = 100
}</pre>
}</pre>
|Pursues AI to ask for foreign manpower to fulfill garrisons, from a specific country if specified.
|AI 将会按照权重请求外国人力支援以满足驻军需求,如果指明了特定国家。
|If <code>id</code> is not specified, will apply towards every other country.
| 如果未指定<code>id</code> ,则将适用于其他所有国家。
|-id="befriend"
|-id="befriend"
|befriend
| 交好
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 此策略的权重。<br/>
<code>id = <country></code><br/>The target of the strategy.
<code>id = <country></code><br/> 策略的目标国家。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = befriend
    type = befriend
第172行: 第174行:
    value = 100
    value = 100
}</pre>
}</pre>
|Pursues AI to befriend a country, accepting most diplomatic actions with them.
|AI 将会与某国家建立友好关系,接受大多数与该国的外交行动。
|
|
|-id="conquer"
|-id="conquer"
|conquer
| 征服
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 此策略的权重。<br/>
<code>id = <country></code><br/>The target of the strategy.
<code>id = <country></code><br/> 策略的目标国家。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = conquer
    type = conquer
第183行: 第185行:
    value = 100
    value = 100
}</pre>
}</pre>
|Pursues AI to conquer a country, being more likely to declare war and justify wargoals.
|AI 将会试图征服某国家,更有可能为之正当化战争目标并宣战。
|This does ''not'' change how the AI will control frontlines when at war with that country.
| 这并'' '' 改变AI在与其进行战争时对前线的控制方式。
|-id="consider_weak"
|-id="consider_weak"
|consider_weak
| 视为弱国
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 此策略的权重。<br/>
<code>id = <country></code><br/>The target of the strategy.
<code>id = <country></code><br/> 策略的目标国家。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = consider_weak
    type = consider_weak
第194行: 第196行:
    value = 100
    value = 100
}</pre>
}</pre>
|Pursues AI to consider a country more weak, decreasing hesitation for declaration of war or making alliance less likely.
|AI 会将某国视为弱国,减少对其宣战前的踌躇不前,或使与该国结盟的可能性降低。
|
|
|-id="contain"
|-id="contain"
|contain
| 遏制
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 此策略的权重。<br/>
<code>id = <country></code><br/>The target of the strategy.
<code>id = <country></code><br/> 策略的目标国家。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = contain
    type = contain
第205行: 第207行:
    value = 100
    value = 100
}</pre>
}</pre>
|Pursues AI to contain a country, protecting any countries that it would try to antagonize or invade.
|AI 将会遏制某个国家,保护他免受任何可能与其敌对国家的侵略。
|
|
|-id="declare_war"
|-id="declare_war"
|declare_war
| 宣战
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 此策略的权重。<br/>
<code>id = <country></code><br/>The target of the strategy.
<code>id = <country></code><br/> 策略的目标国家。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = declare_war
    type = declare_war
第216行: 第218行:
    value = 100
    value = 100
}</pre>
}</pre>
|Pursues AI to declare war on a country if a wargoal already exists.
|AI 将会在已有正当化后的宣战借口的情况下对战争目标宣战。
|
|
|-id="diplo_action_acceptance"
|-id="diplo_action_acceptance"
|diplo_action_acceptance
| 外交行动接受
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 此策略的权重。<br/>
<code>id = <country></code><br/>The target of the strategy.<br/>
<code>id = <country></code><br/> 策略的目标国家。<br/>
<code>target = <diplomatic action></code><br/>The diplomatic action to modify.
<code>target = <diplomatic action></code><br/> 要修改的外交行动。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = diplo_action_acceptance
    type = diplo_action_acceptance
第229行: 第231行:
    target = join_allies
    target = join_allies
}</pre>
}</pre>
|Pursues AI to accept a diplomatic action if a different country requests it.
| 若其他国家请求,AI将接受某项外交行动。
|AI will not be more likely to propose the diplomatic action in question. Names of diplomatic actions can usually be found from localisation keys used for the title, most of the time yet not always in the {{path|localisation/english/diplomacy_l_english.yml}} file: <code>DIPLOMACY_SEND_VOLUNTEERS_TITLE:0 "Send Volunteers"</code> means that the name of the diplomatic action for sending volunteers is <code>send_volunteers</code>.
|AI 被提议不会影响其原有的态度。外交行动的名称通常可以通过用于标题的本地化键找到,大部分情况下位于{{path|localisation/english/diplomacy_l_english.yml}}  文件中:<code>DIPLOMACY_SEND_VOLUNTEERS_TITLE:0 " 派遣志愿军"</code> 表示派遣志愿军的外交行动名称为<code>send_volunteers</code>
|-id="diplo_action_desire"
|-id="diplo_action_desire"
|diplo_action_desire
| 外交行动愿望
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 此策略的权重。<br/>
<code>id = <country></code><br/>The target of the strategy.<br/>
<code>id = <country></code><br/> 策略的目标国家。<br/>
<code>target = <diplomatic action></code><br/>The diplomatic action to modify.
<code>target = <diplomatic action></code><br/> 要修改的外交行动。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
   type = diplo_action_desire
  type = diplo_action_desire
    id = USA
    id = USA
    value = 100
    value = 100
    target = call_allies
    target = call_allies
}</pre>
}</pre>
|Pursues AI to request a diplomatic action towards the specified country.
|AI 将会向指定国家请求某项外交行动。
|AI will not be more likely to accept the diplomatic action in question if it gets proposed to them. Names of diplomatic actions can usually be found from localisation keys used for the title, most of the time yet not always in the {{path|localisation/english/diplomacy_l_english.yml}} file: <code>DIPLOMACY_SEND_VOLUNTEERS_TITLE:0 "Send Volunteers"</code> means that the name of the diplomatic action for sending volunteers is <code>send_volunteers</code>.
|AI 不会因为被提议而更改原有态度。外交行动的名称通常可以通过用于标题的本地化键找到,大部分情况下位于{{path|localisation/english/diplomacy_l_english.yml}} 文件中:<code>DIPLOMACY_SEND_VOLUNTEERS_TITLE:0 " 派遣志愿军"</code> 表示派遣志愿军的外交行动名称为<code>send_volunteers</code>
|-id="dont_join_wars_with"
|-id="dont_join_wars_with"
|dont_join_wars_with
| 不与...一起参战
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 此策略的权重。<br/>
<code>id = <country></code><br/>The target of the strategy.<br/>
<code>id = <country></code><br/> 策略的目标国家。<br/>
<code>target_country = <country></code><br/>The country against whom the war is joined.
<code>target_country = <country></code><br/> 与之参战的国家。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = dont_join_wars_with
    type = dont_join_wars_with
第255行: 第257行:
    target_country = BHR
    target_country = BHR
}</pre>
}</pre>
|Pursues AI to be less likely to join a war together with a specified country against a specific one.
|AI 将更不可能与指定国家联合对某一特定国家参战。
|Does not make AI less likely to join a war together with a ''different'' country against target_country, even if it'll result in fighting against target_country together with the specified country.
| 并不减少AI因“其他”国家召唤导致对目标国家宣战的可能性,即使这会导致与被指定国家一起与目标国家作战。
|-id="ignore"
|-id="ignore"
|ignore
| 无视
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 此策略的权重。<br/>
<code>id = <country></code><br/>The target of the strategy.
<code>id = <country></code><br/> 策略的目标国家。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = ignore
    type = ignore
第266行: 第268行:
    value = 100
    value = 100
}</pre>
}</pre>
|Pursues AI to be less likely to accept or desire any sort of diplomatic action with this country.
|AI 将更不可能接受或主动与目标国进行任何形式的外交行动。
|
|
|-id="ignore_claim"
|-id="ignore_claim"
|ignore_claim
| 无视宣称
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <country></code><br/>The target of the strategy.
<code>id = <country></code><br/> 策略的目标国家。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = ignore_claim
    type = ignore_claim
第277行: 第279行:
    value = 1
    value = 1
}</pre>
}</pre>
|Pursues AI to ignore any claims that it has on the specified country.
|AI 将忽视指定国家发起的外交活动。
|The value is boolean, just set to be 1.
| 值为布尔型,仅设定为1。
|-id="protect"
|-id="protect"
|protect
| 保护
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <country></code><br/>The target of the strategy.
<code>id = <country></code><br/> 策略的目标国家。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = protect
    type = protect
第288行: 第290行:
    value = 100
    value = 100
}</pre>
}</pre>
|Pursues AI to protect a certain country, guaranteeing them or adding to the same faction.
|AI 将保护某一国家,对其进行保障独立或将其拉入同一阵营。
|A negative total value (taking every AI strategy into consideration) results in AI never guaranteeing that country.
| 若值为负(综合考虑所有AI策略值)将导致AI不会保障该国家。
|-id="support"
|-id="support"
|support
| 支持
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <country></code><br/>The target of the strategy.
<code>id = <country></code><br/> 策略的目标国家。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = support
    type = support
第299行: 第301行:
    value = 100
    value = 100
}</pre>
}</pre>
|Pursues AI to support a certain country within wars, sending lend lease, volunteers, or expeditionary forces.
|AI 将在战争中通过起草租借法案、派遣志愿军或远征军支持指定国家。
|
|
|-id="send_lend_lease_desire"
|-id="send_lend_lease_desire"
|send_lend_lease_desire
| 起草租借法案
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <country></code><br/>The target of the strategy.
<code>id = <country></code><br/> 策略的目标国家。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = send_lend_lease_desire
    type = send_lend_lease_desire
第310行: 第312行:
    value = 100
    value = 100
}</pre>
}</pre>
|Pursues AI to lend-lease equipment to the specified country.
|AI 将向指定国家起草租借法案。
|
|
|-id="send_volunteers_desire"
|-id="send_volunteers_desire"
|send_volunteers_desire
| 发送志愿军的意愿
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <country></code><br/>The target of the strategy.
<code>id = <country></code><br/> 策略的目标国家。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = send_volunteers_desire
    type = send_volunteers_desire
第321行: 第323行:
    value = 100
    value = 100
}</pre>
}</pre>
|Pursues AI to send volunteers to the specified country.
|AI 将向指定国家派遣志愿军。
|
|
|}
|}
{| class="wikitable sortable mw-collapsible mw-collapsed" style="display: inline-block; padding: 5px" width="100%"
{| class="wikitable sortable mw-collapsible mw-collapsed" style="display: inline-block; padding: 5px" width="100%"
|+ style="text-align: center;" width = "100%" |{{nowrap|AI strategies related to land army management:}}
|+ style="text-align: center;" width = "100%" |{{nowrap| 与陆军管理相关的AI策略:}}
! width="10%" |Name
! width="10%" | 名称
! width="25%" |Parameters
! width="25%" | 参数
! width="25%" |Examples
! width="25%" | 示例
! width="20%" |Description
! width="20%" | 描述
! width="20%" |Notes
! width="20%" | 备注
|-id="invade"
|-id="invade"
|invade
| 登陆侵略
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <country></code><br/>The target of the strategy.
<code>id = <country></code><br/> 策略的目标国家。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = invade
    type = invade
第341行: 第342行:
    value = -100
    value = -100
}</pre>
}</pre>
|Pursues AI to do naval invasions against the specified country.
|AI 将对指定国家进行海军入侵。
|
|
|-id="naval_invasion_focus"
|-id="naval_invasion_focus"
|naval_invasion_focus
| 海军入侵重点
|<code>value = <int></code><br/>The weight of the strategy.
|<code>value = <int></code><br/> 策略的权重。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = naval_invasion_focus
    type = naval_invasion_focus
    value = 100
    value = 100
}</pre>
}</pre>
|Pursues AI to launch naval invasions.
|AI 将会发起海军入侵。
|-id="prepare_for_war"
|-id="prepare_for_war"
|prepare_for_war
| 准备战争
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <country></code><br/>The target of the strategy.
<code>id = <country></code><br/> 策略的目标国家。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = prepare_for_war
    type = prepare_for_war
第360行: 第361行:
    value = 100
    value = 100
}</pre>
}</pre>
|Pursues AI to prepare for a war against a specified country, moving troops to their border.
|AI 将准备对指定国家的战争,并将部队移动到其边界。
|
|
|-id="area_priority"
|-id="area_priority"
|area_priority
| 区域优先级
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <AI area></code><br/>The [[#AI areas|AI area]] to prioritise.
<code>id = <AI area></code><br/> 要优先考虑的[[#AI areas|AI area]]
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = area_priority
    type = area_priority
第371行: 第372行:
    value = 100
    value = 100
}</pre>
}</pre>
|Pursues AI to put more units within the specified AI area.
| 推动AI在指定区域内放置更多单位。
|
|
|-id="dont_defend_ally_borders"
|-id="dont_defend_ally_borders"
|dont_defend_ally_borders
| 不防守盟友边界
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <country></code><br/>The target of the strategy.
<code>id = <country></code><br/> 策略的目标国家。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = dont_defend_ally_borders
    type = dont_defend_ally_borders
第382行: 第383行:
    value = 10
    value = 10
}</pre>
}</pre>
|Makes AI never put troops on the border between the specified country and countries that are at war with it.
| 使AI永远不在指定国家与与其交战的国家之间的边界上部署部队。
|Strictly binary. If the total value (taking every AI strategy into consideration) is positive, AI will never put any troops on the border.
| 数值必须是二进制的。如果总值(考虑到每个AI策略)为正,AI将永远不会在边界上放置任何部队。
|-id="force_defend_ally_borders"
|-id="force_defend_ally_borders"
|force_defend_ally_borders
| 强制防守盟友边界
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <country></code><br/>The target of the strategy.
<code>id = <country></code><br/> 策略的目标国家。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = force_defend_ally_borders
    type = force_defend_ally_borders
第393行: 第394行:
    value = 100
    value = 100
}</pre>
}</pre>
|Pursues AI to put troops on the border between the specified country and countries that are at war with it.
|AI 将在指定国家与其他国家之间的边界上部署部队。
|Also accepts [[#AI areas|AI areas]] within <code>id</code>.
| 与之交战的国家。 |
|-id="front_armor_score"
| 还接受<code>id</code>中的[[#AI areas|AI areas] 。 |
|front_armor_score
|-id="front_armor_score"
|<code>value = <int></code><br/>The weight of the strategy.<br/>
| 前线装甲分配权重
<code>id = <country></code><br/>The target of the strategy.
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <country></code><br/> 策略的目标国家。 
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = front_armor_score
    type = front_armor_score
    id = POL
    id = POL
    value = 100
    value = 100
}</pre>
}</pre>
|Pursues AI to put more tank units for invading the specified country.
|AI 将为进攻指定国家部署更多装甲单位。 
|
|-id="front_control"
|-id="front_control"
| 前线控制 
|front_control
|<code>state = <state></code><br/> 目标州。<br/>
|<code>state = <state></code><br/>The state to target.<br/>
<code>tag = <country></code><br/> 目标国家。<br/>
<code>tag = <country></code><br/>The state to target.<br/>
<code>strategic_region = <ID></code><br/> 目标战略区域。<br/>
<code>strategic_region = <ID></code><br/>The strategic region to target.<br/>
<code>area = <state></code><br/> 目标[[#AI areas|AI area]] <br/>
<code>area = <state></code><br/>The [[#AI areas|AI area]] to target.<br/>
<code>country_trigger = { ... }</code><br/> 目标国家的触发条件块。<br/>
<code>country_trigger = { ... }</code><br/>Trigger block checked for states to have them as a target.<br/>
<code>state_trigger = { ... }</code><br/> 目标省份的触发条件块。 
<code>state_trigger = { ... }</code><br/>Trigger block checked for countries to have them as a target.
<code>ratio = <decimal></code><br/> 指定前线必须具备的前线比例 ''' 以启用策略的要求'''. 默认为0。<br/>
 
<code>priority = <integer></code><br/> 设置此前线控制策略的优先级。如果存在矛盾的前线控制策略,将遵循优先级更高的策略。<br/>
<code>ratio = <decimal></code><br/>How much of a frontline ratio the specified front must have '''as a requirement to enable the strategy'''. Defaults to 0.<br/>
<code>ordertype = <front|invasion></code><br/> 如果设置,将使AI策略仅适用于陆地前线或海军入侵。<br/>
<code>priority = <integer></code><br/>Sets the priority of this front control strategy. If there are contradictory front control strategies, the one with a higher priority is followed.<br/>
<code>execution_type = <careful|balanced|rush|rush_weak></code><br/> 如果设置,这将使AI的前线计划拥有设置的执行类型。仅适用于前线。<br/>
<code>ordertype = <front|invasion></code><br/>If set, this will make the AI strategy only apply on land frontlines or naval invasions respectively.<br/>
<code>execute_order = <bool></code><br/> 如果设置,将使AI强制执行前线命令或强制不执行。<br/>
<code>execution_type = <careful|balanced|rush|rush_weak></code><br/>If set, this pursues AI to make the frontline plans have the set execution type. Only for front.<br/>
<code>manual_attack = <bool></code><br/> 如果设置为false,防止AI进行不属于前线计划的小规模交战。默认为true,仅适用于前线。 
<code>execute_order = <bool></code><br/>If set, makes AI to either force execute the frontline order or force it being never executed.<br/>
<code>manual_attack = <bool></code><br/>If set to false, prevents AI from doing small engagements that are not a part of a frontline plan. Defaults to true, only for front.
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = front_control
    type = front_control
第440行: 第440行:
    execute_order = yes
    execute_order = yes
}</pre>
}</pre>
|Modifies the orders that AI would give to divisions on a specified frontline.
| 修改AI在指定前线给师团的命令。 
|More than one target type can be used at a time, in which case each one must be met. This only changes the orders assigned to an already-existing frontline, this will not change the amount of units assigned to any particular front or force any to be created.
| 可以同时使用多个目标类型,在这种情况下,必须满足每一个。这只改变分配给已经存在的前线的命令,不会改变分配给任何特定前线的单位数量,也不会强制创建任何单位。 
|-id="front_unit_request"
|-id="front_unit_request"
|front_unit_request
| 前线单位请求 
|<code>state = <state></code><br/>The state to target.<br/>
|<code>state = <state></code><br/> 目标省份。<br/>
<code>tag = <country></code><br/>The state to target.<br/>
<code>tag = <country></code><br/> 目标国家。<br/>
<code>strategic_region = <ID></code><br/>The strategic region to target.<br/>
<code>strategic_region = <ID></code><br/> 目标战略区域。<br/>
<code>area = <state></code><br/>The [[#AI areas|AI area]] to target.<br/>
<code>area = <state></code><br/> 目标[[#AI areas|AI area]] <br/>
<code>country_trigger = { ... }</code><br/>Trigger block checked for states to have them as a target.<br/>
<code>country_trigger = { ... }</code><br/> 目标国家的触发条件块。<br/>
<code>state_trigger = { ... }</code><br/>Trigger block checked for countries to have them as a target.
<code>state_trigger = { ... }</code><br/> 目标省份的触发条件块。 
 
<code>value = <int></code><br/> 策略的权重。 
<code>value = <int></code><br/>The weight of the strategy.
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = front_unit_request
    type = front_unit_request
    tag = POL
    tag = POL
    value = 100
    value = 100
}</pre>
}</pre>
<pre>ai_strategy = {
<pre>ai_strategy = {
    type = front_unit_request
    type = front_unit_request
第465行: 第464行:
    value = 100
    value = 100
}</pre>
}</pre>
|Pursues AI to put more units on a specified land frontline.
| 让AI在指定的陆地前线上部署更多单位。
|More than one target type can be used at a time, in which case each one must be met.
| 可以同时使用多个目标类型,在这种情况下,必须满足每一个。
|-id="invasion_unit_request"
|-id="invasion_unit_request"
|invasion_unit_request
| 入侵单位请求
|<code>state = <state></code><br/>The state to target.<br/>
|<code>state = <state></code><br/> 目标州。<br/>
<code>tag = <country></code><br/>The state to target.<br/>
<code>tag = <country></code><br/> 目标国家。<br/>
<code>strategic_region = <ID></code><br/>The strategic region to target.<br/>
<code>strategic_region = <ID></code><br/> 目标战略区域。<br/>
<code>area = <state></code><br/>The [[#AI areas|AI area]] to target.<br/>
<code>area = <state></code><br/> 目标[[#AI areas|AI area]] <br/>
<code>country_trigger = { ... }</code><br/>Trigger block checked for states to have them as a target.<br/>
<code>country_trigger = { ... }</code><br/> 目标国家的触发条件块。<br/>
<code>state_trigger = { ... }</code><br/>Trigger block checked for countries to have them as a target.
<code>state_trigger = { ... }</code><br/> 目标省份的触发条件块。 
 
<code>value = <int></code><br/> 策略的权重。 
<code>value = <int></code><br/>The weight of the strategy.
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = invasion_unit_request
    type = invasion_unit_request
    state = 123
    state = 123
    value = 100
    value = 100
}</pre>
}</pre>
<pre>ai_strategy = {
<pre>ai_strategy = {
    type = invasion_unit_request
    type = invasion_unit_request
    strategic_region = 42
    strategic_region = 42
    value = 100
    value = 100
}</pre>
}</pre>
|Pursues AI to put more units on a naval invasion with the specified target.
| 让AI在进行对指定目标的海军入侵中部署更多单位。
|More than one target type can be used at a time, in which case each one must be met.
| 可以同时使用多个目标类型,在这种情况下,必须满足每一个。
|-id="garrison"
|-id="garrison"
|garrison
| 驻军
|<code>value = <int></code><br/>The weight of the strategy.
|<code>value = <int></code><br/> 策略的权重。 
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = garrison
    type = garrison
    value = 10
    value = 10
}</pre>
}</pre>
|Controls the amount of units spent on defending the victory points and ports rather than being active on the frontline.
| 控制用于防守胜利点和港口的单位数量,而不是让这些单位在前线活动。
|
|
|-id="garrison_reinforcement_priority"
|-id="garrison_reinforcement_priority"
|garrison_reinforcement_priority
| 驻军增援优先级
|<code>value = <int></code><br/>The weight of the strategy.
|<code>value = <int></code><br/> 策略的权重。 
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = garrison_reinforcement_priority
    type = garrison_reinforcement_priority
    value = 100
    value = 100
}</pre>
}
|Pursues AI to reinforce units that are put on garrisons, protecting victory points and naval bases, with higher priority.
| 让AI优先增强驻军单位,以保护胜利点和海军基地。
|
|
|-id="ignore_army_incompetence"
|-id="ignore_army_incompetence"
|ignore_army_incompetence
| 忽略军队无能
|<code>value = <int></code><br/>The weight of the strategy.
|<code>value = <int></code><br/> 策略的权重。 
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = ignore_army_incompetence
    type = ignore_army_incompetence
    value = 100
    value = 100
}</pre>
}</pre>
|Pursues AI to ignore the modifier given by the lack of experience of divisions in calculations.
| 让AI在计算中忽略因师级缺乏经验而给予的修正值,从而让AI认为优势在我。
|
|
|-id="put_unit_buffers"
|-id="put_unit_buffers"
|put_unit_buffers
| 布置单位缓冲区
|<code>ratio = <decimal></code><br/>The amount of units to buffer.<br/>
|<code>ratio = <decimal></code><br/> 用于缓冲单位的数量。<br/>
<code>order_id = 2</code><br/> If two put_unit_buffers strategies use the same ID, the ratio used for them will be shared rather than them being added together.<br/>
<code>order_id = 2</code><br/> 如果两个布置单位缓冲区策略使用相同的ID,它们的比率将共享,而不是相加。<br/>
<code>states = { ... }</code><br/> List of states where to buffer units<br/>
<code>states = { ... }</code><br/> 可缓冲单位的省份列表。<br/>
<code>area = <AI area></code><br/> The AI area where to buffer units.<br/>
<code>area = <AI area></code><br/> 用于缓冲单位的AI区域。<br/>
<code>subtract_invasions_from_need = yes</code><br/> If true, naval invasions within the area will not count towards the ratio. Defaults to false.<br/>
<code>subtract_invasions_from_need = yes</code><br/> 如果为真,区域内的海军入侵将不计入比率,即不防守海军入侵。默认为假。<br/>
<code>subtract_fronts_from_need = yes</code><br/> If true, land frontlines within the area will not count towards the ratio. Defaults to false.
<code>subtract_fronts_from_need = yes</code><br/> 如果为真,区域内的陆地前线将不计入比率,即不防守前线。默认为假。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = put_unit_buffers
    type = put_unit_buffers
第534行: 第532行:
    }
    }
    subtract_fronts_from_need = yes
    subtract_fronts_from_need = yes
}</pre>
}</pre>
|Pursues AI to keep a certain ratio of divisions on garrison duty in the specified area.
| 让AI在指定区域保持一定比例的师级以进行驻军任务。
|
|
|-id="spare_unit_factor"
|-id="spare_unit_factor"
|spare_unit_factor
| 备用单位因子
|<code>value = <int></code><br/>The weight of the strategy.
|<code>value = <int></code><br/> 策略的权重。 
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = spare_unit_factor
    type = spare_unit_factor
   value = 100
| AI 将使用更多单位来协防盟友。
}</pre>
|Pursues AI to spare more units towards defending allies.
|-id="theatre_distribution_demand_increase"
|-id="theatre_distribution_demand_increase"
|theatre_distribution_demand_increase
| 战区分配需求增加
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <state></code><br/>The target of the strategy.<br/>
<code>id = <state></code><br/> 策略的目标州。<br/>
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = theatre_distribution_demand_increase
    type = theatre_distribution_demand_increase
    value = 10
    value = 10
    id = 123
    id = 123
}</pre>
}</pre>
|Pursues AI to put more units in the specified state's theater.
| 让AI在指定省份的战区中投入更多单位。
|A value of 1 translates to 1 unit.
| 值为1表示1个单位。
|}
|}
{| class="wikitable sortable mw-collapsible mw-collapsed" style="display: inline-block; padding: 5px" width="100%"
{| class="wikitable sortable mw-collapsible mw-collapsed" style="display: inline-block; padding: 5px" width="100%"
|+ style="text-align: center;" width = "100%" |{{nowrap|AI strategies related to navy management:}}
|+ style="text-align: center;" width = "100%" |{{nowrap| 与海军管理相关的 AI 策略:}}
! width="10%" |Name
! width="10%" | 名称
! width="25%" |Parameters
! width="25%" | 参数
! width="25%" |Examples
! width="25%" | 示例
! width="20%" |Description
! width="20%" | 描述
! width="20%" |Notes
! width="20%" | 备注
|-id="naval_avoid_region"
|-id="naval_avoid_region"
|naval_avoid_region
|naval_avoid_region
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <strategic region></code><br/>The target of the strategy.
<code>id = < 战略区域></code><br/> 策略的目标。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = naval_avoid_region
    type = naval_avoid_region
第573行: 第569行:
    value = 100
    value = 100
}</pre>
}</pre>
|Pursues AI to avoid a specific strategic region with its ships.
| AI 将在特定战略区域禁止航行。
|
|
|-id="naval_convoy_raid_region"
|-id="naval_convoy_raid_region"
|naval_convoy_raid_region
|naval_convoy_raid_region
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <strategic region></code><br/>The target of the strategy.
<code>id = < 战略区域></code><br/> 策略的目标。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = naval_convoy_raid_region
    type = naval_convoy_raid_region
第584行: 第580行:
    value = 100
    value = 100
}</pre>
}</pre>
|Pursues AI to raid convoys within the specified strategic region.
|AI 将在指定战略区域内袭击运输船与护航舰队。
|
|
|-id="naval_mission_threshold"
|-id="naval_mission_threshold"
|naval_mission_threshold
|naval_mission_threshold
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <mission></code><br/>The mission to change the threshold of.
<code>id = < 任务></code><br/> 要改变阈值的任务。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = naval_mission_threshold
    type = naval_mission_threshold
    id = MISSION_CONVOY_RAIDING
    id = MISSION_CONVOY_RAIDING
    value = -100
    value = -100
}</pre>
}</pre>
|Makes AI have a higher threshold for its desire to do a naval mission.
| 使 AI 对执行海军任务的欲望有更高的阈值。
|A higher value means AI is less likely to do the mission. Names of missions can be found in {{path|localisation/english/core_l_english.yml}}, where a localisation key of <code>NAVAL_MISSION_NAME_CONVOY_RAIDING</code> means the mission is called <code>MISSION_CONVOY_RAIDING</code>
| 较高的数值意味着 AI 不太可能执行该任务。任务的名称可以在 {{path|localisation/english/core_l_english.yml}} 中找到,其中 <code>NAVAL_MISSION_NAME_CONVOY_RAIDING</code> 的本地化键表示该任务称为 <code>MISSION_CONVOY_RAIDING</code>
|-id="strike_force_home_base"
|-id="strike_force_home_base"
|strike_force_home_base
|strike_force_home_base
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <strategic region></code><br/>The target of the strategy.
<code>id = <strategic region></code><br/> 策略的目标。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = strike_force_home_base
    type = strike_force_home_base
第606行: 第602行:
    value = 70
    value = 70
}</pre>
}</pre>
|Pursues AI to do the strike force mission within the specified strategic region.
| 促使 AI 在指定的战略区域内执行打击舰队任务。
|
|
|}
|}
{| class="wikitable sortable mw-collapsible mw-collapsed" style="display: inline-block; padding: 5px" width="100%"
{| class="wikitable sortable mw-collapsible mw-collapsed" style="display: inline-block; padding: 5px" width="100%"
|+ style="text-align: center;" width = "100%" |{{nowrap|AI strategies related to intelligence:}}
|+ style="text-align: center;" width = "100%" |{{nowrap| 与情报相关的 AI 策略:}}
! width="10%" |Name
! width="10%" | 名称
! width="25%" |Parameters
! width="25%" | 参数
! width="25%" |Examples
! width="25%" | 示例
! width="20%" |Description
! width="20%" | 描述
! width="20%" |Notes
! width="20%" | 备注
|-id="agency_ai_base_num_factories_factor"
|-id="agency_ai_base_num_factories_factor"
|agency_ai_base_num_factories_factor
|agency_ai_base_num_factories_factor
|<code>value = <int></code><br/>The weight of the strategy.
|<code>value = <int></code><br/> 策略的权重。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = agency_ai_base_num_factories_factor
    type = agency_ai_base_num_factories_factor
    value = 70
    value = 70
}</pre>
}</pre>
|Changes the baseline used in the calculation of AI doing agency upgrades.
| 更改AI用于情报系统升级的基准权重。
|A value of 1 equals to a 1% increase over the baseline in [[Defines]].
| 值为 1 等于相对于 [[Defines]] 中规定的基准增加 1%。
|-id="agency_ai_per_upgrade_factories_factor"
|-id="agency_ai_per_upgrade_factories_factor"
|agency_ai_per_upgrade_factories_factor
|agency_ai_per_upgrade_factories_factor
|<code>value = <int></code><br/>The weight of the strategy.
|<code>value = <int></code><br/> 策略的权重。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = agency_ai_per_upgrade_factories_factor
    type = agency_ai_per_upgrade_factories_factor
    value = 70
    value = 70
}</pre>
}</pre>
|Modifies the needed amount of factories used in the calculation of AI doing agency upgrades.
| 调整用于计算AI情报机构升级所需的工厂数量。
|A value of 1 equals to a 1% increase over the baseline in [[Defines]].
| 值为 1 等于相对于 [[Defines]] 的基线增加 1%。
|-id="intelligence_agency_branch_desire_factor"
|-id="intelligence_agency_branch_desire_factor"
|intelligence_agency_branch_desire_factor
|intelligence_agency_branch_desire_factor
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <branch></code><br/>The target of the strategy.
<code>id = < 分支></code><br/> 策略的目标。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = intelligence_agency_branch_desire_factor
    type = intelligence_agency_branch_desire_factor
第643行: 第639行:
    value = 70
    value = 70
}</pre>
}</pre>
|Modifies the needed amount of factories used in the calculation of AI doing agency upgrades.
| 修改用于计算 AI 进行情报机构升级所需的工厂数量。
|Branches are defined in {{path|common/intelligence_agency_upgrades/*.txt}} files.
| 分支定义在 {{path|common/intelligence_agency_upgrades/*.txt}} 文件中。
|-id="intelligence_agency_usable_factories"
|-id="intelligence_agency_usable_factories"
|intelligence_agency_usable_factories
|intelligence_agency_usable_factories
|<code>value = <int></code><br/>The weight of the strategy.
|<code>value = <int></code><br/> 策略的权重。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = intelligence_agency_usable_factories
    type = intelligence_agency_usable_factories
    value = 8
    value = 8
}</pre>
}</pre>
|Modifies the amount of factories that AI would use for intelligence agencies.
| 修改 AI 为情报机构使用的工厂数量。
|
|
|-id="operation_equipment_priority"
|-id="operation_equipment_priority"
|operation_equipment_priority
|operation_equipment_priority
|<code>value = <int></code><br/>The weight of the strategy.
|<code>value = <int></code><br/> 策略的权重。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = operation_equipment_priority
    type = operation_equipment_priority
    value = 80
    value = 80
}</pre>
}</pre>
|Pursues the AI to prioritise equipment for funding operations over other usages.
| AI 优先为当下特勤行动提供足够的军事装备。
|
|
|-id="operative_mission"
|-id="operative_mission"
|operative_mission
|operative_mission
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>mission = <mission></code><br/>The mission to prioritise<br/>
<code>mission = <mission></code><br/> 优先执行的任务<br/>
<code>mission_target = <country></code><br/>The country to target<br/>
<code>mission_target = <country></code><br/> 目标国家<br/>
<code>state = <state></code><br/>The state to prioritise within the target country if valid. Optional.<br/>
<code>state = <state></code><br/> 如果有效,则优先考虑目标国内的状态。可选。<br/>
<code>priority = <int></code><br/>If contradictory AI strategies are defined, the one with the highest priority is picked.
<code>priority = <int></code><br/> 如果定义了矛盾的 AI 策略,则选择优先级最高的策略。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = operative_mission
    type = operative_mission
第678行: 第674行:
    mission_target = ENG
    mission_target = ENG
}</pre>
}</pre>
|Pursues the AI to do the specified mission over the target.
| 使 AI 对目标执行指定的任务。
|Multiple states can be defined, leading to one of them being prioritised. Mission names can be seen in {{path|localisation/english/operatives_l_english.yml}}. For example, <code>OPERATIVE_MISSION_BOOST_IDEOLOGY_TITLE:0 "Boost Ideology"</code> means that boosting ideology is boost_ideology.
| 可以定义多个状态,导致其中一个状态被优先考虑。任务名称可以在 {{path|localisation/english/operatives_l_english.yml}} 中查看。例如,<code>OPERATIVE_MISSION_BOOST_IDEOLOGY_TITLE:0 "Boost Ideology"</code> 表示增强意识形态的任务为 boost_ideology
|-id="operative_operation"
|-id="operative_operation"
|operative_operation
|operative_operation
|<code>value = <int></code></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>operation = <mission></code><br/>The mission to prioritise<br/>
<code>operation = <mission></code><br/> 优先执行的任务<br/>
<code>operation_target = <country></code><br/>The country to target<br/>
<code>operation_target = <country></code><br/> 目标国家<br/>
<code>state = <state></code><br/>The state to prioritise within the target country if valid. Optional.<br/>
<code>state = <state></code><br/> 如果有效,则优先考虑目标国内的状态。可选。<br/>
<code>region = <strategic region></code><br/>The strategic region to prioritise within the target country if valid. Optional.<br/>
<code>region = <strategic region></code><br/> 如果有效,则优先考虑目标国内的战略区域。可选。<br/>
<code>priority = <int></code><br/>If contradictory AI strategies are defined, the one with the highest priority is picked.
<code>priority = <int></code><br/> 如果定义了矛盾的 AI 策略,则选择优先级最高的策略。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = operative_operation
    type = operative_operation
第694行: 第690行:
    operation_target = ENG
    operation_target = ENG
}</pre>
}</pre>
|Pursues the AI to do the specified operation over the target.
| 促使 AI 在目标上执行指定的操作。
|Multiple states can be defined, leading to one of them being prioritised. Operations are defined within {{path|common/operations/*.txt}} files.
| 可以定义多个状态,并使其中一个状态被优先考虑。操作在 {{path|common/operations/*.txt}} 文件中定义。
|}
|}
{| class="wikitable sortable mw-collapsible mw-collapsed" style="display: inline-block; padding: 5px" width="100%"
{| class="wikitable sortable mw-collapsible mw-collapsed" style="display: inline-block; padding: 5px" width="100%"
|+ style="text-align: center;" width = "100%" |{{nowrap|AI strategies related to production, construction, and recruitment:}}
|+ style="text-align: center;" width = "100%" |{{nowrap| 与生产、建设和招聘相关的 AI 策略:}}
! width="10%" |Name
! width="10%" | 名称
! width="25%" |Parameters
! width="25%" | 参数
! width="25%" |Examples
! width="25%" | 示例
! width="20%" |Description
! width="20%" | 描述
! width="20%" |Notes
! width="20%" | 备注
|-id="added_military_to_civilian_factory_ratio"
|-id="added_military_to_civilian_factory_ratio"
|added_military_to_civilian_factory_ratio
|added_military_to_civilian_factory_ratio
|<code>value = <int></code><br/>The weight of the strategy.
|<code>value = <int></code><br/> 策略的权重。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = added_military_to_civilian_factory_ratio
    type = added_military_to_civilian_factory_ratio
    value = 50
    value = 50
}</pre>
}</pre>
|Modifies the ratio of military to civilian factories that the AI desires to keep.
| AI 希望保持的军事与民用工厂比例进行修改。
|A positive value means more military factories.
| 正值意味着更多的军事工厂。
|-id="air_factory_balance"
|-id="air_factory_balance"
|air_factory_balance
|air_factory_balance
|<code>value = <int></code><br/>The weight of the strategy.
|<code>value = <int></code><br/> 策略的权重。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = air_factory_balance
    type = air_factory_balance
    value = 50
    value = 50
}</pre>
}</pre>
|Modifies the ratio of airforce to factories that the AI desires to keep.
| AI 希望保持的空军生产与现有工厂的比例进行修改。
|A positive value means more airforce.
| 正值意味着更多的空军。
|-id="dockyard_to_military_factory_ratio"
|-id="dockyard_to_military_factory_ratio"
|dockyard_to_military_factory_ratio
|dockyard_to_military_factory_ratio
|<code>value = <int></code><br/>The weight of the strategy.
|<code>value = <int></code><br/> 策略的权重。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = dockyard_to_military_factory_ratio
    type = dockyard_to_military_factory_ratio
    value = 50
    value = 50
}</pre>
}</pre>
|Modifies the ratio of dockyards to military factories that the AI desires to keep.
| AI 希望保持的船坞与军事工厂的比例进行修改。
|A positive value means more dockyards.
| 正值意味着更多的船坞。
|-id="railway_gun_divisions_ratio"
|-id="railway_gun_divisions_ratio"
|railway_gun_divisions_ratio
|railway_gun_divisions_ratio
|<code>value = <int></code><br/>The weight of the strategy.
|<code>value = <int></code><br/> 策略的权重。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = railway_gun_divisions_ratio
    type = railway_gun_divisions_ratio
    value = 5
    value = 5
}</pre>
}</pre>
|Modifies the ratio of railway guns to divisions that the AI desires to keep.
| 对AI 希望保持的列车炮与师的比例进行修改。
|Base ratio is RAILWAY_GUN_PRODUCTION_BASE_DIVISIONS_RATIO_PERCENT in [[Defines]], by default 0. This gets added to it, on the 0-100 scale.
| 基本比例为 [[Defines]] 中的 RAILWAY_GUN_PRODUCTION_BASE_DIVISIONS_RATIO_PERCENT,默认值为 0 。这将在 0-100 的比例上进行累加。
|-id="build_building"
|-id="build_building"
|build_building
|build_building
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <building></code><br/>The target of the strategy.<br/>
<code>id = <building></code><br/> 策略的目标。<br/>
<code>target = <state></code><br/>The state where to build.
<code>target = <state></code><br/> 用于建设的省份。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = build_building
    type = build_building
第751行: 第747行:
    value = 1
    value = 1
}</pre>
}</pre>
|Pursues AI to construct a specific building within the specified state.
|AI 将会在指定省份内建造特定建筑。
|Value decides how many buildings AI would want to building in the state at once.
| 值决定了 AI 希望在该省份内同时建造多少座建筑。
|-id="building_target"
|-id="building_target"
|building_target
|building_target
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <building></code><br/>The target of the strategy.
<code>id = <building></code><br/> 策略的目标。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = building_target
    type = building_target
第762行: 第758行:
    value = 30
    value = 30
}</pre>
}</pre>
|Makes AI keep a higher desired target of the specified building.
| 使 AI 保持对指定建筑更高的期望目标。
|
|
|-id="factory_build_score_factor"
|-id="factory_build_score_factor"
|factory_build_score_factor
|factory_build_score_factor
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>target = <state></code><br/>The state where to build.
<code>target = <state></code><br/> 用于建设的省份。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = factory_build_score_factor
    type = factory_build_score_factor
第773行: 第769行:
    value = 1
    value = 1
}</pre>
}</pre>
|Pursues AI to construct buildings within the specified state.
| 让AI 在指定省份内建造建筑。
|
|
|-id="equipment_production_factor"
|-id="equipment_production_factor"
|equipment_production_factor
|equipment_production_factor
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <equipment archetype type></code><br/>The target of the strategy.
<code>id = <equipment archetype type></code><br/> 策略的目标。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = equipment_production_factor
    type = equipment_production_factor
第784行: 第781行:
    value = 30
    value = 30
}</pre>
}</pre>
|Pursues AI to produce equipment types of the specified type.
|AI 将生产指定类型的装备。
|Types are defined for each equipment archetype in {{path|common/units/equipment/*.txt}} files within <code>types = { ... }</code>.
| 每种装备原型的类型在 {{path|common/units/equipment/*.txt}} 文件中的 <code>types = { ... }</code> 中定义。
|-id="equipment_production_min_factories"
|-id="equipment_production_min_factories"
|equipment_production_min_factories
|equipment_production_min_factories
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <equipment archetype type></code><br/>The target of the strategy.
<code>id = <equipment archetype type></code><br/> 策略的目标。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = equipment_production_min_factories
    type = equipment_production_min_factories
第795行: 第792行:
    value = 3
    value = 3
}</pre>
}</pre>
|Pursues AI to keep more factories on the production lines for the equipment types of the specified type.
| 促使 AI 在指定类型的装备生产线上保持更多的工厂。
|A value of 1 corresponds to 1 military factory. Types are defined for each equipment archetype in {{path|common/units/equipment/*.txt}} files within <code>types = { ... }</code>.
| 值为 1 对应于 1 个军事工厂。每种装备原型的类型在 {{path|common/units/equipment/*.txt}} 文件中的 <code>types = { ... }</code> 中定义。
|-id="equipment_variant_production_factor"
|-id="equipment_variant_production_factor"
|equipment_variant_production_factor
|equipment_variant_production_factor
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <equipment archetype></code><br/>The target of the strategy.
<code>id = <equipment archetype></code><br/> 策略的目标。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = equipment_variant_production_factor
    type = equipment_variant_production_factor
第806行: 第804行:
    value = -100
    value = -100
}</pre>
}</pre>
|Pursues AI to produce more of the specified equipment archetype.
| AI 将生产更多指定的军事装备。
|Equipment archetypes are defined in {{path|common/units/equipment/*.txt}} files.
| 军事装备在 {{path|common/units/equipment/*.txt}} 文件中定义。
|-id="equipment_stockpile_surplus_ratio"
|-id="equipment_stockpile_surplus_ratio"
|equipment_stockpile_surplus_ratio
|equipment_stockpile_surplus_ratio
|<code>value = <int></code><br/>The weight of the strategy.
|<code>value = <int></code><br/> 策略的权重。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = equipment_stockpile_surplus_ratio
    type = equipment_stockpile_surplus_ratio
    value = 30
    value = 30
}</pre>
}</pre>
|Changes the ratio of equipment that AI would hold in stockpile rather than immediately using.
| 改变 AI 在库存中保存的装备比例,这将不会使AI立即使用这些装备。
|
|
|-id="build_army"
|-id="build_army"
|build_army
|build_army
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <equipment archetype></code><br/>The target of the strategy.
<code>id = <equipment archetype></code><br/> 策略的目标。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = build_army
    type = build_army
第826行: 第824行:
    value = -1000
    value = -1000
}</pre>
}</pre>
|Modifies the desired division amount for AI.
| 修改 AI 所需的军队编制数量。
|The used target is roles within [[#AI templates|AI templates]].
| 使用的目标是[[#AI templates|AI templates]]. 中的角色。
|-id="force_build_armies"
|-id="force_build_armies"
|force_build_armies
|force_build_armies
|<code>value = <int></code><br/>The weight of the strategy.
|<code>value = <int></code><br/> 策略的权重。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = force_build_armies
    type = force_build_armies
    value = 30
    value = 30
}</pre>
}</pre>
|Forces AI to build divisions above the desired amount.
| 这将强制使 AI 建立超过所需数量的师级单位。
|
|
|-id="production_upgrade_desire_offset"
|-id="production_upgrade_desire_offset"
|production_upgrade_desire_offset
|production_upgrade_desire_offset
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <equipment type></code><br/>The target of the strategy.
<code>id = <equipment type></code><br/> 策略的目标。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = production_upgrade_desire_offset
    type = production_upgrade_desire_offset
第846行: 第844行:
    value = -50
    value = -50
}</pre>
}</pre>
|Pursues AI to upgrade production lines to the specified equipment type.
| 将使AI升级生产线至指定的装备类型。
|Equipment types are defined in {{path|common/units/equipment/*.txt}} files.
| 设备类型在 {{path|common/units/equipment/*.txt}} 文件中定义。
|-id="role_ratio"
|-id="role_ratio"
|role_ratio
|<code>value = <int></code><br/>策略的权重。
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|role_ratio
<code>id = <role></code><br/>The target of the strategy.
|<code>value = <int></code><br/> 策略的权重。<br/>
|<pre>ai_strategy = {
<code>id = <role></code><br/> 策略的目标。 
    type = role_ratio
|<pre>ai_strategy = {
    id = paratroopers
    type = role_ratio
    value = 30
    id = paratroopers
}</pre>
    value = 30
|Modifies the amount of templates that the AI makes for the specified role.
}</pre>
|Roles are defined within [[#AI templates|AI templates]] for unit templates and [[#AI equipment|AI equipment]] for ship and tank variants.
| 修改AI为指定职能制作的编制数量。 
|-id="unit_ratio"
| 职能在[[#AI templates|AI templates] 中定义,用于单位编制,而 [[#AI equipment|AI equipment] 中定义船只和坦克变体。 
|unit_ratio
|-id="unit_ratio"
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|unit_ratio
<code>id = <unit></code><br/>The target of the strategy.
|<code>value = <int></code><br/> 策略的权重。<br/>
|<pre>ai_strategy = {
<code>id = <unit></code><br/> 策略的目标。 
    type = unit_ratio
|<pre>ai_strategy = {
    id = cas
    type = unit_ratio
    value = 30
    id = cas
}</pre>
    value = 30
|Modifies the amount of templates that the AI makes with the specified unit.
}</pre>
|Units are defined in {{path|common/units/*.txt}} files. This includes the airforce and navy alongside land army.
| 修改AI使用特种单位编成的编制的数量上限。 
|-id="min_wanted_supply_trains"
| 单位在 {{path|common/units/*.txt}} 文件中定义,包括空军和海军以及陆军。 
|min_wanted_supply_trains
|-id="min_wanted_supply_trains"
|<code>value = <int></code><br/>The weight of the strategy.
|min_wanted_supply_trains
|<pre>ai_strategy = {
|<code>value = <int></code><br/> 策略的权重。 
    type = min_wanted_supply_trains
|<pre>ai_strategy = {
    value = 300
    type = min_wanted_supply_trains
}</pre>
    value = 300
|Overrides the minimum amount of supply trains wanted by AI.
}</pre>
| 对AI所需的最低补给火车数量进行更改。
|
|
|-id="min_wanted_supply_trucks"
|-id="min_wanted_supply_trucks"
第886行: 第885行:
    value = 30
    value = 30
}</pre>
}</pre>
|Overrides the minimum amount of supply trucks wanted by AI.
|AI 总体上所需卡车的最低数量。
|
|
|}
|}
{| class="wikitable sortable mw-collapsible mw-collapsed" style="display: inline-block; padding: 5px" width="100%"
{| class="wikitable sortable mw-collapsible mw-collapsed" style="display: inline-block; padding: 5px" width="100%"
|+ style="text-align: center;" width = "100%" |{{nowrap|Other AI strategies:}}
|+ style="text-align: center;" width = "100%" |{{nowrap| 其他 AI 策略:}}
! width="10%" |Name
! width="10%" | 名称
! width="25%" |Parameters
! width="25%" | 参数
! width="25%" |Examples
! width="25%" | 例子
! width="20%" |Description
! width="20%" | 描述
! width="20%" |Notes
! width="20%" | 备注
|-id="scorched_earth_prio"
|-id="scorched_earth_prio"
|scorched_earth_prio
|scorched_earth_prio
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <country></code><br/>The owner of the states where to use scorched earth.<br/>
<code>id = <country></code><br/> 使用焦土政策的国家所有者。<br/>
<code>states = { ... }</code><br/> List of states where to use scorched earth.
<code>states = { ... }</code><br/> 使用焦土政策的省份列表。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = scorched_earth_prio
    type = scorched_earth_prio
第912行: 第911行:
    }
    }
}</pre>
}</pre>
|Pursues AI to use scorched earth within the specified states.
| AI 将会在指定省份使用焦土政策。
|
|
|-id="land_xp_spend_priority"
|-id="land_xp_spend_priority"
|land_xp_spend_priority
|land_xp_spend_priority
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <type></code><br/>The target of the strategy.
<code>id = <type></code><br/> 策略的目标。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = land_xp_spend_priority
    type = land_xp_spend_priority
第923行: 第922行:
    value = 30
    value = 30
}</pre>
}</pre>
|Modifies the priority for AI to spend land experience.
| 修改 AI 花费陆军经验的优先顺序。
|Base game usages include <code>division_template</code> and <code>upgrade_xp_cutoff</code>.
| 原版游戏使用包括 <code>division_template</code> <code>upgrade_xp_cutoff</code>
|-id="pp_spend_amount"
|-id="pp_spend_amount"
|pp_spend_amount
|pp_spend_amount
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <type></code><br/>The target of the strategy.
<code>id = <type></code><br/> 策略的目标。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = pp_spend_amount
    type = pp_spend_amount
第934行: 第933行:
    value = 100
    value = 100
}</pre>
}</pre>
|Modifies the political power that AI should preserve for the specified purpose.
| AI 将保留的政治点数。
|Base game usages include <code>idea</code> and <code>decision</code>.
| 原版游戏使用包括 <code>idea</code> <code>decision</code>
|-id="pp_spend_priority"
|-id="pp_spend_priority"
|pp_spend_priority
|pp_spend_priority
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <type></code><br/>The target of the strategy.
<code>id = <type></code><br/> 策略的目标。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = pp_spend_priority
    type = pp_spend_priority
第945行: 第944行:
    value = 100
    value = 100
}</pre>
}</pre>
|Modifies where AI should prioritise spending political power.
| 对AI 花费政治点数的方向进行更改。
|Base game usages include the following:
| 原版游戏使用包括以下内容:
* <code>admiral</code>
* <code>admiral</code>
* <code>guarantee</code>
* <code>guarantee</code>
第953行: 第953行:
|-id="research_weight_factor"
|-id="research_weight_factor"
|research_weight_factor
|research_weight_factor
|<code>value = <int></code><br/>The weight of the strategy.<br/>
|<code>value = <int></code><br/> 策略的权重。<br/>
<code>id = <type></code><br/>The target of the strategy.
<code>id = <type></code><br/> 策略的目标。
|<pre>ai_strategy = {
|<pre>ai_strategy = {
    type = research_weight_factor
    type = research_weight_factor
第960行: 第960行:
    value = 2000
    value = 2000
}</pre>
}</pre>
|Modifies the AI weight (score) of a specific technology.
| 修改 AI 对科研项目研发的权重(分数)。
|value = 50 means 50% increase, -30 means 30% decrease, etc.
|value = 50 意味着增加 50% 的增速,-30 意味着 30% 的减速,等等。
|}
|}


== AI areas ==
== AI 区域 ==
{{SVersion|1.11}}
{{SVersion|1.11}}
AI areas are defined within {{path|common/ai_areas/*.txt}} files. These are ''only'' used in a variety of previously-listed AI strategies, such as [[#area_priority|area_priority]]. A province may be in several AI areas and it may be in none. Hovering over a province with the debug mode turned on will provide information in which AI areas the province is, if any.
AI 区域在 {{path|common/ai_areas/*.txt}} 文件中定义。这些区域'' '' 用于多种之前列出的AI策略,例如 [[#area_priority|area_priority]] 。一个省可能属于多个AI区域,也可能不属于任何区域。启用debug调试模式后,鼠标悬停在一个省上将提供该省所属的AI区域的信息(如果有的话)。


Each AI area is a separate block within the file, with the name of the block being the name of the area. Within these blocks, 2 things can be added:<br/>
每个AI区域在文件中都是一个单独的块,块的名称即为区域的名称。在这些块中,可以添加两项内容:<br/>
<code>continents = { ... }</code> is a list of continents that make up the AI area. Continents are defined within {{path|map/continent.txt}} and assigned to provinces within [[Map modding#Provinces|their definitions]] in {{path|map/definition.csv}}. The full name of the continent should be used within the AI area's definition, rather than the ID used in the province definition.<br/>
<code>continents = { ... }</code> 是构成该AI区域的地理区划列表。这在 {{path|map/continent.txt}} 中定义,并在  [[Map modding#Provinces|their definitions] 中分配给省份,位置在 {{path|map/definition.csv}} 。在AI区域的定义中应使用大陆的全名,而不是省份定义中使用的 ID <br/>
<code>strategic_regions = { ... }</code> is a list of strategic regions that make up the AI area, by their ID number.
<code>strategic_regions = { ... }</code> 是根据其 ID 号码构成该AI区域的战略区域列表。


If there are multiple defined, the province has to be in ''any'' of them.
如果定义了多个ai区域,省份必须属于其中''' 任何(any)'''一个。


An example of an AI area is the following:
一个AI区域的代码示例如下:
<pre>my_ai_area = {
<pre>my_ai_area = {
    continents = {
    continents = {
第986行: 第986行:
}</pre>
}</pre>


== AI focuses ==
== AI 焦点 ==
{{Main|AI focuses}}
{{Main|AI focuses}}
AI focuses, defined within {{path|common/ai_focuses/*.txt}} files, are used to tell the game which technology categories and focuses the AI should pick depending on its currently-pursued focuses.
AI 焦点,定义在{{path|common/ai_focuses/*.txt}} 文件,用于让游戏AI根据当前设置目标的焦点选择点哪些科技和国策。
 


== AI peace ==
== AI 和平谈判 ==
{{SVersion|1.11}}
{{SVersion|1.11}}
{{VisibleCollapse|1=
{{VisibleCollapse|1=
The peace conference behaviour for AI is defined within {{path|common/peace_conference/ai_peace/*.txt}} files.<br/>
AI 的和平谈判行为在 {{path|common/peace_conference/ai_peace/*.txt}} 文件中定义。<br/> 在定义国家使用的和谈AI时,游戏会选择第一个满足前提条件的定义。在这种情况下,文件是根据其文件名按顺序加载的,使用 [[wp:ASCII#Printable characters|ASCII character IDs]]
When defining the peace conference AI that would be used by the country, the game picks the first-defined one that meets the prerequisites. In this case, files are loaded sorted by their filename using [[wp:ASCII#Printable characters|ASCII character IDs]].


When evaluating the peace conference, ROOT (the default scope) is used to represent the currently-evaluated winner and FROM is used to represent the currently-evaluated loser. Additionally, the following [[Variables|temporary variables]] exist within:
在评估和平会议时,使用 ROOT (默认作用域)表示当前评估的赢家,使用 FROM 表示当前评估的输家。此外,存在以下 [[Variables|temporary variables]]
* taken_states@TAG is an array of states that are annexed by the country TAG as a part of the peace conference.
* taken_states@TAG 是一个数组,包含作为和谈中一部分被国家 TAG 吞并的省份。
* taken_by@123 is the country that took the specified state, in this case 123.
* taken_by@123 是占领指定省份的国家,在此情况下为 123
* current_states@TAG is an array of states that aren't decided upon yet in the peace conference and are under the control of TAG that lost the war.
* current_states@TAG 是一个数组,包含在和谈中尚未决定的、处于赢得战争的 TAG 控制下的省份。
* subject_states@TAG is an array of states that are, within the peace conference, set to be transferred to countries that are subjected by TAG.
* subject_states@TAG 是一个数组,包含在和谈中设置为转移给被 TAG 统治的国家的省份。
* subject_countries@TAG is an array of countries that are, within the peace conference, set to be subjected by TAG.
* subject_countries@TAG 是一个数组,包含在和谈中被设置为受 TAG 统治的国家。
* subjected_by@123 is the overlord of the country that is set to have the specified state in the peace conference, in this case 123.
* subjected_by@123 是设定在和谈中拥有指定省份的国家的宗主国,在此情况下为 123
* subjected_by@TAG is an array of countries that have TAG as their overlord.
* subjected_by@TAG 是一个数组,包含以 TAG 作为宗主国的国家。
* liberate_states@TAG is an array of states that are going to countries that have been liberated by TAG.
* liberate_states@TAG 是一个数组,包含将要转移给被 TAG 解放的国家的省份。
* liberate_countries@TAG is an array of countries that have been liberated by TAG.
* liberate_countries@TAG 是一个数组,包含被 TAG 解放的国家。


The <code>enable {{=}} { ... }</code> trigger block is used to determine whether the AI should be enabled. If true and no other previously-loaded peace conference AI is true, this AI will be chosen.
<code>enable {{=}} { ... }</code> 触发块用于确定AI是否应启用。如果为真且没有其他先前加载的和平会议AI为真,则选择该AI。


There are the following peace options that are used in the game:
游戏中使用的和平选项如下:
* annex - The country FROM gets entirely annexed by ROOT. This only evaluates the countries.
* annex - 国家 FROM ROOT 完全吞并。这仅评估国家。
* liberate - The country FROM gets liberated by ROOT.
* liberate - 国家 FROM ROOT 解放。
* puppet - The country FROM gets puppeted by ROOT.
* puppet - 国家 FROM ROOT 作为傀儡。
* puppet_all - The country FROM gets puppeted by ROOT ''and'' is able to retain all of its states.
* puppet_all - 国家 FROM ROOT 作为傀儡 '' 并且'' 能够保留其全部的省份。
* puppet_state - The state ROOT gets transferred to FROM.FROM, which became a subject of FROM within the peace conference.
* puppet_state - ROOT 的省份 被转移到 FROM 。FROM,该省份在和平会议中成为 FROM 的一部分。
* take_states - The state FROM gets annexed by ROOT.
* take_states - FROM 的省份被 ROOT 吞并。
* force_government - The country FROM gets its ideology forcefully changed by ROOT.
* force_government - 国家 FROM 的意识形态被 ROOT 强制更改。
When evaluating peace conferences, the controller of a given state is the same one that occupied it before the start of the conference while the owner is the original owner.
在评估和谈时,若给定省份的控制者与会议开始原本拥有该地块的国家相同,则所有者则是原所有者。
每个和平会议选项都是文件定义中的一个 [[#MTTH blocks|MTTH block]]。


Each peace conference option is a [[#MTTH blocks|MTTH block]] within the file's definition.
代码示例:{{Collapse|
Example:{{Collapse|
<pre>my_peace_conference = {
<pre>my_peace_conference = {
    enable = {
    enable = {
第1,086行: 第1,084行:
      }
      }
    }
    }
}</pre>}}|2=Pre-1.12 AI peace}}
}</pre>}}|2=Pre-1.12 AI 和平谈判}}


== AI strategy plans ==
== AI 策略计划 ==
{{SVersion|1.11}}
{{SVersion|1.11}}
AI strategy plans to tell AI what to prioritise depending on circumstances: which advisors to pick, which technologies to research, which AI strategies to apply, which focuses to pick, etc. These are more detailed than general AI strategies, primarily intended to be activated for most of the game to tell the overall plan of a country. Multiple AI strategy plans can be defined and executed at the same time for a country.
AI 策略计划用于根据情况指导AI优先考虑的事项:选择哪些顾问、研究哪些技术、应用哪些AI策略、选择哪个国策等。这些计划比一般的AI策略更为详细,主要用于在游戏的大部分时间内告知一个国家的整体计划。一个国家可以同时定义和执行多个AI策略计划。
 
AI strategy plans are defined within {{path|common/ai_strategy_plans/*.txt}} files. Within these files, a new strategy plan is done as a new block, the name of which must be the same as the internal ID of the plan.
 
Within that plan, <code>name = "AI plan's name"</code> and <code>desc = "AI plan's description"</code> decide the name and the description of the strategy plan. ''This is never intended to be shown to the player'', so localising it into different languages is never needed. Instead, this is used within the <code>aiview</code> console command, which tells info to the developer about what AI wants to prioritise.
 
<code>allowed = { ... }</code> is, similarly to decisions or ideas, is a trigger block '''checked only at the game's start'''. This is primarily used to tell which country and DLCs to restrict the strategy plan to.


<code>enable = { ... }</code> is checked each day if the allowed is met. If <code>enable = { ... }</code> is met, then the AI strategy plan will be assigned to the AI regardless of whether <code>enable = { ... }</code> turns false later or not. Commonly, [[Triggers#has_game_rule]] is used to make it work with custom game rules deciding what path the AI will pick. [[Triggers#is_historical_focus_on|is_historical_focus_on]] is commonly used with the default AI game rule, and country flags can be used for randomisation, by setting up an [[On actions|on_startup]] to set a random one using [[Scopes#random_list|random_list]]
AI策略计划在{{path|common/ai_strategy_plans/*.txt}}文件中定义。在这些文件中,新策略计划作为一个新代码块进行定义,其名称必须与计划的内部ID相同。
在该计划中,<code>name = "AI计划名称"</code>和<code>desc = "AI计划描述"</code>确定了策略计划的名称和描述。''这并不打算向玩家展示'',因此不需要将其本地化为不同的语言。相反的,这用于<code>aiview</code>控制台命令中,向开发者提供有关AI希望优先考虑的事项的信息。
<code>allowed = { ... }</code>类似于决议或ideas,是一个触发块,'''仅在游戏开始时检查'''。这主要是用来决定要在什么国家和扩展包中使用这个策略计划。
<code>enable = { ... }</code> 游戏时间内每天检查一次,看看是否满足allowed条件。如果满足<code>enable = { ... }</code> ,则该AI策略计划将分配给AI,无论之后<code>enable = { ... }</code> 是否变为false。通常情况下, [[Triggers#has_game_rule]] 用于与自定义游戏规则搭配,以决定AI将选择的路径。[[Triggers#is_historical_focus_on|is_historical_focus_on]] 常与默认AI设置一起使用,国家的flags可以通过设置[[On actions|on_startup]] 来实现随机化,使用[[Scopes#random_list|random_list]] 来设定随机值。
<code>abort = { ... }</code>游戏时间内每天检查一次,以使AI在<code>enable = { ... }</code>条件满足时 ''停止'' 使用该AI策略计划。因此,必须是false的情况下,才能使AI策略计划有可能被选择。
<code>ai_national_focuses = { TAG_focus_name_1 TAG_focus_name_2 }</code> 是一个国家国策的列表,以空格分隔,按照 AI 应该采取的顺序排列。在这个例子中,AI 将首先尝试进行 TAG_focus_name_1国策。若 TAG_focus_name_1 已经完成,或无法进行,那么 AI 将尝试进行 TAG_focus_name_2国策。如果这两个国策由于已完成或者未满足前提条件而都无法进行,AI 将转向其他国策,同时考虑 <code>ai_will_do = { ... }</code> 的内容。在按设定好的国策优先进行顺序下,AI 会忽略 <code>ai_will_do = { ... }</code> 的值。
<code>focus_factors = { ... }</code> 为指定国策的 ai_will_do 值分配一个乘数。这个块中的一个条目看起来像 <code>TAG_focus_name = 3</code>。在这种情况下,这将使该国策的 ai_will_do 值乘以 3,假设 AI 策略计划的权重为 1。如果国策项在应用修正因子后具有 4 的 ai_will_do 值,那么在跟随此策略计划时,它将变为 12,并视为这样的处理。当然,因子为 0 将使该国策项在没有在 ai_national_focuses 中指定的情况下永远不会被选择。这可以作为一种更快书写或更随机的方式,使 AI 通过使它不应选择的国策具有 0 值来实现让其遵循某种政治路径。
<code>research = { ... }</code> 为指定科研槽的 ai_will_do 值分配一个乘数。这个块中的一个条目看起来像 <code>artillery = 3</code>。在这种情况下,这将使该类别内每一项科研项的 ai_will_do 值乘以 3,假设 AI 策略计划的权重为 1。其他内置修正因子仍然适用,但这将增加它们的可能性。
其他也分配增益的块还有 <code>ideas = { ... }</code> 和 <code>traits = { ... }</code>,格式类似。ideas 块用于单个idea(如法律条例或设计商)或顾问(使用 idea_token 在条目中),而 traits 则用于给ideas/顾问的分配国家领导者特质。
<code>ai_strategy = { ... }</code> 允许在策略计划开启时应用 [[#AI strategies|AI strategy]] 。
<code>weight = { ... }</code> 是一个  [[#MTTH blocks|MTTH block]] ,为计划分配一个整体权重。这使得 AI 策略计划中的每个因子在应用之前都乘以权重。例如,权重为 1.25 将使国策因子 4 变为 5 之后再应用。这可以在某些情况下使 AI 更严格地遵循策略计划,而在其他情况下则执行的相对宽松。


<code>abort = { ... }</code> is checked every day in order to make the AI ''stop'' using this AI strategy plan if <code>enable = { ... }</code> is met. Additionally, it must be false in order for the AI strategy plan to be possible to be picked.
=== 代码示例 ===
 
<code>ai_national_focuses = { TAG_focus_name_1 TAG_focus_name_2 }</code> is a list of national focuses, separated by whitespaces, in the order that the AI should take them. In this example, the AI will try to take TAG_focus_name_1 first if possible. If it's already taken or TAG_focus_name_1 is impossible to take, then AI will try to take TAG_focus_name_2. If both of the focuses are impossible to take due to being completed or unavailable, then it will move on to other focuses, taking <code>ai_will_do = { ... }</code> into consideration. While following a focus order, it ignores <code>ai_will_do = { ... }</code> values.
 
<code>focus_factors = { ... }</code> assigns a multiplier to ai_will_do values of the specified focus. An entry in this block looks like <code>TAG_focus_name = 3</code>. In this case, this will make the ai_will_do value of the focus be multiplied by 3, assuming AI strategy plan's weight of 1. If the focus has an ai_will_do value of 4 after applying modifiers, it'll become 12 if AI is following this strategy plan, and get treated as such. And, of course, a factor of 0 will make the focus be never picked without specification in ai_national_focuses. This can serve as a faster-to-write or a more randomised way to make AI follow a political path by making focuses it should never pick have a value of 0.
 
<code>research = { ... }</code> assigns a multiplier to ai_will_do values of the specified research categories. An entry in this block looks like <code>artillery = 3</code>. In this case, this will make the ai_will_do value of every technology within the category be multiplied by 3, assuming AI strategy plan's weight of 1. Other built-in modifiers still apply, but this will increase the likelihood.
 
Other blocks that also assign bonuses are <code>ideas = { ... }</code> and <code>traits = { ... }</code>, with the similar formatting. The ideas block is used for individual ideas (such as laws or designers) or advisors (using the idea_token in the entry), while traits are for country leader traits that are assigned to the ideas/advisors.
 
<code>ai_strategy = { ... }</code> allows an [[#AI strategies|AI strategy]] to apply when the strategy plan is turned on.
 
<code>weight = { ... }</code> is a [[#MTTH blocks|MTTH block]] assigning an overall weight to the plan. This multiplies each factor within the AI strategy plan by the weight before applying them. A weight of 1.25 will turn a focus factor of 4 into 5 before applying it, for instance. This can be used to make the AI follow the strategy plan more strictly in some cases and less strictly in others.
 
=== Example ===
{{Collapse|
{{Collapse|
<pre>BHR_historical = {
<pre>BHR_historical = {
第1,191行: 第1,179行:
}</pre>}}
}</pre>}}


== AI templates ==
== AI 部队编制 ==
{{SVersion|1.11}}
{{SVersion|1.11}}
{{path|common/ai_templates/*.txt}} files are used in order to define the templates that AI would aim for within the division template window.
{{path|common/ai_templates/*.txt}} 文件用于定义AI在编制编成窗口中所追求的模板。 
 
部队编制被定义为文件夹中任何文件内的一个块,块的名称与部队编制的名称相同。<br/> 
这些参数用于部队编制本身: 
* <code>roles = { ... }</code> 是编制所包含的部队类型列表。这些可以是任何东西,用于 [[#role_ratio|role_ratio AI strategy]]。AI将会为所拥有的每个师创建一个编制。 
* <code>available_for = { ... }</code> 在此列表外的国家将不允许使用如下编制。如果未指定,则每个国家都将使用它们。 
* <code>blocked_for = { ... }</code> 在此列表内的国家将不允许使用如下编制。这个参数只有在没有 <code>available_for = { ... }</code> 块时才会被使用。 
* <code>match_to_count = 0.3</code> 是一个在 0-1 的范围内的十进制数,用于判断一个现行部队编制是否符合对应职能编制。默认值设置为 0.5。 
* <code>upgrade_prio = { ... }</code> 是一个 [[#MTTH blocks|MTTH block]] ,决定职能编制相对于其他在花费经验进行提升时的“重要性”。如果有多个职能编制具有相同的职能,则优先级最高的编制会被使用。在别的情况下,此条优先级定义会影响其与不同编制相比的概率。


A role template is defined as a block within any file in the folder with the name of the block being the same as the name of the role template.<br/>
此外,在职能编制中,每个单独的编制被定义为一个其名称是编制的块。它可以是任何名称,只要在文件中没有重名即可。<br/>
These arguments are used for role templates themselves:
这些参数在编制定义中使用: 
* <code>roles = { ... }</code> is a list of roles that the templates would have. These can be anything, getting used for the [[#role_ratio|role_ratio AI strategy]]. AI will try to have one template for each role it has.
* <code>upgrade_prio = { ... }</code> 是一个  [[#MTTH blocks|MTTH block]] ,决定了该编制相对于职能编制中其他编制在花费经验进行升级时的权重。 
* <code>available_for = { ... }</code> restricts the countries that use this role template to the tags in the list. If unspecified, every country uses them.
* <code>production_prio = { ... }</code> 是一个 [[#MTTH blocks|MTTH block]] ,决定了该编制相对于职能编制中其他编制在实际生产时的权重。 
* <code>blocked_for = { ... }</code> restricts the countries that use this role template from being the tags in the list. This is only needed if there is no <code>available_for = { ... }</code> block.
* <code>replace_with = my_other_template</code> 指定了一个不同的编制,作为该编制的新版本。当创建该新编制成为可能时,AI将尝试转向使用此新的编制。 
* <code>match_to_count = 0.3</code> is a decimal on the scale of 0-1 that decides how much a division template should fulfill one of the templates within the role template in order to count as one. By default set to 0.5.
* <code>can_upgrade_in_field = { ... }</code> 是一个触发块,决定AI何时尝试升级已分配此编制的部队到将要替换的编制。 
* <code>upgrade_prio = { ... }</code> is a [[#MTTH blocks|MTTH block]] that decides the 'importance' of the role template compared to other role templates for spending experience on improving. If there are several role templates with the same roles, the one with the highest priority gets used, otherwise this decides likelihood compared to role templates with different roles.
* <code>custom_icon = 10</code> 指定AI为该编制分配的图标。这个代码例将使用 <code>GFX_div_templ_10_large</code> 和 <code>GFX_div_templ_10_small</code> Sprite为编制分配图标。此项为可选,默认为编制中绝大多数旅的图标。 
* <code>reinforce_prio = 2</code> 指定AI在该编制上设置的装备增援优先级。默认优先级为 1,在游戏中显示为“常规”。0 为“后备”,2 为“精英”。如果未设置,默认为 1。 
* <code>target_width = 20</code> 指定AI针对该编制的目标作战宽度。 
* <code>width_weight = 2.5</code> 指定AI在多大程度上应该专注于目标宽度。权重越高,AI越会避免偏离目标宽度。 
* <code>column_swap_factor = 0.3</code> 指定了AI将整个列交换到不同子单位组以满足编制的可能性。 
* <code>stat_weights = { ... }</code> 是一个十进制值列表。每个值适用于不同的统计数据,并决定AI应该优先考虑什么,以及应该避免什么。与 NDefines.NAI.DIVISION_DESIGN_WEIGHTS in [[Defines]] 一样,这些统计数据首先是 17 个陆军值,然后是对空攻击,接下来是共同值和特殊值。换句话说,与空军和海军有关的值除对空攻击外都被跳过,对空攻击来自于防空装备。这个值将添加到定义中的默认值:0.00 意味着与默认优先级相同。


Additionally, within role templates each individual template is defined as a block with the name of the template being the name of the block. It may be anything, as long as there is no overlap.<br/>
* <code>allowed_types = { ... }</code> 是一个AI可以添加到编制中的营级单位列表。如果某个类型被标注省略,AI将永远不会添加它。这可以用来确保AI不会在编制中放入不同种类的单位,例如在一个移动轻坦克师中放置步兵,从而减缓其速度。
These arguments are used within a template definition:
* <code>target_template = { ... }</code> 指定AI应力求达到的编制。特别地,这些参数放在其中:
* <code>upgrade_prio = { ... }</code> is a [[#MTTH blocks|MTTH block]] that decides the 'importance' of the template compared to other templates within the role template for spending experience on improving.
** <code>weight = 0.8</code> 是AI应该多大程度上去靠近这个编制。
* <code>production_prio = { ... }</code> is a [[#MTTH blocks|MTTH block]] that decides the 'importance' of the template compared to other templates within the role template for actually producing.
** <code>match_value = 5000</code> 是一个值,决定了如果与目标编制匹配,该编制对AI的价值。
* <code>replace_with = my_other_template</code> assigns a different template that serves as a more modern version of this one. When it becomes possible to create that template, AI will try to move towards using that one.
** <code>support = { ... }</code> 是目标编制内支援连的列表设定。单个定义的格式为 <code>artillery = 1</code> 。先确定单位类型,再决定数量。由于只允许一个相同支援连的存在,因此数量不能是其他值,只能是 1
* <code>can_upgrade_in_field = { ... }</code> is a trigger block that decides when AI will try to upgrade divisions that are already assigned this template to the one that it's set to be replaced with.
** <code>regiments = { ... }</code> 是目标编制内常规营的列表。单个定义的格式为 <code>artillery_brigade = 4</code> 。首先确定单位类型,再确定值数量。
* <code>custom_icon = 10</code> assigns the icon that AI would assign to this template. This example would assign the template icon using the sprites <code>GFX_div_templ_10_large</code> and <code>GFX_div_templ_10_small</code>. Optional, defaults to the majority brigade within the template.
* <code>reinforce_prio = 2</code> assigns the reinforce priority that AI would set on this template. The default priority is 1, appearing in-game as 'regular'. 0 is 'reserve', and 2 is 'elite'. Defaults to 1 if unset.
* <code>target_width = 20</code> assigns the combat width that the AI aims for on this template.
* <code>width_weight = 2.5</code> assigns how ''much'' the AI should focus on aiming towards the target width. The higher the weight, the more AI would avoid deviating from the target width.
* <code>column_swap_factor = 0.3</code> assigns a likelihood for AI to swap entire columns within the template to a different subunit group to meet the template.
* <code>stat_weights = { ... }</code> is a list of decimal values. Each one applies to different stats and decides what exactly AI should try to prioritise and what it should try to avoid. As within NDefines.NAI.DIVISION_DESIGN_WEIGHTS in [[Defines]], these stats are first the 17 army values, then air_attack, then common values and special values. In other words, Air and Navy values get skipped aside from air_attack, which is used by anti-air equipment. The value would be added to the default in defines: a 0.00 would mean it's the same priority as default.
* <code>allowed_types = { ... }</code> is a list of sub-units that the AI can add to the template. If one is omitted, then the AI would never add it. This can be used to make AI not put units of different varieties in the template, such as putting infantry in a mobile light tank division, slowing it down.
* <code>target_template = { ... }</code> assigns the template that AI should aim for. In particular, these arguments go inside of it:
** <code>weight = 0.8</code> is how much the AI should aim towards having that template.
** <code>match_value = 5000</code> is a value that decides how much the template is worth to AI if it's matched.
** <code>support = { ... }</code> is a list of support battalions within the target template. A single definition within looks like <code>artillery = 1</code>. The first decides the unit type, the second decides the amount. Since there is a limit of only one of the same support battalion being allowed, the number can't be anything other than 1.
** <code>regiments = { ... }</code> is a list of non-support, regular battalions within the target template. A single definition within looks like <code>artillery_brigade = 4</code>. The first decides the unit type, the second decides the amount.


Each template assigned to a role will form a group for the role, and then the fitness score of each available template is used to determine which is used at a specific moment for a specific role.
相同职能的编制将被汇总为同一个职能组,然后每个可用编制将会进行适应性评分计算,以确定哪个编制在特定的时刻与军事目标应当被使用。


=== Example ===
=== 代码示例 ===
{{Collapse|
{{Collapse|
<pre>armor_BHR = {
<pre>armor_BHR = {
第1,443行: 第1,432行:
    }
    }
}</pre>}}
}</pre>}}
== AI equipment ==
== AI 军事装备 ==
{{SVersion|1.11}}
{{SVersion|1.11}}
{{path|common/ai_equipment/*.txt}} files are used in order to define the equipment variants that the AI should aim for when assigning modules to tank or ship variants.
{{path|common/ai_equipment/*.txt}} 文件用于定义AI在为坦克或舰船变体分配模块时应该追求的装备变体。


A role template is defined as a block within any file in the folder with the name of the block being the same as the name of the role template.<br/>
军事装备设计模板定义为文件夹内任何文件中的一个块,其名称与模板的名称相同。<br/>
These arguments are used for role templates themselves:
这些参数用于装备模板设计本身:
* <code>category = <land|naval|air></code> decides whether the template is used for tanks, ships or planes respectively.
* <code>category = <land|naval|air></code> 决定模板是用于坦克、舰船还是飞机。
* <code>roles = { ... }</code> is a list of roles that the templates would have. These can be anything, getting used for the [[#role_ratio|role_ratio AI strategy]]. AI will try to have one variant for each role it has.
* <code>roles = { ... }</code> 是模板所具有的职能的列表。这些可以是任何内容,用于 [[#role_ratio|role_ratio AI strategy]] 。AI会尝试为他设计的每个职能装备拥有一个变体。
* <code>available_for = { ... }</code> restricts the countries that use this role template to the tags in the list. If unspecified, every country uses them.
* <code>available_for = { ... }</code> 处于列表外的国家将不能使用该装备模板。如果未指定,则所有国家均可使用。
* <code>blocked_for = { ... }</code> restricts the countries that use this role template from being the tags in the list. This is only needed if there is no <code>available_for = { ... }</code> block.
* <code>priority = { ... }</code> is a [[#MTTH blocks|MTTH block]] that decides the 'importance' of the role template compared to other role templates for spending experience on improving. If there are several role templates with the same roles, the one with the highest priority gets used, otherwise this decides likelihood compared to role templates with different roles.


Additionally, within role templates each individual design is defined as a block with the name of the design being the name of the block. It may be anything, as long as there is no overlap.<br/>
* <code>blocked_for = { ... }</code> 处于列表内的国家将不能使用该装备模板。只有在没有 <code>available_for = { ... }</code> 块时需要此项。
These arguments are used within a design definition:
* <code>priority = { ... }</code> 是一个 [[#MTTH blocks|MTTH block]] ,决定该装备模板相对于其他模板在花费军事经验进行升级时的“重要性”。如果有多个装备模板具有相同的职能设计,则使用优先级最高的。除此之外这会决定与不同模板相比后选择的概率。
* <code>name = angry_speedboat</code> required to enable the equipment to be used as preset. If not defined, for example German <code>light_tank_artillery_2</code> will use <code>GER_light_tank_artillery_equipment_2_short</code> localization if defined.
此外,在装备模板内,其中的独立设计被定义为一个块,名称为设计名称。在没有重复的前提下可以是任何内容。<br/>
* <code>role_icon_index = 2</code> is used to assign a specific role icon to a ''ship''. This does not work within land equipment. The icons are defined as a part of <code>naval_equipment_role = { ... }</code> within {{path|gfx/army_icons/army_icons.txt}}.
这些参数用于设计定义中:
* <code>priority = { ... }</code> is a [[#MTTH blocks|MTTH block]] that decides the 'importance' of the design compared to other templates within the role template for spending experience on improving.
* <code>name = angry_speedboat</code> 对于使该装备能够作为预设使用是必不可少的。若未定义,例如德国的 <code>light_tank_artillery_2</code> 将使用 <code>GER_light_tank_artillery_equipment_2_short</code> 的本地化(如果本地化已定义)。
* <code>enable = { ... }</code> is a trigger block that decides when AI should aim towards the design.
* <code>role_icon_index = 2</code> 用于为“舰船”分配特定的职能图标。此部分代码在陆地装备中无效。图标作为 <code>naval_equipment_role = { ... }</code> 的一部分在 {{path|gfx/army_icons/army_icons.txt}} 中定义。
* <code>allowed_types = { ... }</code> is a list of sub-units that the AI can add to the design. If one is omitted, then the AI would never add it. This can be used to make AI not put units of different varieties in the design, such as putting infantry in a mobile light tank division, slowing it down.
* <code>priority = { ... }</code> 是一个 [[#MTTH blocks|MTTH block]] ,决定该设计相对于装备模板内其他槽位在花费军事经验进行升级时的“重要性”。
* <code>target_variant = { ... }</code> assigns the variant that AI should aim for. In particular, these arguments go inside of it:
* <code>enable = { ... }</code> 是一个触发块,决定AI何时会专注于达到该设计。
** <code>match_value = 5000</code> is a value that decides how much the template is worth to AI if it's matched.
* <code>allowed_types = { ... }</code> 是一个子单位的列表,AI可以将其添加到设计中。可以通过自定义去除其中的项来让AI不将其编入编制,例如可以使AI不在在机动轻型坦克师中加入步兵,防止师速度因此减慢。
** <code>type = light_tank_chassis_0</code> is the specific equipment type that must be used by the design.
* <code>target_variant = { ... }</code> 指定AI应该追求的变体。具体来说,有如下参数:
** <code>modules = { ... }</code> is a list of modules that the equipment should have, in particular:
** <code>match_value = 5000</code> 用于决定如果现有编制匹配该模板,其对于AI的价值权重多少。
*** <code>main_armament_slot = tank_flamethrower</code> decides requirements for a specified module slot, in first place. The requirement may be a module category, a specific module, or the word <code>empty</code>. If specifying a module, the greater-than or lesser-than signs can be used in order to require greater or lesser modules: this is decided by the year defined within the module. If lesser is specified, AI aims towards oldest modules, if greater is specified, AI aims towards newest modules. If specifying empty, greater than can be used to ensure it's ''not'' empty.
** <code>type = light_tank_chassis_0</code> 是部队编制设计中必须使用的特定装备类型。
*** <code>main_armament_slot = { ... }</code> allows specifying more details for a module slot:
** <code>modules = { ... }</code> 是装备应具备的模块列表,包括:
**** <code>module = tank_flamethrower</code> decides a module requirement for the slot. This is the exact same formatting as previous <code>main_armament_slot = tank_flamethrower</code>: module categories, modules, or empty are allowed, and the equality signs can be used in the same way.
*** <code>main_armament_slot = tank_flamethrower</code> 决定指定模块槽的要求。该要求可以是模块类别、特定模块或是<code>empty</code> 字符使其为空。如果指定为模块,可以使用greater-than(>)或less-than(<)以要求更好或更次的模块:以上根据模块中定义的年份决定。如果指定了更次,AI会倾向于最旧的模块;如果指定了更好,AI会倾向于最新的模块。如果指定为empty即空槽的情况下,使用greater-than(>)可以确保该槽位“不是”空的。
**** <code>any_of = { ... }</code> is a list of modules or module categories. The module slot must have at least one of them.
*** <code>main_armament_slot = { ... }</code> 允许为模块槽指定更多细节:
**** <code>upgrade = current</code> ensures that, when upgrading a variant to match this design, it must use the same one as on the existing equipment. If the 'greater than' sign is used (>), then it would require AI to upgrade this slot as well.
**** <code>module = tank_flamethrower</code> 决定该槽的模块要求。这与之前的 <code>main_armament_slot = tank_flamethrower</code> 完全相同:允许使用模块类别、模块或empty,并且可以以相同的方式使用等号。
** <code>upgrades = { ... }</code> is a list of upgrades that the design should have, in particular:
**** <code>any_of = { ... }</code> 是一个模块或模块类别的列表。模块槽至少必须有列表中的一项。
*** <code>tank_nsb_engine_upgrade = 3</code> decides the AI priority that the specified upgrade should have to a fixed number.
**** <code>upgrade = current</code> 确保在将变体升级以匹配该设计时,必须使用与现有装备相同的模块。如果使用大于符号 (>) ,则还可要求AI对该槽进行部件升级。
*** <code>tank_nsb_engine_upgrade = { ... }</code> is a [[#MTTH blocks|MTTH block]] that assigns the AI priority to the specified upgrade dynamically.
** <code>upgrades = { ... }</code> 是设计应具备的一系列升级,具体包括:
* <code>requirements = { ... }</code> is a list of modules that the AI ''must'' have. This follows the same formatting as a specified module slot within a target variant's modules block: <code>module = tank_flamethrower</code>, <code>any_of = { ... }</code>, etc. However, this is not tied to a specific slot.
*** <code>tank_nsb_engine_upgrade = 3</code> 决定指定升级应具有的AI优先级,设定为一个固定数字。
* <code>allowed_modules = { ... }</code> is a list of modules that the AI can use after the requirements in the target variant are met. If a module isn't here, it'll never be picked. The modules specified first take priority over the later ones.
*** <code>tank_nsb_engine_upgrade = { ... }</code> 是一个[[#MTTH blocks|MTTH block]] ,通过动态绑定分配AI对指定部件升级的优先级。
* <code>requirements = { ... }</code> 是AI“必须”拥有的模块列表。它遵循与目标变体的模块块中指定的模块槽相同的格式:<code>module = tank_flamethrower</code> <code>any_of = { ... }</code> 等。然而其并不与特定的槽相绑定。
* <code>allowed_modules = { ... }</code> 是在满足目标变体中的要求后,AI可以使用的模块列表。AI将永远不会选择列表外的模块。首先指定的模块优先级高于后指定的。


=== Example ===
=== 代码示例  ===
{{Collapse|
{{Collapse|
<pre>BHR_light_tanks = {
<pre>BHR_light_tanks = {

2024年11月2日 (六) 23:27的最新版本

《钢铁雄心IV》中的AI能够操纵国家许多方面的事物。其包括变更国家的国策或科技走向,决定国家应该生产多少单位或建筑,以及国家应该生产什么样的模板,应该集中力量在哪里,决定使用哪些模板或变体等等。 以下是AI的mod文件路径:

  • /Hearts of Iron IV/common/ai_areas
  • /Hearts of Iron IV/common/ai_focuses
  • /Hearts of Iron IV/common/ai_peace
  • /Hearts of Iron IV/common/ai_strategy
  • /Hearts of Iron IV/common/ai_strategy_plans
  • /Hearts of Iron IV/common/ai_templates
  • /Hearts of Iron IV/common/ai_attitudes.txt
  • /Hearts of Iron IV/common/ai_personalities.txt

许多其他给玩家提供选择的地方应附有 AI 倾向来表达 AI 对各选项的权衡,这些地方使用ai_will_do。

MTTH 代码块

MTTH 块,在游戏内命名为 /Hearts of Iron IV/common/mtth/,是一种为某些块分配动态值的方法,无论是 country = { ... } in a focus tree to assign which countries can get it,动态变化的变量值(如在 /Hearts of Iron IV/common/mtth/ 中),还是事件的mean-time-to-happen value for an event值等。由于 MTTH 块分布在整个游戏中,了解其工作原理极为重要。然而,它最常见的应用是为数据库条目(例如国策或科研)分配基本的 AI 权重。

大多数情况下,它会被标记为 ai_will_do,游戏采用的方法是生成一个介于 0 和 ai_will_do 块的值之间的十进制数字,然后选择具有最高值的条目。在 ai_will_do 值之后还可以应用其他修正,例如在 AI strategy plans 中针对国策和科研应用的修正值。或the ones that get defined within Defines。它会与已经获值进行相乘。这可以包括不同的 `ai_will_do` 值,例如与国家领袖特质以及使用这些特质的idea或角色相关的内容。
事件选项则使用 `ai_chance`。即probability-proportional-to-size sampling。它采用与大小成比例的概率抽样,用一个虚拟的 d00 掷骰结果作为最终决定因素。因此,最终事件选项的概率不能不是 1/100 的倍数,尽管每个选项权重的总和可以与 100 有很大区别。换句话说,如果一个选项的值为 1,而另一个选项的值为 999,则第一个选项被选择的概率将是 1%,而不是 0.1%。

MTTH 块的初始值为 1。从该值出发进行进一步操作。这里可以对三个值进行参数更改,分别是: add, basefactor,例:可以这样factor = 0.3, base = 10, or add = 5add将指定参数加到该值上,factor乘以该值,而 base 通常在任何更改之前进行,建议将其设置为完全不同的参数,如乘以 0 并加上这个数。 为了使操作条件适用,使用 modifier = { ... } block。其起到的作用于 trigger block相似,默认作用域下(因此也是 ROOT)是评估 MTTH 块的国家。根据 MTTH 块, there may be additional scopes marked with FROM or FROM.FROM other than the default.可能还有其他标记为 FROM 的范围或 FROM.FROM 以外的默认范围。值修改参数作为常规参数使用(值修改参数和普通参数一样,拥有相同的使用方式和特性。这种设计可以使得函数在处理输入时具有更大的灵活性。),可以几乎没有区别的放置在 modifier = { ... } block中的任何位置,无论是在结束时、开始时,还是在trigger触发块之间。

Variables 也可以在值修改参数中使用。如果使用在 modifier = { ... } 触发块中定义的临时变量,为了变量能够按定义应用,那么修正值的值修改参数必须放在变量定义之后。变量也可以在 modifier = { ... } 块之外使用,也可直接放在 MTTH 块内部。

示例

ai_will_do = {
    base = 10.5

    # If the country is Germany, set the value to 0,
    # causing an early end of the evaluation.
    modifier = { tag = GER factor = 0 }
    modifier = { is_major = yes add = 1 }
    modifier = {
        factor = 3
        add = 2.5
        tag = FRA
    }
    factor = 2

    modifier = {
        set_temp_variable = { t = num_of_civilian_factories }
        add_to_temp_variable = { t = num_of_military_factories }
        divide_temp_variable = { t = 10 }
        round_temp_variable = t
        add = t
    }
}

假设GER和FRA是主要国家,结果是

  • 德国为0 即[math]\displaystyle{ 10.5 \cdot 0 = 0 }[/math]
  • 法国是74 即[math]\displaystyle{ ((10.5 + 1) \cdot 3 + 2.5) \cdot 2 = 74 }[/math]
  • 其他主要国家为23 即[math]\displaystyle{ (10.5 + 1) \cdot 2 = 23 }[/math]
  • 其他非主要国家为21 即[math]\displaystyle{ 10.5 \cdot 2 = 21 }[/math]

计算出该值后,该国民用和军用工厂的总数除以10并四舍五入,将计入得分。例如,如果法国在开局游戏中总共有43家民用和军用工厂,那么这将导致在之前的数值74基础上增加4,总共78。

AI 策略

AI strategies,AI策略,是为了让AI更愿意或更讨厌去采取某些行动。比如开战、保独、志愿军等外交行动,海陆军军事力量的战略部署权重,建造和生产的队列分配,以及抵抗运动抵抗运动 DLC中情报系统的运用。
AI strategies中的 value (值)可正可负,正值会增加AI采取行动的倾向,反之则会减少。

一般的AI策略存储在/Hearts of Iron IV/common/ai_strategy/*.txt 文件中,但是AI策略也可以在该文件夹之外定义。比如add_ai_strategy effect 语句可以在任何效果域中添加永久ai策略, AI strategy plans中也包含着自己内部定义的AI策略。总之,/Hearts of Iron IV/common/ai_strategy/*.txt 文件中定义/描述的AI策略可以通过满足或不满足条件来自动启用或关闭

/Hearts of Iron IV/common/ai_strategy/*.txt 文件中的每个条目都是一个具有 AI 策略名称的域,就像Effect作用域或Trigger条件域一样。条目名称可以任意定义(但为了防止重复,建议在词条后加一个ai_strategy之类的后缀),甚至允许重复定义:这只会出现在 AI dumps的后台中,玩家是看不到的。如果某个 AI 策略修改了 AI 选择与玩家进行外交行为的权重几率,那么当玩家将鼠标悬停在选项上时,会显示该外交行为的影响因素如下: COUNTRY has strategic reasons to be ...。以下是一个名为 BHR_invade_qatar 的 AI 策略示例:

BHR_invade_qatar = {
    allowed = {
        original_tag = BHR
    }
    enable = {
        country_exists = QAT
    }
    abort = {
        has_war_with = QAT
    }
    abort_when_not_enabled = yes
    ai_strategy = {
        type = invade
        id = QAT
        value = 200
    }
}

参数说明

以下是针对 /Hearts of Iron IV/common/ai_strategy/*.txt 条目(而非其中的 AI 策略条目)的参数说明。

allowed = { ... }是启用域, 该allowed域仅在游戏开始前进行检查,用于永久性地允许或禁止某个 AI 策略。通常这只用于国家检查(例如 tag = OMA)或 DLC 检查,这些检查一旦满足就永远不会失效。

enable = { ... } 是可用域,必须满足该条件才能启用 AI 策略。默认情况下,即使不满足该条件,也 不会 取消 AI 策略。可以通过使用 abort_when_not_enabled = yes 作为单独的参数来改变其是否可用。与 allowed 不同的是,这个条件会被实时判断。

abort = { ... } 是一个条件域,满足该条件就能禁用当前 AI 策略。即使不满足该条件,也会阻止该AI策略在游戏开始时被添加。

ai_strategy = { ... } 内部是要生效的 AI 策略。AI 策略的形式是 type = <AI strategy type>。[[#Types|The rest depends on the AI strategy]。

此外,还有 AI 策略的反转参数。用于有 id = TAG 条件的 AI 策略,以针对特定TAG:该 AI 策略将为满足 enable = { ... } 判断条件的国家启用。并依靠 reversed = yes来生效。 enable_reverse = { ... }意为需要满足域内条件才能反转。反转参数无默认条件域,所以需要条件域具体到某个TAG。

反转 AI 策略的例子如下:

BHR_support_neutrals = {
    allowed = {
        NOT = { original_tag = BHR }
    }
    enable = {
        has_government = neutrality
    }
    enable_reverse = {
        BHR = { has_government = neutrality }
    }
    reversed = yes
    abort_when_not_enabled = yes
    ai_strategy = {
        type = support
        id = BHR
        value = 100
    }
}

如果没有 reversed = yes,该例这将使每个 中立主义中立主义 国家支持 BHR。由于该参数的存在,策略被反转:BHR 将支持每个 中立主义中立主义 国家。

Types

此列表可能已过时。有关每种人工智能策略的列表可以在原版游戏的 /Hearts of Iron IV/common/ai_strategy/documentation.info 文件中找到。

与外交行动相关的AI策略:
名称 参数 示例 描述 备注
结盟 value = <int>
策略的权重。

id = <country>
策略的目标。

ai_strategy = {  
    type = alliance  
    id = USA  
    value = -100  
}
AI会尝试与一个国家结盟,如有可能,将加入同一阵营。
对抗 value = <int>
策略的权重。

id = <country>
策略的目标。

ai_strategy = {  
    type = antagonize  
    id = USA  
    value = -100  
}
AI将会与一个国家对抗,拒绝与其进行大多数的外交行动。
请求外国驻军 value = <int>
策略的权重。

id = <country>
策略的目标。

ai_strategy = {  
    type = asking_foreign_garrison  
    id = USA  
    value = 100  
}
AI将会按照权重请求外国人力支援以满足驻军需求,如果指明了特定国家。 如果未指定id,则将适用于其他所有国家。
交好 value = <int>
此策略的权重。

id = <country>
策略的目标国家。

ai_strategy = {
    type = befriend
    id = USA
    value = 100
}
AI将会与某国家建立友好关系,接受大多数与该国的外交行动。
征服 value = <int>
此策略的权重。

id = <country>
策略的目标国家。

ai_strategy = {
    type = conquer
    id = USA
    value = 100
}
AI将会试图征服某国家,更有可能为之正当化战争目标并宣战。 这并改变AI在与其进行战争时对前线的控制方式。
视为弱国 value = <int>
此策略的权重。

id = <country>
策略的目标国家。

ai_strategy = {
    type = consider_weak
    id = USA
    value = 100
}
AI会将某国视为弱国,减少对其宣战前的踌躇不前,或使与该国结盟的可能性降低。
遏制 value = <int>
此策略的权重。

id = <country>
策略的目标国家。

ai_strategy = {
    type = contain
    id = USA
    value = 100
}
AI将会遏制某个国家,保护他免受任何可能与其敌对国家的侵略。
宣战 value = <int>
此策略的权重。

id = <country>
策略的目标国家。

ai_strategy = {
    type = declare_war
    id = USA
    value = 100
}
AI将会在已有正当化后的宣战借口的情况下对战争目标宣战。
外交行动接受 value = <int>
此策略的权重。

id = <country>
策略的目标国家。
target = <diplomatic action>
要修改的外交行动。

ai_strategy = {
    type = diplo_action_acceptance
    id = USA
    value = 100
    target = join_allies
}
若其他国家请求,AI将接受某项外交行动。 AI被提议不会影响其原有的态度。外交行动的名称通常可以通过用于标题的本地化键找到,大部分情况下位于/Hearts of Iron IV/localisation/english/diplomacy_l_english.yml 文件中:DIPLOMACY_SEND_VOLUNTEERS_TITLE:0 "派遣志愿军"表示派遣志愿军的外交行动名称为send_volunteers
外交行动愿望 value = <int>
此策略的权重。

id = <country>
策略的目标国家。
target = <diplomatic action>
要修改的外交行动。

ai_strategy = {
   type = diplo_action_desire
    id = USA
    value = 100
    target = call_allies
}
AI将会向指定国家请求某项外交行动。 AI不会因为被提议而更改原有态度。外交行动的名称通常可以通过用于标题的本地化键找到,大部分情况下位于/Hearts of Iron IV/localisation/english/diplomacy_l_english.yml文件中:DIPLOMACY_SEND_VOLUNTEERS_TITLE:0 "派遣志愿军"表示派遣志愿军的外交行动名称为send_volunteers
不与...一起参战 value = <int>
此策略的权重。

id = <country>
策略的目标国家。
target_country = <country>
与之参战的国家。

ai_strategy = {
    type = dont_join_wars_with
    id = USA
    value = 100
    target_country = BHR
}
AI将更不可能与指定国家联合对某一特定国家参战。 并不减少AI因“其他”国家召唤导致对目标国家宣战的可能性,即使这会导致与被指定国家一起与目标国家作战。
无视 value = <int>
此策略的权重。

id = <country>
策略的目标国家。

ai_strategy = {
    type = ignore
    id = USA
    value = 100
}
AI将更不可能接受或主动与目标国进行任何形式的外交行动。
无视宣称 value = <int>
策略的权重。

id = <country>
策略的目标国家。

ai_strategy = {
    type = ignore_claim
    id = USA
    value = 1
}
AI将忽视指定国家发起的外交活动。 值为布尔型,仅设定为1。
保护 value = <int>
策略的权重。

id = <country>
策略的目标国家。

ai_strategy = {
    type = protect
    id = USA
    value = 100
}
AI将保护某一国家,对其进行保障独立或将其拉入同一阵营。 若值为负(综合考虑所有AI策略值)将导致AI不会保障该国家。
支持 value = <int>
策略的权重。

id = <country>
策略的目标国家。

ai_strategy = {
    type = support
    id = USA
    value = 100
}
AI将在战争中通过起草租借法案、派遣志愿军或远征军支持指定国家。
起草租借法案 value = <int>
策略的权重。

id = <country>
策略的目标国家。

ai_strategy = {
    type = send_lend_lease_desire
    id = USA
    value = 100
}
AI将向指定国家起草租借法案。
发送志愿军的意愿 value = <int>
策略的权重。

id = <country>
策略的目标国家。

ai_strategy = {
    type = send_volunteers_desire
    id = USA
    value = 100
}
AI将向指定国家派遣志愿军。
与陆军管理相关的AI策略:
名称 参数 示例 描述 备注
登陆侵略 value = <int>
策略的权重。

id = <country>
策略的目标国家。

ai_strategy = {
    type = invade
    id = USA
    value = -100
}
AI将对指定国家进行海军入侵。
准备战争 value = <int>
策略的权重。

id = <country>
策略的目标国家。

ai_strategy = {
    type = prepare_for_war
    id = USA
    value = 100
}
AI将准备对指定国家的战争,并将部队移动到其边界。
区域优先级 value = <int>
策略的权重。

id = <AI area>
要优先考虑的AI area

ai_strategy = {
    type = area_priority
    id = europe
    value = 100
}
推动AI在指定区域内放置更多单位。
不防守盟友边界 value = <int>
策略的权重。

id = <country>
策略的目标国家。

ai_strategy = {
    type = dont_defend_ally_borders
    id = POL
    value = 10
}
使AI永远不在指定国家与与其交战的国家之间的边界上部署部队。 数值必须是二进制的。如果总值(考虑到每个AI策略)为正,AI将永远不会在边界上放置任何部队。
强制防守盟友边界 value = <int>
策略的权重。

id = <country>
策略的目标国家。

ai_strategy = {
    type = force_defend_ally_borders
    id = FRA
    value = 100
}
AI将在指定国家与其他国家之间的边界上部署部队。 还接受id中的[[#AI areas|AI areas]。 |
前线装甲分配权重 value = <int>
策略的权重。

id = <country>
策略的目标国家。

ai_strategy = {
    type = front_armor_score
    id = POL
    value = 100
}
AI将为进攻指定国家部署更多装甲单位。
前线控制 state = <state>
目标州。

tag = <country>
目标国家。
strategic_region = <ID>
目标战略区域。
area = <state>
目标AI area
country_trigger = { ... }
目标国家的触发条件块。
state_trigger = { ... }
目标省份的触发条件块。 ratio = <decimal>
指定前线必须具备的前线比例 以启用策略的要求. 默认为0。
priority = <integer>
设置此前线控制策略的优先级。如果存在矛盾的前线控制策略,将遵循优先级更高的策略。
ordertype = <front|invasion>
如果设置,将使AI策略仅适用于陆地前线或海军入侵。
execution_type = <careful|balanced|rush|rush_weak>
如果设置,这将使AI的前线计划拥有设置的执行类型。仅适用于前线。
execute_order = <bool>
如果设置,将使AI强制执行前线命令或强制不执行。
manual_attack = <bool>
如果设置为false,防止AI进行不属于前线计划的小规模交战。默认为true,仅适用于前线。

ai_strategy = {
    type = front_control
    state_trigger = {
        industrial_complex > 1
        is_owned_by = ENG
    }
    ratio = 0.1
    ordertype = front
    execution_type = rush
    manual_attack = no
}
ai_strategy = {
    type = front_control
    area = suez
    priority = 1
    ratio = 0.2
    ordertype = invasion
    execute_order = yes
}
修改AI在指定前线给师团的命令。 可以同时使用多个目标类型,在这种情况下,必须满足每一个。这只改变分配给已经存在的前线的命令,不会改变分配给任何特定前线的单位数量,也不会强制创建任何单位。
前线单位请求 state = <state>
目标省份。

tag = <country>
目标国家。
strategic_region = <ID>
目标战略区域。
area = <state>
目标AI area
country_trigger = { ... }
目标国家的触发条件块。
state_trigger = { ... }
目标省份的触发条件块。 value = <int>
策略的权重。

ai_strategy = {
    type = front_unit_request
    tag = POL
    value = 100
}
ai_strategy = {
    type = front_unit_request
    country_trigger = {
        original_tag = SPR
        has_government = fascism
    }
    value = 100
}
让AI在指定的陆地前线上部署更多单位。 可以同时使用多个目标类型,在这种情况下,必须满足每一个。
入侵单位请求 state = <state>
目标州。

tag = <country>
目标国家。
strategic_region = <ID>
目标战略区域。
area = <state>
目标AI area
country_trigger = { ... }
目标国家的触发条件块。
state_trigger = { ... }
目标省份的触发条件块。 value = <int>
策略的权重。

ai_strategy = {
    type = invasion_unit_request
    state = 123
    value = 100
}
ai_strategy = {
    type = invasion_unit_request
    strategic_region = 42
    value = 100
}
让AI在进行对指定目标的海军入侵中部署更多单位。 可以同时使用多个目标类型,在这种情况下,必须满足每一个。
驻军 value = <int>
策略的权重。
ai_strategy = {
    type = garrison
    value = 10
}
控制用于防守胜利点和港口的单位数量,而不是让这些单位在前线活动。
驻军增援优先级 value = <int>
策略的权重。
ai_strategy = {
    type = garrison_reinforcement_priority
    value = 100
}
| 让AI优先增强驻军单位,以保护胜利点和海军基地。
|
|-id="ignore_army_incompetence"
|忽略军队无能
|<code>value = <int></code><br/>策略的权重。  
|<pre>ai_strategy = {
    type = ignore_army_incompetence
    value = 100
}
让AI在计算中忽略因师级缺乏经验而给予的修正值,从而让AI认为优势在我。
布置单位缓冲区 ratio = <decimal>
用于缓冲单位的数量。

order_id = 2
如果两个布置单位缓冲区策略使用相同的ID,它们的比率将共享,而不是相加。
states = { ... }
可缓冲单位的省份列表。
area = <AI area>
用于缓冲单位的AI区域。
subtract_invasions_from_need = yes
如果为真,区域内的海军入侵将不计入比率,即不防守海军入侵。默认为假。
subtract_fronts_from_need = yes
如果为真,区域内的陆地前线将不计入比率,即不防守前线。默认为假。

ai_strategy = {
    type = put_unit_buffers
    ratio = 0.2
    states = {
        123
        124
        125
        126
    }
    subtract_fronts_from_need = yes
}
让AI在指定区域保持一定比例的师级以进行驻军任务。
备用单位因子 value = <int>
策略的权重。
ai_strategy = {
    type = spare_unit_factor
| AI将使用更多单位来协防盟友。
|-id="theatre_distribution_demand_increase"
|战区分配需求增加
|<code>value = <int></code><br/>策略的权重。<br/>
<code>id = <state></code><br/>策略的目标州。<br/>
|<pre>ai_strategy = {
    type = theatre_distribution_demand_increase
    value = 10
    id = 123
}
让AI在指定省份的战区中投入更多单位。 值为1表示1个单位。
与海军管理相关的 AI 策略:
名称 参数 示例 描述 备注
strike_force_home_base value = <int>
策略的权重。

id = <strategic region>
策略的目标。

ai_strategy = {
    type = strike_force_home_base
    id = 18
    value = 70
}
促使 AI 在指定的战略区域内执行打击舰队任务。
与情报相关的 AI 策略:
名称 参数 示例 描述 备注
agency_ai_base_num_factories_factor value = <int>
策略的权重。
ai_strategy = {
    type = agency_ai_base_num_factories_factor
    value = 70
}
更改AI用于情报系统升级的基准权重。 值为 1 等于相对于 Defines 中规定的基准增加 1%。
agency_ai_per_upgrade_factories_factor value = <int>
策略的权重。
ai_strategy = {
    type = agency_ai_per_upgrade_factories_factor
    value = 70
}
调整用于计算AI情报机构升级所需的工厂数量。 值为 1 等于相对于 Defines 的基线增加 1%。
intelligence_agency_branch_desire_factor value = <int>
策略的权重。

id = <分支>
策略的目标。

ai_strategy = {
    type = intelligence_agency_branch_desire_factor
    id = branch_crypto
    value = 70
}
修改用于计算 AI 进行情报机构升级所需的工厂数量。 分支定义在 /Hearts of Iron IV/common/intelligence_agency_upgrades/*.txt 文件中。
intelligence_agency_usable_factories value = <int>
策略的权重。
ai_strategy = {
    type = intelligence_agency_usable_factories
    value = 8
}
修改 AI 为情报机构使用的工厂数量。
operation_equipment_priority value = <int>
策略的权重。
ai_strategy = {
    type = operation_equipment_priority
    value = 80
}
让 AI 优先为当下特勤行动提供足够的军事装备。
operative_mission value = <int>
策略的权重。

mission = <mission>
优先执行的任务
mission_target = <country>
目标国家
state = <state>
如果有效,则优先考虑目标国内的状态。可选。
priority = <int>
如果定义了矛盾的 AI 策略,则选择优先级最高的策略。

ai_strategy = {
    type = operative_mission
    value = 80
    mission = quiet_intel_network
    state = 123
    state = 321
    mission_target = ENG
}
使 AI 对目标执行指定的任务。 可以定义多个状态,导致其中一个状态被优先考虑。任务名称可以在 /Hearts of Iron IV/localisation/english/operatives_l_english.yml 中查看。例如,OPERATIVE_MISSION_BOOST_IDEOLOGY_TITLE:0 "Boost Ideology" 表示增强意识形态的任务为 boost_ideology。
operative_operation value = <int>
策略的权重。

operation = <mission>
优先执行的任务
operation_target = <country>
目标国家
state = <state>
如果有效,则优先考虑目标国内的状态。可选。
region = <strategic region>
如果有效,则优先考虑目标国内的战略区域。可选。
priority = <int>
如果定义了矛盾的 AI 策略,则选择优先级最高的策略。

ai_strategy = {
    type = operative_operation
    value = 80
    operation = heavy_water_raid
    operation_target = ENG
}
促使 AI 在目标上执行指定的操作。 可以定义多个状态,并使其中一个状态被优先考虑。操作在 /Hearts of Iron IV/common/operations/*.txt 文件中定义。
与生产、建设和招聘相关的 AI 策略:
名称 参数 示例 描述 备注
added_military_to_civilian_factory_ratio value = <int>
策略的权重。
ai_strategy = {
    type = added_military_to_civilian_factory_ratio
    value = 50
}
对 AI 希望保持的军事与民用工厂比例进行修改。 正值意味着更多的军事工厂。
air_factory_balance value = <int>
策略的权重。
ai_strategy = {
    type = air_factory_balance
    value = 50
}
对 AI 希望保持的空军生产与现有工厂的比例进行修改。 正值意味着更多的空军。
dockyard_to_military_factory_ratio value = <int>
策略的权重。
ai_strategy = {
    type = dockyard_to_military_factory_ratio
    value = 50
}
对 AI 希望保持的船坞与军事工厂的比例进行修改。 正值意味着更多的船坞。
railway_gun_divisions_ratio value = <int>
策略的权重。
ai_strategy = {
    type = railway_gun_divisions_ratio
    value = 5
}
对AI 希望保持的列车炮与师的比例进行修改。 基本比例为 Defines 中的 RAILWAY_GUN_PRODUCTION_BASE_DIVISIONS_RATIO_PERCENT,默认值为 0。这将在 0-100 的比例上进行累加。
build_building value = <int>
策略的权重。

id = <building>
策略的目标。
target = <state>
用于建设的省份。

ai_strategy = {
    type = build_building
    id = industrial_complex
    target = 803
    value = 1
}
AI将会在指定省份内建造特定建筑。 值决定了 AI 希望在该省份内同时建造多少座建筑。
building_target value = <int>
策略的权重。

id = <building>
策略的目标。

ai_strategy = {
    type = building_target
    id = industrial_complex
    value = 30
}
使 AI 保持对指定建筑更高的期望目标。
factory_build_score_factor value = <int>
策略的权重。

target = <state>
用于建设的省份。

ai_strategy = {
    type = factory_build_score_factor
    target = 365
    value = 1
}
让AI 在指定省份内建造建筑。
equipment_production_factor value = <int>
策略的权重。

id = <equipment archetype type>
策略的目标。

ai_strategy = {
    type = equipment_production_factor
    id = armor
    value = 30
}
AI 将生产指定类型的装备。 每种装备原型的类型在 /Hearts of Iron IV/common/units/equipment/*.txt 文件中的 types = { ... } 中定义。
equipment_production_min_factories value = <int>
策略的权重。

id = <equipment archetype type>
策略的目标。

ai_strategy = {
    type = equipment_production_min_factories
    id = artillery
    value = 3
}
促使 AI 在指定类型的装备生产线上保持更多的工厂。 值为 1 对应于 1 个军事工厂。每种装备原型的类型在 /Hearts of Iron IV/common/units/equipment/*.txt 文件中的 types = { ... } 中定义。
equipment_variant_production_factor value = <int>
策略的权重。

id = <equipment archetype>
策略的目标。

ai_strategy = {
    type = equipment_variant_production_factor
    id = light_tank_chassis
    value = -100
}
AI 将生产更多指定的军事装备。 军事装备在 /Hearts of Iron IV/common/units/equipment/*.txt 文件中定义。
equipment_stockpile_surplus_ratio value = <int>
策略的权重。
ai_strategy = {
    type = equipment_stockpile_surplus_ratio
    value = 30
}
改变 AI 在库存中保存的装备比例,这将不会使AI立即使用这些装备。
build_army value = <int>
策略的权重。

id = <equipment archetype>
策略的目标。

ai_strategy = {
    type = build_army
    id = suppression
    value = -1000
}
修改 AI 所需的军队编制数量。 使用的目标是AI templates.中的角色。
force_build_armies value = <int>
策略的权重。
ai_strategy = {
    type = force_build_armies
    value = 30
}
这将强制使 AI 建立超过所需数量的师级单位。
production_upgrade_desire_offset value = <int>
策略的权重。

id = <equipment type>
策略的目标。

ai_strategy = {
    type = production_upgrade_desire_offset
    id = artillery_equipment_2
    value = -50
}
将使AI升级生产线至指定的装备类型。 设备类型在 /Hearts of Iron IV/common/units/equipment/*.txt 文件中定义。
value = <int>
策略的权重。
role_ratio value = <int>
策略的权重。

id = <role>
策略的目标。

ai_strategy = {  
    type = role_ratio  
    id = paratroopers  
    value = 30  
}
修改AI为指定职能制作的编制数量。 职能在[[#AI templates|AI templates] 中定义,用于单位编制,而 [[#AI equipment|AI equipment] 中定义船只和坦克变体。
unit_ratio value = <int>
策略的权重。

id = <unit>
策略的目标。

ai_strategy = {  
    type = unit_ratio  
    id = cas  
    value = 30  
}
修改AI使用特种单位编成的编制的数量上限。 单位在 /Hearts of Iron IV/common/units/*.txt 文件中定义,包括空军和海军以及陆军。
min_wanted_supply_trains value = <int>
策略的权重。
ai_strategy = {  
    type = min_wanted_supply_trains  
    value = 300  
}
对AI所需的最低补给火车数量进行更改。
min_wanted_supply_trucks value = <int>
The weight of the strategy.
ai_strategy = {
    type = min_wanted_supply_trucks
    value = 30
}
AI 总体上所需卡车的最低数量。
其他 AI 策略:
名称 参数 例子 描述 备注
scorched_earth_prio value = <int>
策略的权重。

id = <country>
使用焦土政策的国家所有者。
states = { ... }
使用焦土政策的省份列表。

ai_strategy = {
    type = scorched_earth_prio
    value = 100
    id = ENG
    states = {
        123
        124
        125
        126
    }
}
AI 将会在指定省份使用焦土政策。
land_xp_spend_priority value = <int>
策略的权重。

id = <type>
策略的目标。

ai_strategy = {
    type = land_xp_spend_priority
    id = division_template
    value = 30
}
修改 AI 花费陆军经验的优先顺序。 原版游戏使用包括 division_templateupgrade_xp_cutoff
pp_spend_amount value = <int>
策略的权重。

id = <type>
策略的目标。

ai_strategy = {
    type = pp_spend_amount
    id = idea
    value = 100
}
AI 将保留的政治点数。 原版游戏使用包括 ideadecision
pp_spend_priority value = <int>
策略的权重。

id = <type>
策略的目标。

ai_strategy = {
    type = pp_spend_priority
    id = relation
    value = 100
}
对AI 花费政治点数的方向进行更改。 原版游戏使用包括以下内容:
  • admiral
  • guarantee
  • relation
  • decision
research_weight_factor value = <int>
策略的权重。

id = <type>
策略的目标。

ai_strategy = {
    type = research_weight_factor
    id = radio_detection
    value = 2000
}
修改 AI 对科研项目研发的权重(分数)。 value = 50 意味着增加 50%的增速,-30 意味着 30%的减速,等等。

AI 区域

AI区域在 /Hearts of Iron IV/common/ai_areas/*.txt 文件中定义。这些区域用于多种之前列出的AI策略,例如 area_priority。一个省可能属于多个AI区域,也可能不属于任何区域。启用debug调试模式后,鼠标悬停在一个省上将提供该省所属的AI区域的信息(如果有的话)。

每个AI区域在文件中都是一个单独的块,块的名称即为区域的名称。在这些块中,可以添加两项内容:
continents = { ... } 是构成该AI区域的地理区划列表。这在 /Hearts of Iron IV/map/continent.txt 中定义,并在 [[Map modding#Provinces|their definitions]中分配给省份,位置在 /Hearts of Iron IV/map/definition.csv。在AI区域的定义中应使用大陆的全名,而不是省份定义中使用的 ID。
strategic_regions = { ... } 是根据其 ID 号码构成该AI区域的战略区域列表。

如果定义了多个ai区域,省份必须属于其中任何(any)一个。

一个AI区域的代码示例如下:

my_ai_area = {
    continents = {
        europe
        africa
    }
    strategic_regions = {
        53  # Caribbean
        189 # Burma
    }
}

AI 焦点

主条目:AI focuses

AI焦点,定义在/Hearts of Iron IV/common/ai_focuses/*.txt文件,用于让游戏AI根据当前设置目标的焦点选择点哪些科技和国策。

AI 和平谈判

Pre-1.12 AI和平谈判
AI的和平谈判行为在 /Hearts of Iron IV/common/peace_conference/ai_peace/*.txt 文件中定义。
在定义国家使用的和谈AI时,游戏会选择第一个满足前提条件的定义。在这种情况下,文件是根据其文件名按顺序加载的,使用 ASCII character IDs

在评估和平会议时,使用 ROOT(默认作用域)表示当前评估的赢家,使用 FROM 表示当前评估的输家。此外,存在以下 temporary variables

  • taken_states@TAG 是一个数组,包含作为和谈中一部分被国家 TAG 吞并的省份。
  • taken_by@123 是占领指定省份的国家,在此情况下为 123。
  • current_states@TAG 是一个数组,包含在和谈中尚未决定的、处于赢得战争的 TAG 控制下的省份。
  • subject_states@TAG 是一个数组,包含在和谈中设置为转移给被 TAG 统治的国家的省份。
  • subject_countries@TAG 是一个数组,包含在和谈中被设置为受 TAG 统治的国家。
  • subjected_by@123 是设定在和谈中拥有指定省份的国家的宗主国,在此情况下为 123。
  • subjected_by@TAG 是一个数组,包含以 TAG 作为宗主国的国家。
  • liberate_states@TAG 是一个数组,包含将要转移给被 TAG 解放的国家的省份。
  • liberate_countries@TAG 是一个数组,包含被 TAG解放的国家。

enable = { ... } 触发块用于确定AI是否应启用。如果为真且没有其他先前加载的和平会议AI为真,则选择该AI。

游戏中使用的和平选项如下:

  • annex - 国家 FROM 被 ROOT 完全吞并。这仅评估国家。
  • liberate - 国家 FROM 被 ROOT 解放。
  • puppet - 国家 FROM 被 ROOT 作为傀儡。
  • puppet_all - 国家 FROM 被 ROOT 作为傀儡 并且 能够保留其全部的省份。
  • puppet_state - ROOT的省份 被转移到 FROM。FROM,该省份在和平会议中成为 FROM 的一部分。
  • take_states - FROM 的省份被 ROOT 吞并。
  • force_government - 国家 FROM 的意识形态被 ROOT 强制更改。

在评估和谈时,若给定省份的控制者与会议开始原本拥有该地块的国家相同,则所有者则是原所有者。 每个和平会议选项都是文件定义中的一个 MTTH block

代码示例:
my_peace_conference = {
    enable = {
        has_government = my_ideology_group
    }
    annex = {
        base = 500
        modifier = {
            factor = 0
            any_allied_country = {
                any_state = {
                    is_owned_by = FROM
                    is_core_of = PREV
                    NOT = {
                        is_core_of = ROOT
                        is_claimed_by = ROOT
                    }
                }
            }
        }
    }
    puppet = {
        base = 100
        modifier = {
            factor = 0
            FROM = { tag = QAT }
        }
    }
    puppet_all = {
        base = 0
    }
    puppet_state = {
        base = 100
        modifier = {
            factor = 0
            FROM.FROM = { tag = QAT }
        }
        modifier = {
            factor = 0
            any_allied_country = {
                ROOT = {
                    is_core_of = PREV
                    NOT = {
                        is_core_of = FROM.FROM
                        is_claimed_by = FROM.FROM
                    }
                }
            }
        }
    }
    take_states = {
        base = 100
        modifier = {
            factor = 0
            any_allied_country = {
                FROM = {
                    is_core_of = PREV
                    NOT = {
                        is_core_of = ROOT
                        is_claimed_by = ROOT
                    }
                }
            }
        }
    }
}


AI 策略计划

AI策略计划用于根据情况指导AI优先考虑的事项:选择哪些顾问、研究哪些技术、应用哪些AI策略、选择哪个国策等。这些计划比一般的AI策略更为详细,主要用于在游戏的大部分时间内告知一个国家的整体计划。一个国家可以同时定义和执行多个AI策略计划。

AI策略计划在/Hearts of Iron IV/common/ai_strategy_plans/*.txt文件中定义。在这些文件中,新策略计划作为一个新代码块进行定义,其名称必须与计划的内部ID相同。 在该计划中,name = "AI计划名称"desc = "AI计划描述"确定了策略计划的名称和描述。这并不打算向玩家展示,因此不需要将其本地化为不同的语言。相反的,这用于aiview控制台命令中,向开发者提供有关AI希望优先考虑的事项的信息。 allowed = { ... }类似于决议或ideas,是一个触发块,仅在游戏开始时检查。这主要是用来决定要在什么国家和扩展包中使用这个策略计划。 enable = { ... }游戏时间内每天检查一次,看看是否满足allowed条件。如果满足enable = { ... },则该AI策略计划将分配给AI,无论之后enable = { ... }是否变为false。通常情况下, Triggers#has_game_rule用于与自定义游戏规则搭配,以决定AI将选择的路径。is_historical_focus_on 常与默认AI设置一起使用,国家的flags可以通过设置on_startup来实现随机化,使用random_list来设定随机值。 abort = { ... }游戏时间内每天检查一次,以使AI在enable = { ... }条件满足时 停止 使用该AI策略计划。因此,必须是false的情况下,才能使AI策略计划有可能被选择。 ai_national_focuses = { TAG_focus_name_1 TAG_focus_name_2 } 是一个国家国策的列表,以空格分隔,按照 AI 应该采取的顺序排列。在这个例子中,AI 将首先尝试进行 TAG_focus_name_1国策。若 TAG_focus_name_1 已经完成,或无法进行,那么 AI 将尝试进行 TAG_focus_name_2国策。如果这两个国策由于已完成或者未满足前提条件而都无法进行,AI 将转向其他国策,同时考虑 ai_will_do = { ... } 的内容。在按设定好的国策优先进行顺序下,AI 会忽略 ai_will_do = { ... } 的值。 focus_factors = { ... } 为指定国策的 ai_will_do 值分配一个乘数。这个块中的一个条目看起来像 TAG_focus_name = 3。在这种情况下,这将使该国策的 ai_will_do 值乘以 3,假设 AI 策略计划的权重为 1。如果国策项在应用修正因子后具有 4 的 ai_will_do 值,那么在跟随此策略计划时,它将变为 12,并视为这样的处理。当然,因子为 0 将使该国策项在没有在 ai_national_focuses 中指定的情况下永远不会被选择。这可以作为一种更快书写或更随机的方式,使 AI 通过使它不应选择的国策具有 0 值来实现让其遵循某种政治路径。 research = { ... } 为指定科研槽的 ai_will_do 值分配一个乘数。这个块中的一个条目看起来像 artillery = 3。在这种情况下,这将使该类别内每一项科研项的 ai_will_do 值乘以 3,假设 AI 策略计划的权重为 1。其他内置修正因子仍然适用,但这将增加它们的可能性。 其他也分配增益的块还有 ideas = { ... }traits = { ... },格式类似。ideas 块用于单个idea(如法律条例或设计商)或顾问(使用 idea_token 在条目中),而 traits 则用于给ideas/顾问的分配国家领导者特质。 ai_strategy = { ... } 允许在策略计划开启时应用 AI strategyweight = { ... } 是一个 MTTH block ,为计划分配一个整体权重。这使得 AI 策略计划中的每个因子在应用之前都乘以权重。例如,权重为 1.25 将使国策因子 4 变为 5 之后再应用。这可以在某些情况下使 AI 更严格地遵循策略计划,而在其他情况下则执行的相对宽松。

代码示例

BHR_historical = {
    name = "Historical plan for BHR"
    desc = "4 focuses in a specific order"
    allowed = {
        tag = BHR
    }
    enable = {
        OR = {
            AND = {
                is_historical_focus_on = yes
                has_game_rule = {
                    rule = BHR_ai_behavior
                    option = DEFAULT
                }
            }
            has_country_flag = BHR_AI_RANDOM_HISTORICAL # Randomly set in on_actions if BHR_ai_behavior is set to RANDOM. Make sure to set that up!
            has_game_rule = {
                rule = BHR_ai_behavior
                option = HISTORICAL
            }
        }
    }
    abort = {
        OMA = {
            OR = {
                has_government = fascism
                has_government = communism
            }
        }
    }
    ai_national_focuses = {
        BHR_focus_name_1
        BHR_focus_name_2
        BHR_focus_name_3
        BHR_focus_name_4
    }
    ideas = {
        BHR_advisor = 3
    }
    traits = {
        fascist_demagouge = 0
    }
    ai_strategy = {
        type = invade
        id = OMA
        value = 200
    }
}
BHR_alternate = {
    name = "Alternative plan for BHR"
    desc = "AI is just set to never do BHR_focus_name_2 and be more likely to do BHR_focus_name_5, especially if after 1937"
    enable = {
        OR = {
            has_country_flag = BHR_AI_RANDOM_ALTERNATE # Randomly set in on_actions if BHR_ai_behavior is set to RANDOM. Make sure to set that up!
            has_game_rule = {
                rule = BHR_ai_behavior
                option = ALTERNATE
            }
        }
    }
    focus_factors = {
        BHR_focus_name_2 = 0
        BHR_focus_name_5 = 2
    }
    weight = {
        modifier = {
            factor = 2
            date > 1937.1.1
        }
    }
    research = {
        artillery = 2
    }
}

AI 部队编制

/Hearts of Iron IV/common/ai_templates/*.txt 文件用于定义AI在编制编成窗口中所追求的模板。

部队编制被定义为文件夹中任何文件内的一个块,块的名称与部队编制的名称相同。
这些参数用于部队编制本身:

  • roles = { ... } 是编制所包含的部队类型列表。这些可以是任何东西,用于 role_ratio AI strategy。AI将会为所拥有的每个师创建一个编制。
  • available_for = { ... } 在此列表外的国家将不允许使用如下编制。如果未指定,则每个国家都将使用它们。
  • blocked_for = { ... } 在此列表内的国家将不允许使用如下编制。这个参数只有在没有 available_for = { ... } 块时才会被使用。
  • match_to_count = 0.3 是一个在 0-1 的范围内的十进制数,用于判断一个现行部队编制是否符合对应职能编制。默认值设置为 0.5。
  • upgrade_prio = { ... } 是一个 MTTH block ,决定职能编制相对于其他在花费经验进行提升时的“重要性”。如果有多个职能编制具有相同的职能,则优先级最高的编制会被使用。在别的情况下,此条优先级定义会影响其与不同编制相比的概率。

此外,在职能编制中,每个单独的编制被定义为一个其名称是编制的块。它可以是任何名称,只要在文件中没有重名即可。
这些参数在编制定义中使用:

  • upgrade_prio = { ... } 是一个 MTTH block ,决定了该编制相对于职能编制中其他编制在花费经验进行升级时的权重。
  • production_prio = { ... } 是一个 MTTH block ,决定了该编制相对于职能编制中其他编制在实际生产时的权重。
  • replace_with = my_other_template 指定了一个不同的编制,作为该编制的新版本。当创建该新编制成为可能时,AI将尝试转向使用此新的编制。
  • can_upgrade_in_field = { ... } 是一个触发块,决定AI何时尝试升级已分配此编制的部队到将要替换的编制。
  • custom_icon = 10 指定AI为该编制分配的图标。这个代码例将使用 GFX_div_templ_10_largeGFX_div_templ_10_small Sprite为编制分配图标。此项为可选,默认为编制中绝大多数旅的图标。
  • reinforce_prio = 2 指定AI在该编制上设置的装备增援优先级。默认优先级为 1,在游戏中显示为“常规”。0 为“后备”,2 为“精英”。如果未设置,默认为 1。
  • target_width = 20 指定AI针对该编制的目标作战宽度。
  • width_weight = 2.5 指定AI在多大程度上应该专注于目标宽度。权重越高,AI越会避免偏离目标宽度。
  • column_swap_factor = 0.3 指定了AI将整个列交换到不同子单位组以满足编制的可能性。
  • stat_weights = { ... } 是一个十进制值列表。每个值适用于不同的统计数据,并决定AI应该优先考虑什么,以及应该避免什么。与 NDefines.NAI.DIVISION_DESIGN_WEIGHTS in Defines一样,这些统计数据首先是 17 个陆军值,然后是对空攻击,接下来是共同值和特殊值。换句话说,与空军和海军有关的值除对空攻击外都被跳过,对空攻击来自于防空装备。这个值将添加到定义中的默认值:0.00 意味着与默认优先级相同。
  • allowed_types = { ... } 是一个AI可以添加到编制中的营级单位列表。如果某个类型被标注省略,AI将永远不会添加它。这可以用来确保AI不会在编制中放入不同种类的单位,例如在一个移动轻坦克师中放置步兵,从而减缓其速度。
  • target_template = { ... } 指定AI应力求达到的编制。特别地,这些参数放在其中:
    • weight = 0.8 是AI应该多大程度上去靠近这个编制。
    • match_value = 5000 是一个值,决定了如果与目标编制匹配,该编制对AI的价值。
    • support = { ... } 是目标编制内支援连的列表设定。单个定义的格式为 artillery = 1。先确定单位类型,再决定数量。由于只允许一个相同支援连的存在,因此数量不能是其他值,只能是 1。
    • regiments = { ... } 是目标编制内常规营的列表。单个定义的格式为 artillery_brigade = 4。首先确定单位类型,再确定值数量。

相同职能的编制将被汇总为同一个职能组,然后每个可用编制将会进行适应性评分计算,以确定哪个编制在特定的时刻与军事目标应当被使用。

代码示例

armor_BHR = {

    available_for = {
        BHR
    }

    roles = {
        armor
    }

    upgrade_prio = {
        factor = 2.17

        modifier = {
            factor = 7
            OR = {
                has_tech = basic_medium_tank
                has_tech = basic_medium_tank_chassis
            }
        }

        modifier = {
            factor = 2
            OR = {
                has_tech = main_battle_tank
                has_tech = main_battle_tank_chassis
            }
        }
    }

    match_to_count = 0.5

    medium_armor_BHR = {


        upgrade_prio = {
            factor = 2
        }

        target_width = 19.9
        width_weight = 3.0
        column_swap_factor = 0.1

        stat_weights = {
            0.00 #-- default_morale
            1.10 #-- defense
            1.10 #-- breakthrough
            1.60 #-- hardness
            1.00 #-- soft_attack
            2.00 #-- hard_attack
            0.10 #-- recon
            0.01 #-- entrenchment
            0.10 #-- initiative
            0.01 #-- casualty_trickleback
            -0.05 #-- supply_consumption_factor
            -0.01 #-- supply_consumption
            0.00 #-- suppression
            0.00 #-- suppression_factor
            0.01 #-- experience_loss_factor
            0.00 #-- equipment_capture_factor
            0.00 #-- fuel_capacity
            #-- Air Values
            0.02 #-- air_attack
            #-- Common Values
            50.00 #-- max_organisation
            0.80 #-- max_strength
            1.0 #-- maximum_speed
            10.0 #-- armor_value
            0.05 #-- ap_attack
            0.10 #-- reliability
            0.10 #-- reliability_factor
            0.00 #-- weight
            0.00 #-- fuel_consumption
            0.00 #-- fuel_consumption_factor
            0.00 #-- strat_attack
            0.00 #-- carrier_size
            0.00 #-- acc_hot_gain
            0.00 #-- acc_cold_gain
            0.00 #-- build_cost_ic
        }


        target_template = {
            weight = 0.9
            match_value = 7000.0

            support = {
                engineer = 1
                maintenance_company = 1
                logistics_company = 1
            }

            regiments = {
                medium_armor = 6
                motorized = 5
            }
        }

        allowed_types = {
            modern_armor
            medium_armor
            motorized
            mechanized
            infantry

            motorized_rocket_brigade

            engineer
            mot_recon
            armored_car_recon
            light_tank_recon
            signal_company
            maintenance_company
            logistics_company

            anti_tank
            military_police
            artillery
            anti_air
            rocket_artillery
        }

        replace_at_match = 0.8
        replace_with = modern_armor_BHR
        target_min_match = 0.5
    }

    modern_armor_BHR = {

        upgrade_prio = {
            factor = 2

            modifier = {
                factor = 1
            }
        }

        target_width = 19.9
        width_weight = 3.0
        column_swap_factor = 0.1

        stat_weights = {
            0.00 #-- default_morale
            1.10 #-- defense
            1.10 #-- breakthrough
            0.60 #-- hardness
            2.00 #-- soft_attack
            0.00 #-- hard_attack
            0.10 #-- recon
            0.01 #-- entrenchment
            0.10 #-- initiative
            0.01 #-- casualty_trickleback
            -0.05 #-- supply_consumption_factor
            -0.01 #-- supply_consumption
            0.00 #-- suppression
            0.00 #-- suppression_factor
            0.01 #-- experience_loss_factor
            0.00 #-- equipment_capture_factor
            0.00 #-- fuel_capacity
            #-- Air Values
            0.02 #-- air_attack
            #-- Common Values
            50.00 #-- max_organisation
            0.80 #-- max_strength
            10.0 #-- maximum_speed
            0.20 #-- armor_value
            0.05 #-- ap_attack
            0.10 #-- reliability
            0.10 #-- reliability_factor
            0.00 #-- weight
            0.00 #-- fuel_consumption
            0.00 #-- fuel_consumption_factor
            0.00 #-- strat_attack
            0.00 #-- carrier_size
            0.00 #-- acc_hot_gain
            0.00 #-- acc_cold_gain
            0.00 #-- build_cost_ic
        }

        target_template = {
            weight = 0.9
            match_value = 9000.0

            support = {
                engineer = 1
                recon = 1
                maintenance_company = 1
                logistics_company = 1
            }

            regiments = {
                modern_armor = 4
                mechanized = 3
                medium_sp_artillery_brigade = 2
            }
        }


        allowed_types = {
            modern_armor
            mechanized
            motorized_rocket_brigade
            medium_sp_artillery_brigade
            engineer
            recon
            signal_company
            maintenance_company
            logistics_company

            anti_tank
            military_police
            artillery
            anti_air
            rocket_artillery
        }
    }
}

AI 军事装备

/Hearts of Iron IV/common/ai_equipment/*.txt 文件用于定义AI在为坦克或舰船变体分配模块时应该追求的装备变体。

军事装备设计模板定义为文件夹内任何文件中的一个块,其名称与模板的名称相同。
这些参数用于装备模板设计本身:

  • category = <land|naval|air> 决定模板是用于坦克、舰船还是飞机。
  • roles = { ... } 是模板所具有的职能的列表。这些可以是任何内容,用于 role_ratio AI strategy。AI会尝试为他设计的每个职能装备拥有一个变体。
  • available_for = { ... } 处于列表外的国家将不能使用该装备模板。如果未指定,则所有国家均可使用。
  • blocked_for = { ... } 处于列表内的国家将不能使用该装备模板。只有在没有 available_for = { ... } 块时需要此项。
  • priority = { ... } 是一个 MTTH block ,决定该装备模板相对于其他模板在花费军事经验进行升级时的“重要性”。如果有多个装备模板具有相同的职能设计,则使用优先级最高的。除此之外这会决定与不同模板相比后选择的概率。

此外,在装备模板内,其中的独立设计被定义为一个块,名称为设计名称。在没有重复的前提下可以是任何内容。
这些参数用于设计定义中:

  • name = angry_speedboat 对于使该装备能够作为预设使用是必不可少的。若未定义,例如德国的 light_tank_artillery_2 将使用 GER_light_tank_artillery_equipment_2_short 的本地化(如果本地化已定义)。
  • role_icon_index = 2 用于为“舰船”分配特定的职能图标。此部分代码在陆地装备中无效。图标作为 naval_equipment_role = { ... } 的一部分在 /Hearts of Iron IV/gfx/army_icons/army_icons.txt 中定义。
  • priority = { ... } 是一个 MTTH block ,决定该设计相对于装备模板内其他槽位在花费军事经验进行升级时的“重要性”。
  • enable = { ... } 是一个触发块,决定AI何时会专注于达到该设计。
  • allowed_types = { ... } 是一个子单位的列表,AI可以将其添加到设计中。可以通过自定义去除其中的项来让AI不将其编入编制,例如可以使AI不在在机动轻型坦克师中加入步兵,防止师速度因此减慢。
  • target_variant = { ... } 指定AI应该追求的变体。具体来说,有如下参数:
    • match_value = 5000 用于决定如果现有编制匹配该模板,其对于AI的价值权重多少。
    • type = light_tank_chassis_0 是部队编制设计中必须使用的特定装备类型。
    • modules = { ... } 是装备应具备的模块列表,包括:
      • main_armament_slot = tank_flamethrower 决定指定模块槽的要求。该要求可以是模块类别、特定模块或是empty字符使其为空。如果指定为模块,可以使用greater-than(>)或less-than(<)以要求更好或更次的模块:以上根据模块中定义的年份决定。如果指定了更次,AI会倾向于最旧的模块;如果指定了更好,AI会倾向于最新的模块。如果指定为empty即空槽的情况下,使用greater-than(>)可以确保该槽位“不是”空的。
      • main_armament_slot = { ... } 允许为模块槽指定更多细节:
        • module = tank_flamethrower 决定该槽的模块要求。这与之前的 main_armament_slot = tank_flamethrower 完全相同:允许使用模块类别、模块或empty,并且可以以相同的方式使用等号。
        • any_of = { ... } 是一个模块或模块类别的列表。模块槽至少必须有列表中的一项。
        • upgrade = current 确保在将变体升级以匹配该设计时,必须使用与现有装备相同的模块。如果使用大于符号 (>),则还可要求AI对该槽进行部件升级。
    • upgrades = { ... } 是设计应具备的一系列升级,具体包括:
      • tank_nsb_engine_upgrade = 3 决定指定升级应具有的AI优先级,设定为一个固定数字。
      • tank_nsb_engine_upgrade = { ... } 是一个MTTH block,通过动态绑定分配AI对指定部件升级的优先级。
  • requirements = { ... } 是AI“必须”拥有的模块列表。它遵循与目标变体的模块块中指定的模块槽相同的格式:module = tank_flamethrowerany_of = { ... } 等。然而其并不与特定的槽相绑定。
  • allowed_modules = { ... } 是在满足目标变体中的要求后,AI可以使用的模块列表。AI将永远不会选择列表外的模块。首先指定的模块优先级高于后指定的。

代码示例

BHR_light_tanks = {
    category = land

    available_for = {BHR}

    roles = {
        land_light_tank
    }

    priority = {
        factor = 1000
    }

    great_war_tank_default = {
        priority = {
            factor = 1
            modifier = {
                has_tech = basic_light_tank_chassis
                factor = 0 #let's not waste XP here
            }
        }

        target_variant = {
            match_value = 1000
            type = light_tank_chassis_0
            modules = {
                main_armament_slot = tank_heavy_machine_gun
                turret_type_slot = tank_light_one_man_tank_turret
                suspension_type_slot = tank_bogie_suspension
                armor_type_slot = tank_riveted_armor
                engine_type_slot = tank_gasoline_engine
                special_type_slot_1 = empty
                special_type_slot_2 = empty
                special_type_slot_3 = empty
                special_type_slot_4 = empty
            }
            upgrades = {
                tank_nsb_engine_upgrade = 3
                tank_nsb_armor_upgrade = {
                    base = 1
                    modifier = {
                        add = 1
                        has_war = yes
                    }
                }
            }
        }

        allowed_modules = {
            tank_heavy_machine_gun
            tank_light_one_man_tank_turret
            tank_bogie_suspension
            tank_riveted_armor
            tank_gasoline_engine
        }
    }
}