Guest User

Updated trade performance with weight

a guest
Jun 30th, 2021
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.67 KB | None | 0 0
  1. ###_[贸易优化debug] <季度debug/初始化/设置完成> 参数统计/添加修正
  2. z_pf2_eft_cntr_trade_opt_debug = {
  3. if = {
  4. limit = {
  5. is_gestalt = no
  6. OR = {
  7. has_global_flag = z_pf2_flg_glbl_trade_ban #_[贸易禁止]
  8. AND = { is_ai = yes has_global_flag = z_pf2_flg_glbl_trade_opt } #_[贸易优化]
  9. }
  10. }
  11.  
  12. every_owned_planet = {
  13.  
  14. ###_[参数统计] init/人口/人力/贸易增值/贸易乘数/贸易权重/最值限定
  15. #_[init]
  16. set_variable = { which = z_pf2_var_plnt_trade_value_final value = 0 }
  17. #_[人口]
  18. # set_variable = { which = z_pf2_var_plnt_trade_value_pop value = 0 }
  19. # export_trigger_value_to_variable = { trigger = num_pops variable = z_pf2_var_plnt_trade_value_pop rounded = yes } #_[人口统计]
  20. # multiply_variable = { which = z_pf2_var_plnt_trade_value_pop value = 0.5 } #_[人口权重]
  21. # change_variable = { which = z_pf2_var_plnt_trade_value_final value = z_pf2_var_plnt_trade_value_pop }
  22. # clear_variable = z_pf2_var_plnt_trade_value_pop
  23. #_[人力]
  24. # change_variable = { which = z_pf2_var_plnt_trade_value_manpower value = 产业革命人力 } #_[产业革命]
  25. # multiply_variable = { which = z_pf2_var_plnt_trade_value_manpower value = 0.5 } #_[人力权重]
  26. # change_variable = { which = z_pf2_var_plnt_trade_value_final value = z_pf2_var_plnt_trade_value_manpower }
  27. # clear_variable = z_pf2_var_plnt_trade_value_manpower
  28. #_[贸易增值]
  29. export_modifier_to_variable = { modifier = trade_value_add variable = z_pf2_var_plnt_trade_value_add }
  30. change_variable = { which = z_pf2_var_plnt_trade_value_final value = z_pf2_var_plnt_trade_value_add }
  31. clear_variable = z_pf2_var_plnt_trade_value_add
  32.  
  33. #_[贸易乘数]
  34. export_modifier_to_variable = { modifier = trade_value_mult variable = z_pf2_var_plnt_trade_value_mult }
  35. change_variable = { which = z_pf2_var_plnt_trade_value_mult value = 1 }
  36. multiply_variable = { which = z_pf2_var_plnt_trade_value_final value = z_pf2_var_plnt_trade_value_mult }
  37. clear_variable = z_pf2_var_plnt_trade_value_mult
  38. #_[贸易权重]
  39. multiply_variable = { which = z_pf2_var_plnt_trade_value_final value = { scope = event_target:z_fw_tgt_global_event variable = z_pf2_var_npc0_trade_weight_set } }
  40. #_[最值限定]
  41. if = { limit = { check_variable = { which = z_pf2_var_plnt_trade_value_final value < 0 } } set_variable = { which = z_pf2_var_plnt_trade_value_final value = 0 } }
  42. #_[四舍五入]
  43. round_variable = z_pf2_var_plnt_trade_value_final
  44.  
  45. ###_[添加修正] 工整传统/vanilla
  46. #_[工整传统] 电/矿/食/科研/合金/消费/合金消费/凝聚/贸易联盟/颗粒/天然气/水晶/战略/活金属/泽洛/暗物质
  47. if = { limit = { has_global_flag = tidy_tradition_active }
  48. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_1e
  49. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_1m
  50. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_1f
  51. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_rr
  52. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_2a
  53. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_2c
  54. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_2ac
  55. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_ru
  56. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_league
  57. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_3vm
  58. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_3eg
  59. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_3rc
  60. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_3all
  61. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_srlm
  62. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_srzro
  63. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_srdm
  64. if = {#_[矿]
  65. limit = { owner = { has_policy_flag = trade_conversion_minerals } }
  66. add_modifier = {
  67. modifier = z_pf2_mod_plnt_trade_opt_tt_1m
  68. days = 97
  69. multiplier = z_pf2_var_plnt_trade_value_final
  70. clear_on_owner_change = yes
  71. }
  72. }
  73. else_if = {#_[食]
  74. limit = { owner = { has_policy_flag = trade_conversion_food } }
  75. add_modifier = {
  76. modifier = z_pf2_mod_plnt_trade_opt_tt_1f
  77. days = 97
  78. multiplier = z_pf2_var_plnt_trade_value_final
  79. clear_on_owner_change = yes
  80. }
  81. }
  82. else_if = {#_[科研]
  83. limit = { owner = { has_policy_flag = trade_conversion_research } }
  84. add_modifier = {
  85. modifier = z_pf2_mod_plnt_trade_opt_tt_rr
  86. days = 97
  87. multiplier = z_pf2_var_plnt_trade_value_final
  88. clear_on_owner_change = yes
  89. }
  90. }
  91. else_if = {#_[合金]
  92. limit = { owner = { has_policy_flag = trade_conversion_alloys } }
  93. add_modifier = {
  94. modifier = z_pf2_mod_plnt_trade_opt_tt_2a
  95. days = 97
  96. multiplier = z_pf2_var_plnt_trade_value_final
  97. clear_on_owner_change = yes
  98. }
  99. }
  100. else_if = {#_[消费]
  101. limit = { owner = { has_policy_flag = trade_conversion_consumer_goods } }
  102. add_modifier = {
  103. modifier = z_pf2_mod_plnt_trade_opt_tt_2c
  104. days = 97
  105. multiplier = z_pf2_var_plnt_trade_value_final
  106. clear_on_owner_change = yes
  107. }
  108. }
  109. else_if = {#_[合金消费]
  110. limit = { owner = { has_policy_flag = trade_conversion_alloys_and_consumer_goods } }
  111. add_modifier = {
  112. modifier = z_pf2_mod_plnt_trade_opt_tt_2ac
  113. days = 97
  114. multiplier = z_pf2_var_plnt_trade_value_final
  115. clear_on_owner_change = yes
  116. }
  117. }
  118. else_if = {#_[凝聚]
  119. limit = { owner = { has_policy_flag = trade_conversion_unity } }
  120. add_modifier = {
  121. modifier = z_pf2_mod_plnt_trade_opt_tt_ru
  122. days = 97
  123. multiplier = z_pf2_var_plnt_trade_value_final
  124. clear_on_owner_change = yes
  125. }
  126. }
  127. else_if = {#_[贸易联盟]
  128. limit = { owner = { has_policy_flag = trade_conversion_trade_league } }
  129. add_modifier = {
  130. modifier = z_pf2_mod_plnt_trade_opt_tt_league
  131. days = 97
  132. multiplier = z_pf2_var_plnt_trade_value_final
  133. clear_on_owner_change = yes
  134. }
  135. }
  136. else_if = {#_[颗粒]
  137. limit = { owner = { has_policy_flag = trade_conversion_volatile_motes } }
  138. add_modifier = {
  139. modifier = z_pf2_mod_plnt_trade_opt_tt_3vm
  140. days = 97
  141. multiplier = z_pf2_var_plnt_trade_value_final
  142. clear_on_owner_change = yes
  143. }
  144. }
  145. else_if = {#_[天然气]
  146. limit = { owner = { has_policy_flag = trade_conversion_exotic_gases } }
  147. add_modifier = {
  148. modifier = z_pf2_mod_plnt_trade_opt_tt_3eg
  149. days = 97
  150. multiplier = z_pf2_var_plnt_trade_value_final
  151. clear_on_owner_change = yes
  152. }
  153. }
  154. else_if = {#_[水晶]
  155. limit = { owner = { has_policy_flag = trade_conversion_rare_crystals } }
  156. add_modifier = {
  157. modifier = z_pf2_mod_plnt_trade_opt_tt_3rc
  158. days = 97
  159. multiplier = z_pf2_var_plnt_trade_value_final
  160. clear_on_owner_change = yes
  161. }
  162. }
  163. else_if = {#_[战略]
  164. limit = { owner = { has_policy_flag = trade_conversion_advanced_resources } }
  165. add_modifier = {
  166. modifier = z_pf2_mod_plnt_trade_opt_tt_3all
  167. days = 97
  168. multiplier = z_pf2_var_plnt_trade_value_final
  169. clear_on_owner_change = yes
  170. }
  171. }
  172. else_if = {#_[活金属]
  173. limit = { owner = { has_policy_flag = trade_conversion_sr_living_metal } }
  174. add_modifier = {
  175. modifier = z_pf2_mod_plnt_trade_opt_tt_srlm
  176. days = 97
  177. multiplier = z_pf2_var_plnt_trade_value_final
  178. clear_on_owner_change = yes
  179. }
  180. }
  181. else_if = {#_[泽洛]
  182. limit = { owner = { has_policy_flag = trade_conversion_sr_zro } }
  183. add_modifier = {
  184. modifier = z_pf2_mod_plnt_trade_opt_tt_srzro
  185. days = 97
  186. multiplier = z_pf2_var_plnt_trade_value_final
  187. clear_on_owner_change = yes
  188. }
  189. }
  190. else_if = {#_[暗物质]
  191. limit = { owner = { has_policy_flag = trade_conversion_sr_dark_matter } }
  192. add_modifier = {
  193. modifier = z_pf2_mod_plnt_trade_opt_tt_srdm
  194. days = 97
  195. multiplier = z_pf2_var_plnt_trade_value_final
  196. clear_on_owner_change = yes
  197. }
  198. }
  199. else = {#_[电]
  200. add_modifier = {
  201. modifier = z_pf2_mod_plnt_trade_opt_tt_1e
  202. days = 97
  203. multiplier = z_pf2_var_plnt_trade_value_final
  204. clear_on_owner_change = yes
  205. }
  206. }
  207. }
  208. #_[vanilla] 消费品/凝聚/联盟/普通
  209. else = {
  210. remove_modifier = z_pf2_mod_plnt_trade_opt_goods
  211. remove_modifier = z_pf2_mod_plnt_trade_opt_unity
  212. remove_modifier = z_pf2_mod_plnt_trade_opt_league
  213. remove_modifier = z_pf2_mod_plnt_trade_opt_normal
  214. if = {#_[消费品]
  215. limit = { owner = { has_policy_flag = trade_conversion_consumer_goods } }
  216. add_modifier = {
  217. modifier = z_pf2_mod_plnt_trade_opt_goods
  218. days = 97
  219. multiplier = z_pf2_var_plnt_trade_value_final
  220. clear_on_owner_change = yes
  221. }
  222. }
  223. else_if = {#_[凝聚]
  224. limit = { owner = { has_policy_flag = trade_conversion_unity } }
  225. add_modifier = {
  226. modifier = z_pf2_mod_plnt_trade_opt_unity
  227. days = 97
  228. multiplier = z_pf2_var_plnt_trade_value_final
  229. clear_on_owner_change = yes
  230. }
  231. }
  232. else_if = {#_[联盟]
  233. limit = { owner = { has_policy_flag = trade_conversion_trade_league } }
  234. add_modifier = {
  235. modifier = z_pf2_mod_plnt_trade_opt_league
  236. days = 97
  237. multiplier = z_pf2_var_plnt_trade_value_final
  238. clear_on_owner_change = yes
  239. }
  240. }
  241. else = {#_[普通]
  242. add_modifier = {
  243. modifier = z_pf2_mod_plnt_trade_opt_normal
  244. days = 97
  245. multiplier = z_pf2_var_plnt_trade_value_final
  246. clear_on_owner_change = yes
  247. }
  248. }
  249. }
  250. }
  251. set_variable = {
  252. which = z_pf2_var_body_trade_value_tally
  253. value = 0
  254. }
  255. every_planet_within_border = {
  256. limit = {
  257. is_colony = no
  258. }
  259. export_modifier_to_variable = {
  260. modifier = trade_value_add
  261. variable = z_pf2_var_body_trade_value_tally
  262. }
  263. root = {
  264. change_variable = {
  265. which = z_pf2_var_body_trade_value_tally
  266. value = prev
  267. }
  268. }
  269. }
  270. export_modifier_to_variable = { modifier = trade_value_mult variable = z_pf2_var_body_trade_value_tally_mult }
  271. change_variable = { which = z_pf2_var_body_trade_value_tally_mult value = 1 }
  272. multiply_variable = { which = z_pf2_var_body_trade_value_tally value = z_pf2_var_body_trade_value_tally_mult }
  273. clear_variable = z_pf2_var_body_trade_value_tally_mult
  274. multiply_variable = { which = z_pf2_var_body_trade_value_tally value = { scope = event_target:z_fw_tgt_global_event variable = z_pf2_var_npc0_trade_weight_set } }
  275. round_variable = z_pf2_var_body_trade_value_tally
  276.  
  277.  
  278. ###_[添加修正] 工整传统/vanilla
  279. #_[工整传统] 电/矿/食/科研/合金/消费/合金消费/凝聚/贸易联盟/颗粒/天然气/水晶/战略/活金属/泽洛/暗物质
  280. if = { limit = { has_global_flag = tidy_tradition_active }
  281. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_1e
  282. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_1m
  283. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_1f
  284. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_rr
  285. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_2a
  286. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_2c
  287. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_2ac
  288. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_ru
  289. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_league
  290. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_3vm
  291. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_3eg
  292. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_3rc
  293. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_3all
  294. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_srlm
  295. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_srzro
  296. remove_modifier = z_pf2_mod_plnt_trade_opt_tt_srdm
  297. if = {#_[矿]
  298. limit = { has_policy_flag = trade_conversion_minerals }
  299. add_modifier = {
  300. modifier = z_pf2_mod_plnt_trade_opt_tt_1m
  301. days = 97
  302. multiplier = z_pf2_var_body_trade_value_tally
  303.  
  304. }
  305. }
  306. else_if = {#_[食]
  307. limit = { has_policy_flag = trade_conversion_food }
  308. add_modifier = {
  309. modifier = z_pf2_mod_plnt_trade_opt_tt_1f
  310. days = 97
  311. multiplier = z_pf2_var_body_trade_value_tally
  312.  
  313. }
  314. }
  315. else_if = {#_[科研]
  316. limit = { has_policy_flag = trade_conversion_research }
  317. add_modifier = {
  318. modifier = z_pf2_mod_plnt_trade_opt_tt_rr
  319. days = 97
  320. multiplier = z_pf2_var_body_trade_value_tally
  321.  
  322. }
  323. }
  324. else_if = {#_[合金]
  325. limit = { has_policy_flag = trade_conversion_alloys }
  326. add_modifier = {
  327. modifier = z_pf2_mod_plnt_trade_opt_tt_2a
  328. days = 97
  329. multiplier = z_pf2_var_body_trade_value_tally
  330.  
  331. }
  332. }
  333. else_if = {#_[消费]
  334. limit = { has_policy_flag = trade_conversion_consumer_goods }
  335. add_modifier = {
  336. modifier = z_pf2_mod_plnt_trade_opt_tt_2c
  337. days = 97
  338. multiplier = z_pf2_var_body_trade_value_tally
  339.  
  340. }
  341. }
  342. else_if = {#_[合金消费]
  343. limit = { has_policy_flag = trade_conversion_alloys_and_consumer_goods }
  344. add_modifier = {
  345. modifier = z_pf2_mod_plnt_trade_opt_tt_2ac
  346. days = 97
  347. multiplier = z_pf2_var_body_trade_value_tally
  348.  
  349. }
  350. }
  351. else_if = {#_[凝聚]
  352. limit = { has_policy_flag = trade_conversion_unity }
  353. add_modifier = {
  354. modifier = z_pf2_mod_plnt_trade_opt_tt_ru
  355. days = 97
  356. multiplier = z_pf2_var_body_trade_value_tally
  357.  
  358. }
  359. }
  360. else_if = {#_[贸易联盟]
  361. limit = { has_policy_flag = trade_conversion_trade_league }
  362. add_modifier = {
  363. modifier = z_pf2_mod_plnt_trade_opt_tt_league
  364. days = 97
  365. multiplier = z_pf2_var_body_trade_value_tally
  366.  
  367. }
  368. }
  369. else_if = {#_[颗粒]
  370. limit = { has_policy_flag = trade_conversion_volatile_motes }
  371. add_modifier = {
  372. modifier = z_pf2_mod_plnt_trade_opt_tt_3vm
  373. days = 97
  374. multiplier = z_pf2_var_body_trade_value_tally
  375.  
  376. }
  377. }
  378. else_if = {#_[天然气]
  379. limit = { has_policy_flag = trade_conversion_exotic_gases }
  380. add_modifier = {
  381. modifier = z_pf2_mod_plnt_trade_opt_tt_3eg
  382. days = 97
  383. multiplier = z_pf2_var_body_trade_value_tally
  384.  
  385. }
  386. }
  387. else_if = {#_[水晶]
  388. limit = { has_policy_flag = trade_conversion_rare_crystals }
  389. add_modifier = {
  390. modifier = z_pf2_mod_plnt_trade_opt_tt_3rc
  391. days = 97
  392. multiplier = z_pf2_var_body_trade_value_tally
  393.  
  394. }
  395. }
  396. else_if = {#_[战略]
  397. limit = { has_policy_flag = trade_conversion_advanced_resources }
  398. add_modifier = {
  399. modifier = z_pf2_mod_plnt_trade_opt_tt_3all
  400. days = 97
  401. multiplier = z_pf2_var_body_trade_value_tally
  402.  
  403. }
  404. }
  405. else_if = {#_[活金属]
  406. limit = { has_policy_flag = trade_conversion_sr_living_metal }
  407. add_modifier = {
  408. modifier = z_pf2_mod_plnt_trade_opt_tt_srlm
  409. days = 97
  410. multiplier = z_pf2_var_body_trade_value_tally
  411.  
  412. }
  413. }
  414. else_if = {#_[泽洛]
  415. limit = { has_policy_flag = trade_conversion_sr_zro }
  416. add_modifier = {
  417. modifier = z_pf2_mod_plnt_trade_opt_tt_srzro
  418. days = 97
  419. multiplier = z_pf2_var_body_trade_value_tally
  420.  
  421. }
  422. }
  423. else_if = {#_[暗物质]
  424. limit = { has_policy_flag = trade_conversion_sr_dark_matter }
  425. add_modifier = {
  426. modifier = z_pf2_mod_plnt_trade_opt_tt_srdm
  427. days = 97
  428. multiplier = z_pf2_var_body_trade_value_tally
  429.  
  430. }
  431. }
  432. else = {#_[电]
  433. add_modifier = {
  434. modifier = z_pf2_mod_plnt_trade_opt_tt_1e
  435. days = 97
  436. multiplier = z_pf2_var_body_trade_value_tally
  437.  
  438. }
  439. }
  440. }
  441. #_[vanilla] 消费品/凝聚/联盟/普通 #_[消费品]
  442. else = {
  443. remove_modifier = z_pf2_mod_plnt_trade_opt_goods
  444. remove_modifier = z_pf2_mod_plnt_trade_opt_unity
  445. remove_modifier = z_pf2_mod_plnt_trade_opt_league
  446. remove_modifier = z_pf2_mod_plnt_trade_opt_normal
  447. if = {
  448. limit = { has_policy_flag = trade_conversion_consumer_goods }
  449. add_modifier = {
  450. modifier = z_pf2_mod_plnt_trade_opt_goods
  451. days = 97
  452. multiplier = z_pf2_var_body_trade_value_tally
  453.  
  454. }
  455. }
  456. else_if = {#_[凝聚]
  457. limit = { has_policy_flag = trade_conversion_unity }
  458. add_modifier = {
  459. modifier = z_pf2_mod_plnt_trade_opt_unity
  460. days = 97
  461. multiplier = z_pf2_var_body_trade_value_tally
  462.  
  463. }
  464. }
  465. else_if = {#_[联盟]
  466. limit = { has_policy_flag = trade_conversion_trade_league }
  467. add_modifier = {
  468. modifier = z_pf2_mod_plnt_trade_opt_league
  469. days = 97
  470. multiplier = z_pf2_var_body_trade_value_tally
  471.  
  472. }
  473. }
  474. else = {#_[普通]
  475. add_modifier = {
  476. modifier = z_pf2_mod_plnt_trade_opt_normal
  477. days = 97
  478. multiplier = z_pf2_var_body_trade_value_tally
  479.  
  480. }
  481. }
  482. }
  483. }
  484. }
Advertisement
Add Comment
Please, Sign In to add comment