; Strong GoTurks ; for AOK only (not TC) ; ID (defrule (true) => (chat-to-all "GoTurks Will Rock You") (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 is set to 1 if we want more town centers (defconst want-more-town-centers 6) ; 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) ; 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 unique-research-goal 29) (defconst archery-research-goal 30) (defconst cavalry-research-goal 31) (defconst infantry-research-goal 32) (defconst siege-research-goal 33) ; flip time is the time when we change to cheap attack units (defconst flip-time 5400) ; 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 8) (defconst max-mining-camps 16) ; wall parameters (defconst wall-perimeter 2) (defconst required-palisade-percent 0) (defconst required-wall-percent 100) (defconst gates-to-build 5) ; need a monk to get relics (defconst min-monks-to-train 3) (defconst min-villagers 40) (defconst max-villagers 50) (defconst town-centers-to-build 2) (defconst max-villagers-after-attack 50) (defconst max-population 125) (defconst min-attackers-for-attack 35) (defconst scouts-to-train 1) (defconst monks-to-train 4) (defconst trebuchets-to-train 2) (defconst monasteries-to-build 1) (defconst siege-workshops-to-build 1) ;WDP (defconst skirmishers-to-train 0) ; build these after flip-time (defconst hand-cannoneers-to-train 25) (defconst scorpions-to-train 0) (defconst battering-rams-to-train 0) ;WDP (defconst mangonels-to-train 0) (defconst bombard-cannons-to-train 8) (defconst fishing-ships-to-train 3) ;0 WDP (defconst trade-cogs-to-train 0) (defconst transport-ships-to-train 0) (defconst galleys-to-train 0) (defconst fire-ships-to-train 0) (defconst demolition-ships-to-train 0) (defconst cannon-galleons-to-train 0) (defconst longboats-to-train 0) #load-if-defined TURKISH-CIV (defconst attack-population 64) (defconst scout-cavalry-to-train 1) (defconst castles-to-build 3) (defconst eagle-warriors-to-train 0) (defconst janissaries-to-train 16) (defconst barracks-to-build 0) (defconst knights-to-train 0) (defconst stables-to-build 1) (defconst camels-to-train 0) (defconst archery-ranges-to-build 4) (defconst archers-to-train 8) (defconst cavalry-archers-to-train 0) (defconst defenders-to-train 8) (defconst home-towers-to-build 0) (defconst towers-to-build 0) (defconst home-bombard-towers-to-build 0) (defconst bombard-towers-to-build 0) (defconst unique-units-to-train 16) (defconst spearmen-to-train 0) (defconst militias-to-train 0) (defconst defender-type archer-line) (defconst do-unique-unit-upgrade 1) ;yes (defconst do-the-unique-research 0) ;don't do it (defconst do-cavalry-research 0) ;don't do it (defconst do-archery-research 1) ;yes (defconst do-infantry-research 0) ;no (defconst do-siege-research 1) ;yes - bombard cannon (defconst attack-tech1 ri-padded-archer-armor) (defconst attack-tech2 ri-leather-archer-armor) (defconst attack-tech3 ri-forging) (defconst attack-tech4 ri-iron-casting) (defconst attack-tech5 ri-blast-furnace) (defconst attack-tech6 ri-scale-barding) (defconst attack-tech7 ri-chain-barding) (defconst attack-tech8 ri-plate-barding) #else (defconst janissaries-to-train 0) #end-if ; Set initial strategic numbers (defrule (true) => (set-strategic-number sn-percent-civilian-explorers 0) (set-strategic-number sn-percent-civilian-builders 0) (set-strategic-number sn-percent-civilian-gatherers 100) (set-strategic-number sn-minimum-civilian-explorers 0) (disable-self) ) (defrule (true) => (set-strategic-number sn-task-ungrouped-soldiers 1) ;WDP (set-strategic-number sn-percent-enemy-sighted-response 100) (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) (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) ) ; 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) ) (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 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 (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 (or (research-available ri-double-bit-axe) (or (research-available ri-horse-collar) (or (research-available ri-stone-mining) (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) ) (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-paladin) (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 done after tier 7 (or (research-available ri-bracer) ;WDP done after tier 7 (or (research-available ri-crop-rotation) (goal tier7-done-goal 0)))) => (set-goal tier8-done-goal 0) ) (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) ) ; 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) (can-build town-center) => (build town-center) ) ; Always have extra houses. (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 0) (set-strategic-number sn-percent-civilian-explorers 100) (set-strategic-number sn-minimum-civilian-explorers 2000) ) ; 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 > 150)) (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) ) ;TOWERS ; Build home towers early (defrule (game-time > 600) (building-type-count-total watch-tower-line < towers-to-build) (can-build watch-tower-line) => (build watch-tower-line) ) ; build a market 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 market) (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) (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) (building-type-count-total market < 1) (can-build market) => (build market) ) ; 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) (can-train-with-escrow monk) => (release-escrow gold) (train monk) ) ; 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-type-count-total stable < 1) (can-build-with-escrow stable) => (release-escrow wood) (build stable) ) ; defenders (defrule (building-type-count-total town-center > 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 200)) (housing-headroom > 0) (unit-type-count-total defender-type < defenders-to-train) (can-train defender-type) => (train defender-type) ) ; 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) (not (town-under-attack)) (building-type-count-total gate < gates-to-build) (can-build-gate wall-perimeter) => (build-gate wall-perimeter) ) ; 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 castle-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) ) ; Advance to the Feudal Age when available (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) => (research feudal-age) (set-strategic-number sn-maximum-town-size 18) ;14 WDP ) ; 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) (disable-self) ) ; Make sure the blacksmith is available to get to Castle Age (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 <- TIER 4 item (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) (disable-self) ) (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) (disable-self) ) (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) (disable-self) ) ; 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)) (can-research-with-escrow ri-forging) => (release-escrow food) (research ri-forging) (disable-self) ) ; Research horse collar (defrule (goal want-more-town-centers 0) (goal tier1-done-goal 1) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 275)) (can-research ri-horse-collar) => (research ri-horse-collar) (disable-self) ) ; Research fletching (defrule (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 300)) (goal tier2-done-goal 1) (can-research ri-fletching) => (research ri-fletching) (disable-self) ) ;************** RESEARCH ********************** ; 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 tier6-done-goal 1) (building-type-count-total watch-tower-line >= towers-to-build) (building-type-count-total monastery > 0) (building-type-count-total university > 0) (can-research ri-murder-holes) => (research ri-murder-holes) (disable-self) ) ; upgrade to cavalier if have 10 (WDP) knights (break-even point) (defrule (unit-type-count-total knight > 10) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 500)) (can-research-with-escrow ri-cavalier) => (release-escrow food) (release-escrow gold) (research ri-cavalier) (disable-self) ) ; upgrade to paladin if have 20 cavaliers (break-even point) (defrule (unit-type-count-total cavalier > 20) (goal want-more-town-centers 0) (or (unit-type-count-total villager >= min-villagers) (food-amount >= 1500)) (can-research-with-escrow ri-paladin) => (release-escrow food) (release-escrow gold) (research ri-paladin) (disable-self) ) ; 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 imperial-age) (goal tier6-done-goal 1) (housing-headroom > 0) (unit-type-count-total trebuchet < trebuchets-to-train) (can-train trebuchet) => (train trebuchet) ) ; Forward build a castle when we have three already ; Come back to this (defrule (building-type-count-total castle > 3) (building-type-count-total monastery > 0) (food-amount >= 200) (can-build castle) => (build-forward castle) ) ; attack when population is maxed out and time is up (defrule (military-population >= attack-population) (not (town-under-attack)) => (set-strategic-number sn-percent-attack-soldiers 100) (set-strategic-number sn-percent-attack-boats 100) (attack-now) (chat-to-all "1 Charge for initial attack!") (disable-self) ) ; 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))) (can-train villager) => (train villager) ) ; 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) (can-train-with-escrow villager) => (release-escrow food) (train villager) ) ; Prepare to kick ass late in the game (defrule (game-time greater-than flip-time) (building-type-count-total archery-range < 4) (can-build archery-range) => (build archery-range) ) (defrule (game-time greater-than flip-time) (building-type-count-total barracks < 3) (can-build barracks) => (build barracks) ) (defrule (game-time greater-than flip-time) (can-research ri-elite-skirmisher) => (research ri-elite-skirmisher) (disable-self) ) (defrule (game-time greater-than flip-time) (can-train trebuchet) => (train trebuchet) ) ; Sell after 40 minutes if we have lots of extra food and wood. (defrule (or (or (goal need-gold-goal 1) (goal need-stone-goal 1)) (game-time > 2400)) (food-amount > 2500) ;WDP 4000 => (sell-commodity food) (chat-local-to-self "sold extra food") ) (defrule (or (or (goal need-gold-goal 1) (goal need-stone-goal 1)) (game-time > 2400)) (wood-amount > 2500) ;WDP 4000 => (sell-commodity wood) (chat-local-to-self "sold extra wood") )