Advertisement
L00K3

ZenForestNothing.per

Oct 22nd, 2021
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.75 KB | None | 0 0
  1. ;------
  2. ;
  3. ;------
  4. ;Generated by AoE2DE AI Builder
  5.  
  6. ;***Set Constants***
  7. ;---GENERAL---
  8. (defconst yes 1)
  9. (defconst no 0)
  10.  
  11. ;---GOALS---
  12. (defconst unit1 my-unique-unit-line)
  13. (defconst unit2 my-unique-unit-line)
  14. (defconst unit3 monk)
  15. (defconst unit4 my-unique-unit-line)
  16. (defconst unit5 my-unique-unit-line)
  17. (defconst siege1 trebuchet)
  18. (defconst siege2 trebuchet)
  19. (defconst siege3 trebuchet)
  20. (defconst blacksmith-techs 5)
  21. (defconst military-techs 6)
  22. (defconst economic-techs 7)
  23. (defconst university-techs 8)
  24. (defconst monastery-techs 9)
  25. (defconst dock-techs 10)
  26. (defconst house-goal 11)
  27. (defconst end-age 12)
  28. (defconst use-market 14)
  29. (defconst default-resign 15)
  30. (defconst allow-advancing 16)
  31. (defconst allow-signal 17)
  32. (defconst active-at-start 18)
  33. (defconst activate 19)
  34. (defconst combi 20)
  35. (defconst dark 78)
  36. (defconst df-transit 79)
  37. (defconst feudal 80)
  38. (defconst fc-transit 81)
  39. (defconst castle 82)
  40. (defconst ci-transit 83)
  41. (defconst imperial 84)
  42.  
  43. ;---POS CONSTS---
  44. (defconst pos-self 100)
  45. (defconst pos-self-y 101)
  46. (defconst pos-obj 102)
  47. (defconst pos-obj-y 103)
  48. (defconst pos-tc-x 104)
  49. (defconst pos-tc-y 105)
  50.  
  51. ;---UNIT CONSTS---
  52. (defconst villager-class 904)
  53.  
  54. ;---AGE CONST---
  55. (defconst game-time 0)
  56. (defconst current-age 19)
  57. (defconst imperial-food 1100)
  58. (defconst imperial-gold 900)
  59. (defconst castle-food 900)
  60. (defconst castle-gold 300)
  61. (defconst feudal-food 550)
  62. (defconst villager-feudal 4)
  63. (defconst villager-castle 50)
  64.  
  65. ;---ATTACKS---
  66. (defconst standby 0)
  67. (defconst offence 1)
  68. (defconst reset-attack 2)
  69. (defconst attack-goal 3)
  70.  
  71. ;---TIMERS---
  72. (defconst attack-timer 2)
  73. (defconst interval-timer 3)
  74. (defconst timer-build-retry 6)
  75. (defconst timer-house-retry 7)
  76.  
  77. ;---UPGRADES---
  78. (defconst food-escrow 0)
  79. (defconst wood-escrow 0)
  80. (defconst gold-escrow 0)
  81. (defconst stone-escrow 0)
  82.  
  83. ;---SN CONSTS---
  84. (defconst sn-percent-building-cancellation 60)
  85. (defconst sn-current-age dark)
  86. (defconst sn-max-drop-distance 10)
  87. (defconst sn-max-drop-site 30)
  88. (defconst sn-max-barracks 0)
  89. (defconst sn-max-archer 0)
  90. (defconst sn-max-stable 0)
  91. (defconst sn-max-siege 0)
  92. (defconst sn-max-monestry 1)
  93. (defconst sn-max-tc 1)
  94. (defconst sn-max-castle 1)
  95. (defconst sn-max-donjon 0)
  96. (defconst sn-max-blacksmith 1)
  97. (defconst sn-max-market 1)
  98. (defconst sn-max-university 1)
  99. (defconst sn-max-unit1 0)
  100. (defconst sn-max-unit2 0)
  101. (defconst sn-max-unit3 0)
  102. (defconst sn-max-unit4 0)
  103. (defconst sn-max-unit5 0)
  104. (defconst sn-max-unit6 0)
  105. (defconst sn-max-unit7 0)
  106. (defconst sn-max-siege1 0)
  107. (defconst sn-max-siege2 0)
  108. (defconst sn-max-siege3 0)
  109.  
  110. ;---VALID RESEARCH---
  111. (defconst research-melee-atk 0)
  112. (defconst research-melee-def 0)
  113. (defconst research-archer 0)
  114. (defconst research-cavalry 0)
  115. (defconst research-siege 0)
  116. (defconst research-monk 0)
  117.  
  118. ;---FLAGS---
  119. (defconst flag-mill-progress 0)
  120. (defconst flag-market-progress 0)
  121.  
  122. ;---OTHERS---
  123. (defconst max-vills 100)
  124. (defconst max-farms 8)
  125. (defconst max-pending-house 2)
  126. (defconst min-headroom 5)
  127. (defconst min-farm-head 2)
  128. (defconst task-soldiers yes)
  129.  
  130. ;***Setup***
  131. ;---Load Externals---
  132. ;load extra files. These files are generic and take care of the resigning of the AI, its upgrades and the active use of the market.
  133.  
  134. ;Load ZenAI
  135. (load "ZenAI\UnitComp")
  136. (load "ZenAI\AgeUp")
  137. (load "ZenAI\ri_multi")
  138.  
  139. ;DEBUG
  140. (defrule
  141. (resource-found wood)
  142. =>
  143. (chat-local-to-self "Wood Found")
  144. (disable-self)
  145. )
  146.  
  147. ;***ECO BEHAVIOUR***
  148. (defrule
  149. (or
  150. (game-time > 300)
  151. (unit-type-count-total villager > 14)
  152. )
  153. =>
  154. (set-strategic-number sn-wood-gatherer-percentage 80)
  155. (set-strategic-number sn-food-gatherer-percentage 20)
  156. (set-strategic-number sn-placement-zone-size 15)
  157. (set-strategic-number sn-maximum-town-size 25)
  158. (disable-self)
  159. )
  160. (defrule
  161. (or
  162. (game-time > 600)
  163. (unit-type-count-total villager > 35)
  164. )
  165. =>
  166. (set-strategic-number sn-wood-gatherer-percentage 70)
  167. (set-strategic-number sn-food-gatherer-percentage 30)
  168. (set-strategic-number sn-placement-zone-size 22)
  169. (set-strategic-number sn-maximum-town-size 30)
  170. (disable-self)
  171. )
  172. (defrule
  173. (or
  174. (game-time > 900)
  175. (unit-type-count-total villager > 45)
  176. )
  177. =>
  178. (set-strategic-number sn-wood-gatherer-percentage 60)
  179. (set-strategic-number sn-food-gatherer-percentage 40)
  180. (set-strategic-number sn-placement-zone-size 30)
  181. (set-strategic-number sn-maximum-town-size 40)
  182. (disable-self)
  183. )
  184. (defrule
  185. (or
  186. (game-time > 1200)
  187. (unit-type-count-total villager > 55)
  188. )
  189. =>
  190. (set-strategic-number sn-percent-civilian-builders 20)
  191. (set-strategic-number sn-percent-civilian-gatherers 80)
  192. (set-strategic-number sn-wood-gatherer-percentage 50)
  193. (set-strategic-number sn-food-gatherer-percentage 50)
  194. (set-strategic-number sn-placement-zone-size 40)
  195. (set-strategic-number sn-maximum-town-size 55)
  196. (disable-self)
  197. )
  198. (defrule
  199. (or
  200. (game-time > 2400)
  201. (unit-type-count-total villager > 65)
  202. )
  203. =>
  204. (set-strategic-number sn-percent-civilian-builders 10)
  205. (set-strategic-number sn-percent-civilian-gatherers 89)
  206. (set-strategic-number sn-percent-civilian-explorers 1)
  207. (set-strategic-number sn-number-explore-groups 1)
  208. (set-strategic-number sn-total-number-explorers 1)
  209. (disable-self)
  210. )
  211.  
  212. ;***Civ Behaviour***
  213. ;---DEFAULT BEHAVIOURS---
  214. ;Set Init SN Values
  215. (defrule
  216. (true)
  217. =>
  218. (up-change-name -1)
  219. (set-strategic-number sn-percent-civilian-builders 50)
  220. (set-strategic-number sn-percent-civilian-gatherers 50)
  221. (set-strategic-number sn-percent-civilian-explorers 0)
  222. (set-strategic-number sn-number-explore-groups 0)
  223. (set-strategic-number sn-total-number-explorers 0)
  224. (set-strategic-number sn-food-gatherer-percentage 0)
  225. (set-strategic-number sn-wood-gatherer-percentage 100)
  226. (set-strategic-number sn-gold-gatherer-percentage 0)
  227. (set-strategic-number sn-stone-gatherer-percentage 0)
  228. (set-strategic-number sn-initial-exploration-required 0)
  229. (set-strategic-number sn-percent-exploration-required 0)
  230. (set-strategic-number sn-random-placement-factor 0)
  231. (set-strategic-number sn-placement-zone-size 10)
  232. (set-goal house-goal 0)
  233. (enable-timer timer-house-retry 5)
  234. (disable-self)
  235. )
  236.  
  237. ;Disable first mill if Khmer
  238. #load-if-defined KHMER-CIV
  239. (defrule
  240. (true)
  241. =>
  242. (set-strategic-number flag-mill-progress 2)
  243. );
  244. #end-if
  245.  
  246. ;Build Mill if NOT Khmer
  247. (defrule
  248. (and
  249. (and
  250. (and
  251. (and
  252. (not (civ-selected khmer))
  253. (building-type-count-total house >= 2)
  254. )
  255. (building-type-count-total mill == 0)
  256. )
  257. (and
  258. (up-compare-const flag-mill-progress <= 1)
  259. (timer-triggered timer-build-retry)
  260. )
  261. )
  262. (up-can-build 0 c: mill)
  263. )
  264. =>
  265. (set-strategic-number flag-mill-progress 1)
  266. (disable-timer timer-build-retry)
  267. (enable-timer timer-build-retry 10)
  268. (up-full-reset-search)
  269. (up-find-local c: villager-class c: 240)
  270. (up-set-target-object search-local c: 0)
  271. (up-get-point position-object pos-obj)
  272. (up-get-point position-self pos-tc-x)
  273. (up-lerp-tiles pos-obj pos-tc-x c: -1)
  274. (up-build-line pos-obj pos-obj c: mill)
  275. (chat-local-to-self "Building 1st Mill")
  276. )
  277.  
  278. ;(defconst flag-market-progress 0)
  279.  
  280. ;Destroy First Mill (Not needed for now, waste of space)
  281. (defrule
  282. (building-type-count mill == 1)
  283. =>
  284. (set-strategic-number flag-mill-progress 2)
  285. (delete-building mill)
  286. (disable-self)
  287. )
  288.  
  289. ;Build 2nd Mill (1st if Khmer)
  290. (defrule
  291. (and
  292. (and
  293. (and
  294. (and
  295. (not (civ-selected khmer))
  296. (building-type-count-total house >= 2)
  297. )
  298. (building-type-count-total mill == 0)
  299. )
  300. (or
  301. (up-compare-const flag-mill-progress == 2)
  302. (timer-triggered timer-build-retry)
  303. )
  304. )
  305. (up-can-build 0 c: mill)
  306. )
  307. =>
  308. (set-strategic-number flag-mill-progress 3)
  309. (up-full-reset-search)
  310. (up-find-local c: villager-class c: 240)
  311. (up-set-target-object search-local c: 0)
  312. (up-get-point position-object pos-obj)
  313. (up-get-point position-self pos-tc-x)
  314. (up-lerp-tiles pos-obj pos-tc-x c: -1)
  315. (up-build-line pos-obj pos-obj c: mill)
  316. (disable-timer timer-build-retry)
  317. (enable-timer timer-build-retry 10)
  318. (chat-local-to-self "Building 2nd Mill")
  319. )
  320.  
  321. ;Build Market on Age Up
  322. (defrule
  323. (and
  324. (and
  325. (current-age == feudal-age)
  326. (up-can-build 0 c: market)
  327. )
  328. (or
  329. (up-compare-const flag-mill-progress == 3)
  330. (timer-triggered timer-build-retry)
  331. )
  332. )
  333. =>
  334. (set-strategic-number flag-mill-progress 4)
  335. (delete-building town-center)
  336. (up-set-target-point pos-tc-x)
  337. (up-build place-point 0 c: market)
  338. (disable-timer timer-build-retry)
  339. (enable-timer timer-build-retry 15)
  340. ;(up-full-reset-search)
  341. ;(up-find-local c: villager-class c: 240)
  342. ;(up-set-target-object search-local c: 0)
  343. ;(up-get-point position-object pos-obj)
  344. ;(up-get-point position-self pos-tc-x)
  345. ;(up-lerp-tiles pos-obj pos-tc-x c: -1)
  346. ;(up-build-line pos-obj pos-obj c: market)
  347. (chat-local-to-self "Building Market")
  348. )
  349.  
  350. ;Delete 2nd Mill
  351. (defrule
  352. (building-type-count-total market == 1)
  353. =>
  354. (set-strategic-number flag-mill-progress 5)
  355. (delete-building mill)
  356. (disable-self)
  357. )
  358.  
  359. ;First Sale
  360. (defrule
  361. (building-type-count market == 1)
  362. (up-compare-const flag-market-progress == 0)
  363. (wood-amount >= 400)
  364. (can-sell-commodity wood)
  365. =>
  366. (sell-commodity wood)
  367. )
  368. (defrule
  369. (up-compare-const flag-market-progress == 0)
  370. (wood-amount < 400)
  371. =>
  372. (set-strategic-number flag-market-progress 1)
  373. )
  374.  
  375. ;First Buy Food
  376. (defrule
  377. (up-compare-const flag-market-progress == 1)
  378. (food-amount <= 1500)
  379. (gold-amount >= 2000)
  380. (can-buy-commodity food)
  381. =>
  382. (sell-commodity food)
  383. )
  384. (defrule
  385. (up-compare-const flag-market-progress == 1)
  386. (food-amount > 1500)
  387. (gold-amount < 2000)
  388. =>
  389. (set-strategic-number flag-market-progress 2)
  390. )
  391.  
  392. ;First Buy Stone
  393. (defrule
  394. (up-compare-const flag-market-progress == 2)
  395. (stone-amount <= 800)
  396. (gold-amount >= 2500)
  397. (can-buy-commodity stone)
  398. =>
  399. (sell-commodity stone)
  400. )
  401. (defrule
  402. (up-compare-const flag-market-progress == 2)
  403. (food-amount > 1500)
  404. (gold-amount < 2000)
  405. =>
  406. (set-strategic-number flag-market-progress 3)
  407. )
  408. (defrule
  409. (up-compare-const flag-market-progress == 3)
  410. =>
  411. (set-strategic-number flag-market-progress 4)
  412. (delete-building market)
  413. (disable-self)
  414. )
  415.  
  416. ;Rebuild TC
  417. (defrule
  418. (and
  419. (or
  420. (up-compare-const flag-market-progress == 4)
  421. (timer-triggered timer-build-retry)
  422. )
  423. (up-can-build 0 c: town-center)
  424. )
  425. =>
  426. (set-strategic-number flag-market-progress 5)
  427. (up-set-target-point pos-tc-x)
  428. (up-build place-point 0 c: town-center)
  429. (disable-timer timer-build-retry)
  430. (enable-timer timer-build-retry 45)
  431. (chat-local-to-self "Building Town Center")
  432. )
  433.  
  434. ;---Active Behaviour---
  435. ;when activated the AI will begin to play
  436. (defrule
  437. (true)
  438. =>
  439. (set-strategic-number sn-mill-max-distance 10)
  440. (set-strategic-number sn-maximum-gold-drop-distance 10)
  441. (set-strategic-number sn-maximum-stone-drop-distance 10)
  442. (set-strategic-number sn-maximum-food-drop-distance 10)
  443. (set-strategic-number sn-maximum-wood-drop-distance 10)
  444. (set-strategic-number sn-task-ungrouped-soldiers task-soldiers)
  445. (disable-self)
  446. )
  447. ;***AI Behaviour***
  448. ;-----Dodging rules-----
  449. ;ability of the AI to dodge enemy missiles shot at them and maintaining distance when engaging with enemies. The lower the number how better they are at it.
  450. (defrule
  451. (difficulty == easiest)
  452. =>
  453. (set-difficulty-parameter ability-to-maintain-distance 90)
  454. (set-difficulty-parameter ability-to-dodge-missiles 90)
  455. (disable-self)
  456. )
  457. (defrule
  458. (difficulty == easy)
  459. =>
  460. (set-difficulty-parameter ability-to-maintain-distance 70)
  461. (set-difficulty-parameter ability-to-dodge-missiles 70)
  462. (disable-self)
  463. )
  464. (defrule
  465. (difficulty == moderate)
  466. =>
  467. (set-difficulty-parameter ability-to-maintain-distance 50)
  468. (set-difficulty-parameter ability-to-dodge-missiles 50)
  469. (disable-self)
  470. )
  471. (defrule
  472. (difficulty == hard)
  473. =>
  474. (set-difficulty-parameter ability-to-maintain-distance 30)
  475. (set-difficulty-parameter ability-to-dodge-missiles 30)
  476. (disable-self)
  477. )
  478. (defrule
  479. (difficulty == hardest)
  480. =>
  481. (set-difficulty-parameter ability-to-maintain-distance 0)
  482. (set-difficulty-parameter ability-to-dodge-missiles 0)
  483. (disable-self)
  484. )
  485.  
  486. ;***Production***
  487. ;---Homebase Stats---
  488. (defrule
  489. (true)
  490. =>
  491. (set-strategic-number sn-maximum-town-size 40)
  492. (set-strategic-number sn-camp-max-distance sn-max-drop-distance)
  493. (set-strategic-number sn-mill-max-distance sn-max-drop-distance)
  494. (set-strategic-number sn-percent-enemy-sighted-response 50)
  495. (set-strategic-number sn-enemy-sighted-response-distance 15)
  496. (set-strategic-number sn-blot-exploration-map 0)
  497. (set-strategic-number sn-sentry-distance 20)
  498. (disable-self)
  499. )
  500.  
  501. ;---Farming and Civilians---
  502. (defrule
  503. (building-type-count-total farm < max-farms)
  504. (idle-farm-count <= min-farm-head)
  505. (can-build farm)
  506. =>
  507. (build farm)
  508. )
  509. (defrule
  510. (and
  511. (unit-type-count-total villager < max-vills)
  512. (and
  513. (can-train villager)
  514. (population-headroom >= 1)
  515. )
  516. )
  517. =>
  518. (train villager)
  519. )
  520. ;---Economic Buildings---
  521. (defrule
  522. (building-type-count-total town-center < sn-max-tc)
  523. (can-build town-center)
  524. =>
  525. (build town-center)
  526. )
  527. (defrule
  528. (and
  529. (goal house-goal 0)
  530. (and
  531. (and
  532. (timer-triggered timer-house-retry)
  533. (up-pending-objects c: house < max-pending-house)
  534. )
  535. (and
  536. (housing-headroom less-than min-headroom)
  537. (population-headroom greater-than 0)
  538. )
  539. )
  540. )
  541. =>
  542. (set-goal house-goal 1)
  543. (up-full-reset-search)
  544. (up-find-local c: villager-class c: 240)
  545. (up-set-target-object search-local c: 0)
  546. (up-get-point position-object pos-obj)
  547. (up-lerp-tiles pos-obj pos-tc-x c: -1)
  548. (up-build-line pos-obj pos-obj c: house)
  549. (set-goal house-goal 0)
  550. (disable-timer timer-house-retry)
  551. (enable-timer timer-house-retry 15)
  552. (chat-local-to-self "Added Que - House")
  553. )
  554. (defrule
  555. (building-type-count house > 0)
  556. (population-headroom <= 0)
  557. (research-completed ri-nomads)
  558. =>
  559. (delete-building house)
  560. )
  561. (defrule
  562. (resource-found wood)
  563. (dropsite-min-distance wood > 4)
  564. (building-type-count-total lumber-camp < sn-max-drop-site)
  565. (can-build lumber-camp)
  566. =>
  567. (build lumber-camp)
  568. )
  569. (defrule
  570. (up-compare-const flag-market-progress == 5)
  571. (building-type-count-total mill < sn-max-drop-site)
  572. (dropsite-min-distance food > 5)
  573. (can-build mill)
  574. =>
  575. (build mill)
  576. )
  577. (defrule
  578. (resource-found gold)
  579. (building-type-count-total mining-camp < sn-max-drop-site)
  580. (dropsite-min-distance gold > 5)
  581. (can-build mining-camp)
  582. =>
  583. (build mining-camp)
  584. )
  585. (defrule
  586. (resource-found stone)
  587. (building-type-count-total mining-camp < sn-max-drop-site)
  588. (dropsite-min-distance stone > 5)
  589. (can-build mining-camp)
  590. =>
  591. (build mining-camp)
  592. )
  593. ;---Military and Research Buildings---
  594. (defrule
  595. (building-type-count-total barracks < sn-max-barracks)
  596. (can-build barracks)
  597. =>
  598. (build barracks)
  599. )
  600. (defrule
  601. (building-type-count-total archery-range < sn-max-archer)
  602. (can-build archery-range)
  603. =>
  604. (build archery-range)
  605. )
  606. (defrule
  607. (building-type-count-total stable < sn-max-stable)
  608. (can-build stable)
  609. =>
  610. (build stable)
  611. )
  612. (defrule
  613. (building-type-count-total siege-workshop < sn-max-siege)
  614. (can-build siege-workshop)
  615. =>
  616. (build siege-workshop)
  617. )
  618. (defrule
  619. (building-type-count-total university < sn-max-university)
  620. (can-build university)
  621. =>
  622. (build university)
  623. )
  624. (defrule
  625. (building-type-count-total blacksmith < sn-max-blacksmith)
  626. (can-build blacksmith)
  627. =>
  628. (build blacksmith)
  629. )
  630. (defrule
  631. (building-type-count-total market < sn-max-market)
  632. (can-build market)
  633. =>
  634. (build market)
  635. )
  636. (defrule
  637. (building-type-count-total monastery < sn-max-monestry)
  638. (can-build monastery)
  639. =>
  640. (build monastery)
  641. )
  642. (defrule
  643. (building-type-count-total castle < sn-max-castle)
  644. (can-build castle)
  645. =>
  646. (build castle)
  647. )
  648. (defrule
  649. (building-type-count-total donjon < sn-max-donjon)
  650. (can-build donjon)
  651. =>
  652. (build donjon)
  653. )
  654.  
  655. ;***Assault rules***
  656. ;---Assault stats---
  657. (defrule
  658. (true)
  659. =>
  660. (set-strategic-number sn-do-not-scale-for-difficulty-level no)
  661. (set-strategic-number sn-wall-targeting-mode yes)
  662. (disable-self)
  663. )
  664. ;-----Offence-----
  665. ;activate the first attack
  666. (defrule
  667. (true)
  668. =>
  669. (enable-timer attack-timer 5400)
  670. (set-goal attack-goal standby)
  671. (disable-self)
  672. )
  673. ;first attack is activated and a new timer is enabled to already activate the next attack later on
  674. (defrule
  675. (timer-triggered attack-timer)
  676. (goal attack-goal standby)
  677. (military-population >= 10)
  678. (defend-soldier-count >= 10)
  679. (not (town-under-attack))
  680. =>
  681. (set-strategic-number sn-percent-enemy-sighted-response 60)
  682. (set-strategic-number sn-enemy-sighted-response-distance 40)
  683. (set-goal attack-goal offence)
  684. (disable-timer attack-timer)
  685. (enable-timer attack-timer 120);Interval between attacks
  686. )
  687. ;the ai stops his attacks and resets everything until the next wave
  688. (defrule
  689. (timer-triggered interval-timer)
  690. =>
  691. (disable-timer interval-timer)
  692. (set-goal attack-goal standby)
  693. )
  694. ;the ai will keep his units at his base when on standby
  695. (defrule
  696. (goal attack-goal standby)
  697. =>
  698. (set-strategic-number sn-group-form-distance 25)
  699. (set-strategic-number sn-maximum-attack-group-size 0)
  700. (set-strategic-number sn-minimum-attack-group-size 0)
  701. (set-strategic-number sn-number-attack-groups 0)
  702. (set-strategic-number sn-number-boat-attack-groups 0)
  703. (set-strategic-number sn-minimum-boat-attack-group-size 0)
  704. (set-strategic-number sn-maximum-boat-attack-group-size 0)
  705. (disable-timer interval-timer)
  706. (enable-timer interval-timer 10)
  707. ;(set-goal attack-goal reset-attack)
  708. )
  709. ;the ai gathers his troops and attacks the enemy with the amount stated below
  710. (defrule
  711. (goal attack-goal offence) ;Attacking - Groups
  712. =>
  713. (set-strategic-number sn-group-form-distance 30)
  714. (set-strategic-number sn-number-attack-groups 1)
  715. (set-strategic-number sn-maximum-attack-group-size 60)
  716. (set-strategic-number sn-minimum-attack-group-size 60)
  717. (set-strategic-number sn-number-boat-attack-groups 0)
  718. (set-strategic-number sn-minimum-boat-attack-group-size 0)
  719. (set-strategic-number sn-maximum-boat-attack-group-size 0)
  720. (set-goal attack-goal reset-attack)
  721. )
  722. ;***Production2***
  723. ;---Military---
  724. (defrule
  725. (unit-type-count-total unit1 < sn-max-unit1)
  726. (can-train unit1)
  727. =>
  728. (train unit1)
  729. )
  730. (defrule
  731. (unit-type-count-total unit2 < sn-max-unit2)
  732. (can-train unit2)
  733. =>
  734. (train unit2)
  735. )
  736. (defrule
  737. (unit-type-count-total unit3 < sn-max-unit3)
  738. (can-train unit3)
  739. =>
  740. (train unit3)
  741. )
  742. (defrule
  743. (unit-type-count-total unit4 < sn-max-unit4)
  744. (can-train unit4)
  745. =>
  746. (train unit4)
  747. )
  748. (defrule
  749. (unit-type-count-total unit5 < sn-max-unit5)
  750. (can-train unit5)
  751. =>
  752. (train unit5)
  753. )
  754. (defrule
  755. (unit-type-count-total siege1 < sn-max-siege1)
  756. (can-train siege1)
  757. =>
  758. (train siege1)
  759. )
  760. (defrule
  761. (unit-type-count-total siege2 < sn-max-siege2)
  762. (can-train siege2)
  763. =>
  764. (train siege2)
  765. )
  766. (defrule
  767. (unit-type-count-total siege3 < sn-max-siege3)
  768. (can-train siege3)
  769. =>
  770. (train siege3)
  771. )
  772.  
  773. ;***Market sales***
  774. (defrule
  775. (up-compare-const flag-market-progress == 5)
  776. (gold-amount >= 1500)
  777. (food-amount <= 200)
  778. (commodity-buying-price food <= 100)
  779. (can-buy-commodity food)
  780. =>
  781. (buy-commodity food)
  782. )
  783. (defrule
  784. (up-compare-const flag-market-progress == 5)
  785. (gold-amount >= 500)
  786. (food-amount <= 100)
  787. (can-buy-commodity food)
  788. =>
  789. (buy-commodity food)
  790. )
  791. (defrule
  792. (up-compare-const flag-market-progress == 5)
  793. (gold-amount >= 2000)
  794. (stone-amount <= 500)
  795. (commodity-buying-price stone <= 200)
  796. (can-buy-commodity stone)
  797. =>
  798. (buy-commodity stone)
  799. )
  800. (defrule
  801. (up-compare-const flag-market-progress == 5)
  802. (gold-amount >= 1500)
  803. (stone-amount <= 200)
  804. (commodity-buying-price stone <= 500)
  805. (can-buy-commodity stone)
  806. =>
  807. (buy-commodity stone)
  808. )
  809. (defrule
  810. (up-compare-const flag-market-progress == 5)
  811. (wood-amount >= 2500)
  812. (gold-amount < 10000)
  813. (can-sell-commodity wood)
  814. =>
  815. (sell-commodity wood)
  816. )
  817. (defrule
  818. (up-compare-const flag-market-progress == 5)
  819. (food-amount >= 2500)
  820. (gold-amount < 10000)
  821. (can-sell-commodity food)
  822. =>
  823. (sell-commodity food)
  824. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement