; BobGoodSlayer version 2 ; modified version of Strong Slayer ; version 7, for AOK only (not TC) ; modified version of Bingmann 2.2 ; Attempt at new stategy with Barracks before Market ; Included new siege research goal and battering rams. With the goal ; set, the upgrades will eventually be researched (capped ram, siege ram). ; This script takes the Turks on an interesting military campaign using ; fast yet cheap units (light cavalry). The idea is to keep a constant ; stream of attackers involved while the main component (siege items) ; do the real annilation stuff. ; ID (defrule (true) => (chat-to-all "Bharat wins all") (taunt 9) (set-difficulty-parameter ability-to-dodge-missiles 100) (set-difficulty-parameter ability-to-maintain-distance 100) (disable-self) ) ; goals - 31-40 are reserved for use as local variables ; These goals are set to 1 if we need to buy/collect more (defconst need-food-goal 1) (defconst need-wood-goal 2) (defconst need-gold-goal 3) (defconst need-stone-goal 4) ; This goal has two possibilities: build-essentials and build-anything (defconst build-limits 5) ; This goal is set to 1 if we want more town centers (defconst want-more-town-centers 6) ; Keep track of where we are in the attack cycle (defconst attack-cycle-goal 7) ; These goals are set to 1 when we need to escrow resources (defconst escrow-food-goal 8) (defconst escrow-wood-goal 9) (defconst escrow-gold-goal 10) (defconst escrow-stone-goal 11) ; This goal keeps track of who we are attacking. (defconst enemy-player-goal 12) ; This goal lets us check user-defined constants for zero/non-zero. ; It is always set to 0. Then we can do (goal is-zero-goal user-constant) ; to see if user-constant is zero. (defconst is-zero-goal 13) ; These goals are set to 1 when we need to save the resource (not sell) (defconst save-food-goal 14) (defconst save-wood-goal 15) (defconst save-gold-goal 16) (defconst save-stone-goal 17) ; Keep track of which age we are in or are in the process of advancing to. (defconst current-age-goal 18) ; Need to know if we wanted gold or stone on the last pass to decide ; whether or not to bother with mining camps. (defconst needed-gold-goal 19) (defconst needed-stone-goal 20) ; Technology tiers - decide the order to do things (defconst tier1-done-goal 21) (defconst tier2-done-goal 22) (defconst tier3-done-goal 23) (defconst tier4-done-goal 24) (defconst tier5-done-goal 25) (defconst tier6-done-goal 26) (defconst tier7-done-goal 27) (defconst tier8-done-goal 28) (defconst tier9-done-goal 110) (defconst unique-research-goal 29) (defconst archery-research-goal 30) (defconst cavalry-research-goal 31) (defconst infantry-research-goal 32) (defconst siege-research-goal 33) ; timers ; This timer is used for choosing the timing of attacks. (defconst attack-timer 1) ; Fires every 60 seconds. (defconst one-minute-timer 2) ; Check whether or not we actually made it to the next age ; to see if we need to reset current-age-goal. (defconst age-advance-timer 3) ; the limits for building (defconst build-anything 0) (defconst build-essentials 1) ; values for attack-cycle-goal (defconst attack-cycle-none 0) (defconst attack-cycle-first-wait 1) (defconst attack-cycle-charge 2) (defconst attack-cycle-mix-it-up 3) (defconst attack-cycle-wait 4) ; dropsite distances - allow the dropsites to get farther from ; the town while staying closer to our town than the enemy town. ; I've given up on this one. It's better to keep the villagers ; inside the wall and close to home. (defconst first-dropsite-distance 25) (defconst second-dropsite-distance 50) (defconst third-dropsite-distance 100) (defconst fourth-dropsite-distance 200) (defconst buffer-dropsite-distance 50) ; limit the number of camps so the AI doesn't build them continuously ; when the resources run out (defconst max-lumber-camps 6) (defconst max-mining-camps 11) ; wall parameters (defconst wall-perimeter 2) (defconst required-palisade-percent 100) (defconst required-wall-percent 100) (defconst gates-to-build 4) ; maximum distances before building new gathering site (defconst max-food-dropsite-distance 10) (defconst max-wood-dropsite-distance 10) (defconst max-gold-dropsite-distance 5) (defconst max-stone-dropsite-distance 5) (defconst max-hunt-dropsite-distance 10) (defconst emergency-wood-gather-distance -1) (defconst idle-farm-gather-distance 20) (defconst max-food-distance-from-town 100) (defconst max-wood-distance-from-town 25) (defconst max-gold-distance-from-town 25) (defconst max-stone-distance-from-town 25) ; min-extra-housing = build houses until housing-headroom is at least this much #load-if-defined DEATH-MATCH (defconst min-extra-housing 25) ; must be >= 1 or might not be able to train units #else (defconst min-extra-housing 5) ; must be >= 1 or might not be able to train units #end-if ; need a monk to get relics (defconst min-monks-to-train 5) (defconst min-villagers 35) (defconst max-villagers 45) (defconst town-centers-to-build 2) (defconst max-villagers-after-attack 45) (defconst trade-carts-to-train 2) (defconst max-population 125) (defconst max-population-minus-one 124) (defconst min-attackers-for-attack 40) (defconst scouts-to-train 2) (defconst monks-to-train 6) (defconst trebuchets-to-train 4) (defconst monasteries-to-build 2) (defconst siege-workshops-to-build 2) (defconst skirmishers-to-train 5) (defconst cavalry-archers-to-train 5) (defconst hand-cannoneers-to-train 5) (defconst scorpions-to-train 1) (defconst battering-rams-to-train 1) ;WDP (defconst mangonels-to-train 2) (defconst bombard-cannons-to-train 5) (defconst cataphract-line 15) (defconst trade-cogs-to-train 0) (defconst transport-ships-to-train 0) (defconst galleys-to-train 0) (defconst fire-ships-to-train 0) (defconst fishing-ships-to-train 3) (defconst demolition-ships-to-train 0) (defconst cannon-galleons-to-train 0) (defconst longboats-to-train 0) #load-if-defined BYZANTINE-CIV (defconst attack-population 60) (defconst scout-cavalry-to-train 2) (defconst castles-to-build 3) (defconst eagle-warriors-to-train 0) (defconst cataphracts-to-train 25) (defconst barracks-to-build 3) (defconst knights-to-train 31) (defconst stables-to-build 4) (defconst camels-to-train 5) (defconst archery-ranges-to-build 2) (defconst archers-to-train 10) (defconst defenders-to-train 10) (defconst home-towers-to-build 7) (defconst towers-to-build 12) (defconst home-bombard-towers-to-build 5) (defconst bombard-towers-to-build 8) (defconst unique-units-to-train 15) (defconst spearmen-to-train 15) (defconst militias-to-train 5) (defconst cataphract-to-train 15) (defconst attacker-type knight-line) (defconst defender-type spearman-line) (defconst defender-food 35) (defconst defender-wood 25) (defconst defender-gold 0) (defconst defender-stone 0) (defconst defender-save-food 135) (defconst defender-save-wood 225) (defconst defender-save-gold 0) (defconst defender-save-stone 0) (defconst unique-unit-line cataphract-line) (defconst unique-min-villager-food 270) (defconst unique-unit-food 70) (defconst unique-unit-wood 0) (defconst unique-unit-gold 75) (defconst unique-unit-stone 0) (defconst unique-unit-save-food 170) (defconst unique-unit-save-wood 0) (defconst unique-unit-save-gold 275) (defconst unique-unit-save-stone 0) (defconst do-unique-unit-upgrade 1) ;yes (defconst do-the-unique-research 0) ;don't do it (defconst do-cavalry-research 1) ;yes do it (defconst do-archery-research 1) ;no (defconst do-infantry-research 1``) ;yes do it (defconst do-siege-research 0) ;no (defconst unique-research-food 1000) (defconst unique-research-wood 0) (defconst unique-research-gold 600) (defconst unique-research-stone 0) (defconst unique-research-save-food 1100) (defconst unique-research-save-wood 0) (defconst unique-research-save-gold 700) (defconst unique-research-save-stone 0) (defconst attack-tech1 ri-paladin) (defconst attack-tech2 ri-iron-casting) (defconst attack-tech3 ri-chain-barding) (defconst attack-tech4 ri-bracer) (defconst attack-tech5 ri-plate-barding) (defconst attack-tech6 ri-chain-mail) (defconst attack-tech7 ri-plate-mail) (defconst attack-tech8 ri-chain-barding) #else (defconst cataphracts-to-train 0) #end-if ; times for defining the attack cycle (defconst max-wait-to-attack 600) (defconst max-time-to-charge 120) (defconst max-time-to-mix-it-up 900) (defconst charge-group-distance 5) (defconst mixing-group-distance 1) (defconst hide-response-distance 10) (defconst aggressive-response-distance 50) ; Set initial strategic numbers (defrule (game-time < 120) (true) => (set-strategic-number sn-percent-civilian-explorers 30) (set-strategic-number sn-percent-civilian-builders 0) (set-strategic-number sn-percent-civilian-gatherers 70) (set-strategic-number sn-cap-civilian-explorers 2000) (set-strategic-number sn-cap-civilian-builders 2000) (set-strategic-number sn-cap-civilian-gatherers 2000) (set-strategic-number sn-total-number-explorers 2000) (set-strategic-number sn-minimum-civilian-explorers 1) (disable-self) ) (defrule (game-time < 500) (true) => (set-strategic-number sn-percent-civilian-explorers 10) (set-strategic-number sn-percent-civilian-builders 0) (set-strategic-number sn-percent-civilian-gatherers 90) (set-strategic-number sn-cap-civilian-explorers 2000) (set-strategic-number sn-cap-civilian-builders 2000) (set-strategic-number sn-cap-civilian-gatherers 2000) (set-strategic-number sn-total-number-explorers 2000) (set-strategic-number sn-minimum-civilian-explorers 1) (disable-self) ) (defrule (game-time > 500) (true) => (set-strategic-number sn-percent-civilian-explorers 10) (set-strategic-number sn-percent-civilian-builders 0) (set-strategic-number sn-percent-civilian-gatherers 90) (set-strategic-number sn-cap-civilian-explorers 2000) (set-strategic-number sn-cap-civilian-builders 2000) (set-strategic-number sn-cap-civilian-gatherers 2000) (set-strategic-number sn-total-number-explorers 2000) (set-strategic-number sn-minimum-civilian-explorers 0) (disable-self) ) (defrule (game-time < 300) (true) => (set-strategic-number sn-food-gatherer-percentage 100) (set-strategic-number sn-gold-gatherer-percentage 0) (set-strategic-number sn-stone-gatherer-percentage 0) (set-strategic-number sn-wood-gatherer-percentage 0) (set-strategic-number sn-number-enemy-objects-required 0) (set-strategic-number sn-retask-gather-amount 1) (set-strategic-number sn-max-retask-gather-amount 1) (set-strategic-number sn-initial-exploration-required 0) (set-strategic-number sn-use-by-type-max-gathering 1) (set-strategic-number sn-percent-half-exploration 100) (set-strategic-number sn-minimum-boar-hunt-group-size 4) (disable-self) ) (defrule (true) => (set-strategic-number sn-food-gatherer-percentage 65) (set-strategic-number sn-gold-gatherer-percentage 5) (set-strategic-number sn-stone-gatherer-percentage 5) (set-strategic-number sn-wood-gatherer-percentage 25) (set-strategic-number sn-number-enemy-objects-required 0) (set-strategic-number sn-retask-gather-amount 1) (set-strategic-number sn-max-retask-gather-amount 1) (set-strategic-number sn-initial-exploration-required 0) (set-strategic-number sn-use-by-type-max-gathering 1) (set-strategic-number sn-percent-half-exploration 100) (set-strategic-number sn-minimum-boar-hunt-group-size 4) (disable-self) ) (defrule (true) => (set-strategic-number sn-task-ungrouped-soldiers 1) ;WDP (set-strategic-number sn-percent-enemy-sighted-response 100) (set-strategic-number sn-enemy-sighted-response-distance hide-response-distance) (set-strategic-number sn-sentry-distance 8) ;0 WDP (set-strategic-number sn-sentry-distance-variation 3) (disable-self) ) (defrule (true) => (set-strategic-number sn-number-explore-groups 0) (set-strategic-number sn-minimum-explore-group-size 1) (set-strategic-number sn-maximum-explore-group-size 1) (disable-self) ) (defrule (true) => (set-strategic-number sn-minimum-town-size 12) ;10 WDP (set-strategic-number sn-camp-max-distance first-dropsite-distance) (set-strategic-number sn-mill-max-distance first-dropsite-distance) (set-strategic-number sn-minimum-water-body-size-for-dock 300) (set-strategic-number sn-max-build-plan-gatherer-percentage 0) (set-strategic-number sn-food-dropsite-distance max-food-dropsite-distance) (set-strategic-number sn-wood-dropsite-distance max-wood-dropsite-distance) (set-strategic-number sn-stone-dropsite-distance max-stone-dropsite-distance) (set-strategic-number sn-gold-dropsite-distance max-gold-dropsite-distance) (set-strategic-number sn-minimum-dropsite-buffer buffer-dropsite-distance) (set-strategic-number sn-random-placement-factor 33) ;50 WDP (disable-self) ) (defrule (true) => (set-strategic-number sn-relic-return-distance 16) ;12 WDP (set-strategic-number sn-minimum-peace-like-level 85) (set-strategic-number sn-percent-exploration-required 100) (set-strategic-number sn-zero-priority-distance 50) (set-strategic-number sn-scaling-frequency 10) (set-strategic-number sn-build-frequency 1) (set-strategic-number sn-save-scenario-information 0) (disable-self) ) (defrule (true) => (set-strategic-number sn-number-build-attempts-before-skip 25) (set-strategic-number sn-max-skips-per-attempt 10) (set-strategic-number sn-minimum-amount-for-trading 100) (set-strategic-number sn-hits-before-alliance-change 3) (set-strategic-number sn-attack-diplomacy-impact 10) (set-strategic-number sn-easiest-reaction-percentage 100) (set-strategic-number sn-easier-reaction-percentage 100) (set-strategic-number sn-track-player-history 0) (disable-self) ) (defrule (true) => (set-strategic-number sn-attack-winning-player 0) (set-strategic-number sn-coop-share-information 1) (set-strategic-number sn-attack-winning-player-factor 0) (set-strategic-number sn-coop-share-attacking 1) (set-strategic-number sn-coop-share-attacking-interval 120) (set-strategic-number sn-percentage-explore-exterminators 0) (set-strategic-number sn-maximum-wood-drop-distance max-wood-dropsite-distance) (set-strategic-number sn-maximum-food-drop-distance max-food-dropsite-distance) (set-strategic-number sn-maximum-hunt-drop-distance max-hunt-dropsite-distance) (set-strategic-number sn-maximum-fish-boat-drop-distance -1) (set-strategic-number sn-maximum-gold-drop-distance max-gold-dropsite-distance) (set-strategic-number sn-maximum-stone-drop-distance max-stone-dropsite-distance) (disable-self) ) (defrule (true) => (set-strategic-number sn-allow-civilian-defense 1) (set-strategic-number sn-do-not-scale-for-difficulty-level 1) (set-strategic-number sn-gather-defense-units 0) (set-strategic-number sn-group-form-distance 1) (set-strategic-number sn-ignore-attack-group-under-attack 0) (set-strategic-number sn-consecutive-idle-unit-limit 0) (disable-self) ) (defrule (true) => (enable-wall-placement wall-perimeter) (set-escrow-percentage food 0) (set-escrow-percentage wood 0) (set-escrow-percentage gold 0) (set-escrow-percentage stone 0) (set-goal need-food-goal 0) (set-goal need-wood-goal 0) (set-goal need-gold-goal 0) (set-goal need-stone-goal 0) (set-goal build-limits build-anything) (set-goal attack-cycle-goal attack-cycle-none) (disable-self) ) (defrule (true) => (set-goal unique-research-goal do-the-unique-research) (set-goal archery-research-goal do-archery-research) (set-goal cavalry-research-goal do-cavalry-research) (set-goal infantry-research-goal do-infantry-research) (set-goal siege-research-goal do-siege-research) (disable-self) ) (defrule (true) => (set-goal escrow-food-goal 0) (set-goal escrow-wood-goal 0) (set-goal escrow-gold-goal 0) (set-goal escrow-stone-goal 0) (set-goal is-zero-goal 0) (set-goal save-food-goal 0) (set-goal save-wood-goal 0) (set-goal save-gold-goal 0) (set-goal save-stone-goal 0) (set-goal needed-gold-goal 0) (set-goal needed-stone-goal 0) (disable-self) ) #load-if-defined DARK-AGE-START (defrule (true) => (set-goal current-age-goal dark-age) (set-strategic-number sn-maximum-town-size 14) (disable-self) ) #end-if #load-if-defined FEUDAL-AGE-START (defrule (true) => (set-goal current-age-goal feudal-age) (set-strategic-number sn-maximum-town-size 16) (disable-self) ) #end-if #load-if-defined CASTLE-AGE-START (defrule (true) => (set-goal current-age-goal castle-age) (set-strategic-number sn-maximum-town-size 18) (disable-self) ) #end-if #load-if-defined IMPERIAL-AGE-START (defrule (true) => (set-goal current-age-goal imperial-age) (set-strategic-number sn-maximum-town-size 20) (disable-self) ) #end-if #load-if-defined POST-IMPERIAL-AGE-START (defrule (true) => (set-goal current-age-goal imperial-age) (set-strategic-number sn-maximum-town-size 22) (disable-self) ) #end-if ; Slayer 7 - General rules ; Manage the economy and defense ; local goal variables (defconst need-to-explore-now 40) (defconst allow-farming 39) (defrule (current-age == dark-age) (unit-type-count-total palisade-wall < 1) ;(unit-type-count-total villager less-than 20) (game-time > 240) (can-build palisade-wall) => (build-wall 1 palisade-wall) (chat-local-to-self "Another Board on the Wall!!!") ) ; Decide which tech tier to work on next. (defrule (true) => (set-goal tier1-done-goal 1) (set-goal tier2-done-goal 1) (set-goal tier3-done-goal 1) (set-goal tier4-done-goal 1) (set-goal tier5-done-goal 1) (set-goal tier6-done-goal 1) (set-goal tier7-done-goal 1) (set-goal tier8-done-goal 1) (set-goal tier9-done-goal 1) ) (defrule (goal archery-research-goal 1) (or (research-available ri-wheel-barrow) (or (research-available ri-gold-mining) (or (research-available ri-double-bit-axe) (or (research-available ri-horse-collar) (building-type-count-total archery-range < 1))))) => (set-goal tier1-done-goal 0) ) (defrule (goal infantry-research-goal 1) (or (research-available ri-wheel-barrow) (or (research-available ri-gold-mining) (or (research-available ri-double-bit-axe) (or (research-available ri-horse-collar) (building-type-count-total barracks < 1))))) => (set-goal tier1-done-goal 0) ) (defrule (goal cavalry-research-goal 1) (or (research-available ri-wheel-barrow) (or (research-available ri-gold-mining) (or (research-available ri-double-bit-axe) (or (research-available ri-horse-collar) (building-type-count-total stable < 1))))) => (set-goal tier1-done-goal 0) ) (defrule (or (research-available ri-fletching) (or (research-available ri-gold-shaft-mining) (or (research-available ri-bow-saw) (or (research-available ri-heavy-plow) ;(or (research-available ri-hand-cart) ;(or (military-population < min-attackers-for-attack) (goal tier1-done-goal 0))))) => (set-goal tier2-done-goal 0) ) ; removed from the above rule and replaced with military pop size ;(or (unit-type-count-total attacker-type < min-attackers-for-attack) ; (defrule (goal archery-research-goal 1) (or (research-available ri-stone-shaft-mining) (or (research-available ri-fletching) (or (research-available ri-bodkin-arrow) (goal tier2-done-goal 0)))) => (set-goal tier3-done-goal 0) ) (defrule (or (goal cavalry-research-goal 1) (goal infantry-research-goal 1)) (or (research-available ri-stone-shaft-mining) (or (research-available ri-fletching) (or (research-available ri-bodkin-arrow) (or (research-available ri-forging) (or (research-available ri-iron-casting) (goal tier2-done-goal 0)))))) => (set-goal tier3-done-goal 0) ) (defrule (goal cavalry-research-goal 1) (or (research-available ri-scale-barding) (or (research-available ri-chain-barding) (or (research-available ri-plate-barding) (or (research-available ri-blast-furnace) (goal tier3-done-goal 0))))) => (set-goal tier4-done-goal 0) ) (defrule (goal cavalry-research-goal 0) (goal tier3-done-goal 0) => (set-goal tier4-done-goal 0) ) (defrule (goal infantry-research-goal 1) (or (research-available ri-scale-mail) (or (research-available ri-chain-mail) (or (research-available ri-plate-mail) (or (research-available ri-tracking) (or (research-available ri-blast-furnace) (goal tier4-done-goal 0)))))) => (set-goal tier5-done-goal 0) ) (defrule (goal infantry-research-goal 0) (goal tier4-done-goal 0) => (set-goal tier5-done-goal 0) ) (defrule (goal archery-research-goal 1) (or (research-available ri-padded-archer-armor) (or (research-available ri-leather-archer-armor) (or (research-available ri-ring-archer-armor) (goal tier5-done-goal 0)))) => (set-goal tier6-done-goal 0) ) (defrule (goal archery-research-goal 0) (goal tier5-done-goal 0) => (set-goal tier6-done-goal 0) ) (defrule (goal cavalry-research-goal 1) (or (research-available ri-cavalier) (or (research-available ri-chemistry) ;(or (research-available ri-paladin) ;(or (research-available ri-light-cavalry) (goal tier6-done-goal 0))) => (set-goal tier7-done-goal 0) ) (defrule (goal cavalry-research-goal 0) (goal tier6-done-goal 0) => (set-goal tier7-done-goal 0) ) (defrule ;(or (research-available ri-fervor) ;WDP tier 7 in research rules (or (research-available ri-bracer) (or (research-available ri-chemistry) ;(or (research-available ri-crop-rotation) ;(or (research-available ri-redemption) ; WDP tier 7 in research rules ;(or (research-available ri-block-printing) ;not faith WDP (goal tier7-done-goal 0))) => (set-goal tier8-done-goal 0) ) (defrule (goal cavalry-research-goal 1) (or (research-available ri-murder-holes) (goal tier9-done-goal 0)) => (set-goal tier9-done-goal 0) ) ; Decide if we need to focus on the essentials (defrule (true) => (set-goal want-more-town-centers 0) ) (defrule (building-type-count-total town-center < 1) => (set-goal want-more-town-centers 1) ) (defrule (building-type-count-total town-center < town-centers-to-build) (building-available town-center) (unit-type-count-total villager < min-villagers) => (set-goal want-more-town-centers 1) ) (defrule (true) => (set-goal build-limits build-anything) ) (defrule (or (goal want-more-town-centers 1) (and (unit-type-count-total villager < min-villagers) (food-amount < 200))) => (set-goal build-limits build-essentials) ) ; Decide if there's a wood emergency (defrule (true) => (set-strategic-number sn-maximum-wood-drop-distance max-wood-dropsite-distance) ) (defrule (or (wood-amount < 200) (building-type-count lumber-camp >= max-lumber-camps)) (dropsite-min-distance wood > max-wood-dropsite-distance) => (set-strategic-number sn-maximum-wood-drop-distance emergency-wood-gather-distance) ) ; Decide if exploration is needed immediately. ; Wall exploration has been disabled. (defrule (true) => (set-goal need-to-explore-now 0) ) (defrule (goal is-zero-goal 1) (goal build-limits build-anything) (not (goal current-age-goal dark-age)) (wall-invisible-percentage wall-perimeter > 1) => (set-goal need-to-explore-now 10) ) (defrule (goal is-zero-goal 1) (goal build-limits build-anything) (not (goal current-age-goal dark-age)) (wall-invisible-percentage wall-perimeter > 3) => (set-goal need-to-explore-now 50) ) (defrule (not (resource-found food)) (game-time < 120) => (set-goal need-to-explore-now 100) ) (defrule (goal is-zero-goal 1) (goal build-limits build-anything) (not (goal current-age-goal dark-age)) (wall-invisible-percentage wall-perimeter > 10) => (set-goal need-to-explore-now 100) ) ; Decide if new farms should be allowed. ; Town centers have priority. ; A mill is needed first, and wood is reserved for a lumber camp. ; We need to farm if there are no other sources of food. ; Also start farming when there are enough villagers to keep ; producing food for villagers while gathering wood. ; Start collecting wood if that is holding us back. (defrule (true) => (set-goal allow-farming 0) ) (defrule (goal want-more-town-centers 0) (building-type-count-total mill > 0) (or (building-type-count-total lumber-camp > 0) (wood-amount >= 160)) (or (unit-type-count-total villager > 8) (or (unit-type-count-total villager >= min-villagers) (sheep-and-forage-too-far))) => (set-goal allow-farming 1) ) (defrule (goal want-more-town-centers 0) (building-type-count-total mill > 0) (building-type-count-total lumber-camp < 1) (wood-amount < 160) (or (unit-type-count-total villager > 8) (or (unit-type-count-total villager >= min-villagers) (sheep-and-forage-too-far))) => (set-goal need-wood-goal 1) (set-goal save-wood-goal 1) ) ; Make sure a town center exists (defrule (goal want-more-town-centers 1) (wood-amount < 275) => (set-goal need-wood-goal 1) (set-goal escrow-wood-goal 1) ) (defrule (goal want-more-town-centers 1) (wood-amount < 375) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 1) (can-build-with-escrow town-center) => (release-escrow wood) (build town-center) ) (defrule (building-type-count-total town-center < town-centers-to-build) (building-available town-center) (goal current-age-goal imperial-age) (goal tier8-done-goal 1) (wood-amount < 275) => (set-goal need-wood-goal 1) ) (defrule (building-type-count-total town-center < town-centers-to-build) (building-available town-center) (goal current-age-goal imperial-age) (goal tier8-done-goal 1) (wood-amount < 375) => (set-goal save-wood-goal 1) ) (defrule (building-type-count-total town-center < town-centers-to-build) (building-available town-center) (goal current-age-goal imperial-age) (goal tier8-done-goal 1) (can-build town-center) => (build town-center) ) ; Always have extra houses. ; For death match, we build the houses as fast as we can. (defrule (building-type-count-total town-center > 0) (housing-headroom < min-extra-housing) (wood-amount < 30) => (set-goal need-wood-goal 1) ) (defrule (building-type-count-total town-center > 0) (housing-headroom < min-extra-housing) (wood-amount < 130) => (set-goal save-wood-goal 1) ) (defrule (building-type-count-total town-center > 0) (housing-headroom < min-extra-housing) (can-build house) => (build house) ) ; Explore with villagers if needed (defrule (goal need-to-explore-now 100) => (set-strategic-number sn-percent-civilian-gatherers 10) (set-strategic-number sn-percent-civilian-explorers 90) (set-strategic-number sn-minimum-civilian-explorers 2000) ) (defrule (goal need-to-explore-now 50) => (set-strategic-number sn-percent-civilian-gatherers 50) (set-strategic-number sn-percent-civilian-explorers 50) (set-strategic-number sn-minimum-civilian-explorers 2000) ) (defrule (goal need-to-explore-now 10) => (set-strategic-number sn-percent-civilian-gatherers 90) (set-strategic-number sn-percent-civilian-explorers 10) (set-strategic-number sn-minimum-civilian-explorers 2000) ) (defrule (goal need-to-explore-now 0) => (set-strategic-number sn-percent-civilian-explorers 0) (set-strategic-number sn-percent-civilian-gatherers 100) (set-strategic-number sn-minimum-civilian-explorers 0) ) ; Explore with scout/light cavalry only ; Only explore with one in the Imperial Age (defrule (unit-type-count scout-cavalry-line <= 1) => (set-strategic-number sn-number-explore-groups 1) ) (defrule (not (goal current-age-goal imperial-age)) (unit-type-count scout-cavalry-line == 1) => (set-strategic-number sn-number-explore-groups 1) ) (defrule (not (goal current-age-goal imperial-age)) (unit-type-count scout-cavalry-line >= scouts-to-train) => (set-strategic-number sn-number-explore-groups scouts-to-train) ) (defrule (goal current-age-goal imperial-age) (building-type-count stable > 0) (unit-type-count scout-cavalry-line < scouts-to-train) => (set-strategic-number sn-number-explore-groups 0) ) (defrule (goal current-age-goal imperial-age) (building-type-count stable < 1) (unit-type-count scout-cavalry-line < scouts-to-train) (unit-type-count scout-cavalry-line > 0) => (set-strategic-number sn-number-explore-groups 1) ) (defrule (goal current-age-goal imperial-age) (unit-type-count scout-cavalry-line >= scouts-to-train) => (set-strategic-number sn-number-explore-groups 1) ) ; Need a mill for farms and berries (defrule (building-type-count-total town-center > 0) (building-type-count-total mill < 1) (or (resource-found food) (game-time > 100)) (or (sheep-and-forage-too-far) (or (unit-type-count-total villager >= min-villagers) (unit-type-count-total villager > 8))) (wood-amount < 100) => (set-goal need-wood-goal 1) (set-goal escrow-wood-goal 1) ) (defrule (building-type-count-total town-center > 0) (building-type-count-total mill < 1) (or (resource-found food) (game-time > 120)) (or (sheep-and-forage-too-far) (or (unit-type-count-total villager >= min-villagers) (unit-type-count-total villager > 8))) (wood-amount < 200) => (set-goal save-wood-goal 1) ) (defrule (building-type-count-total town-center > 0) (building-type-count-total mill < 1) (or (resource-found food) (game-time > 120)) (or (sheep-and-forage-too-far) (or (unit-type-count-total villager >= min-villagers) (unit-type-count-total villager > 8))) (can-build-with-escrow mill) => (release-escrow wood) (build mill) ) ; Make a farm if none are idle (defrule (goal allow-farming 1) (idle-farm-count < 1) (wood-amount < 60) => (set-goal need-wood-goal 1) ) (defrule (goal allow-farming 1) (idle-farm-count < 1) (wood-amount < 160) => (set-goal save-wood-goal 1) ) (defrule (goal allow-farming 1) (idle-farm-count < 1) ;(building-type-count-total farm < 11) (can-build farm) => (build farm) ) (defrule (goal allow-farming 1) (idle-farm-count < 1) (current-age >= castle-age) (can-build farm) => (build farm) ) ; Make sure there's a lumber camp if there are too many villagers to ; work the stragglers. (defrule (goal want-more-town-centers 0) (building-type-count-total lumber-camp < 1) (or (unit-type-count-total villager >= min-villagers) (unit-type-count villager > 12)) (wood-amount < 100) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (building-type-count-total lumber-camp < 1) (or (unit-type-count-total villager >= min-villagers) (unit-type-count villager > 12)) (wood-amount < 200) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (building-type-count-total lumber-camp < 1) (or (unit-type-count-total villager >= min-villagers) (unit-type-count villager > 12)) (can-build lumber-camp) => (set-strategic-number sn-camp-max-distance 20) ;12 WDP (build lumber-camp) ) ; Build lumber camp if too far away (defrule (goal want-more-town-centers 0) (game-time > 20) (building-type-count-total lumber-camp < max-lumber-camps) (dropsite-min-distance wood > max-wood-dropsite-distance) (wood-amount < 100) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (game-time > 20) (building-type-count-total lumber-camp < max-lumber-camps) (dropsite-min-distance wood > max-wood-dropsite-distance) (wood-amount < 200) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (game-time > 20) (building-type-count-total lumber-camp < 4) (dropsite-min-distance wood > max-wood-dropsite-distance) (can-build lumber-camp) => (set-strategic-number sn-camp-max-distance first-dropsite-distance) (build lumber-camp) ) (defrule (goal want-more-town-centers 0) (game-time > 20) (building-type-count-total lumber-camp >= 4) (building-type-count-total lumber-camp < 8) (dropsite-min-distance wood > max-wood-dropsite-distance) (can-build lumber-camp) => (set-strategic-number sn-camp-max-distance second-dropsite-distance) (build lumber-camp) ) (defrule (goal want-more-town-centers 0) (game-time > 20) (building-type-count-total lumber-camp >= 8) (building-type-count-total lumber-camp < 12) (dropsite-min-distance wood > max-wood-dropsite-distance) (can-build lumber-camp) => (set-strategic-number sn-camp-max-distance third-dropsite-distance) (build lumber-camp) ) (defrule (goal want-more-town-centers 0) (game-time > 20) (building-type-count-total lumber-camp >= 12) (building-type-count-total lumber-camp < 16) (dropsite-min-distance wood > max-wood-dropsite-distance) (can-build lumber-camp) => (set-strategic-number sn-camp-max-distance fourth-dropsite-distance) (build lumber-camp) ) ; Build mining camps if too far away (defrule (goal want-more-town-centers 0) (building-type-count-total mill > 0) (building-type-count-total mining-camp < max-mining-camps) (or (and (goal needed-gold-goal 1) (dropsite-min-distance gold > max-gold-dropsite-distance)) (and (goal needed-stone-goal 1) (dropsite-min-distance stone > max-stone-dropsite-distance))) (wood-amount < 100) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (building-type-count-total mill > 0) (building-type-count-total mining-camp < max-mining-camps) (or (and (goal needed-gold-goal 1) (dropsite-min-distance gold > max-gold-dropsite-distance)) (and (goal needed-stone-goal 1) (dropsite-min-distance stone > max-stone-dropsite-distance))) (wood-amount < 200) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (building-type-count-total mill > 0) (building-type-count-total mining-camp < 4) (or (and (goal needed-gold-goal 1) (dropsite-min-distance gold > max-gold-dropsite-distance)) (and (goal needed-stone-goal 1) (dropsite-min-distance stone > max-stone-dropsite-distance))) (building-type-count-total barracks > 0) (building-type-count-total stable > 0) (can-build mining-camp) => (set-strategic-number sn-camp-max-distance first-dropsite-distance) (build mining-camp) ) (defrule (goal want-more-town-centers 0) (building-type-count-total mill > 0) (building-type-count-total mining-camp >= 4) (building-type-count-total mining-camp < 8) (or (and (goal needed-gold-goal 1) (dropsite-min-distance gold > max-gold-dropsite-distance)) (and (goal needed-stone-goal 1) (dropsite-min-distance stone > max-stone-dropsite-distance))) (can-build mining-camp) => (set-strategic-number sn-camp-max-distance second-dropsite-distance) (build mining-camp) ) (defrule (goal want-more-town-centers 0) (building-type-count-total mill > 0) (building-type-count-total mining-camp >= 8) (building-type-count-total mining-camp < 12) (or (and (goal needed-gold-goal 1) (dropsite-min-distance gold > max-gold-dropsite-distance)) (and (goal needed-stone-goal 1) (dropsite-min-distance stone > max-stone-dropsite-distance))) (can-build mining-camp) => (set-strategic-number sn-camp-max-distance third-dropsite-distance) (build mining-camp) ) (defrule (goal want-more-town-centers 0) (building-type-count-total mill > 0) (building-type-count-total mining-camp >= 12) (building-type-count-total mining-camp < 16) (or (and (goal needed-gold-goal 1) (dropsite-min-distance gold > max-gold-dropsite-distance)) (and (goal needed-stone-goal 1) (dropsite-min-distance stone > max-stone-dropsite-distance))) (can-build mining-camp) => (set-strategic-number sn-camp-max-distance fourth-dropsite-distance) (build mining-camp) ) ; Build home towers early (defrule (game-time > 600) (building-type-count-total watch-tower-line < 3) (wood-amount < 25) => (set-goal need-wood-goal 1) ) (defrule (game-time > 600) (building-type-count-total watch-tower-line < 3) (wood-amount < 125) => (set-goal save-wood-goal 1) ) (defrule (game-time > 600) (not(goal current-age-goal castle-age)) (building-type-count-total watch-tower-line < 3) (stone-amount < 125) => (set-goal need-stone-goal 1) ) (defrule (or(game-time > 600) (current-age == feudal-age)) (building-type-count-total watch-tower-line < 5) (building-type-count-total castle > 1) (can-build watch-tower-line) => (build watch-tower-line) ) ; WDP build a market when available ; Changed to castle-age (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (building-type-count-total mill > 0) (building-available market) (goal current-age-goal imperial-age) (building-type-count-total monastery > 0) (building-type-count-total blacksmith > 0) (building-type-count-total market < 1) (wood-amount < 175) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (building-type-count-total mill > 0) (building-available market) (goal current-age-goal imperial-age) (building-type-count-total monastery > 0) (building-type-count-total blacksmith > 0) (building-type-count-total market < 1) (wood-amount < 275) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (building-type-count-total mill > 0) (goal current-age-goal imperial-age) (building-type-count-total monastery > 0) (building-type-count-total blacksmith > 0) (building-type-count-total market < 1) (can-build market) => (build market) ) ; WDP build a blacksmith when available but after a market ; Changed to not worry about markets (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (building-type-count-total mill > 0) (building-available blacksmith) ;(building-type-count-total market > 0) (building-type-count-total blacksmith < 1) (wood-amount < 150) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (building-type-count-total mill > 0) (building-available blacksmith) ;(building-type-count-total market > 0) (building-type-count-total blacksmith < 1) (wood-amount < 250) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (building-type-count-total mill > 0) ;(building-type-count-total market > 0) (building-type-count-total blacksmith < 1) (can-build blacksmith) => (build blacksmith) ) ; build a monastery when available (defrule (building-type-count-total town-center > 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (building-type-count-total mill > 0) (building-available monastery) (building-type-count-total monastery < 1) (wood-amount < 175) => (set-goal need-wood-goal 1) ) (defrule (building-type-count-total town-center > 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (building-type-count-total mill > 0) (building-available monastery) (building-type-count-total monastery < 1) (wood-amount < 275) => (set-goal save-wood-goal 1) ) (defrule (building-type-count-total town-center > 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (building-type-count-total mill > 0) (building-type-count-total monastery < 1) (can-build monastery) => (build monastery) ) ; train monks when available (defrule (building-type-count-total town-center > 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (or (goal current-age-goal imperial-age) (can-train-with-escrow monk)) (unit-type-count-total monk < min-monks-to-train) (gold-amount < 100) => (set-goal need-gold-goal 1) (set-goal escrow-gold-goal 1) ) (defrule (building-type-count-total town-center > 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (or (goal current-age-goal imperial-age) (can-train-with-escrow monk)) (unit-type-count-total monk < min-monks-to-train) (gold-amount < 300) => (set-goal save-gold-goal 1) ) (defrule (building-type-count-total town-center > 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (or (goal current-age-goal imperial-age) (can-train-with-escrow monk)) (unit-type-count-total monk < min-monks-to-train) (can-train-with-escrow monk) => (release-escrow gold) (train monk) ) ; build a dock to do some of the work dock-key-word (defrule (building-type-count-total monastery > 0) ;(building-type-count-total university > 0) (unit-type-count-total villager > min-villagers) (wood-amount > 199) (building-type-count-total dock less-than 1) (can-build dock) => (build dock) ) ; build a barracks so we can build a stable and/or archery range later (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) ;(goal current-age-goal castle-age) ;imperial-age WDP (building-type-count-total mill > 0) (building-type-count-total lumber-camp > 0) (building-type-count-total dock > 0) ;(building-type-count-total monastery > 0) (building-type-count-total barracks < 1) (wood-amount < 175) => (set-goal need-wood-goal 1) ;(set-goal escrow-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) ;(goal current-age-goal castle-age) ;imperial-age WDP (building-type-count-total mill > 0) (building-type-count-total lumber-camp > 0) (building-type-count-total dock > 0) ;(building-type-count-total monastery > 0) (building-type-count-total barracks < 1) (wood-amount < 175) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) ;(goal current-age-goal castle-age) ;imperial-age WDP (building-type-count-total mill > 0) ; (or (building-type-count-total dock > 0) ; (current-age == feudal-age)) ;(building-type-count-total monastery > 0) (building-type-count-total barracks < 2) ;(can-build barracks) (can-build-with-escrow barracks) => (release-escrow wood) (build-forward barracks) ) (defrule (game-time > 1100) ; (goal want-more-town-centers 0) ; (or (unit-type-count-total villager >= min-villagers) ; (food-amount >= 200)) ; (goal current-age-goal castle-age) ; (building-type-count-total mill > 0) (building-type-count-total barracks < 2) ; (building-type-count-total monastery > 0) ; (building-type-count-total university > 0) ; (can-build-with-escrow barracks) => ; (release-escrow wood) (build barracks) ) ; build an early stable if needed (defrule (goal cavalry-research-goal 1) (building-type-count-total town-center > 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (building-type-count-total mill > 0) ;(building-type-count-total monastery > 0) (building-available stable) (building-type-count-total stable < 1) (wood-amount < 175) => (set-goal need-wood-goal 1) (set-goal escrow-wood-goal 1) ) (defrule (goal cavalry-research-goal 1) (building-type-count-total town-center > 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (building-type-count-total mill > 0) ;(building-type-count-total monastery > 0) (building-available stable) (building-type-count-total stable < 1) (wood-amount < 275) => (set-goal save-wood-goal 1) ) (defrule (goal cavalry-research-goal 1) (building-type-count-total town-center > 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 200)) (building-type-count-total mill > 0) ;(building-type-count-total monastery > 0) (building-type-count-total stable < 2) (can-build-with-escrow stable) => (release-escrow wood) (build-forward stable) ) ; build an early archery range when available (defrule (goal archery-research-goal 1) (building-type-count-total town-center > 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (building-type-count-total mill > 0) (building-type-count-total monastery > 0) (building-available archery-range) (building-type-count-total archery-range < 1) (wood-amount < 175) => (set-goal need-wood-goal 1) (set-goal escrow-wood-goal 1) ) (defrule (goal archery-research-goal 1) (building-type-count-total town-center > 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (building-type-count-total mill > 0) (building-type-count-total monastery > 0) (building-available archery-range) (building-type-count-total archery-range < 1) (wood-amount < 275) => (set-goal save-wood-goal 1) ) (defrule (goal archery-research-goal 1) (building-type-count-total town-center > 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (building-type-count-total mill > 0) (building-type-count-total monastery > 0) (building-type-count-total archery-range < 1) (can-build-with-escrow archery-range) => (release-escrow wood) (build archery-range) ) ; produce units for defense in the castle/imperial age using escrow (defrule (building-type-count-total town-center > 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) ;(or (goal current-age-goal castle-age) ; (goal current-age-goal imperial-age)) (or (current-age == castle-age) (food-amount > 1000)) (housing-headroom > 0) (unit-type-count-total defender-type < defenders-to-train) (food-amount < defender-food) => (set-goal need-food-goal 1) ) (defrule (building-type-count-total town-center > 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) ;(or (goal current-age-goal castle-age) ; (goal current-age-goal imperial-age)) (or (current-age == castle-age) (food-amount > 1000)) (housing-headroom > 0) (unit-type-count-total defender-type < defenders-to-train) (food-amount < defender-save-food) => (set-goal save-food-goal 1) ) (defrule (building-type-count-total town-center > 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) ;(or (goal current-age-goal castle-age) ; (goal current-age-goal imperial-age)) (or (current-age == castle-age) (food-amount > 850)) (housing-headroom > 0) (unit-type-count-total defender-type < defenders-to-train) (wood-amount < defender-wood) => (set-goal need-wood-goal 1) ) (defrule (building-type-count-total town-center > 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) ;(or (goal current-age-goal castle-age) ; (goal current-age-goal imperial-age)) ;(or (current-age == imperial-age) ; (food-amount > 850)) (housing-headroom > 0) (unit-type-count-total defender-type < defenders-to-train) (wood-amount < defender-save-wood) => (set-goal save-wood-goal 1) ) (defrule (building-type-count-total town-center > 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) ;(or (goal current-age-goal castle-age) ; (goal current-age-goal imperial-age)) (or (current-age == castle-age) (food-amount > 850)) (housing-headroom > 0) (unit-type-count-total defender-type < defenders-to-train) (gold-amount < defender-gold) => (set-goal need-gold-goal 1) ) (defrule (building-type-count-total town-center > 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) ;(or (goal current-age-goal castle-age) ; (goal current-age-goal imperial-age)) (or (current-age == imperial-age) (food-amount > 850)) (housing-headroom > 0) (unit-type-count-total defender-type < defenders-to-train) (gold-amount < defender-save-gold) => (set-goal save-gold-goal 1) ) (defrule (building-type-count-total town-center > 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) ;(or (goal current-age-goal castle-age) ; (goal current-age-goal imperial-age)) ;(or (current-age == imperial-age) ; (food-amount > 850)) (housing-headroom > 0) (unit-type-count-total defender-type < defenders-to-train) (stone-amount < defender-stone) => (set-goal need-stone-goal 1) ) (defrule (building-type-count-total town-center > 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) ;(or (goal current-age-goal castle-age) ; (goal current-age-goal imperial-age)) ;(or (current-age == castle-age) ;(or (current-age == imperial-age) ; (food-amount > 1100))) (housing-headroom > 0) (unit-type-count-total defender-type < defenders-to-train) (can-train defender-type) => (train defender-type) ) (defrule (unit-type-count-total defender-type >= 8) => (attack-now) ) ; train scouts when available (defrule (goal want-more-town-centers 0) (unit-available scout-cavalry-line) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 280)) (unit-type-count-total scout-cavalry-line < scouts-to-train) (food-amount < 80) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) (unit-available scout-cavalry-line) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 280)) (unit-type-count-total scout-cavalry-line < scouts-to-train) (food-amount < 180) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (unit-available scout-cavalry-line) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 280)) (unit-type-count-total scout-cavalry-line < scouts-to-train) (can-train scout-cavalry-line) => (train scout-cavalry-line) ) ; Build gates for a wall (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (building-type-count-total gate < gates-to-build) (stone-amount < 30) => (set-goal need-stone-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (not (town-under-attack)) (building-type-count-total gate < gates-to-build) (can-build-gate wall-perimeter) => (build-gate wall-perimeter) ) (defrule (current-age == feudal-age) (wall-completed-percentage wall-perimeter < 100) (can-build-wall-with-escrow wall-perimeter stone-wall-line) => (release-escrow stone) (build-wall wall-perimeter stone-wall-line) ) ; Build the wall (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (wall-completed-percentage wall-perimeter < required-wall-percent) (stone-amount < 200) => (set-goal need-stone-goal 1) ) (defrule (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (not (town-under-attack)) (not (goal is-zero-goal required-wall-percent)) (can-build-wall wall-perimeter stone-wall-line) => (build-wall wall-perimeter stone-wall-line) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (not (town-under-attack)) (wall-completed-percentage wall-perimeter < required-palisade-percent) (wood-amount < 200) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (not (town-under-attack)) (wall-completed-percentage wall-perimeter < required-palisade-percent) (can-build-wall wall-perimeter palisade-wall) => (build-wall wall-perimeter palisade-wall) ) ; Build home towers after the wall and castles are done (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (wall-completed-percentage wall-perimeter >= required-wall-percent) (wall-completed-percentage wall-perimeter >= required-palisade-percent) (building-type-count-total castle >= castles-to-build) (building-type-count-total watch-tower-line < home-towers-to-build) (wood-amount < 25) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (wall-completed-percentage wall-perimeter >= required-wall-percent) (wall-completed-percentage wall-perimeter >= required-palisade-percent) (building-type-count-total castle >= castles-to-build) (building-type-count-total watch-tower-line < home-towers-to-build) (wood-amount < 125) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (wall-completed-percentage wall-perimeter >= required-wall-percent) (wall-completed-percentage wall-perimeter >= required-palisade-percent) (building-type-count-total castle >= castles-to-build) (building-type-count-total watch-tower-line < home-towers-to-build) (stone-amount < 125) => (set-goal need-stone-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (not (town-under-attack)) (wall-completed-percentage wall-perimeter >= required-wall-percent) (wall-completed-percentage wall-perimeter >= required-palisade-percent) (building-type-count-total castle >= castles-to-build) (building-type-count-total watch-tower-line < home-towers-to-build) (can-build watch-tower-line) => (build watch-tower-line) ) ; Build home bombard towers after the wall and castles are done (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (wall-completed-percentage wall-perimeter >= required-wall-percent) (wall-completed-percentage wall-perimeter >= required-palisade-percent) (building-type-count-total castle >= castles-to-build) (building-available bombard-tower) (building-type-count-total bombard-tower < home-bombard-towers-to-build) (gold-amount < 100) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (wall-completed-percentage wall-perimeter >= required-wall-percent) (wall-completed-percentage wall-perimeter >= required-palisade-percent) (building-type-count-total castle >= castles-to-build) (building-available bombard-tower) (building-type-count-total bombard-tower < home-bombard-towers-to-build) (wood-amount < 300) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (wall-completed-percentage wall-perimeter >= required-wall-percent) (wall-completed-percentage wall-perimeter >= required-palisade-percent) (building-type-count-total castle >= castles-to-build) (building-available bombard-tower) (building-type-count-total bombard-tower < home-bombard-towers-to-build) (stone-amount < 125) => (set-goal need-stone-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (not (town-under-attack)) (wall-completed-percentage wall-perimeter >= required-wall-percent) (wall-completed-percentage wall-perimeter >= required-palisade-percent) (building-type-count-total castle >= castles-to-build) (building-type-count-total bombard-tower < home-bombard-towers-to-build) (can-build bombard-tower) => (build bombard-tower)) ; Don't need a university if all research is done. #load-if-not-defined POST-IMPERIAL-AGE-START ; build a university when available (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (building-type-count-total mill > 0) (building-available university) (building-type-count-total university < 1) (wood-amount < 200) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (building-type-count-total mill > 0) (building-available university) (building-type-count-total university < 1) (wood-amount < 300) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (building-type-count-total mill > 0) (building-type-count-total university < 1) (building-type-count-total monastery > 0) (can-build university) => (build university) ) #end-if ; not POST-IMPERIAL-AGE-START ; Build trade carts once we've started the attack cycle. (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (or (players-stance any-human ally) (players-stance any-computer ally)) (not (goal attack-cycle-goal attack-cycle-none)) (unit-type-count-total trade-cart < trade-carts-to-train) (wood-amount < 100) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (or (players-stance any-human ally) (players-stance any-computer ally)) (not (goal attack-cycle-goal attack-cycle-none)) (unit-type-count-total trade-cart < trade-carts-to-train) (wood-amount < 200) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (or (players-stance any-human ally) (players-stance any-computer ally)) (not (goal attack-cycle-goal attack-cycle-none)) (unit-type-count-total trade-cart < trade-carts-to-train) (gold-amount < 50) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (or (players-stance any-human ally) (players-stance any-computer ally)) (not (goal attack-cycle-goal attack-cycle-none)) (unit-type-count-total trade-cart < trade-carts-to-train) (gold-amount < 250) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (or (players-stance any-human ally) (players-stance any-computer ally)) (not (goal attack-cycle-goal attack-cycle-none)) (unit-type-count-total trade-cart < trade-carts-to-train) (can-train trade-cart) => (train trade-cart) ) ; Advance to the Feudal Age when available (defrule (goal current-age-goal dark-age) (food-amount < 500) => (set-goal need-food-goal 1) ) (defrule (goal current-age-goal dark-age) (food-amount < 600) => (set-goal save-food-goal 1) ) (defrule (current-age == dark-age) (food-amount >= 500) (building-type-count mill > 0) (or (building-type-count lumber-camp > 0) (or (building-type-count barracks > 0) (or (building-type-count mining-camp > 0) (building-type-count dock > 0)))) (can-train villager) => (set-goal current-age-goal feudal-age) (research feudal-age) (set-strategic-number sn-maximum-town-size 16) ;14 WDP (disable-timer age-advance-timer) (enable-timer age-advance-timer 150) ) ; Anticipate combined requirements for Feudal Age. (defrule (current-age == dark-age) (goal current-age-goal feudal-age) (food-amount < 1250) => (set-goal need-food-goal 1) ) (defrule (current-age == dark-age) (goal current-age-goal feudal-age) (food-amount < 1350) => (set-goal save-food-goal 1) ) (defrule (current-age == dark-age) (goal current-age-goal feudal-age) (wood-amount < 575) => (set-goal need-wood-goal 1) ) (defrule (current-age == dark-age) (goal current-age-goal feudal-age) (wood-amount < 675) => (set-goal save-wood-goal 1) ) (defrule (current-age == dark-age) (goal current-age-goal feudal-age) (gold-amount < 200) => (set-goal need-gold-goal 1) ) (defrule (current-age == dark-age) (goal current-age-goal feudal-age) (gold-amount < 400) => (set-goal save-gold-goal 1) ) ; Research loom when waiting for food or housing (defrule (or (unit-type-count-total villager >= max-villagers) (or (food-amount < 50) (housing-headroom == 0))) (can-research ri-loom) => (research ri-loom) ) ; Build a lumber camp if need to advance to the Feudal Age (defrule (current-age == dark-age) (food-amount >= 300) (building-type-count-total town-center > 0) (building-type-count-total lumber-camp < 1) (building-type-count-total mining-camp < 1) (building-type-count-total barracks < 1) (or (food-amount >= 200) (unit-type-count-total villager >= max-villagers)) (wood-amount < 100) => (set-goal need-wood-goal 1) (set-goal escrow-wood-goal 1) ) (defrule (current-age == dark-age) (food-amount >= 300) (building-type-count-total town-center > 0) (building-type-count-total lumber-camp < 1) (building-type-count-total mining-camp < 1) (building-type-count-total barracks < 1) (or (food-amount >= 200) (unit-type-count-total villager >= max-villagers)) (wood-amount < 200) => (set-goal save-wood-goal 1) ) (defrule (current-age == dark-age) (food-amount >= 300) (building-type-count-total town-center > 0) (building-type-count-total lumber-camp < 1) (building-type-count-total mining-camp < 1) (building-type-count-total barracks < 1) (or (food-amount >= 200) (unit-type-count-total villager >= max-villagers)) (can-build-with-escrow lumber-camp) => (release-escrow wood) (set-strategic-number sn-camp-max-distance 12) (build lumber-camp) ) ; feudal age local variables (defconst feudal-break-even-goal 40) ; Advance to the Castle Age when available (defrule (goal current-age-goal feudal-age) (food-amount < 800) => (set-goal need-food-goal 1) ) (defrule (goal current-age-goal feudal-age) (food-amount < 900) => (set-goal save-food-goal 1) ) (defrule (goal current-age-goal feudal-age) (gold-amount < 200) => (set-goal need-gold-goal 1) ) (defrule (goal current-age-goal feudal-age) (gold-amount < 400) => (set-goal save-gold-goal 1) ) (defrule (current-age == feudal-age) (goal current-age-goal castle-age) (food-amount < 1000) => (set-goal need-food-goal 1) ) (defrule (current-age == feudal-age) (goal current-age-goal castle-age) (food-amount < 1100) => (set-goal save-food-goal 1) ) (defrule (current-age == feudal-age) (goal current-age-goal castle-age) (wood-amount < 375) => (set-goal need-wood-goal 1) ) (defrule (current-age == feudal-age) (goal current-age-goal castle-age) (wood-amount < 475) => (set-goal save-wood-goal 1) ) (defrule (current-age == feudal-age) (goal current-age-goal castle-age) (gold-amount < 800) => (set-goal need-gold-goal 1) ) (defrule (current-age == feudal-age) (goal current-age-goal castle-age) (gold-amount < 1000) => (set-goal save-gold-goal 1) ) ; WDP This used to be a market, but because I hate markets ; this is now stables ; Make sure the stable is available to get to Castle Age (defrule (or (current-age == feudal-age) (goal current-age-goal feudal-age)) (building-type-count-total town-center > 0) (building-type-count-total mill > 0) (building-type-count-total stable < 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (wood-amount < 175) => (set-goal need-wood-goal 1) (set-goal escrow-wood-goal 1) ) (defrule (or (current-age == feudal-age) (goal current-age-goal feudal-age)) (building-type-count-total town-center > 0) (building-type-count-total mill > 0) (building-type-count-total stable < 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (wood-amount < 275) => (set-goal save-wood-goal 1) ) (defrule (current-age == feudal-age) (building-type-count-total town-center > 0) (building-type-count-total mill > 0) (building-type-count-total stable < 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (can-build-with-escrow market) => (release-escrow wood) (build stable) ) ; Make sure the blacksmith is available to get to Castle Age (defrule (or (current-age == feudal-age) (goal current-age-goal feudal-age)) (building-type-count-total town-center > 0) (building-type-count-total market > 0) (building-type-count-total blacksmith < 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (wood-amount < 150) => (set-goal need-wood-goal 1) (set-goal escrow-wood-goal 1) ) (defrule (or (current-age == feudal-age) (goal current-age-goal feudal-age)) (building-type-count-total town-center > 0) (building-type-count-total market > 0) (building-type-count-total blacksmith < 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (wood-amount < 250) => (set-goal save-wood-goal 1) ) (defrule (current-age == feudal-age) (building-type-count-total town-center > 0) (building-type-count-total market > 0) (building-type-count-total blacksmith < 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (can-build-with-escrow blacksmith) => (release-escrow wood) (build blacksmith) ) ; research scale barding armor (defrule (goal cavalry-research-goal 1) (goal tier3-done-goal 1) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 350)) (research-available ri-scale-barding) (food-amount < 150) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (goal cavalry-research-goal 1) (goal tier3-done-goal 1) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 350)) (research-available ri-scale-barding) (food-amount < 250) => (set-goal save-food-goal 1) ) (defrule (goal cavalry-research-goal 1) (goal tier3-done-goal 1) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 350)) (can-research-with-escrow ri-scale-barding) => (release-escrow food) (research ri-scale-barding) ) (defrule (goal infantry-research-goal 1) (goal tier4-done-goal 1) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 300)) (research-available ri-scale-mail) (food-amount < 100) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (goal infantry-research-goal 1) (goal tier4-done-goal 1) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 300)) (research-available ri-scale-mail) (food-amount < 200) => (set-goal save-food-goal 1) ) (defrule (goal infantry-research-goal 1) (goal tier4-done-goal 1) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 300)) (can-research-with-escrow ri-scale-mail) => (release-escrow food) (research ri-scale-mail) ) (defrule (goal archery-research-goal 1) (goal tier5-done-goal 1) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 300)) (research-available ri-padded-archer-armor) (food-amount < 100) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (goal archery-research-goal 1) (goal tier5-done-goal 1) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 300)) (research-available ri-padded-archer-armor) (food-amount < 200) => (set-goal save-food-goal 1) ) (defrule (goal archery-research-goal 1) (goal tier5-done-goal 1) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 300)) (can-research-with-escrow ri-padded-archer-armor) => (release-escrow food) (research ri-padded-archer-armor) ) ; research forging (defrule (goal want-more-town-centers 0) (or (goal cavalry-research-goal 1) (goal infantry-research-goal 1)) (goal tier2-done-goal 1) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 350)) (goal current-age-goal imperial-age) (research-available ri-forging) (food-amount < 150) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (goal cavalry-research-goal 1) (goal infantry-research-goal 1)) (goal tier2-done-goal 1) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 350)) (goal current-age-goal imperial-age) (research-available ri-forging) (food-amount < 250) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (goal cavalry-research-goal 1) (goal infantry-research-goal 1)) (goal tier2-done-goal 1) (goal current-age-goal imperial-age) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 350)) (can-research-with-escrow ri-forging) => (release-escrow food) (research ri-forging) ) ;research tracking for infantry (defrule (goal infantry-research-goal 1) (goal want-more-town-centers 0) (goal tier4-done-goal 1) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 275)) (research-available ri-tracking) (food-amount < 75) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (goal infantry-research-goal 1) (goal want-more-town-centers 0) (goal tier4-done-goal 1) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 275)) (research-available ri-tracking) (food-amount < 175) => (set-goal save-food-goal 1) ) (defrule (goal infantry-research-goal 1) (goal want-more-town-centers 0) (goal tier4-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 275)) (can-research-with-escrow ri-tracking) => (release-escrow food) (research ri-tracking) ) ; Research wheelbarrow (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 375)) (research-available ri-wheel-barrow) (food-amount < 175) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 375)) (research-available ri-wheel-barrow) (food-amount < 275) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 375)) (research-available ri-wheel-barrow) (wood-amount < 50) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 375)) (research-available ri-wheel-barrow) (wood-amount < 150) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 375)) (can-research ri-wheel-barrow) => (research ri-wheel-barrow) ) ; Research double-bit axe (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 300)) (research-available ri-double-bit-axe) (food-amount < 100) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 300)) (research-available ri-double-bit-axe) (food-amount < 200) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 300)) (research-available ri-double-bit-axe) (wood-amount < 50) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 300)) (research-available ri-double-bit-axe) (wood-amount < 150) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 300)) (can-research ri-double-bit-axe) => (research ri-double-bit-axe) ) ; Research horse collar (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 275)) (research-available ri-horse-collar) (food-amount < 75) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 275)) (research-available ri-horse-collar) (food-amount < 175) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 275)) (research-available ri-horse-collar) (wood-amount < 75) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 275)) (research-available ri-horse-collar) (wood-amount < 175) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 275)) (can-research ri-horse-collar) => (research ri-horse-collar) ) ; Research gold mining (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 300)) (research-available ri-gold-mining) (food-amount < 100) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 300)) (research-available ri-gold-mining) (food-amount < 200) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 300)) (research-available ri-gold-mining) (wood-amount < 75) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 300)) (research-available ri-gold-mining) (wood-amount < 175) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 300)) (can-research ri-gold-mining) => (research ri-gold-mining) ) ; Research stone mining (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 300)) ;(goal current-age-goal imperial-age) ;(goal tier1-done-goal 1) ;(building-type-count-total market > 0) (building-type-count-total blacksmith > 0) (research-available ri-stone-mining) (food-amount < 100) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 300)) ;(goal current-age-goal imperial-age) ;(goal tier1-done-goal 1) ;(building-type-count-total market > 0) (building-type-count-total blacksmith > 0) (research-available ri-stone-mining) (food-amount < 200) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 300)) ;(goal current-age-goal imperial-age) ;(goal tier1-done-goal 1) ;(building-type-count-total market > 0) (building-type-count-total blacksmith > 0) (research-available ri-stone-mining) (wood-amount < 75) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 300)) ;(goal current-age-goal imperial-age) ;(goal tier1-done-goal 1) ;(building-type-count-total market > 0) (building-type-count-total blacksmith > 0) (research-available ri-stone-mining) (wood-amount < 175) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 300)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (can-research ri-stone-mining) => (research ri-stone-mining) ) ; Research fletching (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 300)) (goal current-age-goal imperial-age) (goal tier2-done-goal 1) (research-available ri-fletching) (food-amount < 100) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 300)) (goal current-age-goal imperial-age) (goal tier2-done-goal 1) (research-available ri-fletching) (food-amount < 200) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 300)) (goal current-age-goal imperial-age) (goal tier2-done-goal 1) (research-available ri-fletching) (gold-amount < 50) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 300)) (goal current-age-goal imperial-age) (goal tier2-done-goal 1) (research-available ri-fletching) (gold-amount < 250) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 300)) (goal current-age-goal imperial-age) (goal tier2-done-goal 1) (can-research ri-fletching) => (research ri-fletching) ) ; research town watch - disabled (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 275)) (goal is-zero-goal 1) (building-type-count-total market > 0) (building-type-count-total blacksmith > 0) (research-available ri-town-watch) (food-amount < 75) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 275)) (goal is-zero-goal 1) (building-type-count-total market > 0) (building-type-count-total blacksmith > 0) (research-available ri-town-watch) (food-amount < 175) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 275)) (goal is-zero-goal 1) (building-type-count-total market > 0) (building-type-count-total blacksmith > 0) (can-research ri-town-watch) => (research ri-town-watch) ) ; castle age local variables (defconst castle-break-even-goal 40) ; advance to the Imperial Age (defrule (goal current-age-goal castle-age) (food-amount < 1000) => (set-goal need-food-goal 1) ) (defrule (goal current-age-goal castle-age) (food-amount < 1100) => (set-goal save-food-goal 1) ) (defrule (goal current-age-goal castle-age) (gold-amount < 800) => (set-goal need-gold-goal 1) ) (defrule (goal current-age-goal castle-age) (gold-amount < 1000) => (set-goal save-gold-goal 1) ) (defrule (current-age == castle-age) (food-amount >= 1000) (gold-amount >= 800) (building-type-count monastery > 0) (or (building-type-count siege-workshop > 0) (or (building-type-count castle > 0) (building-type-count university > 0))) (can-train villager) => (set-goal current-age-goal imperial-age) (research imperial-age) (set-strategic-number sn-task-ungrouped-soldiers 0) ;WDP (set-strategic-number sn-maximum-town-size 24) ;20 WDP (disable-timer age-advance-timer) (enable-timer age-advance-timer 210) ) ; Make sure the monastery is available to get to Imperial Age (defrule (or (current-age == castle-age) (goal current-age-goal castle-age)) (building-type-count-total town-center > 0) (building-type-count-total mill > 0) (building-type-count-total monastery < 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (wood-amount < 175) => (set-goal need-wood-goal 1) (set-goal escrow-wood-goal 1) ) (defrule (or (current-age == castle-age) (goal current-age-goal castle-age)) (building-type-count-total town-center > 0) (building-type-count-total mill > 0) (building-type-count-total monastery < 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (wood-amount < 275) => (set-goal save-wood-goal 1) ) (defrule (current-age == castle-age) (building-type-count-total town-center > 0) (building-type-count-total mill > 0) (building-type-count-total monastery < 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (can-build-with-escrow monastery) => (release-escrow wood) (chat-to-all "God saves the world") (build monastery) ) ; Don't need a university if all research is done. #load-if-not-defined POST-IMPERIAL-AGE-START ; Make sure the university is available to get to Imperial Age (defrule (or (current-age == castle-age) (goal current-age-goal castle-age)) (building-type-count-total town-center > 0) (building-type-count-total mill > 0) (building-type-count-total university < 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (wood-amount < 200) => (set-goal need-wood-goal 1) (set-goal escrow-wood-goal 1) ) (defrule (or (current-age == castle-age) (goal current-age-goal castle-age)) (building-type-count-total town-center > 0) ;(building-type-count-total mill > 0) (building-type-count-total university < 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (wood-amount < 300) => (set-goal save-wood-goal 1) ) (defrule (current-age == castle-age) (building-type-count-total town-center > 0) (building-type-count-total mill > 0) (building-type-count-total university < 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (building-type-count-total monastery > 0) (can-build-with-escrow university) => (release-escrow wood) (build university) ) #end-if ; not POST-IMPERIAL-AGE-START ; research chain barding armor (defrule (goal cavalry-research-goal 1) (goal want-more-town-centers 0) (goal tier3-done-goal 1) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 450)) (research-available ri-chain-barding) (food-amount < 250) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (goal cavalry-research-goal 1) (goal want-more-town-centers 0) (goal tier3-done-goal 1) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 450)) (research-available ri-chain-barding) (food-amount < 350) => (set-goal save-food-goal 1) ) (defrule (goal cavalry-research-goal 1) (goal want-more-town-centers 0) (goal tier3-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 450)) (research-available ri-chain-barding) (gold-amount < 150) => (set-goal need-gold-goal 1) (set-goal escrow-gold-goal 1) ) (defrule (goal cavalry-research-goal 1) (goal want-more-town-centers 0) (goal tier3-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 450)) (research-available ri-chain-barding) (gold-amount < 350) => (set-goal save-gold-goal 1) ) (defrule (goal cavalry-research-goal 1) (goal want-more-town-centers 0) (goal tier3-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 450)) (can-research-with-escrow ri-chain-barding) => (release-escrow food) (release-escrow gold) (research ri-chain-barding) ) (defrule (goal infantry-research-goal 1) (goal want-more-town-centers 0) (goal tier4-done-goal 1) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 400)) (research-available ri-chain-mail) (food-amount < 200) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (goal infantry-research-goal 1) (goal want-more-town-centers 0) (goal tier4-done-goal 1) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 400)) (research-available ri-chain-mail) (food-amount < 300) => (set-goal save-food-goal 1) ) (defrule (goal infantry-research-goal 1) (goal want-more-town-centers 0) (goal tier4-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 400)) (research-available ri-chain-mail) (gold-amount < 100) => (set-goal need-gold-goal 1) (set-goal escrow-gold-goal 1) ) (defrule (goal infantry-research-goal 1) (goal want-more-town-centers 0) (goal tier4-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 400)) (research-available ri-chain-mail) (gold-amount < 300) => (set-goal save-gold-goal 1) ) (defrule (goal infantry-research-goal 1) (goal want-more-town-centers 0) (goal tier4-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 400)) (can-research-with-escrow ri-chain-mail) => (release-escrow food) (release-escrow gold) (research ri-chain-mail) ) (defrule (goal archery-research-goal 1) (goal want-more-town-centers 0) (goal tier5-done-goal 1) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 300)) (research-available ri-leather-archer-armor) (food-amount < 150) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (goal archery-research-goal 1) (goal want-more-town-centers 0) (goal tier5-done-goal 1) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 300)) (research-available ri-leather-archer-armor) (food-amount < 350) => (set-goal save-food-goal 1) ) (defrule (goal archery-research-goal 1) (goal want-more-town-centers 0) (goal tier5-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 300)) (research-available ri-leather-archer-armor) (gold-amount < 150) => (set-goal need-gold-goal 1) (set-goal escrow-gold-goal 1) ) (defrule (goal archery-research-goal 1) (goal want-more-town-centers 0) (goal tier5-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 300)) (research-available ri-leather-archer-armor) (gold-amount < 350) => (set-goal save-gold-goal 1) ) ;(defrule ;. (goal archery-research-goal 1) ; (goal want-more-town-centers 0) ; (goal tier5-done-goal 1) ; (or (unit-type-count-total villager >= min-villagers) ; (food-amount >= 300)) ; (can-research-with-escrow ri-leather-archer-armor) ;=> ; (release-escrow food) ; (release-escrow gold) ; (research ri-leather-archer-armor) ;;) ; research iron casting (defrule (goal want-more-town-centers 0) (or (goal cavalry-research-goal 1) (goal infantry-research-goal 1)) (goal tier2-done-goal 1) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 420)) (goal current-age-goal imperial-age) (research-available ri-iron-casting) (food-amount < 220) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (goal cavalry-research-goal 1) (goal infantry-research-goal 1)) (goal tier2-done-goal 1) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 420)) (goal current-age-goal imperial-age) (research-available ri-iron-casting) (food-amount < 320) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (goal cavalry-research-goal 1) (goal infantry-research-goal 1)) (goal tier2-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 420)) (goal current-age-goal imperial-age) (research-available ri-iron-casting) (gold-amount < 120) => (set-goal need-gold-goal 1) (set-goal escrow-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (goal cavalry-research-goal 1) (goal infantry-research-goal 1)) (goal tier2-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 420)) (goal current-age-goal imperial-age) (research-available ri-iron-casting) (gold-amount < 320) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (goal cavalry-research-goal 1) (goal infantry-research-goal 1)) (goal tier2-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 420)) (goal current-age-goal imperial-age) (can-research-with-escrow ri-iron-casting) => (release-escrow food) (release-escrow gold) (research ri-iron-casting) ) ; research hand cart (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 500)) (goal current-age-goal imperial-age) (goal tier6-done-goal 1) (research-available ri-hand-cart) (food-amount < 300) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 500)) (goal current-age-goal imperial-age) (goal tier6-done-goal 1) (research-available ri-hand-cart) (food-amount < 400) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 500)) (goal current-age-goal imperial-age) (goal tier6-done-goal 1) (research-available ri-hand-cart) (wood-amount < 200) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 500)) (goal current-age-goal imperial-age) (goal tier6-done-goal 1) (research-available ri-hand-cart) (wood-amount < 300) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 500)) (goal current-age-goal imperial-age) (goal tier6-done-goal 1) (can-research ri-hand-cart) => (research ri-hand-cart) ) ; research bow saw (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 350)) ;(goal current-age-goal imperial-age) (goal tier1-done-goal 1) (research-available ri-bow-saw) (food-amount < 150) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 350)) ;(goal current-age-goal imperial-age) (goal tier1-done-goal 1) (research-available ri-bow-saw) (food-amount < 250) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 350)) ;(goal current-age-goal imperial-age) (goal tier1-done-goal 1) (research-available ri-bow-saw) (wood-amount < 100) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 350)) ;(goal current-age-goal imperial-age) (goal tier1-done-goal 1) (research-available ri-bow-saw) (wood-amount < 200) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 350)) ;(goal current-age-goal imperial-age) (goal tier1-done-goal 1) (can-research ri-bow-saw) => (research ri-bow-saw) ) ; research heavy plow (defrule (goal want-more-town-centers 0) (goal tier1-done-goal 1) (research-available ri-heavy-plow) (food-amount < 125) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 325)) ;(goal current-age-goal imperial-age) (goal tier1-done-goal 1) (research-available ri-heavy-plow) (food-amount < 225) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 325)) ;(goal current-age-goal imperial-age) (goal tier1-done-goal 1) (research-available ri-heavy-plow) (wood-amount < 125) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 325)) ;(goal current-age-goal imperial-age) (goal tier1-done-goal 1) (research-available ri-heavy-plow) (wood-amount < 225) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 325)) ;(goal current-age-goal imperial-age) (goal tier1-done-goal 1) (can-research ri-heavy-plow) => (research ri-heavy-plow) ) ; research gold shaft mining (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 400)) ;(goal current-age-goal imperial-age) (goal tier1-done-goal 1) (research-available ri-gold-shaft-mining) (food-amount < 200) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 400)) ;(goal current-age-goal imperial-age) (goal tier1-done-goal 1) (research-available ri-gold-shaft-mining) (food-amount < 300) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 400)) ;(goal current-age-goal imperial-age) (goal tier1-done-goal 1) (research-available ri-gold-shaft-mining) (wood-amount < 150) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 400)) ;(goal current-age-goal imperial-age) (goal tier1-done-goal 1) (research-available ri-gold-shaft-mining) (wood-amount < 250) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 400)) ;(goal current-age-goal imperial-age) (goal tier1-done-goal 1) (can-research ri-gold-shaft-mining) => (research ri-gold-shaft-mining) ) ; research stone shaft mining (defrule (goal want-more-town-centers 0) (research-available ri-stone-shaft-mining) (goal tier2-done-goal 1) (food-amount < 200) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) (goal tier2-done-goal 1) (research-available ri-stone-shaft-mining) (food-amount < 300) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 400)) (goal tier2-done-goal 1) (research-available ri-stone-shaft-mining) (wood-amount < 150) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 400)) ;(goal current-age-goal imperial-age) (goal tier2-done-goal 1) (research-available ri-stone-shaft-mining) (wood-amount < 250) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 400)) ;(goal current-age-goal imperial-age) (goal tier2-done-goal 1) (can-research ri-stone-shaft-mining) => (research ri-stone-shaft-mining) ) ; research bodkin arrow (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 400)) (goal current-age-goal imperial-age) (goal tier2-done-goal 1) (research-available ri-bodkin-arrow) (food-amount < 200) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 400)) (goal current-age-goal imperial-age) (goal tier2-done-goal 1) (research-available ri-bodkin-arrow) (food-amount < 300) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 400)) (goal current-age-goal imperial-age) (goal tier2-done-goal 1) (research-available ri-bodkin-arrow) (wood-amount < 100) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 400)) (goal current-age-goal imperial-age) (goal tier2-done-goal 1) (research-available ri-bodkin-arrow) (wood-amount < 200) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 400)) (goal current-age-goal imperial-age) (goal tier2-done-goal 1) (can-research ri-bodkin-arrow) => (research ri-bodkin-arrow) ) ; upgrade walls if done (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 400)) (goal current-age-goal castle-age) (goal tier8-done-goal 1) (not (goal is-zero-goal required-wall-percent)) (wall-completed-percentage wall-perimeter == 100) (building-type-count-total monastery > 0) (building-type-count-total university > 0) (research-available ri-fortified-wall) (food-amount < 200) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 400)) (goal current-age-goal castle-age) (goal tier8-done-goal 1) (not (goal is-zero-goal required-wall-percent)) (wall-completed-percentage wall-perimeter == 100) (building-type-count-total monastery > 0) (building-type-count-total university > 0) (research-available ri-fortified-wall) (food-amount < 300) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 400)) (goal current-age-goal castle-age) (goal tier8-done-goal 1) (not (goal is-zero-goal required-wall-percent)) (wall-completed-percentage wall-perimeter == 100) (building-type-count-total monastery > 0) (building-type-count-total university > 0) (research-available ri-fortified-wall) (stone-amount < 100) => (set-goal need-stone-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 400)) (goal current-age-goal castle-age) (goal tier8-done-goal 1) (not (goal is-zero-goal required-wall-percent)) (building-type-count-total monastery > 0) (building-type-count-total university > 0) (wall-completed-percentage wall-perimeter == 100) (can-research ri-fortified-wall) => (research ri-fortified-wall) ) ; upgrade towers if 3 or more (break-even cost) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 300)) (goal current-age-goal imperial-age) (goal tier8-done-goal 1) (building-type-count-total watch-tower > 0) (building-type-count-total monastery > 0) (building-type-count-total university > 0) (research-available ri-guard-tower) (food-amount < 100) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 300)) (goal current-age-goal imperial-age) (goal tier8-done-goal 1) (building-type-count-total watch-tower > 0) (building-type-count-total monastery > 0) (building-type-count-total university > 0) (research-available ri-guard-tower) (food-amount < 200) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 300)) (goal current-age-goal imperial-age) (goal tier8-done-goal 1) (building-type-count-total watch-tower > 0) (building-type-count-total monastery > 0) (building-type-count-total university > 0) (research-available ri-guard-tower) (stone-amount < 250) => (set-goal need-stone-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 300)) (goal current-age-goal imperial-age) (goal tier8-done-goal 1) (building-type-count-total watch-tower > 0) (building-type-count-total monastery > 0) (building-type-count-total university > 0) (can-research ri-guard-tower) => (research ri-guard-tower) ) ; research ballistics (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) ;(goal current-age-goal imperial-age) (goal tier6-done-goal 1) (building-type-count-total monastery > 0) (building-type-count-total university > 0) (research-available ri-ballistics) (wood-amount < 300) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) ;(goal current-age-goal imperial-age) (goal tier6-done-goal 1) (building-type-count-total monastery > 0) (building-type-count-total university > 0) (research-available ri-ballistics) (wood-amount < 400) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) ;(goal current-age-goal imperial-age) (goal tier6-done-goal 1) (building-type-count-total monastery > 0) (building-type-count-total university > 0) (research-available ri-ballistics) (gold-amount < 175) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) ;(goal current-age-goal imperial-age) (goal tier6-done-goal 1) (building-type-count-total monastery > 0) (building-type-count-total university > 0) (research-available ri-ballistics) (gold-amount < 375) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) ;(goal current-age-goal imperial-age) (goal tier6-done-goal 1) (building-type-count-total monastery > 0) (building-type-count-total university > 0) (can-research ri-ballistics) => (research ri-ballistics) ) ; research murder holes after all towers complete (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 400)) ;(goal current-age-goal imperial-age) (goal tier8-done-goal 1) (building-type-count-total watch-tower-line >= home-towers-to-build) (building-type-count-total monastery > 0) (building-type-count-total university > 0) (research-available ri-murder-holes) (food-amount < 200) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 400)) ;(goal current-age-goal imperial-age) (goal tier8-done-goal 1) (building-type-count-total watch-tower-line >= home-towers-to-build) (building-type-count-total monastery > 0) (building-type-count-total university > 0) (research-available ri-murder-holes) (food-amount < 300) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 400)) ;(goal current-age-goal imperial-age) (goal tier8-done-goal 1) (building-type-count-total watch-tower-line >= home-towers-to-build) (building-type-count-total monastery > 0) (building-type-count-total university > 0) (research-available ri-murder-holes) (stone-amount < 200) => (set-goal need-stone-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 400)) ;(goal current-age-goal imperial-age) (goal tier8-done-goal 1) (building-type-count-total watch-tower-line >= home-towers-to-build) (building-type-count-total monastery > 0) (building-type-count-total university > 0) (can-research ri-murder-holes) => (research ri-murder-holes) ) (defrule (current-age == castle-age) (can-research ri-elite-cataphract) => (research ri-elite-cataphract) ) ; upgrade to light cavalry if have 2 scouts (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 350)) ;(goal current-age-goal imperial-age) (goal tier6-done-goal 1) (building-type-count-total monastery > 0) (building-type-count-total university > 0) (research-available ri-light-cavalry) (food-amount < 150) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 350)) ;(goal current-age-goal imperial-age) (goal tier6-done-goal 1) (building-type-count-total monastery > 0) (building-type-count-total university > 0) (research-available ri-light-cavalry) (food-amount < 250) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 350)) ;(goal current-age-goal imperial-age) (goal tier6-done-goal 1) (building-type-count-total monastery > 0) (building-type-count-total university > 0) (research-available ri-light-cavalry) (gold-amount < 50) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 350)) ;(goal current-age-goal imperial-age) (goal tier6-done-goal 1) (building-type-count-total monastery > 0) (building-type-count-total university > 0) (research-available ri-light-cavalry) (gold-amount < 250) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 350)) ;(goal current-age-goal imperial-age) (goal tier6-done-goal 1) (building-type-count-total monastery > 0) (building-type-count-total university > 0) (can-research ri-light-cavalry) => (research ri-light-cavalry) ) ; research husbandry/bloodlines or squires when ready to attack (defrule (goal cavalry-research-goal 1) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 450)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier7-done-goal 1) (research-available ri-husbandry) (food-amount < 250) => (set-goal need-food-goal 1) ) (defrule (goal cavalry-research-goal 1) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 450)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier7-done-goal 1) (research-available ri-husbandry) (food-amount < 350) => (set-goal save-food-goal 1) ) (defrule (goal cavalry-research-goal 1) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 450)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier7-done-goal 1) (can-research ri-husbandry) => (research ri-husbandry) ) (defrule (goal infantry-research-goal 1) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 450)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier8-done-goal 1) (research-available ri-squires) (food-amount < 250) => (set-goal need-food-goal 1) ) (defrule (goal infantry-research-goal 1) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 450)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier8-done-goal 1) (research-available ri-squires) (food-amount < 350) => (set-goal save-food-goal 1) ) (defrule (goal infantry-research-goal 1) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 450)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier8-done-goal 1) (can-research ri-squires) => (research ri-squires) ) ; research sanctity when ready to attack (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier8-done-goal 1) (research-available ri-sanctity) (gold-amount < 120) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier8-done-goal 1) (research-available ri-sanctity) (gold-amount < 320) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier8-done-goal 1) (can-research ri-sanctity) => (research ri-sanctity) ) ;research redemption (convert buildings) early (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier7-done-goal 1) (research-available ri-redemption) (gold-amount < 475) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier7-done-goal 1) (research-available ri-redemption) (gold-amount < 675) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier7-done-goal 1) (can-research ri-redemption) => (research ri-redemption) ) ; research fervor when ready to attack (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier7-done-goal 1) (research-available ri-fervor) (gold-amount < 140) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier7-done-goal 1) (research-available ri-fervor) (gold-amount < 340) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier7-done-goal 1) (can-research ri-fervor) => (research ri-fervor) ) ; upgrade to capped rams if siege research is set to 1 (defrule (goal siege-research-goal 1) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 400)) ;(goal current-age-goal imperial-age) (goal tier8-done-goal 1) (building-type-count-total siege-workshop > 0) (research-available ri-capped-ram) (food-amount < 200) => (set-goal need-food-goal 1) ) (defrule (goal siege-research-goal 1) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 400)) ;(goal current-age-goal imperial-age) (goal tier8-done-goal 1) (building-type-count-total siege-workshop > 0) (research-available ri-capped-ram) (food-amount < 500) => (set-goal save-food-goal 1) ) (defrule (goal siege-research-goal 1) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 400)) ;(goal current-age-goal imperial-age) (goal tier8-done-goal 1) (building-type-count-total siege-workshop > 0) (research-available ri-capped-ram) (gold-amount < 250) => (set-goal need-gold-goal 1) ) (defrule (goal siege-research-goal 1) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 400)) ;(goal current-age-goal imperial-age) (goal tier8-done-goal 1) (building-type-count-total siege-workshop > 0) (research-available ri-capped-ram) (gold-amount < 450) => (set-goal save-gold-goal 1) ) (defrule (goal siege-research-goal 1) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 400)) ;(goal current-age-goal imperial-age) (goal tier8-done-goal 1) (building-type-count-total siege-workshop > 0) (can-research ri-capped-ram) => (research ri-capped-ram) ) ; research siege engineers when ready to attack (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 700)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier8-done-goal 1) (research-available ri-siege-engineers) (food-amount < 500) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 700)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier8-done-goal 1) (research-available ri-siege-engineers) (food-amount < 600) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 700)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier8-done-goal 1) (research-available ri-siege-engineers) (wood-amount < 600) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 700)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier8-done-goal 1) (research-available ri-siege-engineers) (wood-amount < 700) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 700)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier8-done-goal 1) (can-research ri-siege-engineers) => (research ri-siege-engineers) ) ; imperial age local variables (defconst imperial-break-even-goal 40) ;WDP ; research plate barding armor at break-even (defrule (goal cavalry-research-goal 1) (goal want-more-town-centers 0) (goal tier3-done-goal 1) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 550)) (research-available ri-plate-barding) (food-amount < 350) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (goal cavalry-research-goal 1) (goal want-more-town-centers 0) (goal tier3-done-goal 1) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 550)) (research-available ri-plate-barding) (food-amount < 450) => (set-goal save-food-goal 1) ) (defrule (goal cavalry-research-goal 1) (goal want-more-town-centers 0) (goal tier3-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 550)) (research-available ri-plate-barding) (gold-amount < 200) => (set-goal need-gold-goal 1) (set-goal escrow-gold-goal 1) ) (defrule (goal cavalry-research-goal 1) (goal want-more-town-centers 0) (goal tier3-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 550)) (research-available ri-plate-barding) (gold-amount < 400) => (set-goal save-gold-goal 1) ) (defrule (goal cavalry-research-goal 1) (goal want-more-town-centers 0) (goal tier3-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 550)) (can-research-with-escrow ri-plate-barding) => (release-escrow food) (release-escrow gold) (research ri-plate-barding) ) ; research plate mail also (defrule (goal infantry-research-goal 1) (goal want-more-town-centers 0) (goal tier4-done-goal 1) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 500)) (research-available ri-plate-mail) (food-amount < 300) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (goal infantry-research-goal 1) (goal want-more-town-centers 0) (goal tier4-done-goal 1) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 500)) (research-available ri-plate-mail) (food-amount < 400) => (set-goal save-food-goal 1) ) (defrule (goal infantry-research-goal 1) (goal want-more-town-centers 0) (goal tier4-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 500)) (research-available ri-plate-mail) (gold-amount < 150) => (set-goal need-gold-goal 1) (set-goal escrow-gold-goal 1) ) (defrule (goal infantry-research-goal 1) (goal want-more-town-centers 0) (goal tier4-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 500)) (research-available ri-plate-mail) (gold-amount < 350) => (set-goal save-gold-goal 1) ) (defrule (goal infantry-research-goal 1) (goal want-more-town-centers 0) (goal tier4-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 500)) (can-research-with-escrow ri-plate-mail) => (release-escrow food) (release-escrow gold) (research ri-plate-mail) ) (defrule (goal archery-research-goal 1) (goal want-more-town-centers 0) (goal tier5-done-goal 1) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 450)) (research-available ri-ring-archer-armor) (food-amount < 250) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (goal archery-research-goal 1) (goal want-more-town-centers 0) (goal tier5-done-goal 1) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 450)) (research-available ri-ring-archer-armor) (food-amount < 350) => (set-goal save-food-goal 1) ) (defrule (goal archery-research-goal 1) (goal want-more-town-centers 0) (goal tier5-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 450)) (research-available ri-ring-archer-armor) (gold-amount < 250) => (set-goal need-gold-goal 1) (set-goal escrow-gold-goal 1) ) (defrule (goal archery-research-goal 1) (goal want-more-town-centers 0) (goal tier5-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 450)) (research-available ri-ring-archer-armor) (gold-amount < 450) => (set-goal save-gold-goal 1) ) (defrule (goal archery-research-goal 1) (goal want-more-town-centers 0) (goal tier5-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 450)) (can-research-with-escrow ri-ring-archer-armor) => (release-escrow food) (release-escrow gold) (research ri-ring-archer-armor) ) ; research blast-furnace at break-even (defrule (goal want-more-town-centers 0) (or (goal cavalry-research-goal 1) (goal infantry-research-goal 1)) (goal tier3-done-goal 1) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 475)) (research-available ri-blast-furnace) (food-amount < 275) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (goal cavalry-research-goal 1) (goal infantry-research-goal 1)) (goal tier3-done-goal 1) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 475)) (research-available ri-blast-furnace) (food-amount < 375) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (goal cavalry-research-goal 1) (goal infantry-research-goal 1)) (goal tier3-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 475)) (research-available ri-blast-furnace) (gold-amount < 225) => (set-goal need-gold-goal 1) (set-goal escrow-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (goal cavalry-research-goal 1) (goal infantry-research-goal 1)) (goal tier3-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 475)) (research-available ri-blast-furnace) (gold-amount < 425) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (goal cavalry-research-goal 1) (goal infantry-research-goal 1)) (goal tier3-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 475)) (can-research-with-escrow ri-blast-furnace) => (release-escrow food) (release-escrow gold) (research ri-blast-furnace) ) ; upgrade to pikemen if we have 6 spearman (break-even point?) (defrule (unit-type-count-total spearman > 2) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 415)) (or (unit-type-count-total spearman > 6) (and (population >= attack-population) (unit-type-count-total spearman > 6))) (research-available ri-pikeman) (food-amount < 215) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (unit-type-count-total spearman > 2) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 415)) (or (unit-type-count-total spearman > 6) (and (population >= attack-population) (unit-type-count-total spearman > 6))) (research-available ri-pikeman) (food-amount < 315) => (set-goal save-food-goal 1) ) (defrule (unit-type-count-total spearman > 2) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 115)) (or (unit-type-count-total spearman > 6) (and (population >= attack-population) (unit-type-count-total spearman > 6))) (research-available ri-pikeman) (gold-amount < 90) => (set-goal need-gold-goal 1) (set-goal escrow-gold-goal 1) ) (defrule (unit-type-count-total spearman > 2) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 115)) (or (unit-type-count-total spearman > 6) (and (population >= attack-population) (unit-type-count-total spearman > 6))) (research-available ri-pikeman) (gold-amount < 90) => (set-goal save-gold-goal 1) ) (defrule (unit-type-count-total spearman > 2) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 415)) (or (unit-type-count-total spearman > 6) (and (population >= attack-population) (unit-type-count-total spearman > 6))) (can-research-with-escrow ri-pikeman) => (release-escrow food) (release-escrow gold) (research ri-pikeman) ) ; upgrade to cavalier if have 12 (WDP) knights (break-even point) (defrule (unit-type-count-total knight > 2) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 500)) (or (unit-type-count-total knight > 10) (and (population >= attack-population) (unit-type-count-total knight > 10))) (research-available ri-cavalier) (food-amount < 300) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (unit-type-count-total knight > 2) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 500)) (or (unit-type-count-total knight > 10) (and (population >= attack-population) (unit-type-count-total knight > 10))) (research-available ri-cavalier) (food-amount < 400) => (set-goal save-food-goal 1) ) (defrule (unit-type-count-total knight > 2) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (or (unit-type-count-total knight > 10) (and (population >= attack-population) (unit-type-count-total knight > 10))) (research-available ri-cavalier) (gold-amount < 300) => (set-goal need-gold-goal 1) (set-goal escrow-gold-goal 1) ) (defrule (unit-type-count-total knight > 2) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (or (unit-type-count-total knight > 10) (and (population >= attack-population) (unit-type-count-total knight > 10))) (research-available ri-cavalier) (gold-amount < 500) => (set-goal save-gold-goal 1) ) (defrule (unit-type-count-total knight > 2) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 500)) (or (unit-type-count-total knight > 10) (and (population >= attack-population) (unit-type-count-total knight > 10))) (can-research-with-escrow ri-cavalier) => (release-escrow food) (release-escrow gold) (research ri-cavalier) ) ; upgrade to paladin if have 20 cavaliers (break-even point) (defrule (unit-type-count-total cavalier > 2) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 1500)) (or (unit-type-count-total cavalier > 20) (and (population >= attack-population) (unit-type-count-total cavalier > 30))) (research-available ri-paladin) (food-amount < 1300) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (unit-type-count-total cavalier > 2) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 1500)) (or (unit-type-count-total cavalier > 20) (and (population >= attack-population) (unit-type-count-total cavalier > 30))) (research-available ri-paladin) (food-amount < 1400) => (set-goal save-food-goal 1) ) (defrule (unit-type-count-total cavalier > 2) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 1500)) (or (unit-type-count-total cavalier > 20) (and (population >= attack-population) (unit-type-count-total cavalier > 30))) (research-available ri-paladin) (gold-amount < 750) => (set-goal need-gold-goal 1) (set-goal escrow-gold-goal 1) ) (defrule (unit-type-count-total cavalier > 2) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 1500)) (or (unit-type-count-total cavalier > 20) (and (population >= attack-population) (unit-type-count-total cavalier > 30))) (research-available ri-paladin) (gold-amount < 950) => (set-goal save-gold-goal 1) ) (defrule (unit-type-count-total cavalier > 2) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 1500)) (or (unit-type-count-total cavalier > 20) (and (population >= attack-population) (unit-type-count-total cavalier > 30))) (can-research-with-escrow ri-paladin) => (release-escrow food) (release-escrow gold) (research ri-paladin) ) ; upgrade to man-at-arms if we have 8 militia (defrule (unit-type-count-total militiaman > 6) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 300)) (or (unit-type-count-total militiaman > 10) (and (population >= attack-population) (unit-type-count-total militiaman > 10))) (research-available ri-man-at-arms) (food-amount < 200) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (unit-type-count-total militiaman > 6) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 300)) (or (unit-type-count-total militiaman > 10) (and (population >= attack-population) (unit-type-count-total militiaman > 10))) (research-available ri-man-at-arms) (food-amount < 200) => (set-goal save-food-goal 1) ) (defrule (unit-type-count-total militiaman > 6) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 100)) (or (unit-type-count-total militiaman > 10) (and (population >= attack-population) (unit-type-count-total militiaman > 10))) (research-available ri-man-at-arms) (gold-amount < 40) => (set-goal need-gold-goal 1) (set-goal escrow-gold-goal 1) ) (defrule (unit-type-count-total militiaman > 6) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 100)) (or (unit-type-count-total militiaman > 10) (and (population >= attack-population) (unit-type-count-total militiaman > 10))) (research-available ri-man-at-arms) (gold-amount < 40) => (set-goal save-gold-goal 1) ) (defrule (unit-type-count-total militiaman > 6) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 250)) (or (unit-type-count-total militiaman > 10) (and (population >= attack-population) (unit-type-count-total militiaman > 10))) (can-research-with-escrow ri-man-at-arms) => (release-escrow food) (release-escrow gold) (research ri-man-at-arms) ) ; upgrade to long swordsman if we have 8 men at arms (defrule (unit-type-count-total man-at-arms > 6) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 400)) (or (unit-type-count-total man-at-arms > 8) (and (population >= attack-population) (unit-type-count-total man-at-arms > 8))) (research-available ri-long-swordsman) (food-amount < 300) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (unit-type-count-total man-at-arms > 6) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 400)) (or (unit-type-count-total man-at-arms > 8) (and (population >= attack-population) (unit-type-count-total man-at-arms > 8))) (research-available ri-long-swordsman) (food-amount < 300) => (set-goal save-food-goal 1) ) (defrule (unit-type-count-total man-at-arms > 6) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (or (unit-type-count-total man-at-arms > 8) (and (population >= attack-population) (unit-type-count-total man-at-arms > 8))) (research-available ri-long-swordsman) (gold-amount < 65) => (set-goal need-gold-goal 1) (set-goal escrow-gold-goal 1) ) (defrule (unit-type-count-total man-at-arms > 6) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (or (unit-type-count-total man-at-arms > 8) (and (population >= attack-population) (unit-type-count-total man-at-arms > 8))) (research-available ri-long-swordsman) (gold-amount < 65) => (set-goal save-gold-goal 1) ) (defrule (unit-type-count-total man-at-arms > 6) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 400)) (or (unit-type-count-total man-at-arms > 8) (and (population >= attack-population) (unit-type-count-total man-at-arms > 8))) (can-research-with-escrow ri-long-swordsman) => (release-escrow food) (release-escrow gold) (research ri-long-swordsman) ) ; upgrade to long swordsman if we have 8 two handed swordsman (defrule (unit-type-count-total long-swordsman > 6) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 500)) (or (unit-type-count-total long-swordsman > 8) (and (population >= attack-population) (unit-type-count-total long-swordsman > 8))) (research-available ri-two-handed-swordsman) (food-amount < 400) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (unit-type-count-total long-swordsman > 6) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 500)) (or (unit-type-count-total long-swordsman > 8) (and (population >= attack-population) (unit-type-count-total long-swordsman > 8))) (research-available ri-two-handed-swordsman) (food-amount < 400) => (set-goal save-food-goal 1) ) (defrule (unit-type-count-total long-swordsman > 6) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 300)) (or (unit-type-count-total long-swordsman > 8) (and (population >= attack-population) (unit-type-count-total long-swordsman > 8))) (research-available ri-two-handed-swordsman) (gold-amount < 100) => (set-goal need-gold-goal 1) (set-goal escrow-gold-goal 1) ) (defrule (unit-type-count-total long-swordsman > 6) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 300)) (or (unit-type-count-total long-swordsman > 8) (and (population >= attack-population) (unit-type-count-total long-swordsman > 8))) (research-available ri-two-handed-swordsman) (gold-amount < 100) => (set-goal save-gold-goal 1) ) (defrule (unit-type-count-total long-swordsman > 6) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 500)) (or (unit-type-count-total long-swordsman > 8) (and (population >= attack-population) (unit-type-count-total long-swordsman > 8))) (can-research-with-escrow ri-two-handed-swordsman) => (release-escrow food) (release-escrow gold) (research ri-two-handed-swordsman) ) ; upgrade to champion if we have 8 two handed swordsman (defrule (unit-type-count-total two-handed-swordsman > 6) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 950)) (or (unit-type-count-total two-handed-swordsman > 8) (and (population >= attack-population) (unit-type-count-total two-handed-swordsman > 8))) (research-available ri-champion) (food-amount < 850) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (unit-type-count-total two-handed-swordsman > 6) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 950)) (or (unit-type-count-total two-handed-swordsman > 8) (and (population >= attack-population) (unit-type-count-total two-handed-swordsman > 8))) (research-available ri-champion) (food-amount < 850) => (set-goal save-food-goal 1) ) (defrule (unit-type-count-total two-handed-swordsman > 6) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 750)) (or (unit-type-count-total two-handed-swordsman > 8) (and (population >= attack-population) (unit-type-count-total two-handed-swordsman > 8))) (research-available ri-champion) (gold-amount < 350) => (set-goal need-gold-goal 1) (set-goal escrow-gold-goal 1) ) (defrule (unit-type-count-total two-handed-swordsman > 6) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 750)) (or (unit-type-count-total two-handed-swordsman > 8) (and (population >= attack-population) (unit-type-count-total two-handed-swordsman > 8))) (research-available ri-champion) (gold-amount < 350) => (set-goal save-gold-goal 1) ) (defrule (unit-type-count-total two-handed-swordsman > 6) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 950)) (or (unit-type-count-total two-handed-swordsman > 8) (and (population >= attack-population) (unit-type-count-total two-handed-swordsman > 8))) (can-research-with-escrow ri-champion) => (release-escrow food) (release-escrow gold) (research ri-champion) ) ;upgrade to crossbowman (defrule (unit-type-count-total archer > 2) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 325)) (or (unit-type-count-total archer > 7) (and (population >= attack-population) (unit-type-count-total archer > 7))) (research-available ri-crossbow) (food-amount < 125) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (unit-type-count-total archer > 2) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 325)) (or (unit-type-count-total archer > 7) (and (population >= attack-population) (unit-type-count-total archer > 7))) (research-available ri-crossbow) (food-amount < 225) => (set-goal save-food-goal 1) ) (defrule (unit-type-count-total archer > 2) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 60)) (or (unit-type-count-total archer > 7) (and (population >= attack-population) (unit-type-count-total archer > 7))) (research-available ri-crossbow) (gold-amount < 75) => (set-goal need-gold-goal 1) (set-goal escrow-gold-goal 1) ) (defrule (unit-type-count-total archer > 2) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 60)) (or (unit-type-count-total archer > 7) (and (population >= attack-population) (unit-type-count-total archer > 7))) (research-available ri-crossbow) (gold-amount < 325) => (set-goal save-gold-goal 1) ) (defrule (unit-type-count-total archer > 2) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 325)) (or (unit-type-count-total archer > 7) (and (population >= attack-population) (unit-type-count-total archer > 7))) (can-research-with-escrow ri-crossbow) => (release-escrow food) (release-escrow gold) (research ri-crossbow) ) ; upgrade to arbalest (defrule (unit-type-count-total crossbowman > 2) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 550)) (or (unit-type-count-total crossbowman > 12) (and (population >= attack-population) (unit-type-count-total crossbowman > 12))) (research-available ri-arbalest) (food-amount < 350) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (unit-type-count-total crossbowman > 2) (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 550)) (or (unit-type-count-total crossbowman > 12) (and (population >= attack-population) (unit-type-count-total crossbowman > 12))) (research-available ri-arbalest) (food-amount < 450) => (set-goal save-food-goal 1) ) (defrule (unit-type-count-total crossbowman > 2) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 550)) (or (unit-type-count-total crossbowman > 12) (and (population >= attack-population) (unit-type-count-total crossbowman > 12))) (research-available ri-arbalest) (gold-amount < 300) => (set-goal need-gold-goal 1) (set-goal escrow-gold-goal 1) ) (defrule (unit-type-count-total crossbowman > 2) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 550)) (or (unit-type-count-total crossbowman > 12) (and (population >= attack-population) (unit-type-count-total crossbowman > 12))) (research-available ri-arbalest) (gold-amount < 500) => (set-goal save-gold-goal 1) ) (defrule (unit-type-count-total crossbowman > 2) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 550)) (or (unit-type-count-total crossbowman > 12) (and (population >= attack-population) (unit-type-count-total crossbowman > 12))) (can-research-with-escrow ri-arbalest) => (release-escrow food) (release-escrow gold) (research ri-arbalest) ) ; research two-man saw (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 500)) (goal tier8-done-goal 1) (research-available ri-two-man-saw) (food-amount < 300) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 500)) (goal tier8-done-goal 1) (research-available ri-two-man-saw) (food-amount < 400) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 500)) (goal tier8-done-goal 1) (research-available ri-two-man-saw) (wood-amount < 200) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 500)) (goal tier8-done-goal 1) (research-available ri-two-man-saw) (wood-amount < 300) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 500)) (goal tier8-done-goal 1) (can-research ri-two-man-saw) => (research ri-two-man-saw) ) ; research crop rotation (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 450)) (goal tier7-done-goal 1) (research-available ri-crop-rotation) (food-amount < 250) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 450)) (goal tier7-done-goal 1) (research-available ri-crop-rotation) (food-amount < 350) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 450)) (goal tier7-done-goal 1) (research-available ri-crop-rotation) (wood-amount < 250) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 450)) (goal tier7-done-goal 1) (research-available ri-crop-rotation) (wood-amount < 350) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 450)) (goal tier7-done-goal 1) (can-research ri-crop-rotation) => (research ri-crop-rotation) ) ; research bracer (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 500)) (goal tier7-done-goal 1) (research-available ri-bracer) (food-amount < 300) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 500)) (goal tier7-done-goal 1) (research-available ri-bracer) (food-amount < 400) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 500)) (goal tier7-done-goal 1) (research-available ri-bracer) (gold-amount < 200) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 500)) (goal tier7-done-goal 1) (research-available ri-bracer) (gold-amount < 400) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 500)) (goal tier7-done-goal 1) (can-research ri-bracer) => (research ri-bracer) ) ; research chemistry with escrow (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 500)) (not (goal attack-cycle-goal attack-cycle-none)) (goal tier8-done-goal 1) (research-available ri-chemistry) (food-amount < 300) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 500)) (not (goal attack-cycle-goal attack-cycle-none)) (goal tier8-done-goal 1) (research-available ri-chemistry) (food-amount < 400) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 500)) (not (goal attack-cycle-goal attack-cycle-none)) (goal tier8-done-goal 1) (research-available ri-chemistry) (gold-amount < 200) => (set-goal need-gold-goal 1) (set-goal escrow-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 500)) (not (goal attack-cycle-goal attack-cycle-none)) (goal tier8-done-goal 1) (research-available ri-chemistry) (gold-amount < 400) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 500)) (not (goal attack-cycle-goal attack-cycle-none)) (goal tier8-done-goal 1) (can-research-with-escrow ri-chemistry) => (release-escrow food) (release-escrow gold) (research ri-chemistry) ) ; research guilds (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 500)) (goal tier8-done-goal 1) (research-available ri-guilds) (food-amount < 300) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 500)) (goal tier8-done-goal 1) (research-available ri-guilds) (food-amount < 400) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 500)) (goal tier8-done-goal 1) (research-available ri-guilds) (gold-amount < 200) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 500)) (goal tier8-done-goal 1) (research-available ri-guilds) (gold-amount < 400) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 500)) (goal tier8-done-goal 1) (can-research ri-guilds) => (research ri-guilds) ) ; research conscription (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 250)) (goal tier8-done-goal 1) (research-available ri-conscription) (food-amount < 150) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 250)) (goal tier8-done-goal 1) (research-available ri-conscription) (food-amount < 200) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 250)) (goal tier8-done-goal 1) (research-available ri-conscription) (gold-amount < 150) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 250)) (goal tier8-done-goal 1) (research-available ri-conscription) (gold-amount < 300) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 250)) (goal tier8-done-goal 1) (can-research ri-conscription) => (research ri-conscription) ) ; research block printing when attack is ready (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) ; (not (goal attack-cycle-goal attack-cycle-none)) ; (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier7-done-goal 1) (research-available ri-block-printing) (gold-amount < 200) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) ; (not (goal attack-cycle-goal attack-cycle-none)) ; (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier7-done-goal 1) (research-available ri-block-printing) (gold-amount < 400) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) ; (not (goal attack-cycle-goal attack-cycle-none)) ; (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier7-done-goal 1) (can-research ri-block-printing) => (research ri-block-printing) ) ; upgrade to keep at break-even point (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 700)) (building-type-count-total watch-tower-line > 0) (goal tier8-done-goal 1) (research-available ri-keep) (food-amount < 500) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 700)) (building-type-count-total watch-tower-line > 0) (goal tier8-done-goal 1) (research-available ri-keep) (food-amount < 600) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 700)) (building-type-count-total watch-tower-line > 0) (goal tier8-done-goal 1) (research-available ri-keep) (stone-amount < 350) => (set-goal need-stone-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 700)) (building-type-count-total watch-tower-line > 0) (goal tier8-done-goal 1) (can-research ri-keep) => (research ri-keep) ) ; research bombard tower after first attack (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 1000)) (not (goal is-zero-goal bombard-towers-to-build)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier8-done-goal 1) (research-available ri-bombard-tower) (food-amount < 800) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 1000)) (not (goal is-zero-goal bombard-towers-to-build)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier8-done-goal 1) (research-available ri-bombard-tower) (food-amount < 900) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 1000)) (not (goal is-zero-goal bombard-towers-to-build)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier8-done-goal 1) (research-available ri-bombard-tower) (stone-amount < 400) => (set-goal need-stone-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 1000)) (not (goal is-zero-goal bombard-towers-to-build)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier8-done-goal 1) (can-research ri-bombard-tower) => (research ri-bombard-tower) ) ; research illumination when attack is ready (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier8-done-goal 1) (research-available ri-illumination) (gold-amount < 120) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier8-done-goal 1) (research-available ri-illumination) (gold-amount < 320) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (not (goal attack-cycle-goal attack-cycle-none)) (not (goal attack-cycle-goal attack-cycle-first-wait)) (goal tier8-done-goal 1) (can-research ri-illumination) => (research ri-illumination) ) ; research faith using escrow after tier 3, WDP (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 950)) (goal tier8-done-goal 1) (research-available ri-faith) (food-amount < 750) => (set-goal need-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 950)) (goal tier8-done-goal 1) (research-available ri-faith) (food-amount < 850) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 950)) (goal tier8-done-goal 1) (research-available ri-faith) (gold-amount < 1000) => (set-goal need-gold-goal 1) (set-goal escrow-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 950)) (goal tier8-done-goal 1) (research-available ri-faith) (gold-amount < 1200) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 950)) (goal tier8-done-goal 1) (can-research-with-escrow ri-faith) => (release-escrow food) (release-escrow gold) (research ri-faith) ) ; build up the military in the imperial age WDP ; local goal variables (defconst need-more-pop-room 40) (defconst need-more-not-trebuchet 39) (defconst use-after-attack-villagers 38) ; Decide which villager maximum to use. (defrule (true) => (set-goal use-after-attack-villagers 0) ) (defrule (or (players-stance any-human ally) (players-stance any-computer ally)) (not (goal attack-cycle-goal attack-cycle-none)) => (set-goal use-after-attack-villagers 1) ) ; Decide if we need to delete some units to make room for others (defrule (true) => (set-goal need-more-pop-room 0) (set-goal need-more-not-trebuchet 0) ) (defrule (population >= max-population) (or (unit-type-count-total militiaman-line < militias-to-train) (or (unit-type-count-total spearman-line < spearmen-to-train) (unit-type-count-total unique-unit-line < unique-units-to-train))) => (set-goal need-more-pop-room 1) (set-goal need-more-not-trebuchet 1) ) (defrule (population >= max-population) (or (unit-type-count-total archer-line < archers-to-train) (or (unit-type-count-total skirmisher-line < skirmishers-to-train) (or (unit-type-count-total cavalry-archer-line < cavalry-archers-to-train) (unit-type-count-total hand-cannoneer < hand-cannoneers-to-train)))) => (set-goal need-more-pop-room 1) (set-goal need-more-not-trebuchet 1) ) (defrule (population >= max-population) (or (unit-type-count-total villager < max-villagers-after-attack) (or (and (goal use-after-attack-villagers 0) (unit-type-count-total villager < max-villagers)) (unit-type-count-total monk < monks-to-train))) => (set-goal need-more-pop-room 1) (set-goal need-more-not-trebuchet 1) ) (defrule (population >= max-population) (goal use-after-attack-villagers 1) (unit-type-count-total trade-cart < trade-carts-to-train) => (set-goal need-more-pop-room 1) (set-goal need-more-not-trebuchet 1) ) (defrule (population >= max-population) (or (unit-type-count-total scorpion-line < scorpions-to-train) (or (and (unit-available bombard-cannon) (unit-type-count-total bombard-cannon < bombard-cannons-to-train)) (or (unit-type-count-total battering-ram-line < battering-rams-to-train) (unit-type-count-total mangonel-line < mangonels-to-train)))) => (set-goal need-more-pop-room 1) (set-goal need-more-not-trebuchet 1) ) (defrule (population >= max-population) (unit-type-count-total trebuchet < trebuchets-to-train) => (set-goal need-more-pop-room 1) ) ; Make room for desired units (defrule (goal need-more-pop-room 1) (or (unit-type-count-total trade-cart > trade-carts-to-train) (and (unit-type-count-total trade-cart > 0) (not (or (players-stance any-human ally) (players-stance any-computer ally))))) => (chat-local-to-self "Deleting trade cart!") (delete-unit trade-cart) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total trade-cog > trade-cogs-to-train) => (chat-local-to-self "Deleting trade cog!") (delete-unit trade-cog) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total transport-ship > transport-ships-to-train) => (chat-local-to-self "Deleting transport ship!") (delete-unit transport-ship) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total fishing-ship > fishing-ships-to-train) => (chat-local-to-self "Deleting fishing ship!") (delete-unit fishing-ship) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total demolition-ship-line > demolition-ships-to-train) (unit-type-count-total demolition-ship > 0) => (chat-local-to-self "Deleting demolition ship!") (delete-unit demolition-ship) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total demolition-ship-line > demolition-ships-to-train) (unit-type-count-total heavy-demolition-ship > 0) => (chat-local-to-self "Deleting heavy demolition ship!") (delete-unit heavy-demolition-ship) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total fire-ship-line > fire-ships-to-train) (unit-type-count-total fire-ship > 0) => (chat-local-to-self "Deleting fire ship!") (delete-unit fire-ship) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total fire-ship-line > fire-ships-to-train) (unit-type-count-total fast-fire-ship > 0) => (chat-local-to-self "Deleting fast fire ship!") (delete-unit fast-fire-ship) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total longboat-line > longboats-to-train) (unit-type-count-total longboat > 0) => (chat-local-to-self "Deleting longboat!") (delete-unit longboat) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total longboat-line > longboats-to-train) (unit-type-count-total elite-longboat > 0) => (chat-local-to-self "Deleting elite longboat!") (delete-unit elite-longboat) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total galley-line > galleys-to-train) (unit-type-count-total galley > 0) => (chat-local-to-self "Deleting galley!") (delete-unit galley) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total galley-line > galleys-to-train) (unit-type-count-total war-galley > 0) => (chat-local-to-self "Deleting war galley!") (delete-unit war-galley) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total galley-line > galleys-to-train) (unit-type-count-total galleon > 0) => (chat-local-to-self "Deleting galleon!") (delete-unit galleon) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total cannon-galleon-line > cannon-galleons-to-train) (unit-type-count-total cannon-galleon > 0) => (chat-local-to-self "Deleting cannon galleon!") (delete-unit cannon-galleon) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total cannon-galleon-line > cannon-galleons-to-train) (unit-type-count-total elite-cannon-galleon > 0) => (chat-local-to-self "Deleting elite cannon galleon!") (delete-unit elite-cannon-galleon) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (or (unit-type-count-total villager > max-villagers) (and (goal use-after-attack-villagers 1) (unit-type-count-total villager > max-villagers-after-attack))) => (chat-local-to-self "Deleting villager!") (delete-unit villager) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total militiaman-line > militias-to-train) (unit-type-count-total militiaman > 0) => (chat-local-to-self "Deleting militiaman!") (delete-unit militiaman) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total militiaman-line > militias-to-train) (unit-type-count-total man-at-arms > 0) => (chat-local-to-self "Deleting man-at-arms!") (delete-unit man-at-arms) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total militiaman-line > militias-to-train) (unit-type-count-total long-swordsman > 0) => (chat-local-to-self "Deleting long swordsman!") (delete-unit long-swordsman) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total militiaman-line > militias-to-train) (unit-type-count-total two-handed-swordsman > 0) => (chat-local-to-self "Deleting 2h swordsman!") (delete-unit two-handed-swordsman) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total militiaman-line > militias-to-train) (unit-type-count-total champion > 0) => (chat-local-to-self "Deleting champion!") (delete-unit champion) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total spearman-line > spearmen-to-train) (unit-type-count-total spearman > 0) => (chat-local-to-self "Deleting spearman!") (delete-unit spearman) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total spearman-line > spearmen-to-train) (unit-type-count-total pikeman > 0) => (chat-local-to-self "Deleting pikeman!") (delete-unit pikeman) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total battering-ram-line > battering-rams-to-train) (unit-type-count-total battering-ram > 0) => (chat-local-to-self "Deleting battering ram!") (delete-unit battering-ram) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total battering-ram-line > battering-rams-to-train) (unit-type-count-total capped-ram > 0) => (chat-local-to-self "Deleting capped ram!") (delete-unit capped-ram) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total battering-ram-line > battering-rams-to-train) (unit-type-count-total siege-ram > 0) => (chat-local-to-self "Deleting siege ram!") (delete-unit siege-ram) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total scorpion-line > scorpions-to-train) (unit-type-count-total scorpion > 0) => (chat-local-to-self "Deleting scorpion!") (delete-unit scorpion) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total scorpion-line > scorpions-to-train) (unit-type-count-total heavy-scorpion > 0) => (chat-local-to-self "Deleting heavy scorpion!") (delete-unit heavy-scorpion) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total skirmisher-line > skirmishers-to-train) (unit-type-count-total skirmisher > 0) => (chat-local-to-self "Deleting skirmisher!") (delete-unit skirmisher) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total skirmisher-line > skirmishers-to-train) (unit-type-count-total elite-skirmisher > 0) => (chat-local-to-self "Deleting elite skirmisher!") (delete-unit elite-skirmisher) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total archer-line > archers-to-train) (unit-type-count-total archer > 0) => (chat-local-to-self "Deleting archer!") (delete-unit archer) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total archer-line > archers-to-train) (unit-type-count-total crossbowman > 0) => (chat-local-to-self "Deleting crossbowman!") (delete-unit crossbowman) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total archer-line > archers-to-train) (unit-type-count-total arbalest > 0) => (chat-local-to-self "Deleting arbalest!") (delete-unit arbalest) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total scout-cavalry-line > scout-cavalry-to-train) (unit-type-count-total scout-cavalry > 0) => (chat-local-to-self "Deleting scout cavalry!") (delete-unit scout-cavalry) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total scout-cavalry-line > scout-cavalry-to-train) (unit-type-count-total light-cavalry > 0) => (chat-local-to-self "Deleting light cavalry!") (delete-unit light-cavalry) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total cavalry-archer-line > cavalry-archers-to-train) (unit-type-count-total cavalry-archer > 0) => (chat-local-to-self "Deleting cavalry archer!") (delete-unit cavalry-archer) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total cavalry-archer-line > cavalry-archers-to-train) (unit-type-count-total heavy-cavalry-archer > 0) => (chat-local-to-self "Deleting heavy cavalry archer!") (delete-unit heavy-cavalry-archer) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total hand-cannoneer > hand-cannoneers-to-train) => (chat-local-to-self "Deleting hand cannoneer!") (delete-unit hand-cannoneer) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total bombard-cannon > bombard-cannons-to-train) => (chat-local-to-self "Deleting bombard cannon!") (delete-unit bombard-cannon) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total monk > monks-to-train) => (chat-local-to-self "Deleting monk!") (delete-unit monk) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total mangonel-line > mangonels-to-train) (unit-type-count-total mangonel > 0) => (chat-local-to-self "Deleting mangonel!") (delete-unit mangonel) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total mangonel-line > mangonels-to-train) (unit-type-count-total onager > 0) => (chat-local-to-self "Deleting onager!") (delete-unit onager) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total mangonel-line > mangonels-to-train) (unit-type-count-total siege-onager > 0) => (chat-local-to-self "Deleting siege onager!") (delete-unit siege-onager) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total camel-line > camels-to-train) (unit-type-count-total camel > 0) => (chat-local-to-self "Deleting camel!") (delete-unit camel) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total camel-line > camels-to-train) (unit-type-count-total heavy-camel > 0) => (chat-local-to-self "Deleting heavy camel!") (delete-unit heavy-camel) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total knight-line > knights-to-train) (unit-type-count-total knight > 0) => (chat-local-to-self "Deleting knight!") (delete-unit knight) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total knight-line > knights-to-train) (unit-type-count-total cavalier > 0) => (chat-local-to-self "Deleting cavalier!") (delete-unit cavalier) (set-goal need-more-pop-room 0) ) (defrule (goal need-more-pop-room 1) (unit-type-count-total knight-line > knights-to-train) (unit-type-count-total paladin > 0) => (chat-local-to-self "Deleting paladin!") (delete-unit paladin) (set-goal need-more-pop-room 0) ) ; unit-type-count-total does not count unpacked trebuchets. ; Since all of the other amounts are correct, that leaves a trebuchet. ; Just make sure not to make extras. ;(defrule ; (goal need-more-pop-room 1) ; (goal need-more-not-trebuchet 1) ;=> ; (chat-local-to-self "Deleting trebuchet!") ; (delete-unit trebuchet) ; (set-goal need-more-pop-room 0) ;) ; build the rest of the stables in the imperial age (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (building-type-count-total mill > 0) (building-available stable) (building-type-count-total stable < stables-to-build) (wood-amount < 175) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (building-type-count-total mill > 0) (building-available stable) (building-type-count-total stable < stables-to-build) (wood-amount < 275) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (building-type-count-total mill > 0) (building-type-count-total stable < stables-to-build) (can-build stable) => (build stable) ) ; build the rest of the archery ranges in the imperial age (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (building-type-count-total mill > 0) (building-available archery-range) (building-type-count-total archery-range < archery-ranges-to-build) (wood-amount < 175) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (building-type-count-total mill > 0) (building-available archery-range) (building-type-count-total archery-range < archery-ranges-to-build) (wood-amount < 275) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (building-type-count-total mill > 0) (building-type-count-total archery-range < archery-ranges-to-build) (can-build archery-range) => (build archery-range) ) ; build the rest of the barracks in the imperial age (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (building-type-count-total mill > 0) (building-available barracks) (building-type-count-total barracks < barracks-to-build) (wood-amount < 175) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (building-type-count-total mill > 0) (building-available barracks) (building-type-count-total barracks < barracks-to-build) (wood-amount < 275) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (building-type-count-total mill > 0) (building-type-count-total barracks < barracks-to-build) (can-build barracks) => (build barracks) ) ; build the rest of the monasteries in the imperial age (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (building-type-count-total mill > 0) (building-available monastery) (building-type-count-total monastery < monasteries-to-build) (wood-amount < 175) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (building-type-count-total mill > 0) (building-available monastery) (building-type-count-total monastery < monasteries-to-build) (wood-amount < 275) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (building-type-count-total mill > 0) (building-type-count-total monastery < monasteries-to-build) (can-build monastery) => (chat-to-all "") (build monastery) ) ; build the rest of the siege workshops in the imperial age (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (building-type-count-total mill > 0) (building-available siege-workshop) (building-type-count-total siege-workshop < siege-workshops-to-build) (wood-amount < 200) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (building-type-count-total mill > 0) (building-available siege-workshop) (building-type-count-total siege-workshop < siege-workshops-to-build) (wood-amount < 300) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (building-type-count-total mill > 0) (building-type-count-total siege-workshop < siege-workshops-to-build) (can-build siege-workshop) => (build siege-workshop) ) ; build the rest of the castles in the imperial age (defrule ;(goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 200)) ;(goal current-age-goal imperial-age) ;(goal tier2-done-goal 1) (building-type-count-total mill > 0) (building-available castle) (building-type-count-total castle < castles-to-build) (stone-amount < 650) => (set-goal need-stone-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (goal tier2-done-goal 1) (not (town-under-attack)) (building-type-count-total mill > 0) (building-type-count-total castle < castles-to-build) (can-build castle) => (build castle) ) (defrule ;(goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 200)) ;(goal current-age-goal imperial-age) ;(goal tier2-done-goal 1) (not (town-under-attack)) ;(building-type-count-total mill > 0) ;(building-type-count-total castle < castles-to-build) (building-type-count-total castle < 1) (can-build castle) => (build castle) ) ; crank out knights in the imperial age (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 260)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total knight-line < knights-to-train) (food-amount < 60) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 260)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total knight-line < knights-to-train) (food-amount < 160) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 260)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total knight-line < knights-to-train) (gold-amount < 75) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 260)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total knight-line < knights-to-train) (gold-amount < 275) => (set-goal save-gold-goal 1) ) (defrule ;(goal want-more-town-centers 0) ;(or (unit-type-count-total villager >= min-villagers) ;(food-amount >= 260)) ;(goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total knight-line < knights-to-train) (can-train knight-line) => (train knight-line) ) ; crank out camels in the imperial age (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 255)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total camel-line < camels-to-train) (food-amount < 55) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 255)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total camel-line < camels-to-train) (food-amount < 155) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 255)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total camel-line < camels-to-train) (gold-amount < 60) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 255)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total camel-line < camels-to-train) (gold-amount < 260) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 255)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total camel-line < camels-to-train) (can-train camel-line) => (train camel-line) ) ; crank out scout cavalry in the imperial age (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 280)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total scout-cavalry-line < scout-cavalry-to-train) (food-amount < 80) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 280)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total scout-cavalry-line < scout-cavalry-to-train) (food-amount < 180) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 280)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total scout-cavalry-line < scout-cavalry-to-train) (can-train scout-cavalry-line) => (train scout-cavalry-line) ) ; crank out cavalry archers in the castle age (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal castle-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total cavalry-archer-line < cavalry-archers-to-train) (wood-amount < 40) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total cavalry-archer-line < cavalry-archers-to-train) (wood-amount < 140) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total cavalry-archer-line < cavalry-archers-to-train) (gold-amount < 70) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total cavalry-archer-line < cavalry-archers-to-train) (gold-amount < 270) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total cavalry-archer-line < cavalry-archers-to-train) (can-train cavalry-archer-line) => (train cavalry-archer-line) ) ; crank out archers in the imperial age (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total archer-line < archers-to-train) (wood-amount < 25) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total archer-line < archers-to-train) (wood-amount < 125) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total archer-line < archers-to-train) (gold-amount < 45) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total archer-line < archers-to-train) (gold-amount < 245) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total archer-line < archers-to-train) (can-train archer-line) => (train archer-line) ) ; crank out skirmishers in the imperial age (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 225)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total skirmisher-line < skirmishers-to-train) (food-amount < 25) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 225)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total skirmisher-line < skirmishers-to-train) (food-amount < 125) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 225)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total skirmisher-line < skirmishers-to-train) (wood-amount < 35) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 225)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total skirmisher-line < skirmishers-to-train) (wood-amount < 135) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 225)) (goal current-age-goal imperial-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total skirmisher-line < skirmishers-to-train) (can-train skirmisher-line) => (train skirmisher-line) ) ; crank out unique units in the imperial age (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= unique-min-villager-food)) (goal current-age-goal castle-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total unique-unit-line < unique-units-to-train) (food-amount < unique-unit-food) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= unique-min-villager-food)) (goal current-age-goal castle-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total unique-unit-line < unique-units-to-train) (food-amount < unique-unit-save-food) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= unique-min-villager-food)) (goal current-age-goal castle-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total unique-unit-line < unique-units-to-train) (wood-amount < unique-unit-wood) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= unique-min-villager-food)) (goal current-age-goal castle-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total unique-unit-line < unique-units-to-train) (wood-amount < unique-unit-save-wood) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= unique-min-villager-food)) (goal current-age-goal castle-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total unique-unit-line < unique-units-to-train) (gold-amount < unique-unit-gold) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= unique-min-villager-food)) (goal current-age-goal castle-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total unique-unit-line < unique-units-to-train) (gold-amount < unique-unit-save-gold) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= unique-min-villager-food)) (goal current-age-goal castle-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total unique-unit-line < unique-units-to-train) (stone-amount < unique-unit-stone) => (set-goal need-stone-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= unique-min-villager-food)) (goal current-age-goal castle-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total unique-unit-line < unique-units-to-train) (can-train unique-unit-line) => (train unique-unit-line) ) ; crank out spearmen in the imperial age (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 235)) (goal current-age-goal castle-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total spearman-line < spearmen-to-train) (food-amount < 35) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 235)) (goal current-age-goal castle-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total spearman-line < spearmen-to-train) (food-amount < 135) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 235)) (goal current-age-goal castle-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total spearman-line < spearmen-to-train) (wood-amount < 25) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 235)) (goal current-age-goal castle-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total spearman-line < spearmen-to-train) (wood-amount < 125) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 235)) (goal current-age-goal castle-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total spearman-line < spearmen-to-train) (can-train spearman-line) => (train spearman-line) ) ; crank out monks in the imperial age (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal castle-age) (goal tier2-done-goal 1) (housing-headroom > 0) (unit-type-count-total monk < monks-to-train) (gold-amount < 100) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal castle-age) (goal tier2-done-goal 1) (housing-headroom > 0) (unit-type-count-total monk < monks-to-train) (gold-amount < 300) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal castle-age) (goal tier2-done-goal 1) (housing-headroom > 0) (unit-type-count-total monk < monks-to-train) (can-train monk) => (train monk) ) ; crank out mangonels in the imperial age (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total mangonel-line < mangonels-to-train) (wood-amount < 160) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total mangonel-line < mangonels-to-train) (wood-amount < 260) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total mangonel-line < mangonels-to-train) (gold-amount < 135) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total mangonel-line < mangonels-to-train) (gold-amount < 335) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal imperial-age) (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total mangonel-line < mangonels-to-train) (can-train mangonel-line) => (train mangonel-line) ) ; crank out scorpions in the imperial age (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal castle-age) (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total scorpion-line < scorpions-to-train) (wood-amount < 75) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal castle-age) (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total scorpion-line < scorpions-to-train) (wood-amount < 175) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal castle-age) (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total scorpion-line < scorpions-to-train) (gold-amount < 75) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal castle-age) (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total scorpion-line < scorpions-to-train) (gold-amount < 275) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal castle-age) (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total scorpion-line < scorpions-to-train) (can-train scorpion-line) => (train scorpion-line) ) ; crank out bombard cannons in the imperial age (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal castle-age) (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total bombard-cannon < bombard-cannons-to-train) (wood-amount < 225) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal castle-age) (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total bombard-cannon < bombard-cannons-to-train) (wood-amount < 325) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal castle-age) (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total bombard-cannon < bombard-cannons-to-train) (gold-amount < 225) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal castle-age) (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total bombard-cannon < bombard-cannons-to-train) (gold-amount < 425) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal castle-age) (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total bombard-cannon < bombard-cannons-to-train) (can-train bombard-cannon) => (train bombard-cannon) ) ; crank out militia in the imperial age (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 260)) (goal current-age-goal castle-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total militiaman-line < militias-to-train) (food-amount < 60) => (set-goal need-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 260)) (goal current-age-goal castle-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total militiaman-line < militias-to-train) (food-amount < 160) => (set-goal save-food-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 260)) (goal current-age-goal castle-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total militiaman-line < militias-to-train) (gold-amount < 20) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 260)) (goal current-age-goal castle-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total militiaman-line < militias-to-train) (gold-amount < 220) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 260)) (goal current-age-goal castle-age) (goal tier1-done-goal 1) (housing-headroom > 0) (unit-type-count-total militiaman-line < militias-to-train) (can-train militiaman-line) => (train militiaman-line) ) ; crank out battering rams in the castle age (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal castle-age) ;WDP (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total battering-ram-line < battering-rams-to-train) (wood-amount < 160) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal castle-age) ;WDP (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total battering-ram-line < battering-rams-to-train) (wood-amount < 260) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal castle-age) ;WDP (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total battering-ram-line < battering-rams-to-train) (gold-amount < 75) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal castle-age) ;WDP (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total battering-ram-line < battering-rams-to-train) (gold-amount < 275) => (set-goal save-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal castle-age) ;WDP (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total battering-ram-line < battering-rams-to-train) (can-train battering-ram-line) => (train battering-ram-line) ) ; crank out trebuchets in the imperial age ; Reserve resources if it reports that we don't have enough, but ; only train it if everything else is done to prevent unpacked duplicates. (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal castle-age) (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total trebuchet < trebuchets-to-train) (wood-amount < 200) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal castle-age) (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total trebuchet < trebuchets-to-train) (wood-amount < 300) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal castle-age) (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total trebuchet < trebuchets-to-train) (gold-amount < 200) => (set-goal need-gold-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal current-age-goal castle-age) (goal tier3-done-goal 1) (housing-headroom > 0) (unit-type-count-total trebuchet < trebuchets-to-train) (goal need-more-not-trebuchet 0) (can-train trebuchet) => (train trebuchet) ) ; Forward build normal towers when mixing it up (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal attack-cycle-goal attack-cycle-mix-it-up) (building-type-count-total watch-tower-line < towers-to-build) (wood-amount < 25) => (set-goal need-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal attack-cycle-goal attack-cycle-mix-it-up) (building-type-count-total watch-tower-line < towers-to-build) (wood-amount < 125) => (set-goal save-wood-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (goal attack-cycle-goal attack-cycle-mix-it-up) (building-type-count-total watch-tower-line < towers-to-build) (stone-amount < 125) => (set-goal need-stone-goal 1) ) (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) ;(goal attack-cycle-goal attack-cycle-mix-it-up) (building-type-count-total watch-tower-line < towers-to-build) (can-build watch-tower-line) => (build-forward watch-tower-line) ) ; Don't wait too long once the army is complete (defrule (military-population >= attack-population) (goal attack-cycle-goal attack-cycle-none) => (enable-timer attack-timer max-wait-to-attack) (set-goal attack-cycle-goal attack-cycle-first-wait) (chat-to-all "attack!") (disable-self) ) ; attack when population is maxed out and techs are done (defrule (goal attack-cycle-goal attack-cycle-first-wait) (military-population >= attack-population) (research-completed attack-tech1) (research-completed attack-tech2) (research-completed attack-tech3) (research-completed attack-tech4) (research-completed attack-tech5) (research-completed attack-tech6) (research-completed attack-tech7) (research-completed attack-tech8) (not (town-under-attack)) => (disable-timer attack-timer) (enable-timer attack-timer 1) (chat-to-all "!") (disable-self) ) ; attack when population is maxed out and time is up (defrule (goal attack-cycle-goal attack-cycle-first-wait) (military-population >= attack-population) (timer-triggered attack-timer) (not (town-under-attack)) => (set-strategic-number sn-percent-attack-soldiers 100) (set-strategic-number sn-percent-attack-boats 100) (set-strategic-number sn-group-form-distance charge-group-distance) (set-strategic-number sn-consecutive-idle-unit-limit 15) (set-goal attack-cycle-goal attack-cycle-charge) (attack-now) (disable-timer attack-timer) (enable-timer attack-timer max-time-to-charge) (chat-to-all "!") (disable-self) ) ; stop charging and mix it up (defrule (goal attack-cycle-goal attack-cycle-charge) (timer-triggered attack-timer) => (set-strategic-number sn-percent-attack-soldiers 0) (set-strategic-number sn-percent-attack-boats 0) (set-strategic-number sn-task-ungrouped-soldiers 1) (set-strategic-number sn-group-form-distance mixing-group-distance) (set-strategic-number sn-number-attack-groups 0) (set-strategic-number sn-consecutive-idle-unit-limit 0) (set-goal attack-cycle-goal attack-cycle-mix-it-up) (disable-timer attack-timer) (enable-timer attack-timer max-time-to-mix-it-up) (chat-to-all "!") ) ; Check for minimum levels to continue mixing it up ;(unit-type-count attacker-type < min-attackers-for-attack) ; above rule replaced in below rule with military pop size (defrule (goal attack-cycle-goal attack-cycle-mix-it-up) (military-population < min-attackers-for-attack) => (set-strategic-number sn-task-ungrouped-soldiers 0) (set-goal attack-cycle-goal attack-cycle-wait) (disable-timer attack-timer) (chat-to-all "") ) ; Charge again after mixing it up (defrule (goal attack-cycle-goal attack-cycle-mix-it-up) (timer-triggered attack-timer) => (set-strategic-number sn-percent-attack-soldiers 100) (set-strategic-number sn-percent-attack-boats 100) (set-strategic-number sn-group-form-distance charge-group-distance) (set-strategic-number sn-consecutive-idle-unit-limit 15) (set-goal attack-cycle-goal attack-cycle-charge) (attack-now) (disable-timer attack-timer) (enable-timer attack-timer max-time-to-charge) (chat-to-all "") ) ; attack when population is maxed out (defrule (goal attack-cycle-goal attack-cycle-wait) (military-population >= attack-population) (not (town-under-attack)) => (set-strategic-number sn-percent-attack-soldiers 100) (set-strategic-number sn-percent-attack-boats 100) (set-strategic-number sn-group-form-distance charge-group-distance) (set-strategic-number sn-consecutive-idle-unit-limit 15) (set-goal attack-cycle-goal attack-cycle-charge) (attack-now) (enable-timer attack-timer max-time-to-charge) (chat-to-all "") ) ; Stop hiding when we have min-attackers-for-attack. ;(unit-type-count-total attacker-type >= min-attackers-for-attack) ; rule replaced with military pop size (defrule (military-population >= min-attackers-for-attack) => (set-strategic-number sn-enemy-sighted-response-distance aggressive-response-distance) ) (defrule (military-population < min-attackers-for-attack) => (set-strategic-number sn-enemy-sighted-response-distance hide-response-distance) ) ; end of loop local variables (defconst sell-what-commodity 40) (defconst really-need-cash 39) (defconst train-after-attack-villagers 38) (defconst sell-the-nothing 0) (defconst sell-the-food 1) (defconst sell-the-wood 2) ; Decide which villager maximum to use. (defrule (true) => (set-goal train-after-attack-villagers 0) ) (defrule (or (players-stance any-human ally) (players-stance any-computer ally)) (not (goal attack-cycle-goal attack-cycle-none)) => (set-goal train-after-attack-villagers 1) ) ; Move the the castle age (defrule (current-age == feudal-age) (food-amount >= 800) (gold-amount >= 200) ;(building-type-count market > 0) (or (building-type-count blacksmith > 0) (or (building-type-count stable > 0) (building-type-count archery-range > 0))) (can-train villager) => (set-goal current-age-goal castle-age) (research castle-age) (set-strategic-number sn-maximum-town-size 20) ;16 WDP (disable-timer age-advance-timer) (enable-timer age-advance-timer 180) ) ; Crank out the villagers until the limit is reached ; Wait until now so that the town center can try other stuff first (defrule (or (unit-type-count-total villager < max-villagers-after-attack) (and (unit-type-count-total villager < max-villagers) (goal train-after-attack-villagers 0))) (building-type-count-total town-center >= 1) (food-amount < 50) => (set-goal need-food-goal 1) ) (defrule (or (unit-type-count-total villager < max-villagers-after-attack) (and (unit-type-count-total villager < max-villagers) (goal train-after-attack-villagers 0))) (building-type-count-total town-center >= 1) (food-amount < 150) => (set-goal save-food-goal 1) ) (defrule (unit-type-count-total villager < 30) (can-train villager) (current-age == dark-age) => (train villager) ) (defrule (unit-type-count-total villager < 35) (can-train villager) (current-age == feudal-age) => (train villager) ) (defrule (or (unit-type-count-total villager < max-villagers-after-attack) (and (unit-type-count-total villager < max-villagers) (goal train-after-attack-villagers 0))) (can-train villager) (and (not(current-age == dark-age)) (not(current-age == feudal-age))) => (train villager) ) ; Build fishing ships to help with food (defrule (unit-type-count-total villager > min-villagers) (unit-type-count-total fishing-ship < fishing-ships-to-train) (can-train fishing-ship) => (train fishing-ship) ) ; Just in case, use escrow for villagers when less than min-villagers (defrule (building-type-count-total town-center >= 1) (unit-type-count-total villager < min-villagers) (food-amount < 50) => (set-goal need-food-goal 1) (set-goal save-food-goal 1) (set-goal escrow-food-goal 1) ) (defrule (building-type-count-total town-center >= 1) (unit-type-count-total villager < min-villagers) (can-train-with-escrow villager) (and (not(current-age == dark-age)) (not(current-age == feudal-age))) => (release-escrow food) (train villager) ) ; Handle escrow goals (defrule (goal escrow-food-goal 1) => (set-escrow-percentage food 50) ) (defrule (goal escrow-food-goal 0) => (release-escrow food) (set-escrow-percentage food 0) ) (defrule (goal escrow-wood-goal 1) => (set-escrow-percentage wood 50) ) (defrule (goal escrow-wood-goal 0) => (release-escrow wood) (set-escrow-percentage wood 0) ) (defrule (goal escrow-gold-goal 1) => (set-escrow-percentage gold 50) ) (defrule (goal escrow-gold-goal 0) => (release-escrow gold) (set-escrow-percentage gold 0) ) (defrule (goal escrow-stone-goal 1) => (set-escrow-percentage stone 50) ) (defrule (goal escrow-stone-goal 0) => (release-escrow stone) (set-escrow-percentage stone 0) ) (defrule (true) => (set-goal escrow-food-goal 0) (set-goal escrow-wood-goal 0) (set-goal escrow-gold-goal 0) (set-goal escrow-stone-goal 0) ) ; Decide if we really need cash. Otherwise, hold on to resources. (defrule (true) => (set-goal really-need-cash 0) ) (defrule (goal need-gold-goal 1) (building-type-count-total mining-camp < 4) (dropsite-min-distance gold > first-dropsite-distance) => (set-goal really-need-cash 1) ) (defrule (goal need-gold-goal 1) (building-type-count-total mining-camp >= 4) (building-type-count-total mining-camp < 8) (dropsite-min-distance gold > second-dropsite-distance) => (set-goal really-need-cash 1) ) (defrule (goal need-gold-goal 1) (building-type-count-total mining-camp >= 8) (building-type-count-total mining-camp < 12) (dropsite-min-distance gold > third-dropsite-distance) => (set-goal really-need-cash 1) ) (defrule (goal need-gold-goal 1) (building-type-count-total mining-camp >= 12) (dropsite-min-distance gold > fourth-dropsite-distance) => (set-goal really-need-cash 1) ) (defrule (goal need-stone-goal 1) (building-type-count-total mining-camp < 4) (dropsite-min-distance stone > first-dropsite-distance) => (set-goal really-need-cash 1) ) (defrule (goal need-stone-goal 1) (building-type-count-total mining-camp >= 4) (building-type-count-total mining-camp < 8) (dropsite-min-distance stone > second-dropsite-distance) => (set-goal really-need-cash 1) ) (defrule (goal need-stone-goal 1) (building-type-count-total mining-camp >= 8) (building-type-count-total mining-camp < 12) (dropsite-min-distance stone > third-dropsite-distance) => (set-goal really-need-cash 1) ) (defrule (goal need-stone-goal 1) (building-type-count-total mining-camp >= 12) (dropsite-min-distance stone > fourth-dropsite-distance) => (set-goal really-need-cash 1) ) ; Decide what to sell based on prices ; Only sell if gold can't be gathered (defrule (true) => (set-goal sell-what-commodity sell-the-nothing) ) (defrule (goal save-food-goal 1) (goal save-wood-goal 0) (can-sell-commodity wood) => (set-goal sell-what-commodity sell-the-wood) ) (defrule (goal save-wood-goal 1) (goal save-food-goal 0) (can-sell-commodity food) => (set-goal sell-what-commodity sell-the-food) ) (defrule (goal save-food-goal 0) (goal save-wood-goal 0) (can-sell-commodity food) => (set-goal sell-what-commodity sell-the-food) ) (defrule (goal save-food-goal 0) (goal save-wood-goal 0) (can-sell-commodity wood) => (set-goal sell-what-commodity sell-the-wood) ) (defrule (goal save-food-goal 0) (goal save-wood-goal 0) (can-sell-commodity food) (commodity-selling-price food > 15) => (set-goal sell-what-commodity sell-the-food) ) (defrule (goal save-food-goal 0) (goal save-wood-goal 0) (can-sell-commodity wood) (commodity-selling-price wood > 15) => (set-goal sell-what-commodity sell-the-wood) ) (defrule (goal save-food-goal 0) (goal save-wood-goal 0) (can-sell-commodity food) (commodity-selling-price food > 31) => (set-goal sell-what-commodity sell-the-food) ) (defrule (goal save-food-goal 0) (goal save-wood-goal 0) (can-sell-commodity wood) (commodity-selling-price wood > 31) => (set-goal sell-what-commodity sell-the-wood) ) (defrule (goal save-food-goal 0) (goal save-wood-goal 0) (can-sell-commodity food) (commodity-selling-price food > 63) => (set-goal sell-what-commodity sell-the-food) ) (defrule (goal save-food-goal 0) (goal save-wood-goal 0) (can-sell-commodity wood) (commodity-selling-price wood > 63) => (set-goal sell-what-commodity sell-the-wood) ) (defrule (goal really-need-cash 1) (goal sell-what-commodity sell-the-food) => (sell-commodity food) (chat-local-to-self "sold food") ) (defrule (goal really-need-cash 1) (goal sell-what-commodity sell-the-wood) => (sell-commodity wood) (chat-local-to-self "sold wood") ) ; Sell after 20 minutes if we have lots of extra food and wood. (defrule (or (goal need-gold-goal 1) (goal need-stone-goal 1)) (game-time > 1200) (food-amount > 4000) => (sell-commodity food) (chat-local-to-self "food") ) (defrule (or (goal need-gold-goal 1) (goal need-stone-goal 1)) (game-time > 1200) (wood-amount > 2000) => (sell-commodity wood) (chat-local-to-self "wood") ) ; Buy commodities as needed (defrule (goal really-need-cash 1) (goal save-gold-goal 0) (can-buy-commodity stone) => (buy-commodity stone) (chat-local-to-self " stone") ) ; Don't gather gold or stone if too far away and maxed out on mining camps (defrule (building-type-count-total mining-camp >= max-mining-camps) (dropsite-min-distance gold > max-gold-dropsite-distance) => (set-goal need-gold-goal 0) ) (defrule (building-type-count-total mining-camp >= max-mining-camps) (dropsite-min-distance stone > max-stone-dropsite-distance) => (set-goal need-stone-goal 0) ) ; Extend food gathering distance when farms are idle and need food. (defrule (goal need-food-goal 1) (idle-farm-count > 0) => (set-strategic-number sn-maximum-food-drop-distance idle-farm-gather-distance) ) (defrule (or (goal need-food-goal 0) (idle-farm-count < 1)) => (set-strategic-number sn-maximum-food-drop-distance max-food-dropsite-distance) ) ; Keep track of whether or not we needed gold or stone (defrule (goal need-gold-goal 0) => (set-goal needed-gold-goal 0) ) (defrule (goal need-gold-goal 1) => (set-goal needed-gold-goal 1) ) (defrule (goal need-stone-goal 0) => (set-goal needed-stone-goal 0) ) (defrule (goal need-stone-goal 1) => (set-goal needed-stone-goal 1) ) ; Set the gathering percentages (defrule (goal need-food-goal 1) (goal need-wood-goal 0) (goal need-gold-goal 0) (goal need-stone-goal 0) => (set-goal need-food-goal 0) (set-strategic-number sn-food-gatherer-percentage 100) (set-strategic-number sn-wood-gatherer-percentage 0) (set-strategic-number sn-gold-gatherer-percentage 0) (set-strategic-number sn-stone-gatherer-percentage 0) ) (defrule (goal need-food-goal 0) (goal need-wood-goal 1) (goal need-gold-goal 0) (goal need-stone-goal 0) => (set-goal need-wood-goal 0) (set-strategic-number sn-food-gatherer-percentage 20) (set-strategic-number sn-wood-gatherer-percentage 80) (set-strategic-number sn-gold-gatherer-percentage 0) (set-strategic-number sn-stone-gatherer-percentage 0) ) (defrule (goal need-food-goal 1) (goal need-wood-goal 1) (goal need-gold-goal 0) (goal need-stone-goal 0) => (set-goal need-food-goal 0) (set-goal need-wood-goal 0) (set-strategic-number sn-food-gatherer-percentage 50) (set-strategic-number sn-wood-gatherer-percentage 50) (set-strategic-number sn-gold-gatherer-percentage 0) (set-strategic-number sn-stone-gatherer-percentage 0) ) (defrule (goal need-food-goal 0) (goal need-wood-goal 0) (goal need-gold-goal 1) (goal need-stone-goal 0) => (set-goal need-gold-goal 0) (set-strategic-number sn-food-gatherer-percentage 20) (set-strategic-number sn-wood-gatherer-percentage 20) (set-strategic-number sn-gold-gatherer-percentage 60) (set-strategic-number sn-stone-gatherer-percentage 0) ) (defrule (goal need-food-goal 1) (goal need-wood-goal 0) (goal need-gold-goal 1) (goal need-stone-goal 0) => (set-goal need-food-goal 0) (set-goal need-gold-goal 0) (set-strategic-number sn-food-gatherer-percentage 50) (set-strategic-number sn-wood-gatherer-percentage 10) (set-strategic-number sn-gold-gatherer-percentage 40) (set-strategic-number sn-stone-gatherer-percentage 0) ) (defrule (goal need-food-goal 0) (goal need-wood-goal 1) (goal need-gold-goal 1) (goal need-stone-goal 0) => (set-goal need-wood-goal 0) (set-goal need-gold-goal 0) (set-strategic-number sn-food-gatherer-percentage 10) (set-strategic-number sn-wood-gatherer-percentage 50) (set-strategic-number sn-gold-gatherer-percentage 40) (set-strategic-number sn-stone-gatherer-percentage 0) ) (defrule (goal need-food-goal 1) (goal need-wood-goal 1) (goal need-gold-goal 1) (goal need-stone-goal 0) => (set-goal need-food-goal 0) (set-goal need-wood-goal 0) (set-goal need-gold-goal 0) (set-strategic-number sn-food-gatherer-percentage 37) (set-strategic-number sn-wood-gatherer-percentage 36) (set-strategic-number sn-gold-gatherer-percentage 27) (set-strategic-number sn-stone-gatherer-percentage 0) ) (defrule (goal need-food-goal 0) (goal need-wood-goal 0) (goal need-gold-goal 0) (goal need-stone-goal 1) => (set-goal need-stone-goal 0) (set-strategic-number sn-food-gatherer-percentage 20) (set-strategic-number sn-wood-gatherer-percentage 20) (set-strategic-number sn-gold-gatherer-percentage 0) (set-strategic-number sn-stone-gatherer-percentage 60) ) (defrule (goal need-food-goal 1) (goal need-wood-goal 0) (goal need-gold-goal 0) (goal need-stone-goal 1) => (set-goal need-food-goal 0) (set-goal need-stone-goal 0) (set-strategic-number sn-food-gatherer-percentage 50) (set-strategic-number sn-wood-gatherer-percentage 10) (set-strategic-number sn-gold-gatherer-percentage 0) (set-strategic-number sn-stone-gatherer-percentage 40) ) (defrule (goal need-food-goal 0) (goal need-wood-goal 1) (goal need-gold-goal 0) (goal need-stone-goal 1) => (set-goal need-wood-goal 0) (set-goal need-stone-goal 0) (set-strategic-number sn-food-gatherer-percentage 10) (set-strategic-number sn-wood-gatherer-percentage 50) (set-strategic-number sn-gold-gatherer-percentage 0) (set-strategic-number sn-stone-gatherer-percentage 40) ) (defrule (goal need-food-goal 1) (goal need-wood-goal 1) (goal need-gold-goal 0) (goal need-stone-goal 1) => (set-goal need-food-goal 0) (set-goal need-wood-goal 0) (set-goal need-stone-goal 0) (set-strategic-number sn-food-gatherer-percentage 37) (set-strategic-number sn-wood-gatherer-percentage 36) (set-strategic-number sn-gold-gatherer-percentage 0) (set-strategic-number sn-stone-gatherer-percentage 27) ) (defrule (goal need-food-goal 0) (goal need-wood-goal 0) (goal need-gold-goal 1) (goal need-stone-goal 1) => (set-goal need-gold-goal 0) (set-goal need-stone-goal 0) (set-strategic-number sn-food-gatherer-percentage 10) (set-strategic-number sn-wood-gatherer-percentage 10) (set-strategic-number sn-gold-gatherer-percentage 40) (set-strategic-number sn-stone-gatherer-percentage 40) ) (defrule (goal need-food-goal 1) (goal need-wood-goal 0) (goal need-gold-goal 1) (goal need-stone-goal 1) => (set-goal need-food-goal 0) (set-goal need-gold-goal 0) (set-goal need-stone-goal 0) (set-strategic-number sn-food-gatherer-percentage 36) (set-strategic-number sn-wood-gatherer-percentage 10) (set-strategic-number sn-gold-gatherer-percentage 27) (set-strategic-number sn-stone-gatherer-percentage 27) ) (defrule (goal need-food-goal 0) (goal need-wood-goal 1) (goal need-gold-goal 1) (goal need-stone-goal 1) => (set-goal need-wood-goal 0) (set-goal need-gold-goal 0) (set-goal need-stone-goal 0) (set-strategic-number sn-food-gatherer-percentage 10) (set-strategic-number sn-wood-gatherer-percentage 36) (set-strategic-number sn-gold-gatherer-percentage 27) (set-strategic-number sn-stone-gatherer-percentage 27) ) (defrule (goal need-food-goal 1) (goal need-wood-goal 1) (goal need-gold-goal 1) (goal need-stone-goal 1) => (set-goal need-food-goal 0) (set-goal need-wood-goal 0) (set-goal need-gold-goal 0) (set-goal need-stone-goal 0) (set-strategic-number sn-food-gatherer-percentage 30) (set-strategic-number sn-wood-gatherer-percentage 30) (set-strategic-number sn-gold-gatherer-percentage 20) (set-strategic-number sn-stone-gatherer-percentage 20) ) ; Clear the resource saving goals. (defrule (true) => (set-goal save-food-goal 0) (set-goal save-wood-goal 0) (set-goal save-gold-goal 0) (set-goal save-stone-goal 0) ) ; Check the age advancement timer to see if age advancement failed. (defrule (timer-triggered age-advance-timer) (goal current-age-goal feudal-age) (current-age != feudal-age) => (set-goal current-age-goal dark-age) (disable-timer age-advance-timer) ) (defrule (timer-triggered age-advance-timer) (goal current-age-goal castle-age) (current-age != castle-age) => (set-goal current-age-goal feudal-age) (disable-timer age-advance-timer) ) (defrule (timer-triggered age-advance-timer) (goal current-age-goal imperial-age) (current-age != imperial-age) => (set-goal current-age-goal imperial-age) (disable-timer age-advance-timer) ) ; Reset the one minute timer (defrule (timer-triggered one-minute-timer) => (disable-timer one-minute-timer) (enable-timer one-minute-timer 60) ) (defrule (current-age == castle-age) (game-time > 2400) => (attack-now) (disable-self) ) (defrule ;(current-age == castle-age) (game-time > 3600) => (attack-now) (disable-self) ) (defrule (current-age == imperial-age) (game-time > 9000) => (attack-now) (disable-self) )