;******************************************* ; CONSTANTS ;******************************************* (defconst NO 0) ;indicates not set or initial value (defconst YES 1) ;Used to indicate set (defconst MAYBE 2) ;Used to check for land maps & resign (defconst MONASTERY 33) ;upgrade conflict value (defconst ADVANCE 999);used to advance to the next age (defconst NOTICE 99) ;Used for military and buildings ; Constants used for ratings (i.e. monk-rating) (defconst EXCELLENT 99) (defconst GOOD 70) (defconst MEDIUM 50) (defconst FAIR 30) (defconst POOR 10) ; Constants used for combat or defense strategy selection (defconst INFANTRY 1) (defconst CAVALRY 2) (defconst LIGHTCAV 3) (defconst CAVARCHER 4) (defconst ARCHER 5) (defconst EAGLEMAN 6) (defconst SCORPION 12) (defconst UNIQUE 13) (defconst RESERVES 20) ;goal 1 Uses YES, NO, MAYBE (maybe is the flag for multi rule checking (defconst resign-game 1) ;goal 2 ;goal 3 ;uses NO, YES, & SUPERIOR (defconst military-parity 3) (defconst SUPERIOR 2) ;goal 4 = used to track attack group AI (defconst attack-control 4) ;0 = NO do not launch an attack ;1 = YES okay to attack ;goal 5 = controls gathering (defconst resource-needed 5) (defconst WOOD 1) (defconst FOOD 2) (defconst GOLD 3) (defconst STONE 4) (defconst GOLD-STONE 5) ;this means you want both gold & stone ;goal 6 = controls rushes!; also uses NOTICE (defconst rush-control 6) (defconst FEUDAL 2) (defconst CASTLE 3) (defconst IMPERIAL 4) (defconst RUSHING 10) ;goal 7 ;goal 8 secondary-build controls secondary builds after primarys built (defconst secondary-build 8) ;Uses YES and NO ;NO: 0 = don't build a secondary unit ;YES:1 = build a secondary unit ;goal 9 resource-supp used in conjunction with resource-needed to determine what to gather (defconst resource-supp 9) (defconst FOOD-ONLY 2) (defconst GOLD-ONLY 3) (defconst WOOD-FOOD 12) (defconst WOOD-GOLD 13) (defconst WOOD-STONE 14) (defconst FOOD-GOLD 23) (defconst FOOD-STONE 24) ;goal 10 used to keep from building siege if I have few or no other units (defconst soldiers-available 10) ;goal 11 = used to determine your main combat arm (defconst combat-arm 11) ; combat-arm, uses common offense/defense unit line numbers. ;repl goal 11 1 = Infantry goal 12 1 ;repl goal 11 2 = Cavalry goal 12 2 ;repl goal 11 3 = Light Cav goal 12 3 ;repl goal 11 4 = Cav Archer goal 12 4 ;repl goal 11 5 = Archer goal 12 5 ;repl goal 11 6 = Eagle Man goal 12 6 ;repl scorpion = goal 12 12 ;repl goal 11 13 = Unique ;goal 12 = used to supplement goal 11. (defconst combat-supp 12) ; Uses combat and defense strategy standard codes ;goal 13 = used to keep CP from attacking if we the player don't want him to do so. (defconst attack-enabled 13) ; uses YES & NO. I.e., "No" means don't attack. ;goal 14 ;goal 15 helps in age advancement (defconst age-advancing 15) ; Uses NO, YES ;NO = we are not advancing in age right now ;YES = we are researching the next age ;goal 16 helps control upgrade conflicts (defconst upgrade-conflict 16) ;goal 17 controls builds based on civ type before unique units are available (defconst pre-unique-arm 17) ;1 = we're training infantry (until our castle is finished) ;2 = we're training cavalry (till our castle is finished) ;3 = we're training light-cavalry (till our castle is finished) ;4 = we're training cav archers (till our castle is finished) ;5 = we're training archers (till our castle is finished) ;note that these numbers correspond to the combat-arm and combat-supp goals above. ;goal 18 ;goal 19 = make-villagers ; used to build tons of villagers (defconst make-villagers 19) ;goal 20 controls castle buildings (defconst castle-count 20) ;uses 0, 1, 2, maybe 3 ;goal 21 = helps control castle-building (defconst castle-attempt 21) ; Uses: NO, YES ;goal 22 ;goal 23 ;goal 24 ;goal 25 ;goal 26 = checks to see how big the enemy military is in absolute terms. (defconst enemy-soldiers 26) ;the number given is app the enemy's size ;goal 27 = determines monk prowess (defconst monk-rating 27) ;Uses: GOOD, FAIR, NO ;goal 28 ;goal 29 ;goal 30 ;goal 31 1 = infantry (defconst infantry-upgrades 31) ;0 = not training infantry ;1 = training infantry ;goal 32 1 = archers (defconst archer-upgrades 32) ;0 = not training archers ;1 = training archers ;goal 33 1 = cav (defconst cav-upgrades 33) ;0 = not training cav ;1 = training cav ;goal 34 used to see if we are short on siege equipment (defconst siege-available 34) ;0 = NO (we don't have enough siege) ;1 = YES (we have some siege) ;goal 35 ;goal 36 ;goal 37 ;goal 38 ;goal 39 ;goal 40 = wall-construction (defconst wall-build 40) ; Uses: NO, YES, NOTICE ;timers ;timer 1 = controls tribute ;timer 2 = controls attack groups ;timer 3 = checks on what we are currently producing ;timer 5 = used to control chat messages ;timer 6 = additional chat message help ;timer 7 = wall-building timer ;timer 8 = yet more chat-message help ;timer 9 = the lumber-camp timer ;timer 10 = see if we've risen in age. Once in imperial, used to build extraneous units (defconst t-attackgroup 2) (defconst t-production 3) (defconst t-tower 7) (defconst t-lumbercamp 9) (defconst civ-dark-rush 20) (defconst civ-dark 23) (defconst civ-dark-mod 15) (defconst civ-feudal-mod 20) (defconst civ-feudal 27) (defconst civ-castle 31) (defconst civ-imperial 66) (defconst pop-cap 125) (defconst town-center-count 3) (defconst dark-town-size 25) (defconst feudal-town-size 25) (defconst castle-town-size 30) (defconst imperial-town-size 30) (defconst castles 2) (defconst max-farms 25) (defconst unit-max 125) (defconst five-percent-pop 6) (defconst ten-percent-pop 13) (defconst fifteen-percent-pop 18) (defconst twenty-percent-pop 24) (defconst thirty-percent-pop 38) (defconst fifty-percent-pop 62) ;************************************************************* #load-if-defined TINY-MAP ; (defrule (true) => ; (chat-to-all "tiny map constants loading") (disable-self)) (defconst feudal-mill-count 1) (defconst castle-mill-count 1) (defconst imperial-mill-count 1) (defconst mining-count 4) #end-if ;************************************************************* #load-if-defined SMALL-MAP ; (defrule (true) => ; (chat-to-all "small map constants loading") (disable-self)) (defconst feudal-mill-count 1) (defconst castle-mill-count 1) (defconst imperial-mill-count 1) (defconst mining-count 6) #end-if ;************************** #load-if-defined MEDIUM-MAP ; (defrule (true) => ; (chat-to-all "medium map constants loading") (disable-self)) (defconst feudal-mill-count 1) (defconst castle-mill-count 1) (defconst imperial-mill-count 1) (defconst mining-count 8) #end-if ;************************** #load-if-defined NORMAL-MAP ; (defrule (true) => ; (chat-to-all "normal map constants loading") (disable-self)) (defconst feudal-mill-count 1) (defconst castle-mill-count 1) (defconst imperial-mill-count 2) (defconst mining-count 10) #end-if ;************************** #load-if-defined LARGE-MAP ; (defrule (true) => ; (chat-to-all "large map constants loading") (disable-self)) (defconst feudal-mill-count 1) (defconst castle-mill-count 2) (defconst imperial-mill-count 3) (defconst mining-count 12) #end-if ;************************** #load-if-defined GIANT-MAP ; (defrule (true) => ; (chat-to-all "giant map constants loading") (disable-self)) (defconst feudal-mill-count 2) (defconst castle-mill-count 3) (defconst imperial-mill-count 4) (defconst mining-count 14) #end-if ;************************** ;******************************************* ; INITIAL GOALS and STRATEGIC NUMBERS ;******************************************* (defrule (true) => (enable-wall-placement 2) (disable-self) ) (defrule (true) => (set-goal resign-game MAYBE) ;goal 1 (set-goal military-parity YES) ;goal 3 (set-goal attack-control NO) ;goal 4 (set-goal resource-needed NO) ;goal 5 (set-goal rush-control NOTICE) ;goal 6 (set-goal secondary-build NO) ;goal 8 (set-goal soldiers-available NO) ;goal 10 (disable-self) ) (defrule (true) => (set-goal combat-arm NOTICE) ;goal 11 (set-goal combat-supp RESERVES) ;goal 12 (set-goal attack-enabled NO) ;goal 13 (set-goal monk-rating GOOD) (set-goal enemy-soldiers NO) ;goal 26 (set-goal siege-available NO) ;goal 34 (set-goal wall-build YES) (disable-self) ) (defrule (true) => (set-goal castle-attempt NO) (set-goal make-villagers NO) (set-goal castle-count 0) (set-goal age-advancing NO) ;goal 15 (set-goal upgrade-conflict NO) ;goal 16 (disable-self) ) (defrule (current-age == dark-age) => (set-escrow-percentage wood 0) (set-escrow-percentage food 0) (set-escrow-percentage gold 0) (set-escrow-percentage stone 0) (disable-self) ) (defrule (current-age == feudal-age) => (set-escrow-percentage wood 5) (set-escrow-percentage food 5) (set-escrow-percentage gold 5) (set-escrow-percentage stone 5) (disable-self) ) (defrule (current-age == castle-age) => (set-escrow-percentage wood 10) (set-escrow-percentage food 10) (set-escrow-percentage gold 10) (set-escrow-percentage stone 10) (disable-self) ) ;****************************************** ; DARK AGE SNs ;****************************************** ; Set the group raiders stuff here (defrule (true) => (set-strategic-number sn-number-explore-groups 2) (set-strategic-number sn-minimum-explore-group-size 1) (set-strategic-number sn-percentage-explore-exterminators 100) (set-strategic-number sn-target-evaluation-hitpoints 1) (set-strategic-number sn-percent-attack-soldiers 0) (disable-self) ) (defrule (true) => (set-strategic-number sn-coop-share-information 1) (set-strategic-number sn-coop-share-attacking 1) (set-strategic-number sn-maximum-town-size dark-town-size) (set-strategic-number sn-task-ungrouped-soldiers 0) (set-strategic-number sn-zero-priority-distance 40) (set-strategic-number sn-blot-exploration-map 1) (disable-self) ) (defrule (true) => (set-strategic-number sn-attack-intelligence 1) (set-strategic-number sn-gather-defense-units 1) (set-strategic-number sn-defense-distance 3) (set-strategic-number sn-maximum-gaia-attack-response 2) (set-strategic-number sn-ignore-attack-group-under-attack 1) (disable-self) ) (defrule (true) => (set-strategic-number sn-stone-dropsite-distance 3) (set-strategic-number sn-gold-dropsite-distance 3) (set-strategic-number sn-retask-gather-amount 10) (set-strategic-number sn-camp-max-distance 30) (set-strategic-number sn-mill-max-distance 30) (set-strategic-number sn-enemy-sighted-response-distance 10) (set-strategic-number sn-group-form-distance 30) (set-strategic-number sn-allow-civilian-defense 1) (disable-self) ) (defrule (true) => (set-strategic-number sn-percent-enemy-sighted-response 100) (set-difficulty-parameter ability-to-maintain-distance 100) (set-difficulty-parameter ability-to-dodge-missiles 100) (disable-self) ) (defrule (true) => (set-strategic-number sn-town-defend-priority 1) (set-strategic-number sn-gold-defend-priority 2) (set-strategic-number sn-stone-defend-priority 3) (set-strategic-number sn-forage-defend-priority 2) (set-strategic-number sn-relic-defend-priority 3) (set-strategic-number sn-cap-civilian-builders 15) (set-strategic-number sn-cap-civilian-gatherers 100) (disable-self) ) (defrule (true) => (set-strategic-number sn-maximum-wood-drop-distance 5) (set-strategic-number sn-maximum-food-drop-distance 5) (set-strategic-number sn-maximum-hunt-drop-distance 30) (set-strategic-number sn-maximum-gold-drop-distance 5) (set-strategic-number sn-maximum-stone-drop-distance 5) (set-strategic-number sn-target-evaluation-attack-attempts 1) (disable-self) ) ;start exploring ; explore a bit with cavalary guy and one villager (defrule (game-time < 180) => (set-strategic-number sn-minimum-civilian-explorers 1) (set-strategic-number sn-cap-civilian-explorers 1) (set-strategic-number sn-percent-civilian-explorers 10) (set-strategic-number sn-percent-civilian-builders 10) (set-strategic-number sn-percent-civilian-gatherers 80) (disable-self) ) (defrule ; explore with the cavalary guy only (game-time > 180) => (set-strategic-number sn-percent-civilian-explorers 0) (set-strategic-number sn-minimum-civilian-explorers 0) (set-strategic-number sn-cap-civilian-explorers 0) (set-strategic-number sn-percent-civilian-builders 10) (set-strategic-number sn-percent-civilian-gatherers 90) (disable-self) ) (defrule (or (players-current-age any-enemy > feudal-age) (players-military-population any-enemy > 2) ) => (set-strategic-number sn-allow-civilian-defense 1) (disable-self) ) ;********************************************* ; MORE STRATEGIC NUMBERS ;********************************************* ;*********************************************** ;DARK AGE ;*********************************************** (defrule (current-age == dark-age) => (set-strategic-number sn-wood-gatherer-percentage 30) (set-strategic-number sn-food-gatherer-percentage 70) (set-strategic-number sn-gold-gatherer-percentage 0) (set-strategic-number sn-stone-gatherer-percentage 0) (disable-self) ) ;*********************************************** ;FEUDAL AGE ;*********************************************** (defrule (current-age == feudal-age) (goal age-advancing YES) => (set-goal age-advancing NO) (set-goal upgrade-conflict NOTICE) (chat-local-to-self "OK, set age-advancing to NO in feudal.") (disable-self) ) (defrule (current-age == feudal-age) => (set-strategic-number sn-maximum-town-size feudal-town-size) (set-strategic-number sn-percent-civilian-builders 10) (set-strategic-number sn-percent-civilian-gatherers 90) (set-strategic-number sn-camp-max-distance 30) (set-strategic-number sn-mill-max-distance 30) (set-strategic-number sn-group-form-distance 30) (set-strategic-number sn-enemy-sighted-response-distance 25) (set-strategic-number sn-ignore-attack-group-under-attack 1) (disable-self) ) (defrule (current-age == feudal-age) (building-type-count-total mining-camp == 0) => (chat-local-to-self "No Mines, 70/30.") (set-strategic-number sn-wood-gatherer-percentage 30) (set-strategic-number sn-food-gatherer-percentage 70) (set-strategic-number sn-gold-gatherer-percentage 0) (set-strategic-number sn-stone-gatherer-percentage 0) (disable-self) ) (defrule (current-age == feudal-age) (building-type-count-total mining-camp == 1) => (chat-local-to-self "One Mine, 65/20/15.") (set-strategic-number sn-wood-gatherer-percentage 20) (set-strategic-number sn-food-gatherer-percentage 65) (set-strategic-number sn-gold-gatherer-percentage 15) (set-strategic-number sn-stone-gatherer-percentage 0) (disable-self) ) (defrule (current-age == feudal-age) (building-type-count-total mining-camp > 1) => (chat-local-to-self "Two Mines, 60/20/15/5.") (set-strategic-number sn-wood-gatherer-percentage 20) (set-strategic-number sn-food-gatherer-percentage 60) (set-strategic-number sn-gold-gatherer-percentage 15) (set-strategic-number sn-stone-gatherer-percentage 5) (disable-self) ) ;*********************************************** ;CASTLE AGE ;*********************************************** (defrule (current-age == castle-age) (goal age-advancing YES) => (set-goal age-advancing NO) (set-goal upgrade-conflict NOTICE) (chat-local-to-self "OK, set age-advancing to NO in castle.") (disable-self) ) (defrule (current-age == castle-age) => (set-strategic-number sn-sentry-distance 4) (set-strategic-number sn-maximum-town-size castle-town-size) (set-strategic-number sn-percent-civilian-builders 10) (set-strategic-number sn-percent-civilian-gatherers 90) (set-strategic-number sn-blot-exploration-map 1) (set-strategic-number sn-camp-max-distance 30) (set-strategic-number sn-mill-max-distance 30) (set-strategic-number sn-group-form-distance 30) (set-strategic-number sn-enemy-sighted-response-distance 25) (disable-self) ) (defrule (current-age == castle-age) (building-type-count-total mining-camp == 0) => (chat-local-to-self "No Mines, 80/20.") (set-strategic-number sn-wood-gatherer-percentage 20) (set-strategic-number sn-food-gatherer-percentage 80) (set-strategic-number sn-gold-gatherer-percentage 0) (set-strategic-number sn-stone-gatherer-percentage 0) (disable-self) ) (defrule (current-age == castle-age) (building-type-count-total mining-camp == 1) => (chat-local-to-self "One Mine, 60/20/20.") (set-strategic-number sn-wood-gatherer-percentage 20) (set-strategic-number sn-food-gatherer-percentage 60) (set-strategic-number sn-gold-gatherer-percentage 20) (set-strategic-number sn-stone-gatherer-percentage 0) (disable-self) ) (defrule (current-age == castle-age) (building-type-count-total mining-camp > 1) => (chat-local-to-self "Mines, 55/20/15/10.") (set-strategic-number sn-wood-gatherer-percentage 20) (set-strategic-number sn-food-gatherer-percentage 60) (set-strategic-number sn-gold-gatherer-percentage 10) (set-strategic-number sn-stone-gatherer-percentage 10) (disable-self) ) ;********************************************* ; IMPERIAL AGE SNs ;********************************************* (defrule (current-age == imperial-age) (goal age-advancing YES) => (set-goal age-advancing NO) (set-goal upgrade-conflict NO) (chat-local-to-self "OK, set age-advancing to NO in imperial.") (disable-self) ) (defrule (current-age == imperial-age) => (set-strategic-number sn-maximum-town-size imperial-town-size) (set-strategic-number sn-percent-civilian-builders 10) (set-strategic-number sn-percent-civilian-gatherers 90) (set-strategic-number sn-camp-max-distance 30) (set-strategic-number sn-mill-max-distance 30) (set-strategic-number sn-enemy-sighted-response-distance 25) (disable-self) ) (defrule (goal resource-needed NO) (current-age == imperial-age) => (set-strategic-number sn-wood-gatherer-percentage 25) (set-strategic-number sn-food-gatherer-percentage 50) (set-strategic-number sn-gold-gatherer-percentage 15) (set-strategic-number sn-stone-gatherer-percentage 10) ) (defrule (goal resource-needed WOOD) (current-age == imperial-age) => (set-strategic-number sn-wood-gatherer-percentage 40) (set-strategic-number sn-food-gatherer-percentage 30) (set-strategic-number sn-gold-gatherer-percentage 20) (set-strategic-number sn-stone-gatherer-percentage 10) ) (defrule (goal resource-needed FOOD) (current-age == imperial-age) => (set-strategic-number sn-wood-gatherer-percentage 20) (set-strategic-number sn-food-gatherer-percentage 60) (set-strategic-number sn-gold-gatherer-percentage 10) (set-strategic-number sn-stone-gatherer-percentage 10) ) (defrule (goal resource-needed GOLD) (current-age == imperial-age) => (set-strategic-number sn-wood-gatherer-percentage 30) (set-strategic-number sn-food-gatherer-percentage 30) (set-strategic-number sn-gold-gatherer-percentage 30) (set-strategic-number sn-stone-gatherer-percentage 10) ) (defrule (goal resource-needed STONE) (current-age == imperial-age) => (set-strategic-number sn-wood-gatherer-percentage 30) (set-strategic-number sn-food-gatherer-percentage 40) (set-strategic-number sn-gold-gatherer-percentage 10) (set-strategic-number sn-stone-gatherer-percentage 20) ) ;*************************************** ; CIVILIZATIONS ;*************************************** ;********************************************************* #load-if-defined BRITON-CIV (defrule (true) => (chat-local-to-self "We are the British.") (disable-self) ) (defrule (goal combat-arm NOTICE) => (set-goal monk-rating GOOD) (set-goal combat-arm UNIQUE) (set-goal pre-unique-arm ARCHER) ) (defrule (goal combat-arm UNIQUE) (building-type-count castle == 0) (not (goal pre-unique-arm ARCHER) ) => (set-goal pre-unique-arm ARCHER) ) #end-if ;********************************************************* #load-if-defined BYZANTINE-CIV (defrule (true) => (chat-local-to-self "We are the Byzantines.") (disable-self) ) (defrule (goal combat-arm NOTICE) => (set-goal monk-rating GOOD) (set-goal combat-arm UNIQUE) (set-goal pre-unique-arm CAVALRY) ) (defrule (goal combat-arm UNIQUE) (current-age == feudal-age) (not (goal pre-unique-arm INFANTRY) ) => (set-goal pre-unique-arm INFANTRY) ) (defrule (goal combat-arm UNIQUE) (building-type-count castle == 0) (current-age >= castle-age) (not (goal pre-unique-arm CAVALRY) ) => (set-goal pre-unique-arm CAVALRY) ) #end-if ;********************************************************* #load-if-defined CELTIC-CIV (defrule (true) => (chat-local-to-self "We are the Celts.") (disable-self) ) (defrule (goal combat-arm NOTICE) => (set-goal monk-rating POOR) ) (defrule (goal combat-arm NOTICE) => (set-goal combat-arm UNIQUE) (set-goal pre-unique-arm INFANTRY) ) (defrule (goal combat-arm UNIQUE) (building-type-count castle == 0) (not (goal pre-unique-arm INFANTRY) ) => (set-goal pre-unique-arm INFANTRY) ) #end-if ;********************************************************* #load-if-defined CHINESE-CIV (defrule (true) => (chat-local-to-self "We are the Chinese.") (disable-self) ) (defrule (goal combat-arm NOTICE) => (set-goal monk-rating FAIR) (set-goal combat-arm UNIQUE) (set-goal pre-unique-arm ARCHER) ) (defrule (goal combat-arm UNIQUE) (building-type-count castle == 0) (not (goal pre-unique-arm ARCHER) ) => (set-goal pre-unique-arm ARCHER) ) #end-if ;********************************************************* #load-if-defined FRANKISH-CIV (defrule (true) => (chat-local-to-self "We are the Franks.") (disable-self) ) (defrule (goal combat-arm NOTICE) => (set-goal monk-rating FAIR) ) (defrule (goal combat-arm NOTICE) => (set-goal combat-arm UNIQUE) (set-goal pre-unique-arm INFANTRY) ) (defrule (goal combat-arm UNIQUE) (building-type-count castle == 0) (not (goal pre-unique-arm INFANTRY) ) => (set-goal pre-unique-arm INFANTRY) ) #end-if ;********************************************************* #load-if-defined GOTHIC-CIV (defrule (true) => (chat-local-to-self "Yes, we are the Goths. Prepare to die!") (disable-self) ) (defrule (goal combat-arm NOTICE) => (set-goal monk-rating POOR) (set-goal combat-arm UNIQUE) (set-goal pre-unique-arm INFANTRY) ) (defrule (goal combat-arm UNIQUE) (building-type-count castle == 0) (not (goal pre-unique-arm INFANTRY) ) => (set-goal pre-unique-arm INFANTRY) ) (defrule (goal wall-build YES) => (set-goal wall-build NO) ) #end-if ;********************************************************* #load-if-defined JAPANESE-CIV (defrule (true) => (chat-local-to-self "We are the Japanese.") (disable-self) ) (defrule (goal combat-arm NOTICE) => (set-goal monk-rating GOOD) (set-goal combat-arm UNIQUE) (set-goal pre-unique-arm INFANTRY) ) (defrule (goal combat-arm UNIQUE) (building-type-count castle == 0) (not (goal pre-unique-arm INFANTRY) ) => (set-goal pre-unique-arm INFANTRY) ) #end-if ;********************************************************* #load-if-defined MONGOL-CIV (defrule (true) => (chat-local-to-self "We are the Mongols.") (disable-self) ) (defrule (goal combat-arm NOTICE) => (set-goal monk-rating POOR) (set-goal combat-arm UNIQUE) ) (defrule (goal combat-arm UNIQUE) (current-age == feudal-age) (not (goal pre-unique-arm ARCHER) ) => (set-goal pre-unique-arm ARCHER) ) (defrule (goal combat-arm UNIQUE) (current-age >= castle-age) (building-type-count castle == 0) (not (goal pre-unique-arm CAVARCHER) ) => (set-goal pre-unique-arm CAVARCHER) ) #end-if ;********************************************************* #load-if-defined PERSIAN-CIV (defrule (true) => (chat-local-to-self "We are the Persians.") (disable-self) ) (defrule (goal combat-arm NOTICE) => (set-goal monk-rating POOR) (set-goal combat-arm UNIQUE) ) (defrule (goal combat-arm UNIQUE) (current-age == feudal-age) (not (goal pre-unique-arm INFANTRY) ) => (set-goal pre-unique-arm INFANTRY) ) (defrule (goal combat-arm UNIQUE) (building-type-count castle == 0) (current-age >= castle-age) (not (goal pre-unique-arm CAVALRY) ) => (set-goal pre-unique-arm CAVALRY) ) #end-if ;********************************************************* #load-if-defined SARACEN-CIV (defrule (true) => (chat-local-to-self "We are the Saracens.") (disable-self) ) (defrule (goal combat-arm NOTICE) => (set-goal monk-rating GOOD) (set-goal combat-arm UNIQUE) (set-goal pre-unique-arm CAVALRY) ) (defrule (goal combat-arm UNIQUE) (current-age == feudal-age) (not (goal pre-unique-arm INFANTRY) ) => (set-goal pre-unique-arm INFANTRY) ) (defrule (goal combat-arm UNIQUE) (building-type-count castle == 0) (current-age >= castle-age) (not (goal pre-unique-arm CAVALRY) ) => (set-goal pre-unique-arm CAVALRY) ) #end-if ;********************************************************* #load-if-defined TEUTONIC-CIV (defrule (true) => (chat-local-to-self "We are the Teutons.") (disable-self) ) (defrule (goal combat-arm NOTICE) => (set-goal monk-rating GOOD) (set-goal combat-arm UNIQUE) (set-goal pre-unique-arm INFANTRY) ) (defrule (goal combat-arm UNIQUE) (building-type-count castle == 0) (not (goal pre-unique-arm INFANTRY) ) => (set-goal pre-unique-arm INFANTRY) ) #end-if ;********************************************************* #load-if-defined TURKISH-CIV (defrule (true) => (chat-local-to-self "We are the Turks.") (disable-self) ) (defrule (goal combat-arm NOTICE) => (set-goal monk-rating FAIR) (set-goal combat-arm UNIQUE) (set-goal pre-unique-arm ARCHER) ) (defrule (goal combat-arm UNIQUE) (building-type-count castle == 0) (not (goal pre-unique-arm ARCHER) ) => (set-goal pre-unique-arm ARCHER) ) #end-if ;********************************************************* #load-if-defined VIKING-CIV (defrule (true) => (chat-local-to-self "We are the Vikings.") (disable-self) ) (defrule (goal combat-arm NOTICE) => (set-goal monk-rating POOR) (set-goal combat-arm UNIQUE) (set-goal pre-unique-arm INFANTRY) ) (defrule (goal combat-arm UNIQUE) (building-type-count castle == 0) (not (goal pre-unique-arm INFANTRY) ) => (set-goal pre-unique-arm INFANTRY) ) #end-if (defrule (goal combat-arm UNIQUE) (current-age >= castle-age) (building-type-count castle > 0) (not (goal pre-unique-arm NO) ) => (set-goal pre-unique-arm NO) ) ;********************************************* ; RUSHING/ADVANCING ;********************************************* (defrule (goal rush-control NOTICE) => (set-goal rush-control IMPERIAL) (chat-local-to-self "Rushing in imperial age.") (disable-self) ) (defrule (goal rush-control IMPERIAL) (current-age == imperial-age) => (set-goal rush-control RUSHING) (chat-local-to-self "The IMPERIAL rush is on!") (disable-self) ) ;************************************************ ;AGE ADVANCEMENT ;************************************************ (defrule (current-age == dark-age) (goal upgrade-conflict NO) (goal age-advancing NO) (civilian-population >= civ-dark) (or (building-type-count-total lumber-camp > 0) (building-type-count-total mining-camp > 0) ) (building-type-count-total mill > 0) => (set-goal upgrade-conflict ADVANCE) (set-goal make-villagers MAYBE) (chat-local-to-self "Ready to advance to Feudal Age.") ) (defrule (goal upgrade-conflict ADVANCE) (current-age == dark-age) => (set-strategic-number sn-wood-gatherer-percentage 20) (set-strategic-number sn-food-gatherer-percentage 80) (set-strategic-number sn-gold-gatherer-percentage 0) (set-strategic-number sn-stone-gatherer-percentage 0) (disable-self) ) (defrule ;advance as soon as we can after pre-requisites (current-age == feudal-age) (goal upgrade-conflict NO) (goal age-advancing NO) (civilian-population >= civ-feudal) (building-type-count-total stable > 0) (building-type-count-total blacksmith > 0) => (set-goal upgrade-conflict ADVANCE) (set-goal make-villagers MAYBE) (chat-local-to-self "Ready to advance to Castle Age.") ) (defrule ;advance as soon as we can after pre-requisites (current-age == feudal-age) (goal upgrade-conflict NO) (goal age-advancing NO) (civilian-population >= civ-feudal) (building-type-count-total archery-range > 0) (building-type-count-total blacksmith > 0) => (set-goal upgrade-conflict ADVANCE) (set-goal make-villagers MAYBE) (chat-local-to-self "Ready to advance to Castle Age.") ) (defrule ;advance as soon as we can after pre-requisites (current-age == feudal-age) (goal upgrade-conflict NO) (goal age-advancing NO) (civilian-population >= civ-feudal) (building-type-count-total stable > 0) (building-type-count-total market > 0) => (set-goal upgrade-conflict ADVANCE) (set-goal make-villagers MAYBE) (chat-local-to-self "Ready to advance to Castle Age.") ) (defrule ;advance as soon as we can after pre-requisites (current-age == feudal-age) (goal upgrade-conflict NO) (goal age-advancing NO) (civilian-population >= civ-feudal) (building-type-count-total archery-range > 0) (building-type-count-total market > 0) => (set-goal upgrade-conflict ADVANCE) (set-goal make-villagers MAYBE) (chat-local-to-self "Ready to advance to Castle Age.") ) (defrule ;advance as soon as we can after pre-requisites (current-age == feudal-age) (goal upgrade-conflict NO) (goal age-advancing NO) (civilian-population >= civ-feudal) (building-type-count-total stable > 0) (building-type-count-total archery-range > 0) => (set-goal upgrade-conflict ADVANCE) (set-goal make-villagers MAYBE) (chat-local-to-self "Ready to advance to Castle Age.") ) (defrule ;advance as soon as we can after pre-requisites (current-age == feudal-age) (goal upgrade-conflict NO) (goal age-advancing NO) (civilian-population >= civ-feudal) (building-type-count-total market > 0) (building-type-count-total blacksmith > 0) => (set-goal upgrade-conflict ADVANCE) (set-goal make-villagers MAYBE) (chat-local-to-self "Ready to advance to Castle Age.") ) (defrule (current-age == feudal-age) (goal upgrade-conflict ADVANCE) => (set-strategic-number sn-wood-gatherer-percentage 15) (set-strategic-number sn-food-gatherer-percentage 70) (set-strategic-number sn-gold-gatherer-percentage 15) (set-strategic-number sn-stone-gatherer-percentage 0) (chat-local-to-self "Resetting gatherers.") (disable-self) ) (defrule (current-age == castle-age) (goal upgrade-conflict NO) (goal age-advancing NO) (civilian-population >= civ-castle) (building-type-count-total university > 0) (building-type-count-total siege-workshop > 0) => (set-goal upgrade-conflict ADVANCE) (set-goal make-villagers MAYBE) (chat-local-to-self "Ready to advance to Imperial Age.") ) (defrule (current-age == castle-age) (goal upgrade-conflict NO) (goal age-advancing NO) (civilian-population >= civ-castle) (building-type-count-total university > 0) (building-type-count-total monastery > 0) => (set-goal upgrade-conflict ADVANCE) (set-goal make-villagers MAYBE) (chat-local-to-self "Ready to advance to Imperial Age.") ) (defrule (current-age == castle-age) (goal upgrade-conflict NO) (goal age-advancing NO) (civilian-population >= civ-castle) (building-type-count-total monastery > 0) (building-type-count-total siege-workshop > 0) => (set-goal upgrade-conflict ADVANCE) (set-goal make-villagers MAYBE) (chat-local-to-self "Ready to advance to Imperial Age.") ) (defrule (current-age == castle-age) (goal upgrade-conflict NO) (goal age-advancing NO) (civilian-population >= civ-castle) (building-type-count-total castle > 0) => (set-goal upgrade-conflict ADVANCE) (set-goal make-villagers MAYBE) (chat-local-to-self "Ready to advance to Imperial Age.") ) (defrule (current-age == castle-age) (goal upgrade-conflict ADVANCE) => (set-strategic-number sn-wood-gatherer-percentage 10) (set-strategic-number sn-food-gatherer-percentage 70) (set-strategic-number sn-gold-gatherer-percentage 20) (set-strategic-number sn-stone-gatherer-percentage 0) (chat-local-to-self "Resetting gatherers.") (disable-self) ) ;advance to feudal age (defrule (goal upgrade-conflict ADVANCE) (can-research-with-escrow feudal-age) => (set-goal resource-needed NO) (set-goal make-villagers NO) (set-goal age-advancing YES) (set-goal upgrade-conflict NO) (release-escrow food) (research feudal-age) (chat-local-to-self "Advancing to Feudal Age.") ) ;advance to castle age (defrule (goal upgrade-conflict ADVANCE) (can-research-with-escrow castle-age) => (set-goal resource-needed NO) (set-goal make-villagers NO) (set-goal age-advancing YES) (set-goal upgrade-conflict NO) (release-escrow food) (release-escrow gold) (research castle-age) (chat-local-to-self "Advancing to Castle Age.") ) ;advance to imperial (defrule (goal upgrade-conflict ADVANCE) (can-research-with-escrow imperial-age) => (set-goal resource-needed NO) (set-goal make-villagers NO) (set-goal age-advancing YES) (set-goal upgrade-conflict NO) (release-escrow food) (release-escrow gold) (research imperial-age) (chat-local-to-self "Advancing to Imperial Age.") ) ;*********************************************** ; CASTLE (new) & RULES ;*********************************************** ; train villagers (defrule (goal make-villagers NO) (current-age == dark-age) (unit-type-count-total villager <= civ-dark) => (set-goal make-villagers YES) ) (defrule (goal make-villagers NO) (current-age == feudal-age) (unit-type-count-total villager <= civ-feudal) => (set-goal make-villagers YES) ) (defrule (goal make-villagers NO) (current-age == castle-age) (unit-type-count-total villager <= civ-castle) => (set-goal make-villagers YES) ) (defrule (goal make-villagers NO) (current-age == imperial-age) (unit-type-count-total villager <= civ-imperial) => (set-goal make-villagers YES) ) (defrule (goal make-villagers YES) (can-train villager) => (train villager) (chat-local-to-self "Training villager.") (set-goal make-villagers NO) ) ;maintain houses (defrule (building-type-count town-center > 0) (housing-headroom < 4) (population-headroom > 0) (can-build house) => (build house) (chat-local-to-self "Building house.") ) ; Build a mill when we find food (defrule (building-type-count-total mill == 0) (building-type-count town-center > 0) (game-time > 240) (building-type-count-total house > 0) (or (resource-found food) (game-time > 300) ) (can-build mill) => (build mill) (chat-local-to-self "Building 1st mill.") (disable-self) ) (defrule (resource-found wood) (building-type-count town-center > 0) (game-time > 240) (building-type-count-total lumber-camp == 0) (can-build lumber-camp) => (build lumber-camp) (chat-local-to-self "Building lumber camp.") (disable-self) ) (defrule (resource-found gold) (current-age == dark-age) (game-time > 300) (building-type-count-total mining-camp == 0) (can-build-with-escrow mining-camp) => (release-escrow wood) (build mining-camp) (chat-local-to-self "Building dark mining camp.") (disable-self) ) (defrule (resource-found stone) (current-age == dark-age) (game-time > 420) (building-type-count-total mining-camp == 1) (can-build-with-escrow mining-camp) => (release-escrow wood) (build mining-camp) (chat-local-to-self "Building dark mining camp.") (disable-self) ) (defrule (current-age == dark-age) (building-type-count-total lumber-camp > 0) (building-type-count-total mill > 0) (sheep-and-forage-too-far) (building-type-count farm < 8) (can-build farm) => (build farm) (chat-local-to-self "Building 1 of 9 early farms.") ) ;maintain a town center (defrule (building-type-count-total town-center < 1) (can-build town-center) => (build town-center) (chat-local-to-self "Building Town Center.") ) ;=======================FEUDAL AGE RULES (defrule (goal upgrade-conflict NOTICE) (current-age == feudal-age) (building-type-count-total blacksmith > 0) (building-type-count-total market > 0) => (set-goal upgrade-conflict NO) (chat-local-to-self "Buildings are good to go.") ) (defrule (goal upgrade-conflict NOTICE) (current-age == feudal-age) (building-type-count-total archery-range > 0) (building-type-count-total market > 0) => (set-goal upgrade-conflict NO) (chat-local-to-self "Buildings are good to go.") ) (defrule (goal upgrade-conflict NOTICE) (current-age == feudal-age) (building-type-count-total archery-range > 0) (building-type-count-total stable > 0) => (set-goal upgrade-conflict NO) (chat-local-to-self "Buildings are good to go.") ) (defrule (goal upgrade-conflict NOTICE) (current-age == feudal-age) (building-type-count-total market > 0) (building-type-count-total stable > 0) => (set-goal upgrade-conflict NO) (chat-local-to-self "Buildings are good to go.") ) (defrule (goal upgrade-conflict NOTICE) (current-age == feudal-age) (building-type-count-total stable > 0) (building-type-count-total blacksmith > 0) => (set-goal upgrade-conflict NO) (chat-local-to-self "Buildings are good to go.") ) (defrule (goal upgrade-conflict NOTICE) (current-age == feudal-age) (building-type-count-total archery-range > 0) (building-type-count-total blacksmith > 0) => (set-goal upgrade-conflict NO) (chat-local-to-self "Buildings are good to go.") ) (defrule (goal age-advancing YES) (current-age == dark-age) (building-type-count-total barracks == 0) (building-type-count-total lumber-camp > 0) (building-type-count-total mill > 0) (can-build barracks) => (build barracks) (chat-local-to-self "Building 1st barracks.") (taunt 15) (disable-self) ) ;build a blacksmith (defrule (building-type-count-total blacksmith == 0) (can-build-with-escrow blacksmith) => (release-escrow wood) (build blacksmith) (chat-local-to-self "Building blacksmith.") ) ;feudal age market -- always keep a market handy! (defrule (building-type-count-total market == 0) (can-build-with-escrow market) => (release-escrow wood) (build market) (chat-local-to-self "Building market.") ) (defrule (current-age == feudal-age) (sheep-and-forage-too-far) (building-type-count farm < 12) (can-build farm) => (build farm) (chat-local-to-self "Building feudal farm.") ) (defrule (current-age >= feudal-age) => (set-goal combat-supp RESERVES) (enable-timer t-production 10) (enable-timer t-tower 300) (enable-timer t-attackgroup 600) (enable-timer t-lumbercamp 120) ;(disable-timer t-ageup) (disable-self) ) ; Build camps as needed (defrule (timer-triggered t-lumbercamp) (current-age >= feudal-age) (resource-found wood) (dropsite-min-distance wood > 4) (can-build lumber-camp) => (build lumber-camp) (chat-local-to-self "Building special lumber camp.") ) (defrule (current-age >= feudal-age) (dropsite-min-distance gold > 4) (building-type-count-total mining-camp <= mining-count) (resource-found gold) (can-build mining-camp) => (build mining-camp) (chat-local-to-self "Building mining camp.") ) (defrule (current-age >= feudal-age) (dropsite-min-distance stone > 4) (building-type-count-total mining-camp <= mining-count) (resource-found stone) (can-build mining-camp) => (build mining-camp) (chat-local-to-self "Building mining camp.") ) (defrule (timer-triggered t-lumbercamp) => (disable-timer t-lumbercamp) (enable-timer t-lumbercamp 120) ) (defrule (current-age >= feudal-age) (current-age-time > 180) (building-type-count-total mill < feudal-mill-count) (wood-amount > 200) (can-build mill) => (build mill) (chat-local-to-self "Building another mill.") ) ;======================== CASTLE AGE RULES (defrule (goal upgrade-conflict NOTICE) (current-age == castle-age) (building-type-count-total castle > 0) => (set-goal upgrade-conflict NO) (chat-local-to-self "Buildings are good to go.") ) (defrule (goal upgrade-conflict NOTICE) (current-age == castle-age) (building-type-count-total monastery > 0) (building-type-count-total university > 0) => (set-goal upgrade-conflict NO) (chat-local-to-self "Buildings are good to go.") ) (defrule (goal upgrade-conflict NOTICE) (current-age == castle-age) (building-type-count-total monastery > 0) (building-type-count-total siege-workshop > 0) => (set-goal upgrade-conflict NO) (chat-local-to-self "Buildings are good to go.") ) (defrule (goal upgrade-conflict NOTICE) (current-age == castle-age) (building-type-count-total siege-workshop > 0) (building-type-count-total university > 0) => (set-goal upgrade-conflict NO) (chat-local-to-self "Buildings are good to go.") ) (defrule (goal age-advancing YES) (current-age == feudal-age) (building-type-count-total archery-range == 0) (building-type-count-total lumber-camp > 0) (building-type-count-total mill > 0) (can-build archery-range) => (build archery-range) (chat-local-to-self "Building 1st archery-range.") (taunt 15) (disable-self) ) ; Build a University (defrule (building-type-count-total town-center > 0) (building-type-count-total university < 1) (can-build-with-escrow university) => (release-escrow wood) (build university) (chat-local-to-self "Building university.") ) ; Build a monastery (defrule (building-type-count-total monastery < 1) (building-type-count-total town-center > 0) (can-build-with-escrow monastery) => (release-escrow wood) (build monastery) (chat-local-to-self "Building 1st monastery.") (taunt 18) ) (defrule (goal monk-rating GOOD) (goal age-advancing YES) (current-age == castle-age) (building-type-count-total monastery < 2) (building-type-count-total siege-workshop > 0) (can-build monastery) => (build monastery) (chat-local-to-self "Building another monastery.") (taunt 18) ) (defrule ;(goal upgrade-conflict NO) (building-type-count-total archery-range < 2) (building-type-count-total market == 1) (current-age >= feudal-age) (can-build-with-escrow archery-range) => (release-escrow wood) (build archery-range) (chat-local-to-self "Building archery range.") (taunt 15) ) (defrule (goal upgrade-conflict NO) (current-age >= feudal-age) (building-type-count-total market > 0) (building-type-count-total stable < 1) (can-build-with-escrow stable) => (release-escrow wood) (build stable) (chat-local-to-self "Building stable.") ) (defrule (current-age == castle-age) (current-age-time > 300) (building-type-count-total mill < castle-mill-count) (wood-amount > 200) (building-type-count-total town-center > 1) (can-build mill) => (build mill) (chat-local-to-self "Building mill.") ) (defrule (current-age == castle-age) (building-type-count farm < 14) (can-build farm) => (build farm) (chat-local-to-self "Building castle farm.") ) ;Siege Workshop (defrule (building-type-count-total siege-workshop < 1) (building-type-count-total town-center > 0) (building-type-count-total university > 0) (can-build-with-escrow siege-workshop) => (release-escrow wood) (build siege-workshop) (chat-local-to-self "Building siege workshop.") ) (defrule (building-type-count-total barracks < 2) (current-age >= castle-age) (can-build-with-escrow barracks) => (release-escrow wood) (build barracks) (chat-local-to-self "Building another barracks.") ) ;(defrule ; (building-type-count-total barracks < 2) ; (current-age >= feudal-age) ; (can-build barracks) ;=> ; (build-forward barracks) ; (chat-local-to-self "Building forward barracks.") ;) ;=============================IMPERIAL AGE RULES (defrule (current-age == imperial-age) (building-type-count farm < 18) (can-build farm) => (build farm) (chat-local-to-self "Building imperial farm.") ) ;another town center? (defrule (current-age == imperial-age) (building-type-count town-center < town-center-count) (wood-amount > 400) (stone-amount > 100) (can-build town-center) => (build town-center) (chat-local-to-self "Building another town center.") ) (defrule (current-age == imperial-age) (current-age-time > 180) (building-type-count-total mill < imperial-mill-count) (wood-amount > 500) (can-build mill) => (build mill) (chat-local-to-self "Building mill.") ) ;**************** ;forward builders! (defrule (goal rush-control RUSHING) (building-type-count siege-workshop == 1) (strategic-number sn-number-forward-builders == 0) (unit-type-count villager >= civ-castle) (or (or (building-type-count-total archery-range > 1) (building-type-count-total castle > 1) ) (or (building-type-count-total barracks > 1) (building-type-count-total stable > 1) ) ) => (set-strategic-number sn-number-forward-builders 1) ) (defrule (goal rush-control RUSHING) (unit-type-count villager > civ-castle) (building-type-count-total castle < 3) (can-build-with-escrow castle) => (set-strategic-number sn-number-forward-builders 1) ) (defrule (or (attack-soldier-count < ten-percent-pop) (or (or (unit-type-count villager < 10) (not (goal rush-control RUSHING) ) ) (or (goal military-parity NO) (town-under-attack) ) ) ) (strategic-number sn-number-forward-builders >= 1) => (set-strategic-number sn-number-forward-builders 0) ) (defrule (current-age == imperial-age) (building-type-count-total siege-workshop == 1) (can-build siege-workshop) (or (or (building-type-count-total archery-range > 1) (building-type-count-total castle > 1) ) (or (building-type-count-total barracks > 1) (building-type-count-total stable > 1) ) ) => (build siege-workshop) (chat-local-to-self "Building 2nd local siege workshop.") ) ;*********************************************** ; manage castle building (defrule (goal castle-attempt NO) (building-type-count castle == 0) (building-type-count castle < castles) (can-build-with-escrow castle) => (release-escrow stone) (build castle) (set-goal castle-attempt YES) (chat-local-to-self "Building 1st castle.") (taunt 17) ) (defrule (goal upgrade-conflict NO) (goal castle-attempt NO) (building-type-count castle == 1) (building-type-count castle < castles) (can-build-with-escrow castle) => (release-escrow stone) (build castle) (set-goal castle-attempt YES) (chat-local-to-self "Building 2nd castle.") (taunt 17) ) (defrule (goal upgrade-conflict NO) (goal castle-attempt NO) (building-type-count castle == 2) (building-type-count castle < castles) (can-build-with-escrow castle) => (release-escrow stone) (build castle) (set-goal castle-attempt YES) (chat-local-to-self "Building 3rd castle.") (taunt 17) ) (defrule (goal upgrade-conflict NO) (building-type-count-total castle == castles) (goal castle-attempt NO) (can-build-with-escrow castle) => (chat-local-to-self "Building a forward castle.") (release-escrow stone) (build-forward castle) ) (defrule (goal castle-attempt YES) (goal castle-count 0) (building-type-count castle == 1) => (set-goal castle-attempt NO) (set-goal castle-count 1) ) (defrule (goal castle-attempt YES) (goal castle-count 1) (building-type-count castle == 2) => (set-goal castle-attempt NO) (set-goal castle-count 2) ) (defrule (goal castle-attempt YES) (goal castle-count 2) (building-type-count castle == 3) => (set-goal castle-attempt NO) (set-goal castle-count 3) ) (defrule (goal castle-attempt NO) (goal castle-count 1) (building-type-count castle == 0) => (set-goal castle-count 0) ) (defrule (goal castle-attempt NO) (goal castle-count 2) (building-type-count castle == 1) => (set-goal castle-count 1) ) (defrule (goal castle-attempt NO) (goal castle-count 2) (building-type-count castle == 0) => (set-goal castle-count 0) ) (defrule (goal castle-attempt NO) (goal castle-count 3) (building-type-count castle == 0) => (set-goal castle-count 0) ) (defrule (goal castle-attempt NO) (goal castle-count 3) (building-type-count castle == 1) => (set-goal castle-count 1) ) (defrule (goal castle-attempt NO) (goal castle-count 3) (building-type-count castle == 2) => (set-goal castle-count 2) ) ;*********************************************** ; SUPPLEMENT & GROUPS ;*********************************************** (defrule (goal siege-available NO) ;(or ;(population >= 45) (or (or (unit-type-count battering-ram-line > 4) (unit-type-count mangonel-line > 4) ) (or (unit-type-count bombard-cannon > 4) (unit-type-count trebuchet > 4) ) ) ;) => (set-goal siege-available YES) (chat-local-to-self "Turning siege on.") ) (defrule (goal soldiers-available NO) (or (or (unit-type-count militiaman-line > fifteen-percent-pop) (unit-type-count knight-line > fifteen-percent-pop) ) (or (or (unit-type-count scout-cavalry-line > fifteen-percent-pop) (unit-type-count cavalry-archer-line > fifteen-percent-pop) ) (or (unit-type-count archer-line > fifteen-percent-pop) (unit-type-count my-unique-unit-line > fifteen-percent-pop) ) ) ) => (set-goal soldiers-available YES) (chat-local-to-self "Turning siege (soldiers) on.") ) (defrule (goal soldiers-available YES) (unit-type-count militiaman-line < five-percent-pop) (unit-type-count knight-line < five-percent-pop) (unit-type-count scout-cavalry-line < five-percent-pop) (unit-type-count cavalry-archer-line < five-percent-pop) (unit-type-count archer-line < five-percent-pop) (unit-type-count my-unique-unit-line < five-percent-pop) => (set-goal soldiers-available NO) (chat-local-to-self "We don't have any soldiers.") (taunt 30) ) ;**************************************** ;BOMBARD CANNONS (defrule (goal soldiers-available YES) (unit-type-count-total bombard-cannon < five-percent-pop) (can-train bombard-cannon) (or (soldier-count > fifteen-percent-pop) (map-type black-forest) ) (not (town-under-attack) ) => (train bombard-cannon) (chat-local-to-self "Training bombard cannon.") ) ;*********************** ;SCORPIONS (defrule (goal upgrade-conflict NO) (goal siege-available NO) (unit-type-count scorpion < 5) (can-train-with-escrow scorpion) => (release-escrow wood) (release-escrow gold) (train scorpion) (chat-local-to-self "Training scorpion.") ) (defrule (goal soldiers-available YES) (unit-type-count scorpion < 6) (can-train scorpion) => (train scorpion) (chat-local-to-self "Training scorpion.") ) ;*********************** ;TREBUCHETS (defrule (goal siege-available NO) (can-train-with-escrow trebuchet) ;(not (town-under-attack)) => (release-escrow wood) (release-escrow gold) (train trebuchet) (chat-local-to-self "Training trebuchet.") ) (defrule (goal soldiers-available YES) (unit-type-count-total trebuchet < 5) (can-train trebuchet) ;(not (town-under-attack) ) => (train trebuchet) (chat-local-to-self "Training trebuchet.") ) ;***************************************** ;MANGONEL/ONAGER (defrule (goal upgrade-conflict NO) (goal siege-available NO) (can-train-with-escrow mangonel-line) => (release-escrow wood) (release-escrow gold) (train mangonel-line) (chat-local-to-self "Training mangonel line.") ) (defrule (goal upgrade-conflict NO) (goal soldiers-available YES) (unit-type-count-total mangonel-line < five-percent-pop) (can-train mangonel-line) (not (unit-available bombard-cannon) ) => (train mangonel-line) (chat-local-to-self "Training mangonel line.") ) (defrule (goal soldiers-available YES) (unit-type-count-total mangonel-line < ten-percent-pop) (can-train siege-onager) => (train siege-onager) (chat-local-to-self "Training siege onager.") ) ;**************************************** ;RAMS (defrule (goal upgrade-conflict NO) (goal siege-available NO) (can-train-with-escrow battering-ram-line) (or (unit-type-count militiaman-line > 0) (unit-type-count spearman-line > 0) ) (not (town-under-attack)) => (release-escrow wood) (release-escrow gold) (train battering-ram-line) (chat-local-to-self "Training battering ram line.") ) (defrule (goal upgrade-conflict NO) (goal soldiers-available YES) (unit-type-count-total battering-ram-line < five-percent-pop) (can-train battering-ram-line) (or (unit-type-count militiaman-line > 0) (unit-type-count spearman-line > 0) ) (nor (unit-available bombard-cannon) (town-under-attack) ) => (train battering-ram-line) (chat-local-to-self "Training battering ram line.") ) (defrule (goal upgrade-conflict NO) (goal soldiers-available YES) (unit-type-count-total battering-ram-line < ten-percent-pop) (can-train siege-ram) (or (unit-type-count militiaman-line > 0) (unit-type-count spearman-line > 0) ) (not (town-under-attack) ) => (train siege-ram) (chat-local-to-self "Training siege ram.") ) ;****************************************************** ;train specialty units (defrule (goal upgrade-conflict NO) (unit-type-count-total camel-line < 5) (can-train camel-line) => (chat-local-to-self "Training camel line.") (train camel-line) ) (defrule (goal upgrade-conflict NO) (unit-type-count-total spearman-line < 5) (can-train spearman-line) => (chat-local-to-self "Training spearman line.") (train spearman-line) ) (defrule (goal upgrade-conflict NO) (unit-type-count-total skirmisher-line < 5) (can-train skirmisher-line) => (chat-local-to-self "Training skirmisher line.") (train skirmisher-line) ) (defrule (goal upgrade-conflict NO) (unit-type-count-total scout-cavalry-line < 2) (can-train scout-cavalry-line) => (chat-local-to-self "Training scout cavalry line.") (train scout-cavalry-line) ) ;********************************** ;monks (defrule (goal upgrade-conflict NO) (unit-type-count-total monk < 2) (can-train monk) (not (goal monk-rating NO) ) => (train monk) (chat-local-to-self "Training monk.") ) ;***************************************************** (defrule (unit-type-count-total scout-cavalry-line == 0) (can-train scout-cavalry-line) => (chat-local-to-self "Training scout cavalry line.") (train scout-cavalry-line) ) ;********************************************* ; MILITARY PARITY ;********************************************* ;(defrule ; (not (goal military-parity YES) ) ;=> ; (set-goal military-parity YES) ;) (defrule (or (or (and (players-military-population any-enemy > 50) (military-population < 45) ) (and (players-military-population any-enemy > 40) (military-population < 35) ) ) (and (players-military-population any-enemy > 30) (military-population < 25) ) ) => (set-goal military-parity NO) ) (defrule (or (or (and (players-military-population any-enemy > 20) (military-population < 15) ) (and (players-military-population any-enemy > 10) (military-population < 5) ) ) (and (players-military-population any-enemy > 0) (military-population == 0) ) ) => (set-goal military-parity NO) ) (defrule (or (or (and (players-military-population every-enemy < 30) (military-population > 60) ) (and (players-military-population every-enemy < 25) (military-population > 50) ) ) (and (players-military-population every-enemy < 20) (military-population > 40) ) ) => (set-goal military-parity SUPERIOR) ) (defrule (or (or (and (players-military-population every-enemy < 15) (military-population > 30) ) (and (players-military-population every-enemy < 10) (military-population > 20) ) ) (and (players-military-population every-enemy == 0) (military-population > 4) ) ) => (set-goal military-parity SUPERIOR) ) ;enemy army size (defrule (players-military-population any-enemy == 0) (players-building-type-count any-enemy watch-tower-line == 0) (players-building-type-count any-enemy castle == 0) (players-building-type-count any-enemy town-center <= 1) (not (goal enemy-soldiers 0) ) => (set-goal enemy-soldiers 0) (disable-self) ) (defrule (or (players-military-population any-enemy > 1) (players-building-type-count any-enemy watch-tower-line > 0) ) (not (goal enemy-soldiers 10) ) => (chat-local-to-self "Enemy has about 10 soldiers!") (set-goal enemy-soldiers 10) (disable-self) ) (defrule (or (or (players-military-population any-enemy > 10) (players-building-type-count any-enemy watch-tower-line > 2) ) (or (players-building-type-count any-enemy castle > 0) (players-building-type-count any-enemy town-center > 1) ) ) (not (goal enemy-soldiers 20) ) => (chat-local-to-self "Enemy has about 20 soldiers!") (set-goal enemy-soldiers 20) (disable-self) ) (defrule (or (or (players-military-population any-enemy > 20) (players-building-type-count any-enemy watch-tower-line > 4) ) (or (players-building-type-count any-enemy castle > 1) (players-building-type-count any-enemy town-center > 2) ) ) (not (goal enemy-soldiers 30) ) => (chat-local-to-self "Enemy has about 30 soldiers!") (set-goal enemy-soldiers 30) (disable-self) ) (defrule (or (or (players-military-population any-enemy > 30) (players-building-type-count any-enemy watch-tower-line > 5) ) (or (players-building-type-count any-enemy castle > 2) (players-building-type-count any-enemy town-center > 3) ) ) (not (goal enemy-soldiers 40) ) => (chat-local-to-self "Enemy has about 40 soldiers!") (set-goal enemy-soldiers 40) (disable-self) ) ;********************************************************************* ; take some seige and soldiers and go attack ;********************************************************************* (defrule (timer-triggered t-attackgroup) => (disable-timer t-attackgroup) (enable-timer t-attackgroup 420) ) (defrule (current-age == imperial-age) (goal attack-control NO) (goal soldiers-available YES) (goal siege-available YES) => (chat-local-to-self "Time to attack!") (set-goal attack-control YES) ) (defrule (goal attack-control YES) (goal rush-control RUSHING) => (disable-timer t-attackgroup) (enable-timer t-attackgroup 1) (disable-self) ) (defrule (goal attack-control YES) (timer-triggered t-attackgroup) => (chat-local-to-self "ATTACKING NOW!") (set-strategic-number sn-percent-attack-soldiers 100) (attack-now) (disable-timer t-attackgroup) (enable-timer t-attackgroup 240) ) (defrule (timer-triggered t-attackgroup) (goal siege-available NO) (goal soldiers-available NO) => (set-goal attack-control NO) (set-strategic-number sn-percent-attack-soldiers 0) ) (defrule (timer-triggered t-attackgroup) (town-under-attack) => (chat-local-to-self "Tally ho, I am under attack!") (set-goal attack-control NO) ) ;************************************************************** ; RESEARCH: UPGRADES & TECHNOLOGIES ;************************************************************** ; ********** TARGET UPGRADES ********** (defrule (true) => (set-goal infantry-upgrades NO) (set-goal archer-upgrades NO) (set-goal cav-upgrades NO) ) (defrule (soldier-count >= five-percent-pop) (or (or (goal combat-arm INFANTRY) (goal combat-supp INFANTRY) ) (goal pre-unique-arm INFANTRY) ) => (set-goal infantry-upgrades YES) ) (defrule (building-type-count castle > 0) (soldier-count >= five-percent-pop) (or (civ-selected celtic) (civ-selected frankish) ) => (set-goal infantry-upgrades YES) ) (defrule (building-type-count castle > 0) (soldier-count >= five-percent-pop) (or (civ-selected gothic) (civ-selected japanese) ) => (set-goal infantry-upgrades YES) ) (defrule (building-type-count castle > 0) (soldier-count >= five-percent-pop) (or (civ-selected teutonic) (civ-selected viking) ) => (set-goal infantry-upgrades YES) ) (defrule (soldier-count >= five-percent-pop) (or (or (goal combat-arm CAVARCHER) (goal combat-arm ARCHER) ) (or (or (goal combat-supp CAVARCHER) (goal combat-supp ARCHER) ) (or (goal pre-unique-arm CAVARCHER) (goal pre-unique-arm ARCHER) ) ) ) => (set-goal archer-upgrades YES) ) (defrule (building-type-count castle > 0) (soldier-count >= five-percent-pop) (or (civ-selected mongol) (civ-selected turkish) ) => (set-goal archer-upgrades YES) ) (defrule (building-type-count castle > 0) (soldier-count >= five-percent-pop) (or (civ-selected briton) (civ-selected chinese) ) => (set-goal archer-upgrades YES) ) (defrule (soldier-count >= five-percent-pop) (or (goal pre-unique-arm CAVALRY) (or (or (goal combat-arm CAVALRY) (goal combat-arm LIGHTCAV) ) (or (goal combat-supp CAVALRY) (goal combat-supp LIGHTCAV) ) ) ) => (set-goal cav-upgrades YES) ) (defrule (building-type-count castle > 0) (soldier-count >= five-percent-pop) (or (or (civ-selected byzantine) (civ-selected persian) ) (civ-selected saracen) ) => (set-goal cav-upgrades YES) ) ; ********** TOWN CENTER RESEARCH ********** (defrule ;50 gold (game-time > 180) (civilian-population > 9) (can-research ri-loom) => (research ri-loom) (chat-local-to-self "Researching loom.") ) (defrule (goal upgrade-conflict NO) (can-research-with-escrow ri-wheel-barrow) => (release-escrow wood) (release-escrow food) (research ri-wheel-barrow) (chat-local-to-self "Researching wheel barrow.") ) (defrule ;200 wood, 300 food castle age upgrade (goal upgrade-conflict NO) (civilian-population > 28) (can-research-with-escrow ri-hand-cart) => (release-escrow wood) (release-escrow food) (research ri-hand-cart) (chat-local-to-self "Researching hand cart.") ) (defrule ;75 food (goal upgrade-conflict NO) (building-type-count town-center > 1) (research-available ri-town-watch) (food-amount > 500) (can-research-with-escrow ri-town-watch) => (release-escrow food) (research ri-town-watch) (chat-local-to-self "Researching town watch.") ) (defrule ;300 food, 200 gold (goal upgrade-conflict NO) (current-age == imperial-age) (building-type-count town-center > 1) (research-available ri-town-patrol) => (set-goal upgrade-conflict 2) (set-goal resource-supp FOOD-GOLD) (chat-local-to-self "Setting up to research patrol.") ) (defrule (goal upgrade-conflict 2) (can-research-with-escrow ri-town-patrol) => (release-escrow food) (release-escrow gold) (research ri-town-patrol) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching town patrol.") ) ; ********** MILL RESEARCH ********** (defrule (goal upgrade-conflict NO) (building-type-count-total farm > 6) (building-type-count mill > 0) (or (research-available ri-horse-collar) (or (research-available ri-heavy-plow) (research-available ri-crop-rotation) ) ) => (set-goal upgrade-conflict 9) (set-goal resource-supp WOOD-FOOD) (chat-local-to-self "Setting up to research horse collar.") ) (defrule (goal upgrade-conflict 9) (can-research-with-escrow ri-horse-collar) => (release-escrow wood) (release-escrow food) (research ri-horse-collar) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching horse collar.") ) (defrule (goal upgrade-conflict 9) (can-research-with-escrow ri-heavy-plow) => (release-escrow wood) (release-escrow food) (research ri-heavy-plow) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching heavy plow.") ) (defrule (goal upgrade-conflict 9) (can-research-with-escrow ri-crop-rotation) => (release-escrow wood) (release-escrow food) (research ri-crop-rotation) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching crop rotation.") ) ; ********** LUMBER-CAMP RESEARCH ********** (defrule ;200 wood, 300 food (goal upgrade-conflict NO) (current-age > dark-age) (building-type-count lumber-camp > 0) (or (research-available ri-double-bit-axe) (or (research-available ri-bow-saw) (research-available ri-two-man-saw) ) ) => (set-goal upgrade-conflict 5) (set-goal resource-supp WOOD-FOOD) (chat-local-to-self "Setting up to research axe.") ) (defrule (goal upgrade-conflict 5) (can-research-with-escrow ri-double-bit-axe) => (release-escrow wood) (release-escrow food) (research ri-double-bit-axe) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching double bit axe.") ) (defrule (goal upgrade-conflict 5) (can-research-with-escrow ri-bow-saw) => (release-escrow wood) (release-escrow food) (research ri-bow-saw) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching bow saw.") ) (defrule (goal upgrade-conflict 5) (can-research-with-escrow ri-two-man-saw) => (release-escrow wood) (release-escrow food) (research ri-two-man-saw) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching two man saw.") ) ; ********** MINING-CAMP RESEARCH ********** (defrule ;see if we can do some stone mining research (goal upgrade-conflict NO) (current-age > feudal-age) (building-type-count mining-camp > 1) (research-completed ri-gold-mining) (or (research-available ri-stone-mining) (research-available ri-stone-shaft-mining) ) => (set-goal upgrade-conflict 3) (set-goal resource-supp WOOD-FOOD) (chat-local-to-self "Setting up to research mining.") ) (defrule (goal upgrade-conflict 3) (can-research-with-escrow ri-stone-mining) => (release-escrow wood) (release-escrow food) (research ri-stone-mining) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching stone mining.") ) (defrule (goal upgrade-conflict 3) (can-research-with-escrow ri-stone-shaft-mining) => (release-escrow wood) (release-escrow food) (research ri-stone-shaft-mining) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching stone shaft mining.") ) (defrule (goal upgrade-conflict NO) (current-age > dark-age) (building-type-count mining-camp > 1) (or (research-available ri-gold-mining) (research-available ri-gold-shaft-mining) ) => (set-goal upgrade-conflict 4) (set-goal resource-supp WOOD-FOOD) (chat-local-to-self "Setting up to research mining.") ) (defrule (goal upgrade-conflict 4) (can-research-with-escrow ri-gold-mining) => (release-escrow wood) (release-escrow food) (research ri-gold-mining) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching gold mining.") ) (defrule (goal upgrade-conflict 4) (can-research-with-escrow ri-gold-shaft-mining) => (release-escrow wood) (release-escrow food) (research ri-gold-shaft-mining) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching gold shaft mining.") ) ; ********** BLACKSMITH RESEARCH ********** (defrule (goal upgrade-conflict NO) (building-type-count blacksmith > 0) (research-available ri-blast-furnace) => (set-goal upgrade-conflict 27) (set-goal resource-supp FOOD-GOLD) (chat-local-to-self "Setting up to research blacksmith.") ) (defrule (goal upgrade-conflict 27) (can-research-with-escrow ri-blast-furnace) => (release-escrow food) (release-escrow gold) (research ri-blast-furnace) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching blast furnace.") ) (defrule ;100 food, 50 gold (goal upgrade-conflict NO) (can-research-with-escrow ri-fletching) => (release-escrow food) (release-escrow gold) (chat-local-to-self "Researching fletching.") (research ri-fletching) ) (defrule (goal upgrade-conflict NO) (can-research-with-escrow ri-forging) => (release-escrow food) (chat-local-to-self "Researching forging.") (research ri-forging) ) (defrule (goal upgrade-conflict NO) (can-research-with-escrow ri-iron-casting) => (release-escrow food) (release-escrow gold) (chat-local-to-self "Researching iron casting.") (research ri-iron-casting) ) (defrule (goal upgrade-conflict NO) (can-research-with-escrow ri-padded-archer-armor) (or (goal archer-upgrades YES) (or (building-type-count watch-tower-line > 0) (building-type-count archery-range > 0) ) ) => (release-escrow food) (chat-local-to-self "Researching padded archer armor.") (research ri-padded-archer-armor) ) (defrule (goal upgrade-conflict NO) (can-research-with-escrow ri-leather-archer-armor) (or (goal archer-upgrades YES) (or (building-type-count watch-tower-line > 0) (building-type-count archery-range > 0) ) ) => (release-escrow food) (release-escrow gold) (chat-local-to-self "Researching leather archer armor.") (research ri-leather-archer-armor) ) (defrule ;200 food, 100 gold (goal upgrade-conflict NO) (can-research-with-escrow ri-bodkin-arrow) => (release-escrow food) (release-escrow gold) (chat-local-to-self "Researching bodkin arrow.") (research ri-bodkin-arrow) ) (defrule ;300 food, 150 gold (goal upgrade-conflict NO) (goal infantry-upgrades YES) (building-type-count blacksmith > 0) (research-available ri-plate-mail) => (set-goal upgrade-conflict 24) (set-goal resource-supp FOOD-GOLD) (chat-local-to-self "Setting up to research mail.") ) (defrule (goal upgrade-conflict 24) (can-research-with-escrow ri-plate-mail) => (release-escrow food) (release-escrow gold) (chat-local-to-self "Researching plate mail.") (research ri-plate-mail) (set-goal upgrade-conflict NO) ) (defrule ;350 food, 200 gold (goal upgrade-conflict NO) (goal cav-upgrades YES) (building-type-count blacksmith > 0) (research-available ri-plate-barding) => (set-goal upgrade-conflict 25) (set-goal resource-supp FOOD-GOLD) (chat-local-to-self "Setting up to research barding.") ) (defrule (goal upgrade-conflict 25) (can-research-with-escrow ri-plate-barding) => (release-escrow food) (release-escrow gold) (chat-local-to-self "Researching plate barding.") (research ri-plate-barding) (set-goal upgrade-conflict NO) ) (defrule ;250 food, 250 gold (goal upgrade-conflict NO) (goal archer-upgrades YES) (building-type-count blacksmith > 0) (research-available ri-ring-archer-armor) => (set-goal upgrade-conflict 26) (set-goal resource-supp FOOD-GOLD) (chat-local-to-self "Setting up to research armor.") ) (defrule (goal upgrade-conflict 26) (can-research-with-escrow ri-ring-archer-armor) => (release-escrow food) (release-escrow gold) (chat-local-to-self "Researching ring archer armor.") (research ri-ring-archer-armor) (set-goal upgrade-conflict NO) ) (defrule ;300 food, 200 gold (goal upgrade-conflict NO) (building-type-count blacksmith > 0) (research-available ri-bracer) => (set-goal upgrade-conflict 28) (set-goal resource-supp FOOD-GOLD) (chat-local-to-self "Setting up to research bracer.") ) (defrule (goal upgrade-conflict 28) (can-research-with-escrow ri-bracer) => (release-escrow food) (release-escrow gold) (research ri-bracer) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching bracer.") ) ; ********** UNIVERSITY RESEARCH ********** (defrule ;300 wood, 175 gold (goal upgrade-conflict NO) (building-type-count university > 0) (research-available ri-ballistics) => (set-goal upgrade-conflict 46) (set-goal resource-supp WOOD-GOLD) (chat-local-to-self "Setting up to research ballistics.") ) (defrule (goal upgrade-conflict 46) (can-research-with-escrow ri-ballistics) => (release-escrow wood) (release-escrow gold) (research ri-ballistics) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching ballistics.") ) (defrule (goal upgrade-conflict NO) (building-type-count-total university > 0) (or (research-available ri-masonry) (research-available ri-architecture) ) => (set-goal upgrade-conflict 41) (set-goal resource-supp WOOD-STONE) (chat-local-to-self "Setting up to research masonry.") ) (defrule (goal upgrade-conflict 41) (can-research-with-escrow ri-masonry) => (release-escrow wood) (release-escrow stone) (chat-local-to-self "Researching masonry.") (research ri-masonry) (set-goal upgrade-conflict NO) ) (defrule (goal upgrade-conflict 41) (can-research-with-escrow ri-architecture) => (release-escrow wood) (release-escrow stone) (research ri-architecture) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching architecture.") ) (defrule (goal upgrade-conflict NO) ;(civ-selected korean) (building-type-count watch-tower > 1) (research-available ri-guard-tower) (can-research-with-escrow ri-guard-tower) => (release-escrow food) (release-escrow stone) (research ri-guard-tower) (chat-local-to-self "Researching guard tower.") ) (defrule ;500 food, 350 stone (goal upgrade-conflict NO) (building-type-count university > 0) (building-type-count guard-tower > 0) (research-available ri-keep) => (set-goal upgrade-conflict 43) (set-goal resource-supp FOOD-STONE) (chat-local-to-self "Researching keep.") ) (defrule (goal upgrade-conflict 43) (can-research-with-escrow ri-keep) => (release-escrow food) (release-escrow stone) (chat-local-to-self "Researching keep.") (research ri-keep) (set-goal upgrade-conflict NO) ) (defrule ;800 food, 400 stone (goal upgrade-conflict NO) (building-type-count university > 0) (civ-selected turkish) (building-type-count watch-tower > 2) (research-available ri-bombard-tower) => (set-goal upgrade-conflict 44) (set-goal resource-supp FOOD-STONE) (chat-local-to-self "Setting up to research tower.") ) (defrule (goal upgrade-conflict 44) (can-research-with-escrow ri-bombard-tower) => (release-escrow food) (release-escrow stone) (chat-local-to-self "Researching bombard tower.") (research ri-bombard-tower) (set-goal upgrade-conflict NO) ) (defrule ;200 food, 200 stone (goal upgrade-conflict NO) (can-research-with-escrow ri-murder-holes) => (release-escrow food) (release-escrow stone) (research ri-murder-holes) (chat-local-to-self "Researching murder holes.") ) (defrule ;200 food, 100 stone (goal upgrade-conflict NO) (goal wall-build YES) (can-research-with-escrow ri-fortified-wall) => (release-escrow food) (release-escrow stone) (chat-local-to-self "Researching fortified wall.") (research ri-fortified-wall) ) (defrule (goal upgrade-conflict NO) (research-available ri-siege-engineers) => (set-goal upgrade-conflict 45) (set-goal resource-supp WOOD-FOOD) (chat-local-to-self "Setting up to research siege.") ) (defrule (goal upgrade-conflict 45) (can-research-with-escrow ri-siege-engineers) => (release-escrow food) (release-escrow wood) (research ri-siege-engineers) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching siege engineers.") ) (defrule ;300 food, 200 gold (building-type-count university > 0) (research-available ri-chemistry) (can-research-with-escrow ri-chemistry) => (release-escrow food) (release-escrow gold) (chat-local-to-self "Researching chemistry.") (research ri-chemistry) ) ; ********** MONASTERY RESEARCH ********** (defrule ;475 gold (goal upgrade-conflict NO) ;(goal monk-rating GOOD) (building-type-count monastery > 0) (unit-type-count-total monk > 1) (research-available ri-redemption) => (set-goal upgrade-conflict MONASTERY) (set-goal resource-supp GOLD-ONLY) (chat-local-to-self "Setting up to research monks.") ) (defrule (goal upgrade-conflict MONASTERY) (can-research-with-escrow ri-redemption) => (release-escrow gold) (chat-local-to-self "Researching redemption.") (research ri-redemption) (set-goal upgrade-conflict NO) ) (defrule ;325 gold (goal upgrade-conflict NO) (goal monk-rating GOOD) (building-type-count monastery > 0) (unit-type-count-total monk > 1) (research-available ri-atonement) => (set-goal upgrade-conflict 34) (set-goal resource-supp GOLD-ONLY) (chat-local-to-self "Setting up to research monks.") ) (defrule (goal upgrade-conflict 34) (can-research-with-escrow ri-atonement) => (release-escrow gold) (chat-local-to-self "Researching atonement.") (research ri-atonement) (set-goal upgrade-conflict NO) (set-goal resource-supp GOLD-ONLY) ) (defrule ;200 gold (goal upgrade-conflict NO) ;(goal monk-rating GOOD) (building-type-count monastery > 0) (unit-type-count-total monk > 1) (research-available ri-block-printing) => (set-goal upgrade-conflict 35) (set-goal resource-supp GOLD-ONLY) (chat-local-to-self "Setting up to research monks.") ) (defrule (goal upgrade-conflict 35) (can-research-with-escrow ri-block-printing) => (release-escrow gold) (chat-local-to-self "Researching block printing.") (research ri-block-printing) (set-goal upgrade-conflict NO) ) (defrule ;140 gold (goal upgrade-conflict NO) (building-type-count monastery > 0) (unit-type-count-total monk > 0) (research-available ri-fervor) => (set-goal upgrade-conflict 36) (set-goal resource-supp GOLD-ONLY) (chat-local-to-self "Setting up to research monks.") ) (defrule (goal upgrade-conflict 36) (can-research-with-escrow ri-fervor) => (release-escrow gold) (chat-local-to-self "Researching fervor.") (research ri-fervor) (set-goal upgrade-conflict NO) ) (defrule ;120 gold (goal upgrade-conflict NO) (building-type-count monastery > 0) (unit-type-count-total monk > 0) (research-available ri-illumination) => (set-goal upgrade-conflict 37) (set-goal resource-supp GOLD-ONLY) (chat-local-to-self "Setting up to research monks.") ) (defrule (goal upgrade-conflict 37) (can-research-with-escrow ri-illumination) => (release-escrow gold) (chat-local-to-self "Researching illumination.") (research ri-illumination) (set-goal upgrade-conflict NO) ) (defrule ;120 gold (goal upgrade-conflict NO) (building-type-count monastery > 0) (unit-type-count-total monk > 0) (research-available ri-sanctity) => (set-goal upgrade-conflict 38) (set-goal resource-supp GOLD-ONLY) (chat-local-to-self "Setting up to research monks.") ) (defrule (goal upgrade-conflict 38) (can-research-with-escrow ri-sanctity) => (release-escrow gold) (chat-local-to-self "Researching sanctity.") (research ri-sanctity) (set-goal upgrade-conflict NO) ) ;(defrule ;1000 gold ; (goal upgrade-conflict NO) ; (building-type-count monastery > 0) ; (research-available ri-heresy) ; (not (research-completed ri-faith) ) ;=> ; (set-goal upgrade-conflict 39) ; (set-goal resource-supp GOLD-ONLY) ; (chat-local-to-self "Setting up to research monks.") ;) ; ;(defrule ; (goal upgrade-conflict 39) ; (can-research-with-escrow ri-heresy) ;=> ; (release-escrow gold) ; (chat-local-to-self "Researching heresy.") ; (research ri-heresy) ; (set-goal upgrade-conflict NO) ;) ;(defrule ;750 food, 1000 gold ; (goal upgrade-conflict NO) ; (building-type-count monastery > 0) ; (research-available ri-faith) ; (not (research-completed ri-heresy) ) ;=> ; (set-goal upgrade-conflict 40) ; (set-goal resource-supp FOOD-GOLD) ; (chat-local-to-self "Setting up to research monks.") ;) ; ;(defrule ; (goal upgrade-conflict 40) ; (can-research-with-escrow ri-faith) ;=> ; (release-escrow food) ; (release-escrow gold) ; (chat-local-to-self "Researching faith.") ; (research ri-faith) ; (set-goal upgrade-conflict NO) ;) ; ********** CIVILATION RESEARCH ********** (defrule (goal upgrade-conflict NO) (building-type-count castle > 0) => (set-goal upgrade-conflict 94) (chat-local-to-self "Setting up to research unique stuff.") ) (defrule (goal upgrade-conflict 94) (or (civ-selected celtic) (civ-selected persian) ) => (set-goal upgrade-conflict 95) (set-goal resource-supp FOOD-GOLD) ) (defrule (goal upgrade-conflict 94) (or (civ-selected saracen) (civ-selected viking) ) => (set-goal upgrade-conflict 95) (set-goal resource-supp FOOD-GOLD) ) (defrule (goal upgrade-conflict 94) (civ-selected chinese) => (set-goal upgrade-conflict 95) (set-goal resource-supp WOOD-GOLD) ) (defrule (goal upgrade-conflict 94) (civ-selected briton) (research-completed ri-bracer) => (set-goal upgrade-conflict 95) (set-goal resource-supp WOOD-GOLD) ) (defrule (goal upgrade-conflict 94) (or (civ-selected byzantine) (civ-selected frankish) ) => (set-goal upgrade-conflict 95) (set-goal resource-supp FOOD-GOLD) ) (defrule (goal upgrade-conflict 94) (building-type-count siege-workshop > 0) (or (civ-selected japanese) (civ-selected mongol) ) => (set-goal upgrade-conflict 95) (set-goal resource-supp FOOD-GOLD) ) (defrule (goal upgrade-conflict 94) (civ-selected turkish) (or (unit-type-count-total bombard-cannon > 3) (unit-type-count-total bombard-tower > 3) ) => (set-goal upgrade-conflict 95) (set-goal resource-supp FOOD-STONE) ) (defrule (goal upgrade-conflict 94) => (set-goal upgrade-conflict NO) ) ; ********** MARKET RESEARCH ********** (defrule (goal upgrade-conflict NO) (can-research-with-escrow ri-guilds) => (release-escrow food) (release-escrow gold) (research ri-guilds) (chat-local-to-self "Researching guilds.") ) (defrule (goal upgrade-conflict NO) (players-population any-ally > 1) (can-research-with-escrow ri-coinage) => (release-escrow food) (release-escrow gold) (research ri-coinage) (chat-local-to-self "Researching coinage.") ) (defrule (goal upgrade-conflict NO) (players-population any-ally > 1) (can-research-with-escrow ri-cartography) => (release-escrow food) (release-escrow gold) (research ri-cartography) (chat-local-to-self "Researching cartography.") ) (defrule (goal upgrade-conflict NO) (players-population any-ally > 1) (can-research-with-escrow ri-banking) => (release-escrow food) (release-escrow gold) (research ri-banking) (chat-local-to-self "Researching banking.") ) ; ********** BARRACKS RESEARCH ********** (defrule ;75 food (goal upgrade-conflict NO) (building-type-count barracks > 0) (research-available ri-tracking) => (set-goal upgrade-conflict 11) (set-goal resource-supp FOOD-ONLY) (chat-local-to-self "Setting up to research barracks.") ) (defrule (goal upgrade-conflict 11) (can-research-with-escrow ri-tracking) => (release-escrow food) (research ri-tracking) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching tracking.") ) (defrule ;750 food, 350 gold (goal upgrade-conflict NO) (building-type-count barracks > 0) (research-available ri-champion) => (set-goal upgrade-conflict 12) (set-goal resource-supp FOOD-GOLD) (chat-local-to-self "Setting up to research champion.") ) (defrule (goal upgrade-conflict 12) (can-research-with-escrow ri-champion) => (release-escrow food) (release-escrow gold) (research ri-champion) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching champion.") ) (defrule ;200 food (goal upgrade-conflict NO) (building-type-count barracks > 0) (research-available ri-squires) => (set-goal upgrade-conflict 13) (set-goal resource-supp FOOD-ONLY) (chat-local-to-self "Setting up to research squires.") ) (defrule (goal upgrade-conflict 13) (can-research-with-escrow ri-squires) => (release-escrow food) (research ri-squires) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching squires.") ) (defrule ;215 food, 90 gold (goal upgrade-conflict NO) (can-research-with-escrow ri-pikeman) => (release-escrow food) (release-escrow gold) (research ri-pikeman) (chat-local-to-self "Researching pikeman.") ) (defrule ;man-at-arms (building-type-count barracks > 0) (can-research-with-escrow ri-man-at-arms) => (release-escrow food) (release-escrow gold) (research ri-man-at-arms) (chat-local-to-self "Researching men at arms.") ) (defrule ;200 food, 65 gold (goal upgrade-conflict NO) (can-research-with-escrow ri-long-swordsman) => (release-escrow food) (release-escrow gold) (research ri-long-swordsman) (chat-local-to-self "Researching long swordsman.") ) (defrule ;300 food, 100 gold (goal upgrade-conflict NO) (can-research-with-escrow ri-two-handed-swordsman) => (release-escrow food) (release-escrow gold) (research ri-two-handed-swordsman) (chat-local-to-self "Researching two-handed swordsman.") ) ; ********** STABLE RESEARCH ********** (defrule ;250 food (goal upgrade-conflict NO) (building-type-count stable > 0) (research-available ri-husbandry) (or (or (goal cav-upgrades YES) (goal combat-arm CAVARCHER) ) (or (goal combat-supp CAVARCHER) (civ-selected mongol) ) ) => (set-goal upgrade-conflict 17) (set-goal resource-supp FOOD-ONLY) (chat-local-to-self "Setting up to research husbandry.") ) (defrule (goal upgrade-conflict 17) (can-research-with-escrow ri-husbandry) => (release-escrow food) (research ri-husbandry) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching husbandry.") ) (defrule ;150 food, 50 gold (goal upgrade-conflict NO) (can-research-with-escrow ri-light-cavalry) => (release-escrow food) (release-escrow gold) (research ri-light-cavalry) (chat-local-to-self "Researching light cavalry.") ) (defrule (goal upgrade-conflict NO) (building-type-count stable > 0) (unit-type-count camel > 2) (research-available ri-heavy-camel) (goal cav-upgrades YES) => (set-goal upgrade-conflict 15) (set-goal resource-supp FOOD-GOLD) (chat-local-to-self "Setting up to research heavy camel.") ) (defrule (goal upgrade-conflict 15) (can-research-with-escrow ri-heavy-camel) => (release-escrow food) (release-escrow gold) (research ri-heavy-camel) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching heavy camel.") ) (defrule (goal upgrade-conflict NO) (building-type-count stable > 0) (or (goal combat-arm CAVALRY) (goal combat-supp CAVALRY) ) (or (research-available ri-paladin) (research-available ri-cavalier) ) => (set-goal upgrade-conflict 16) (set-goal resource-supp FOOD-GOLD) (chat-local-to-self "Setting up to research cavalier.") ) (defrule (goal upgrade-conflict 16) (can-research-with-escrow ri-cavalier) => (release-escrow food) (release-escrow gold) (research ri-cavalier) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching cavalier.") ) (defrule (goal upgrade-conflict 16) (can-research-with-escrow ri-paladin) => (release-escrow food) (release-escrow gold) (research ri-paladin) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching paladin.") ) ;********** ARCHERY RANGE RESEARCH ********** (defrule ;450 food, 200 gold (goal upgrade-conflict NO) (can-research-with-escrow ri-hand-cannon) => (release-escrow food) (release-escrow gold) (research ri-hand-cannon) (chat-local-to-self "Researching hand cannon.") ) (defrule ;125 food, 75 gold (goal upgrade-conflict NO) (research-available ri-crossbow) (can-research-with-escrow ri-crossbow) ;(not (research-completed ri-crossbow)) (or (goal combat-arm ARCHER) (or (goal combat-supp ARCHER) (goal pre-unique-arm ARCHER) ) ) => (release-escrow food) (release-escrow gold) (chat-local-to-self "Researching crossbow.") (research ri-crossbow) ) (defrule ;350 food, 300 gold (goal upgrade-conflict NO) (building-type-count archery-range > 0) (research-available ri-arbalest) (nor (research-available ri-hand-cannon) (research-completed ri-hand-cannon) ) (or (goal combat-arm ARCHER) (goal combat-supp ARCHER) ) => (set-goal upgrade-conflict 20) (set-goal resource-supp FOOD-GOLD) (chat-local-to-self "Setting up to research arbalest.") ) (defrule (goal upgrade-conflict 20) (can-research-with-escrow ri-arbalest) => (release-escrow food) (release-escrow gold) (research ri-arbalest) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching arbalest.") ) (defrule ;900 food, 500 gold (goal upgrade-conflict NO) (goal combat-arm CAVARCHER) (building-type-count archery-range > 0) (research-available ri-heavy-cavalry-archer) => (set-goal upgrade-conflict 21) (set-goal resource-supp FOOD-GOLD) (chat-local-to-self "Setting up to research heavy archer.") ) (defrule (goal upgrade-conflict 21) (can-research-with-escrow ri-heavy-cavalry-archer) => (release-escrow food) (release-escrow gold) (research ri-heavy-cavalry-archer) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching heavy cavalry archer.") ) (defrule ;250 wood, 160 gold (unit-type-count skirmisher > 6) (can-research-with-escrow ri-elite-skirmisher) (or (goal upgrade-conflict NO) (current-age-time > 120) ) => (release-escrow wood) (release-escrow gold) (research ri-elite-skirmisher) (chat-local-to-self "Researching elite skirmisher.") ) ; ********** SIEGE-WORKSHOP RESEARCH ********** (defrule ;1000 food, 800 gold (goal upgrade-conflict NO) (building-type-count siege-workshop > 0) (or (research-available ri-siege-ram) (research-available ri-capped-ram) ) (nor (research-completed ri-bombard-cannon) (research-completed ri-siege-onager) ) => (set-goal upgrade-conflict 30) (set-goal resource-supp FOOD-GOLD) (chat-local-to-self "Setting up to research ram.") ) (defrule (goal upgrade-conflict 30) (can-research-with-escrow ri-capped-ram) => (release-escrow food) (release-escrow gold) (research ri-capped-ram) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching capped ram.") ) (defrule (goal upgrade-conflict 30) (can-research-with-escrow ri-siege-ram) => (release-escrow food) (release-escrow gold) (research ri-siege-ram) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching siege ram.") ) (defrule ;1450 food, 1000 gold (goal upgrade-conflict NO) (building-type-count siege-workshop > 0) (or (research-available ri-onager) (research-available ri-siege-onager) ) (nor (research-completed ri-bombard-cannon) (research-completed ri-siege-ram) ) => (set-goal upgrade-conflict 31) (set-goal resource-supp FOOD-GOLD) (chat-local-to-self "Setting up to research onager.") ) (defrule (goal upgrade-conflict 31) (can-research-with-escrow ri-onager) => (release-escrow food) (release-escrow gold) (research ri-onager) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching onager.") ) (defrule (goal upgrade-conflict 31) (can-research-with-escrow ri-siege-onager) => (release-escrow food) (release-escrow gold) (research ri-siege-onager) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching siege onager.") ) (defrule ;500 food, 250 gold (goal upgrade-conflict NO) (can-research-with-escrow ri-bombard-cannon) => (release-escrow food) (release-escrow gold) (research ri-bombard-cannon) (chat-local-to-self "Researching bombard cannon.") ) ; ********** CASTLE RESEARCH ********** (defrule ;150 food, 150 gold (goal upgrade-conflict NO) (can-research-with-escrow ri-conscription) => (release-escrow food) (release-escrow gold) (research ri-conscription) (chat-local-to-self "Researching conscription.") ) (defrule ;400 wood, 400 stone (goal upgrade-conflict NO) (building-type-count castle > 0) (research-available ri-hoardings) => (set-goal upgrade-conflict 47) (set-goal resource-supp WOOD-STONE) (chat-local-to-self "Setting up to research hoardings.") ) (defrule (goal upgrade-conflict 47) (can-research-with-escrow ri-hoardings) => (release-escrow wood) (release-escrow stone) (research ri-hoardings) (set-goal upgrade-conflict NO) (chat-local-to-self "Researching hoardings.") ) (defrule (goal upgrade-conflict NO) (building-type-count castle > 0) (can-research-with-escrow ri-elite-longbowman) => (release-escrow food) (release-escrow gold) (research ri-elite-longbowman) (chat-local-to-self "Researching elite long bowman.") ) (defrule (goal upgrade-conflict NO) (building-type-count castle > 0) (can-research-with-escrow ri-elite-samurai) => (release-escrow food) (release-escrow gold) (research ri-elite-samurai) (chat-local-to-self "Researching elite samuri.") ) (defrule (goal upgrade-conflict NO) (building-type-count castle > 0) (can-research-with-escrow ri-elite-woad-raider) => (release-escrow food) (release-escrow gold) (research ri-elite-woad-raider) (chat-local-to-self "Researching elite woad raider.") ) (defrule (goal upgrade-conflict NO) (building-type-count castle > 0) (can-research-with-escrow ri-elite-janissary) => (release-escrow food) (release-escrow gold) (research ri-elite-janissary) (chat-local-to-self "Researching elite janissary.") ) ;************************************************************** ; MILITARY SUPPORT ;************************************************************** (defrule (timer-triggered t-production) (goal military-parity NO) => (set-goal combat-supp RESERVES) ) ;************************************ ;feudal-age (defrule (goal combat-supp RESERVES) (current-age == feudal-age) (timer-triggered t-production) (or (or (goal combat-arm INFANTRY) (goal combat-arm CAVALRY) ) (or (goal combat-arm EAGLEMAN) (goal pre-unique-arm INFANTRY) ) ) => (set-goal combat-supp ARCHER) ) ;castle-age & higher ;if Infantry is the main build (defrule (goal combat-arm INFANTRY) (goal combat-supp RESERVES) (timer-triggered t-production) => (set-goal combat-supp ARCHER) ) ;if eagle warriors are the main build (defrule (goal combat-arm EAGLEMAN) (goal combat-supp RESERVES) (timer-triggered t-production) => (set-goal combat-supp INFANTRY) ) ;if Cavalry is the main build (defrule (goal combat-supp RESERVES) (timer-triggered t-production) (goal combat-arm CAVALRY) => (set-goal combat-supp CAVARCHER) ) ;if Light Cav is the main build (defrule (goal combat-arm LIGHTCAV) (goal combat-supp RESERVES) (timer-triggered t-production) => (set-goal combat-supp CAVALRY) ) ;if Cav Archers are the main build (defrule (goal combat-supp RESERVES) (timer-triggered t-production) (goal combat-arm CAVARCHER) => (set-goal combat-supp INFANTRY) ) ;if Archers are the main build (defrule (goal combat-supp RESERVES) (timer-triggered t-production) (goal combat-arm ARCHER) => (set-goal combat-supp INFANTRY) ) ;periodically check how we're doing! (defrule (timer-triggered t-production) => (disable-timer t-production) (enable-timer t-production 180) ) ;******************************************************* ;INFANTRY ARMY (defrule (soldier-count < five-percent-pop) (building-type-count stable == 0) (building-type-count archery-range == 0) (building-type-count castle == 0) (players-military-population any-enemy >= ten-percent-pop) (can-train militiaman) => (train militiaman) (chat-local-to-self "emergency militia") ) (defrule (goal rush-control RUSHING) (soldier-count < fifteen-percent-pop) (can-train-with-escrow militiaman-line) (nor (can-train militiaman-line) (goal upgrade-conflict ADVANCE) ) (or (goal combat-arm INFANTRY) (goal pre-unique-arm INFANTRY) ) => (release-escrow food) (release-escrow gold) (chat-local-to-self "Training militiaman line.") (train militiaman-line) (set-goal secondary-build NO) ) (defrule (goal upgrade-conflict NO) (current-age > feudal-age) (population < unit-max) (can-train militiaman-line) (or (goal combat-arm INFANTRY) (goal pre-unique-arm INFANTRY) ) => (chat-local-to-self "Training militiaman line.") (train militiaman-line) (set-goal secondary-build NO) ) (defrule (goal upgrade-conflict NO) (goal secondary-build NO) (current-age > feudal-age) (goal combat-supp INFANTRY) (population < unit-max) (can-train militiaman-line) => (chat-local-to-self "Training militiaman line.") (train militiaman-line) (set-goal secondary-build YES) ) ;******************************************************* ;EAGLE WARRIOR ARMY (defrule (goal rush-control RUSHING) (current-age < castle-age) (soldier-count < ten-percent-pop) (can-train-with-escrow militiaman-line) (goal combat-arm EAGLEMAN) (nor (can-train militiaman-line) (goal upgrade-conflict ADVANCE) ) => (release-escrow food) (release-escrow gold) (chat-local-to-self "Training militiaman line.") (train militiaman-line) (set-goal secondary-build NO) ) (defrule (goal upgrade-conflict NO) (current-age > feudal-age) (soldier-count < twenty-percent-pop) (players-military-population any-enemy >= ten-percent-pop) (goal combat-arm EAGLEMAN) (can-train militiaman-line) => (chat-local-to-self "Training militiaman line.") (train militiaman-line) (set-goal secondary-build NO) ) ;******************************************************************** ;CAVALRY ARMY == goal combat-arm CAVALRY & goal combat-supp CAVALRY (defrule (goal rush-control RUSHING) (current-age < castle-age) (soldier-count < ten-percent-pop) (can-train-with-escrow militiaman-line) (goal combat-arm CAVALRY) (nor (can-train militiaman-line) (goal upgrade-conflict ADVANCE) ) => (release-escrow food) (release-escrow gold) (chat-local-to-self "Training militiaman line.") (train militiaman-line) (set-goal secondary-build NO) ) (defrule (goal rush-control RUSHING) (soldier-count < ten-percent-pop) (can-train-with-escrow knight-line) (nor (can-train knight-line) (goal upgrade-conflict ADVANCE) ) (or (goal combat-arm CAVALRY) (goal pre-unique-arm CAVALRY) ) => (release-escrow food) (release-escrow gold) (chat-local-to-self "Training knight line.") (train knight-line) (set-goal secondary-build NO) ) (defrule (goal upgrade-conflict NO) (current-age > feudal-age) (soldier-count < twenty-percent-pop) (players-military-population any-enemy >= ten-percent-pop) (or (goal combat-arm CAVALRY) (goal pre-unique-arm CAVALRY) ) (can-train militiaman-line) => (chat-local-to-self "Training militiaman line.") (train militiaman-line) (set-goal secondary-build NO) ) (defrule (goal upgrade-conflict NO) (current-age > feudal-age) (population < unit-max) (can-train knight-line) (or (goal combat-arm CAVALRY) (goal pre-unique-arm CAVALRY) ) => (chat-local-to-self "Training knight line.") (train knight-line) (set-goal secondary-build NO) ) (defrule (goal upgrade-conflict NO) (goal secondary-build NO) (current-age > feudal-age) (goal combat-supp CAVALRY) (population < unit-max) (can-train knight-line) => (chat-local-to-self "Training knight line.") (train knight-line) (set-goal secondary-build YES) ) ;******************************************************************** ;LIGHT CAV ARMY == goal combat-arm LIGHTCAV & goal combat-supp LIGHTCAV (defrule (goal rush-control RUSHING) (goal combat-arm LIGHTCAV) (soldier-count < ten-percent-pop) (can-train-with-escrow scout-cavalry-line) (nor (can-train scout-cavalry-line) (goal upgrade-conflict ADVANCE) ) => (release-escrow food) (chat-local-to-self "Training scout cavalry line.") (train scout-cavalry-line) (set-goal secondary-build NO) ) (defrule (goal combat-arm LIGHTCAV) (current-age > feudal-age) (population < unit-max) (can-train light-cavalry) (or (current-age == castle-age) (not (can-afford-unit knight-line) ) ) => (chat-local-to-self "Training light cavalry.") (train light-cavalry) (set-goal secondary-build NO) ) (defrule (goal combat-arm LIGHTCAV) (current-age == imperial-age) (population < unit-max) (can-train knight-line) => (chat-local-to-self "Training knight line.") (train knight-line) (set-goal secondary-build NO) ) (defrule (goal secondary-build NO) (current-age > feudal-age) (population < unit-max) (can-train light-cavalry) (or (goal combat-supp LIGHTCAV) (and (goal combat-arm LIGHTCAV) (current-age == imperial-age) ) ) => (chat-local-to-self "Training light cavalry line.") (train light-cavalry) (set-goal secondary-build YES) ) ;******************************************************************** ;CAV ARCHER ARMY == goal combat-arm CAVARCHER & goal combat-supp CAVARCHER (defrule (goal rush-control RUSHING) (current-age > feudal-age) (soldier-count < ten-percent-pop) (can-train-with-escrow archer) (nor (can-train archer) (goal upgrade-conflict ADVANCE) ) (or (goal combat-arm CAVARCHER) (goal pre-unique-arm CAVARCHER) ) => (release-escrow wood) (release-escrow gold) (chat-local-to-self "Training archer.") (train archer) (set-goal secondary-build NO) ) (defrule (goal rush-control RUSHING) (soldier-count < ten-percent-pop) (can-train-with-escrow cavalry-archer-line) (nor (can-train cavalry-archer-line) (goal upgrade-conflict ADVANCE) ) (or (goal combat-arm CAVARCHER) (goal pre-unique-arm CAVARCHER) ) => (release-escrow wood) (release-escrow gold) (chat-local-to-self "Training cavalry archer line.") (train cavalry-archer-line) (set-goal secondary-build NO) ) (defrule (current-age > feudal-age) (soldier-count < twenty-percent-pop) (can-train-with-escrow archer-line) (not (can-train archer-line) ) (or (goal rush-control RUSHING) (players-military-population any-enemy >= ten-percent-pop) ) (or (goal combat-arm CAVARCHER) (goal pre-unique-arm CAVARCHER) ) => (chat-local-to-self "Training archer line.") (train archer-line) (set-goal secondary-build NO) ) (defrule (current-age > feudal-age) (soldier-count < twenty-percent-pop) (can-train-with-escrow archer-line) (not (can-train archer-line) ) (or (goal rush-control RUSHING) (players-military-population any-enemy >= ten-percent-pop) ) (or (goal combat-arm CAVARCHER) (goal pre-unique-arm CAVARCHER) ) => (chat-local-to-self "Training archer line.") (train archer-line) (set-goal secondary-build NO) ) (defrule (population < unit-max) (current-age > feudal-age) (can-train cavalry-archer-line) (or (goal combat-arm CAVARCHER) (goal pre-unique-arm CAVARCHER) ) => (chat-local-to-self "Training cavalry archer line.") (train cavalry-archer-line) (set-goal secondary-build NO) ) (defrule (current-age > feudal-age) (goal secondary-build NO) (goal combat-supp CAVARCHER) (population < unit-max) (can-train cavalry-archer-line) => (chat-local-to-self "Training cavalry archer line.") (train cavalry-archer-line) (set-goal secondary-build YES) ) ;******************************************************* ;HAND-CANNONEERS (defrule (population < unit-max) (can-train hand-cannoneer) (or (goal combat-arm ARCHER) (goal pre-unique-arm ARCHER) ) => (chat-local-to-self "Training hand cannoneer.") (train hand-cannoneer) (set-goal secondary-build NO) ) (defrule (goal secondary-build NO) (goal combat-supp ARCHER) (population < unit-max) (can-train hand-cannoneer) => (chat-local-to-self "Training hand cannoneer.") (train hand-cannoneer) (set-goal secondary-build YES) ) ;******************************************************* ;ARCHER ARMY == goal combat-arm ARCHER & goal combat-supp ARCHER (defrule (goal rush-control RUSHING) (soldier-count < ten-percent-pop) (can-train-with-escrow archer-line) (nor (can-train archer) (goal upgrade-conflict ADVANCE) ) (or (goal combat-arm ARCHER) (goal pre-unique-arm ARCHER) ) => (release-escrow wood) (release-escrow gold) (chat-local-to-self "Training archer line.") (train archer-line) (set-goal secondary-build NO) ) (defrule (current-age > feudal-age) (population < unit-max) (can-train archer-line) (not (unit-available hand-cannoneer) ) (or (goal combat-arm ARCHER) (goal pre-unique-arm ARCHER) ) => (chat-local-to-self "Training archer line.") (train archer-line) (set-goal secondary-build NO) ) (defrule (current-age > feudal-age) (goal secondary-build NO) (goal combat-supp ARCHER) (population < unit-max) (can-train archer-line) => (chat-local-to-self "Training archer line.") (train archer-line) (set-goal secondary-build YES) ) ;******************************************************* ;UNIQUE UNITS! == goal combat-arm UNIQUE (defrule (goal rush-control RUSHING) (goal combat-arm UNIQUE) (soldier-count < ten-percent-pop) (can-train-with-escrow my-unique-unit-line) (nor (can-train my-unique-unit-line) (goal upgrade-conflict ADVANCE) ) => (release-escrow wood) (release-escrow food) (release-escrow gold) (train my-unique-unit-line) (set-goal secondary-build NO) (chat-local-to-self "Training my unique unit line.") ) (defrule (goal combat-arm UNIQUE) (population < unit-max) (can-train my-unique-unit-line) => (chat-local-to-self "Training my unique unit line.") (train my-unique-unit-line) (set-goal secondary-build NO) ) (defrule (current-age > feudal-age) (goal combat-arm UNIQUE) (goal secondary-build NO) (civ-selected persian) (unit-type-count war-elephant-line < ten-percent-pop) (can-train-with-escrow war-elephant-line) (not (goal upgrade-conflict ADVANCE) ) => (release-escrow food) (release-escrow gold) (chat-local-to-self "Training war elephant line.") (train war-elephant-line) (set-goal secondary-build YES) ) ;********************************** ; oh no, out of gold so set up some defense (defrule (current-age == imperial-age) (current-age-time > 1800) (population < thirty-percent-pop) (gold-amount < 100) (can-train skirmisher-line) (town-under-attack) => (chat-local-to-self "Training skirmisher line.") (train skirmisher-line) (set-goal secondary-build NO) ) (defrule (current-age == imperial-age) (current-age-time > 1800) (population < thirty-percent-pop) (gold-amount < 100) (can-train spearman-line) (town-under-attack) => (chat-local-to-self "Training spearman line.") (train spearman-line) (set-goal secondary-build NO) ) (defrule (current-age == imperial-age) (current-age-time > 1800) (population < thirty-percent-pop) (gold-amount < 100) (can-train scout-cavalry-line) (town-under-attack) => (chat-local-to-self "Training scout cavalry line.") (train scout-cavalry-line) (set-goal secondary-build NO) ) ;*********************************************** ; GATHERING & MARKETPLACE ;*********************************************** ;IMPERIAL AGE (defrule (current-age == imperial-age) => (set-goal resource-needed NO) ) (defrule (goal resource-supp FOOD-ONLY) (current-age == imperial-age) (food-amount < 250) => (set-goal resource-needed FOOD) ) (defrule (goal resource-supp GOLD-ONLY) (current-age == imperial-age) (gold-amount < 475) => (set-goal resource-needed GOLD) ) (defrule (goal resource-supp WOOD-FOOD) (goal upgrade-conflict MONASTERY) (current-age == imperial-age) (wood-amount < 1100) (food-amount > 1000) => (set-goal resource-needed WOOD) ) (defrule (goal resource-supp WOOD-FOOD) (goal upgrade-conflict MONASTERY) (current-age == imperial-age) (wood-amount > 1100) (food-amount < 1000) => (set-goal resource-needed FOOD) ) (defrule (goal resource-supp WOOD-FOOD) (current-age == imperial-age) (wood-amount < 600) (food-amount > 500) (not (goal upgrade-conflict MONASTERY) ) => (set-goal resource-needed WOOD) ) (defrule (goal resource-supp WOOD-FOOD) (current-age == imperial-age) (wood-amount > 600) (food-amount < 500) (not (goal upgrade-conflict MONASTERY) ) => (set-goal resource-needed FOOD) ) (defrule (goal resource-supp WOOD-GOLD) (current-age == imperial-age) (wood-amount > 525) (gold-amount < 500) => (set-goal resource-needed GOLD) ) (defrule (goal resource-supp WOOD-GOLD) (current-age == imperial-age) (wood-amount < 525) (gold-amount > 500) => (set-goal resource-needed WOOD) ) (defrule (goal resource-supp WOOD-STONE) (current-age == imperial-age) (wood-amount > 400) (stone-amount < 400) => (set-goal resource-needed STONE) ) (defrule (goal resource-supp WOOD-STONE) (current-age == imperial-age) (wood-amount < 400) (stone-amount > 400) => (set-goal resource-needed WOOD) ) (defrule (goal resource-supp FOOD-GOLD) (current-age == imperial-age) (food-amount > 1600) (gold-amount < 1200) => (set-goal resource-needed GOLD) ) (defrule (goal resource-supp FOOD-GOLD) (current-age == imperial-age) (food-amount < 1600) (gold-amount > 1200) => (set-goal resource-needed FOOD) ) (defrule (goal resource-supp FOOD-STONE) (current-age == imperial-age) (food-amount > 500) (stone-amount < 350) => (set-goal resource-needed STONE) ) (defrule (goal resource-supp FOOD-STONE) (current-age == imperial-age) (food-amount < 500) (stone-amount > 350) => (set-goal resource-needed FOOD) ) (defrule ;get stone to build a castle if we want to (building-type-count-total castle < castles) (current-age == imperial-age) (stone-amount < 650) => (set-goal resource-needed STONE) ) ;*********************************************** ;FEUDAL MARKET (defrule (goal upgrade-conflict NO) (current-age == feudal-age) (gold-amount > 400) (can-buy-commodity food) (commodity-buying-price food < 150) => (chat-local-to-self "buy food with gold") (release-escrow gold) (buy-commodity food) ) (defrule (goal upgrade-conflict NO) (current-age == feudal-age) (gold-amount > 400) (can-buy-commodity wood) (commodity-buying-price wood < 150) => (chat-local-to-self "buy wood with gold") (release-escrow gold) (buy-commodity wood) ) (defrule (goal upgrade-conflict NO) (current-age == feudal-age) (food-amount > 1000) (can-sell-commodity food) => (chat-local-to-self "buy gold with food") (release-escrow food) (sell-commodity food) ) (defrule (goal upgrade-conflict NO) (current-age == feudal-age) (stone-amount > 200) (can-sell-commodity stone) (commodity-selling-price stone > 75) (not (goal wall-build YES)) => (chat-local-to-self "buy gold with stone") (release-escrow stone) (sell-commodity stone) ) ;**************************** ;CASTLE MARKET (defrule (goal upgrade-conflict NO) (current-age == castle-age) (gold-amount > 950) (can-buy-commodity food) (commodity-buying-price food < 150) => (chat-local-to-self "buy food with gold") (release-escrow gold) (buy-commodity food) ) (defrule (goal upgrade-conflict NO) (current-age == castle-age) (gold-amount > 950) (can-buy-commodity wood) (commodity-buying-price wood < 150) => (chat-local-to-self "buy wood with gold") (release-escrow gold) (buy-commodity wood) ) (defrule (goal upgrade-conflict NO) (current-age == castle-age) (wood-amount > 450) (can-sell-commodity wood) => (chat-local-to-self "buy gold with wood") (release-escrow wood) (sell-commodity wood) ) (defrule (goal upgrade-conflict NO) (current-age == castle-age) (food-amount > 1200) (can-sell-commodity food) => (chat-local-to-self "buy gold with food") (release-escrow food) (sell-commodity food) ) (defrule (goal upgrade-conflict NO) (current-age == castle-age) (stone-amount > 900) (can-sell-commodity stone) (commodity-selling-price stone > 75) (not (goal wall-build YES)) => (chat-local-to-self "buy gold with stone") (release-escrow stone) (sell-commodity stone) (set-goal resource-needed NO) ) ;**************************** ;IMPERIAL MARKET (defrule (current-age == imperial-age) (goal resource-needed WOOD) (research-completed ri-guilds) (can-buy-commodity wood) (commodity-buying-price wood < 150) (gold-amount > 1100) ;1400 => (chat-local-to-self "buy wood with gold") (release-escrow gold) (buy-commodity wood) ) (defrule (current-age == imperial-age) (goal resource-needed FOOD) (research-completed ri-guilds) (can-buy-commodity food) (commodity-buying-price food < 150) (gold-amount > 1000) ;1400 => (chat-local-to-self "buy food with gold") (release-escrow gold) (buy-commodity food) ) (defrule (current-age == imperial-age) (goal resource-needed GOLD) (research-completed ri-guilds) (can-sell-commodity wood) (wood-amount > 1200) => (chat-local-to-self "buy gold with wood") (release-escrow wood) (sell-commodity wood) ) (defrule (current-age == imperial-age) (goal resource-needed GOLD) (research-completed ri-guilds) (food-amount > 1300) ;1700 (can-sell-commodity food) => (chat-local-to-self "buy gold with food") (release-escrow food) (sell-commodity food) ) (defrule (current-age == imperial-age) (goal resource-needed GOLD) (research-completed ri-guilds) (stone-amount > 500) ;500 (can-sell-commodity stone) (commodity-selling-price stone > 75) (not (goal wall-build YES)) => (chat-local-to-self "buy gold with stone") (release-escrow stone) (sell-commodity stone) ) (defrule (current-age == imperial-age) (goal resource-needed STONE) (research-completed ri-guilds) (can-buy-commodity stone) (commodity-buying-price stone < 200) (gold-amount > 900) ;1400 => (chat-local-to-self "buy stone with gold") (release-escrow gold) (buy-commodity stone) ) ;**************************** ;Excess stuff (defrule (wood-amount > 1200) (or (food-amount < 1600) (or (gold-amount < 1200) (stone-amount < 650) ) ) (can-sell-commodity wood) => (chat-local-to-self "selling excess wood") (release-escrow wood) (sell-commodity wood) ) (defrule (food-amount > 1700) (or (wood-amount < 1100) (or (gold-amount < 1200) (stone-amount < 650) ) ) (can-sell-commodity food) => (chat-local-to-self "selling excess food") (release-escrow food) (sell-commodity food) ) (defrule (gold-amount > 1250) (can-buy-commodity wood) (commodity-buying-price wood < 50) (or (and (not (goal upgrade-conflict MONASTERY) ) (wood-amount < 525) ) (wood-amount < 1100) ) => (chat-local-to-self "selling excess gold to buy wood") (release-escrow gold) (buy-commodity wood) ) (defrule (gold-amount > 1250) (food-amount < 1600) (can-buy-commodity food) (commodity-buying-price food < 50) => (chat-local-to-self "selling excess gold to buy food") (release-escrow gold) (buy-commodity food) ) (defrule (gold-amount > 1400) (stone-amount < 650) (can-buy-commodity stone) (commodity-buying-price stone < 200) => (chat-local-to-self "selling excess gold to buy stone") (release-escrow gold) (buy-commodity stone) ) (defrule (stone-amount > 1400) (or (wood-amount < 1100) (or (food-amount < 1600) (gold-amount < 1200) ) ) (can-sell-commodity stone) => (chat-local-to-self "selling excess stone") (release-escrow stone) (sell-commodity stone) ) ;*********************************************** ; TOWER & WALLS ;*********************************************** ;(defrule ; (current-age == dark-age) ;=> ; (set-goal wall-build NOTICE) ; (enable-timer t-tower 30) ; (disable-self) ;) ; ; ;(defrule ; (goal wall-build NOTICE) ;=> ; (set-goal wall-build YES) ; (disable-self) ;) ; ;(defrule ; (goal wall-build NO) ; (not (map-type fortress) ) ;=> ; (set-goal wall-build YES) ; (disable-self) ;) ; ;(defrule ; (goal wall-build NO) ; (current-age == imperial-age) ; (not (map-type fortress)) ;=> ; (set-goal wall-build YES) ; (disable-self) ;) ;***************************** ;build walls (defrule (current-age > dark-age) (goal wall-build YES) (can-build-wall-with-escrow 2 stone-wall-line) (or (can-afford-complete-wall 2 stone-wall-line) (stone-amount > 125) ) => (release-escrow stone) (build-wall 2 stone-wall-line) (set-goal wall-build NOTICE) (chat-local-to-self "Building a wall.") ) ;(defrule ; (goal wall-build YES) ; (can-build-wall-with-escrow 2 stone-wall-line) ;(or ; (can-afford-complete-wall 2 stone-wall-line) ; (stone-amount > 300) ;) ;=> ; (release-escrow stone) ; (build-wall 2 stone-wall-line) ; (set-goal wall-build NOTICE) ; (chat-local-to-self "Building a wall.") ;) (defrule (goal wall-build NOTICE) (wall-completed-percentage 2 == 100) (building-type-count-total gate < 1) (can-build-gate-with-escrow 2) => (release-escrow stone) (build-gate 2) (set-goal wall-build NO) (chat-local-to-self "Building a gate.") ) ;***************************** ;bombard towers (defrule (goal upgrade-conflict NO) (can-build bombard-tower) (building-type-count-total bombard-tower < 2) (or (goal wall-build NO) (timer-triggered t-tower) ) => (chat-local-to-self "Building a bombard tower.") (build bombard-tower) ) (defrule (goal upgrade-conflict NO) (current-age <= feudal-age) (can-build watch-tower) (building-type-count-total watch-tower < 3) => (chat-local-to-self "Building a watch tower.") (build watch-tower) ) (defrule (goal upgrade-conflict NO) (current-age == castle-age) (can-build watch-tower-line) (building-type-count-total watch-tower-line < 3) (not (research-available ri-guard-tower) ) (or (goal wall-build NO) (timer-triggered t-tower) ) => (chat-local-to-self "Building a watch tower line.") (build watch-tower-line) ) (defrule (goal upgrade-conflict NO) (current-age == imperial-age) (can-build watch-tower-line) (not (can-build bombard-tower)) (building-type-count-total watch-tower-line < 3) (nor (research-available ri-guard-tower) (research-available ri-keep) ) (or (goal wall-build NO) (timer-triggered t-tower) ) => (chat-local-to-self "Building a watch tower line.") (build watch-tower-line) ) (defrule (timer-triggered t-tower) => (set-goal wall-build YES) (disable-timer t-tower) (enable-timer t-tower 660) ) ;*********************************************** ; RESIGNING THE GAME ;*********************************************** ;There are a couple of conditions that would force us to resign right away ;such as an islands map or some other water based map (defrule (map-type continental) => (set-goal resign-game NO) (chat-to-all "Playing the Continental map.") (disable-self) ) (defrule (map-type coastal) => (set-goal resign-game NO) (chat-to-all "Playing the Coastal map.") (disable-self) ) (defrule (map-type black-forest) => (set-goal resign-game NO) (chat-to-all "Playing the Black Forest map.") (disable-self) ) ;***************************** (defrule (game-time > 600) (soldier-count <= five-percent-pop) (unit-type-count-total villager <= five-percent-pop) => (set-goal resign-game YES) (disable-self) ) (defrule (goal resign-game YES) => (chat-to-all "Can not play anymore, we are whipped; good game, dude.") (resign) (disable-self) ) ;***************************** (defrule (goal resign-game MAYBE) (map-type islands) => (chat-to-all "Playing wrong map: ISLANDS.") (resign) (disable-self) ) (defrule (goal resign-game MAYBE) (map-type archipelago) => (chat-to-all "Playing wrong map: ARCHIPELAGO.") (resign) (disable-self) ) (defrule (goal resign-game MAYBE) (map-type baltic) => (chat-to-all "Playing wrong map: BALTIC.") (resign) (disable-self) ) (defrule (goal resign-game MAYBE) (map-type mediterranean) => (chat-to-all "Playing wrong map: MEDITERRANEAN.") (resign) (disable-self) ) (defrule (goal resign-game MAYBE) (map-type migration) => (chat-to-all "Playing wrong map: MIGRATION.") (resign) (disable-self) ) ;This rule catches the scandinavia map which gives a syntax error ;when using (map-type scandinavia). We go ahead and play it however. (defrule (goal resign-game MAYBE) => (chat-to-all "Playing map: SCANDINAVIA, continue") (set-goal resign-game NO) (disable-self) ) ;********************************************************************