;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Author : Vineet Khosla ; This agent is written from scratch ; It goes through the ages settings goals to be achieved in every age ; In feudal age it has to two levels/goals to achieve. ; In castle age it has to three levels/goals to achieve. ; It can go to the next age even without accomplishing those goals of needed. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Identify yourself and set the basic stuff (defrule (true) => (chat-to-all "I am Shah Of Persia !!!") (set-difficulty-parameter ability-to-dodge-missiles 0) (set-difficulty-parameter ability-to-maintain-distance 0) (disable-self) ) ; ============= RSIGNING CONDITION =============== ; resigns if it can't train villagers and has no town center (defrule (building-type-count town-center less-than 1) (unit-type-count-total villager < 1) (not (can-train villager) ) => (resign) (disable-self) ) ; resigns if persian civilization is not selected (defrule (not (civ-selected persian)) => (chat-to-all "How do you expect me to fight without my kingdom ???") (chat-to-all "Select my civilization as Persia and start again !!!") (resign) (disable-self) ) ; ============================================================ ; ============== COMMON RULES TO ALL AGES ; ============================================================ ; =========== STARTEGIC NUMBERS =============================== ; controlling retasking and gathering (defrule (true) => (set-strategic-number sn-retask-gather-amount 0) ; retask immediately (set-strategic-number sn-max-retask-gather-amount 0) ;(set-strategic-number sn-cap-civilian-builders 4) (set-strategic-number sn-intelligent-gathering 1) (set-strategic-number sn-maximum-fish-boat-drop-distance 30) (set-strategic-number sn-minimum-water-body-size-for-dock 30) (disable-self) ) ;defend priority (defrule (true) => (set-strategic-number sn-relic-return-distance 100) (set-strategic-number sn-relic-defend-priority 0) (set-strategic-number sn-town-defend-priority 0) (set-strategic-number sn-dock-defend-priority 7) (set-strategic-number sn-forage-defend-priority 7) (set-strategic-number sn-stone-defend-priority 7) (set-strategic-number sn-gold-defend-priority 2) (set-strategic-number sn-minimum-town-size 10) (set-strategic-number sn-maximum-town-size 25) (set-strategic-number sn-allow-civilian-defense 1) (disable-self) ) ;maintain housing (defrule (housing-headroom less-than 2) (population-headroom greater-than 0) (can-build house) => (build house) ;(chat-local-to-self "house") ) ; =========== ATLEAST ONE STUFF =============================== ; build a town-centre if is destroyed .. use escrow if needed. (defrule (building-type-count-total town-center < 1) (can-build town-center ) => (build town-center ) (chat-local-to-self "1st town-center ") ) (defrule (building-type-count-total town-center < 1) (can-build-with-escrow town-center ) => (release-escrow wood) (build town-center ) (set-escrow-percentage wood 15) (chat-local-to-self "1st town-center escrow ") ) ; build a mill ... make sure we have atleast one mill!!! ; also we cant build farms if we dont have a mill (defrule (building-type-count-total mill < 1) (can-build mill) => (build mill) (chat-local-to-self "1st mill") ) ;;;;;;;;;;; build a barrack ... ... (usually begining of feudal) ;;;;;;;;;;;;; (defrule (current-age == feudal-age) (building-type-count-total barracks < 1) (can-build barracks) => (build barracks) (chat-local-to-self "1st barracks") ) (defrule (current-age == feudal-age) (building-type-count-total barracks < 1) (can-build-with-escrow barracks) => (release-escrow wood) (build barracks) (set-escrow-percentage wood 15) (chat-local-to-self "1st barracks with escrow") ) ; if we r in castle or imperial then build barracks with escrow amount ;(defrule ; (or ; (current-age == castle-age) ; (current-age == imperial-age) ; ) ; (building-type-count-total barracks < 1) ; (can-build-with-escrow barracks) ;=> ; (release-escrow wood) ; (build barracks) ; (chat-local-to-self "1st barracks escrow, castle or imperial") ;) ;;;;;;;;;;; build a archery range ... (usually begining of feudal) ;;;;;;;;;;;;;; (defrule (building-type-count-total archery-range < 1) (can-build archery-range) => (build archery-range) (chat-local-to-self "1st archery-range") ) (defrule (building-type-count-total archery-range < 1) (can-build-with-escrow archery-range) => (release-escrow wood) (build archery-range) (set-escrow-percentage wood 15) (chat-local-to-self "1st archery-range-with-escrow") ) ; if we r in castle or imperial then build archery-range with escrow amount ;(defrule ; (or ; (current-age == castle-age) ; (current-age == imperial-age) ; ) ; (building-type-count-total archery-range < 1) ; (can-build-with-escrow archery-range) ;=> ; (release-escrow wood) ; (build archery-range) ; (chat-local-to-self "1st archery-range escrow") ;) ;;;;;;;;;;;;;;; building a blacksmith .... (usually begining of feudal) (defrule (building-type-count-total archery-range > 0) (building-type-count-total barracks > 0) (building-type-count-total blacksmith < 1) ; (or ; (unit-type-count-total skirmisher-line > 3) ; (unit-type-count-total archer-line > 3 ) ; ) (can-build blacksmith) => (build blacksmith) (chat-local-to-self "blacksmith") ) ;;;;;;;;;;; build a monastry... ( usually begining of castle) ;;;;;;;;;;; ; we need monastry even if we have to dive in our escrow funds (defrule (building-type-count-total monastery < 1) (can-build monastery ) => (build monastery ) (chat-local-to-self "1st monastery ") ) (defrule (building-type-count-total monastery < 1) (can-build-with-escrow monastery ) => (release-escrow wood) (build monastery ) (set-escrow-percentage wood 15) (chat-local-to-self "1st monastery escrow") ) ; ;;;;;;;; build a castle... (usually begining of castle) ; if 35% of the wall is built (defrule (building-type-count-total castle < 1) (wall-completed-percentage 2 > 35) (can-build castle ) => (build castle ) (chat-local-to-self "1st castle ") ) ; build one stable in castle age (usually begining of castle) (defrule ( not (current-age == feudal-age) ) (building-type-count-total stable < 1) (can-build stable) => (build stable) (chat-local-to-self "1st stable") ) ; build one seige-workshop in castle age (usually begining of castle) ; must have 1 barrack,1 archery-range,1-STABLE, 1 monastry (defrule (building-type-count-total siege-workshop < 1) (building-type-count-total barracks > 0) (building-type-count-total archery-range > 0) (building-type-count-total stable > 0) (building-type-count-total monastery > 0) (can-build siege-workshop ) => (build siege-workshop ) (chat-local-to-self "1st siege-workshop ") ; 200 W ) ; build one university in castle age (usually begining of castle) ; must have 1 barrack,1 archery-range, 1 monastry,stable and castle ; i am reseaarching only murder holes and chemistry, so university ; should not be built before castle. (defrule (building-type-count-total university < 1) (building-type-count-total barracks > 0) (building-type-count-total archery-range > 0) (building-type-count-total stable > 0) (building-type-count-total monastery > 0) (building-type-count-total castle > 0) (can-build university ) => (build university ) (chat-local-to-self "1st university ") ; 200 W ) ; atleast one scout cavalry exists!!! (anytime) (defrule (unit-type-count-total scout-cavalry < 1) (can-train scout-cavalry) => (train scout-cavalry) (chat-local-to-self "1st scout-cavalry") (set-strategic-number sn-number-explore-groups 1) (set-strategic-number sn-minimum-explore-group-size 1) (set-strategic-number sn-maximum-explore-group-size 1) ) ; =============== CONSTANTS FOR ALL AGES (defconst crtical_food_amount 150) (defconst crtical_gold_amount 100) (defconst crtical_stone_amount 100) (defconst crtical_wood_amount 200) (defconst castle-imperial_age_farms 35) (defconst castle-imperial_age_max_camps 20) ; mining, (defconst castle-imperial_age_min_distance 13) ; this is the distance past to which build stuff. ; =============== GOALS FOR ALL AGES (defconst YES 1) (defconst NO 0) (defconst GOAL_RESEARCHING_FEUDAL 2) (defconst GOAL_RESEARCHING_CASTLE 3) (defconst GOAL_RESEARCHING_IMPERIAL 4) (defconst I_NEED_FOOD 5) (defconst I_NEED_WOOD 6) (defconst I_NEED_GOLD 7) (defconst I_NEED_STONE 8) (defconst GOAL_FEUDAL_LEVEL_1 9) (defconst GOAL_FEUDAL_LEVEL_2 10) (defconst GOAL_CIVIL_CASTLE_LEVEL_1 11) (defconst GOAL_CIVIL_CASTLE_LEVEL_2 12) (defconst GOAL_ARMY_CASTLE_LEVEL_1 13) (defconst GOAL_ARMY_CASTLE_LEVEL_2 14) (defconst GOAL_ARMY_CASTLE_LEVEL_3 15) (defconst GOAL_CIVIL_IMPERIAL_LEVEL_1 16) (defconst GOAL_CIVIL_IMPERIAL_LEVEL_2 17) (defconst GOAL_ARMY_IMPERIAL_LEVEL_1 18) (defconst GOAL_ARMY_IMPERIAL_LEVEL_2 19) (defconst GOAL_MAKE_SKIRMISHER_LINE 20) (defconst DRASTIC_CIVIL_TIMES 21) (defconst IN_CASTLE_OR_IMPERIAL 22) (defconst HAND_CANNONEER_READY 23) ; setting all of them to no (defrule (true) => (set-goal GOAL_RESEARCHING_FEUDAL NO) ;2 (set-goal GOAL_RESEARCHING_CASTLE NO) ;3 (set-goal GOAL_RESEARCHING_IMPERIAL NO) ;4 (set-goal I_NEED_FOOD NO) ;5 (set-goal I_NEED_WOOD NO) ;6 (set-goal I_NEED_GOLD NO) ;7 (set-goal I_NEED_STONE NO) ;8 (set-goal GOAL_FEUDAL_LEVEL_1 NO) ;9 (set-goal GOAL_FEUDAL_LEVEL_1 NO) ;10 (set-goal GOAL_CIVIL_CASTLE_LEVEL_1 NO) ;11 (set-goal GOAL_CIVIL_CASTLE_LEVEL_2 NO) ;12 (set-goal GOAL_ARMY_CASTLE_LEVEL_1 NO) ;13 (set-goal GOAL_ARMY_CASTLE_LEVEL_2 NO) ;14 (set-goal GOAL_ARMY_CASTLE_LEVEL_3 NO) ;15 (disable-self) ) ; setting all of them to no (defrule (true) => (set-goal GOAL_CIVIL_IMPERIAL_LEVEL_1 NO) (set-goal GOAL_CIVIL_IMPERIAL_LEVEL_2 NO) (set-goal GOAL_ARMY_IMPERIAL_LEVEL_1 NO) (set-goal GOAL_ARMY_IMPERIAL_LEVEL_2 NO) (set-goal GOAL_MAKE_SKIRMISHER_LINE NO) (set-goal DRASTIC_CIVIL_TIMES NO) (set-goal IN_CASTLE_OR_IMPERIAL NO) (set-goal HAND_CANNONEER_READY NO) (disable-self) ) ; ===================================================================================================================== ; ============== DARK AGE ============================================================================================= ; ===================================================================================================================== ; rule to advance to next age (defrule (current-age == dark-age) (can-research-with-escrow feudal-age) => (release-escrow food) (research feudal-age) (chat-local-to-self "Researching Feudal Age") (set-goal GOAL_RESEARCHING_FEUDAL YES) (disable-self) ) ; =============== CONSTANTS FOR DARK AGE (defconst dark_age_villagers 22) (defconst dark_age_militia 1) (defconst dark_age_farms 7) (defconst dark_age_max_camps 2) ; mining and lumber camp (defconst dark_age_min_distance 15) ; this is the distance past to which build stuff. ; this can be replaced with sn-camp-max-distance ; ============== VILLAGER ASSIGNMENT - age dependent assignments (defrule (current-age == dark-age) => (set-strategic-number sn-number-explore-groups 1) (set-strategic-number sn-minimum-explore-group-size 1) (set-strategic-number sn-maximum-explore-group-size 1) (disable-self) ) (defrule (current-age == dark-age) => (set-strategic-number sn-percent-civilian-explorers 0) (set-strategic-number sn-percent-civilian-builders 15) (set-strategic-number sn-percent-civilian-gatherers 85) (set-strategic-number sn-cap-civilian-explorers 0) (set-strategic-number sn-cap-civilian-gatherers 100) (set-strategic-number sn-food-gatherer-percentage 70) (set-strategic-number sn-gold-gatherer-percentage 5) (set-strategic-number sn-stone-gatherer-percentage 0) (set-strategic-number sn-wood-gatherer-percentage 25) (set-strategic-number sn-maximum-gold-drop-distance 20) (set-strategic-number sn-maximum-stone-drop-distance 20) (set-strategic-number sn-maximum-food-drop-distance 20) (set-strategic-number sn-maximum-hunt-drop-distance 20) (disable-self) ) ; dark age ; search for food (defrule (current-age == dark-age) (not (resource-found food)) (unit-type-count-total villager < 10) => (set-strategic-number sn-percent-civilian-gatherers 0) (set-strategic-number sn-percent-civilian-builders 10) (set-strategic-number sn-percent-civilian-explorers 90) (chat-local-to-self "going to find food") (disable-self) ) (defrule (current-age == dark-age) (resource-found food) => (set-strategic-number sn-percent-civilian-gatherers 85) (set-strategic-number sn-percent-civilian-builders 15) (set-strategic-number sn-percent-civilian-explorers 0) (chat-local-to-self "found food, going back to work") (disable-self) ) ; if i have all buildings to go to next age, put everyone to food. ; basically means that i have evrything to advance to next age but foo, so go 4 food. (defrule (current-age == dark-age) (or (building-type-count-total lumber-camp >= 1) (building-type-count-total mining-camp >= 1) ) ; (building-type-count-total barracks >= dark_age_max_camps) (building-type-count-total mill >= 1) => (set-strategic-number sn-food-gatherer-percentage 80) (set-strategic-number sn-wood-gatherer-percentage 20) (chat-local-to-self "done building going 4 food only") (disable-self) ) ; if we cant move to next age due to building deficiet ; then build a lumber camp (we already have a mill) ;(defrule ; (current-age == dark-age) ; (food-amount > 500) ; (or ; (building-type-count-total mining-camp < 1) ; (building-type-count-total lumber-camp < 1) ; ) ; (can-build lumber-camp) ;=> ; (build lumber-camp) ; (chat-local-to-self "Timber !!!") ;) ; ============== BUILD LISTS - for people and buildings ; building villagers (defrule (current-age == dark-age) (unit-type-count-total villager < dark_age_villagers) (can-train villager) => (train villager) ;(chat-local-to-self "villager") ) ; building militia (defrule (current-age == dark-age) (unit-type-count-total militiaman < dark_age_militia) (building-type-count-total barracks == dark_age_max_camps) (can-train militiaman ) => (train militiaman ) (chat-local-to-self "militiaman ") ) ; building farm (defrule (current-age == dark-age) (building-type-count-total farm < dark_age_farms) (idle-farm-count < 1) (can-build farm) => (build farm) ;(chat-local-to-self "Farm Fudd !!!") ) ; if food is far away, then build a mill (defrule (current-age == dark-age) (dropsite-min-distance food > dark_age_min_distance) ;(sheep-and-forage-too-far) (can-build mill) => (build mill) ) ; if lumber camp is far away then build one (defrule (current-age == dark-age) (resource-found wood) (building-type-count-total lumber-camp < dark_age_max_camps) (dropsite-min-distance wood > dark_age_min_distance) (can-build lumber-camp) => (build lumber-camp) (chat-local-to-self "Timber !!!") ) (defrule (current-age == dark-age) (resource-found wood) (building-type-count-total lumber-camp < 1) (can-build lumber-camp) => (build lumber-camp) (chat-local-to-self "1st Timber !!!") ) ; if mining camp is far away then build one (gold) (defrule (current-age == dark-age) (resource-found gold) (building-type-count-total mining-camp < dark_age_max_camps) (dropsite-min-distance gold > dark_age_min_distance) (can-build mining-camp) => (build mining-camp) ;(chat-local-to-self "Glimmer !!!") ) ; if mining camp is far away then build one (stone) ;(defrule ; (current-age == dark-age) ; (goal GOAL_RESEARCHING_FEUDAL 0) ; (resource-found stone) ; (building-type-count-total mining-camp < dark_age_max_camps) ; (dropsite-min-distance stone > dark_age_min_distance) ; (can-build mining-camp) ;=> ; (build mining-camp) ; (chat-local-to-self "Rock !!!") ;) ; since we r building 1 lumber camp and 1 mill to advance to next age ; ================================================================================================================== ; ============== FEUDEL AGE ======================================================================================== ; ================================================================================================================== ; rule to advance to next age (defrule (current-age == feudal-age) (can-research castle-age) (goal GOAL_FEUDAL_LEVEL_2 YES) => (research castle-age) (chat-local-to-self "Researching Castle Age level-2") (set-goal GOAL_RESEARCHING_CASTLE YES) (disable-self) ) (defrule (current-age == feudal-age) (can-research-with-escrow castle-age) (goal GOAL_FEUDAL_LEVEL_2 YES) => (release-escrow food) (release-escrow gold) (research castle-age) (chat-local-to-self "Researching Castle Age level-2 Escrow") (set-goal GOAL_RESEARCHING_CASTLE YES) ;(set-escrow-percentage food 20) ;(set-escrow-percentage gold 20) (disable-self) ) (defrule (current-age == feudal-age) (can-research castle-age) (food-amount > 1000) (gold-amount > 300) => (research castle-age) (chat-local-to-self "Researching Castle") (set-goal GOAL_RESEARCHING_CASTLE YES) (disable-self) ) (defrule (current-age == feudal-age) (can-research-with-escrow castle-age) => (release-escrow food) (release-escrow gold) (research castle-age) (chat-local-to-self "Researching Castle with escrow") (set-goal GOAL_RESEARCHING_CASTLE YES) ;(set-escrow-percentage food 20) ;(set-escrow-percentage gold 20) (disable-self) ) ; make sure we have reached feudal age (defrule (current-age == feudal-age) => (set-goal GOAL_RESEARCHING_FEUDAL NO) (chat-local-to-self "Made it to Feudal Age") ;(taunt 11) (disable-self) ) (defrule (current-age == feudal-age) => (set-escrow-percentage wood 15) (set-escrow-percentage food 15) (set-escrow-percentage gold 15) (chat-local-to-self "Escrow set for feudal") (disable-self) ) ; =============== CONSTANTS FOR FEUDAL AGE ============================================== (defconst feudal_age_villagers_1 40) (defconst feudal_age_villagers_2 50) (defconst feudal_age_archer_1 4) (defconst feudal_age_skirmisher_1 3) (defconst feudal_age_man-at-arms_1 2) (defconst feudal_age_spearman_1 7) (defconst feudal_age_archer_2 10) (defconst feudal_age_skirmisher_2 10) (defconst feudal_age_man-at-arms_2 10) (defconst feudal_age_spearman_2 10) (defconst feudal_age_farms_1 25) ;(defconst feudal_age_farms_2 20) (defconst feudal_age_max_camps 10) ; mining,barracks (defconst feudal_age_min_distance 13) ; this is the distance past to which build stuff. ; =============== VILLAGER ASSIGNMENT - FEUDEL AGE ========================================= (defrule (current-age == feudal-age) => (set-strategic-number sn-percent-civilian-explorers 0) (set-strategic-number sn-percent-civilian-builders 20) (set-strategic-number sn-percent-civilian-gatherers 80) (set-strategic-number sn-cap-civilian-explorers 0) (set-strategic-number sn-cap-civilian-gatherers 100) (set-strategic-number sn-food-gatherer-percentage 45) (set-strategic-number sn-gold-gatherer-percentage 10) (set-strategic-number sn-stone-gatherer-percentage 05) (set-strategic-number sn-wood-gatherer-percentage 40) (disable-self) ) (defrule (current-age == feudal-age) => (set-strategic-number sn-maximum-wood-drop-distance -1) ; we are looking further away for stuff compared to dark-ages (set-strategic-number sn-maximum-gold-drop-distance -1) (set-strategic-number sn-maximum-stone-drop-distance -1) (set-strategic-number sn-maximum-food-drop-distance -1) (set-strategic-number sn-maximum-hunt-drop-distance 10) (set-strategic-number sn-maximum-fish-boat-drop-distance 10) (disable-self) ) (defrule (current-age == feudal-age) => (set-strategic-number sn-group-commander-selection-method 2); unit with most range is the commander (set-strategic-number sn-number-attack-groups 0) ;strategic numbers for attack ;(set-strategic-number sn-minimum-attack-group-size 2) ;(set-strategic-number sn-maximum-attack-group-size 10) (set-strategic-number sn-number-defend-groups 4);strategic numbers for defence (set-strategic-number sn-minimum-defend-group-size 3) (set-strategic-number sn-maximum-defend-group-size 10) (disable-self) ) ; ==================== GOALS FEUDAL AGE ====================================================== ;;;;;;;;;;;;;;;;;; levels to accomplish ;;;;;;;;;;;;;;;;;;;;;;;;;;; ; start feudal age with goal-1 ; once goal-1 is achieved, then never reset it (defrule (current-age == feudal-age) (goal GOAL_FEUDAL_LEVEL_1 NO) ;(goal GOAL_FEUDAL_LEVEL_2 NO) (unit-type-count-total villager < feudal_age_villagers_1) (unit-type-count-total archer < feudal_age_archer_1 ) (unit-type-count-total skirmisher < feudal_age_skirmisher_1 ) (unit-type-count-total man-at-arms < feudal_age_man-at-arms_1 ) (unit-type-count-total spearman < feudal_age_spearman_1) => (set-goal GOAL_FEUDAL_LEVEL_1 YES) (set-goal GOAL_FEUDAL_LEVEL_2 NO) (chat-local-to-self "Goal-Level 1 set") (disable-self) ) ; check if we have achieved level 1. If yes the set level 2 (defrule (current-age == feudal-age) (goal GOAL_FEUDAL_LEVEL_1 YES) (unit-type-count-total villager >= feudal_age_villagers_1) (unit-type-count-total archer >= feudal_age_archer_1 ) (unit-type-count-total skirmisher >= feudal_age_skirmisher_1 ) (unit-type-count-total man-at-arms >= feudal_age_man-at-arms_1 ) (unit-type-count-total spearman >= feudal_age_spearman_1) => (set-goal GOAL_FEUDAL_LEVEL_1 NO) (set-goal GOAL_FEUDAL_LEVEL_2 YES) (taunt 11) (chat-local-to-self "Goal-Level 1 achieved, Goal-Level 2 set") (disable-self) ) ;;;;;;;;;; need stuff goals ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; The key idea is that we take villagers away only from that ; particular resource, that we have enough of and reassign them ; to the scarcer resource ; ORDER OF PREFERENCE ... FOOD > WOOD > GOLD > STONE ;;;;;;;;;;;;;;;;;; need food ;(right now not bothering with stone and gold becoz, there %age is already low) ; need food, enough wood (defrule (current-age == feudal-age) (goal I_NEED_FOOD NO) (food-amount < 200) (wood-amount > 800) => (set-goal I_NEED_FOOD YES) (set-goal I_NEED_WOOD NO) (set-goal I_NEED_GOLD NO) (set-goal I_NEED_STONE NO) (set-strategic-number sn-food-gatherer-percentage 55) (set-strategic-number sn-wood-gatherer-percentage 30) (chat-local-to-self "Turned Lumberjacks into Farmers ") ) ; reset if we have enough food now (defrule (current-age == feudal-age) (food-amount > 800) (goal I_NEED_FOOD YES) => (set-goal I_NEED_FOOD NO) (set-goal I_NEED_WOOD NO) (set-goal I_NEED_GOLD NO) (set-goal I_NEED_STONE NO) (set-strategic-number sn-food-gatherer-percentage 45) (set-strategic-number sn-gold-gatherer-percentage 10) (set-strategic-number sn-stone-gatherer-percentage 05) (set-strategic-number sn-wood-gatherer-percentage 40) ) ;;;;;;;;;;;;;;;;;; need wood ; need wood, enough food (defrule (current-age == feudal-age) (goal I_NEED_FOOD NO) (goal I_NEED_WOOD NO) (wood-amount < 200) (food-amount > 900) => (set-goal I_NEED_WOOD YES) (set-goal I_NEED_GOLD NO) (set-goal I_NEED_STONE NO) (set-strategic-number sn-food-gatherer-percentage 35) (set-strategic-number sn-wood-gatherer-percentage 50) (chat-local-to-self "Turned Farmers into Lumberjacks") ) ; reset if we have enough wood now (defrule (current-age == feudal-age) (wood-amount > 800) (goal I_NEED_WOOD YES) => (set-goal I_NEED_WOOD NO) (set-strategic-number sn-food-gatherer-percentage 45) (set-strategic-number sn-gold-gatherer-percentage 10) (set-strategic-number sn-stone-gatherer-percentage 05) (set-strategic-number sn-wood-gatherer-percentage 40) ) ; need wood, enough gold ;(defrule ; (current-age == feudal-age) ; (goal I_NEED_FOOD NO) ; (goal I_NEED_WOOD NO) ; (wood-amount < 200) ; (gold-amount > 350) ;=> ; (set-goal I_NEED_WOOD YES) ; (set-strategic-number sn-gold-gatherer-percentage 5) ; (set-strategic-number sn-wood-gatherer-percentage 45) ; (chat-local-to-self "Turned Gold Diggers into Lumberjacks") ;) ; need wood, enough stone ;(defrule ; (current-age == feudal-age) ; (goal I_NEED_FOOD NO) ; (goal I_NEED_WOOD NO) ; (wood-amount < 200) ; (stone-amount > 600);350 ;=> ; (set-goal I_NEED_WOOD YES) ; (set-strategic-number sn-stone-gatherer-percentage 0) ; (set-strategic-number sn-wood-gatherer-percentage 45) ; (chat-local-to-self "Turned Stoners into Lumberjacks") ;) ;;;;;;;;;;;;; need gold ; need gold, enough food (defrule (current-age == feudal-age) (goal I_NEED_FOOD NO) (goal I_NEED_WOOD NO) (goal I_NEED_GOLD NO) (food-amount > 1000) (gold-amount < 200) => (set-goal I_NEED_GOLD YES) (set-goal I_NEED_STONE NO) (set-strategic-number sn-food-gatherer-percentage 30) (set-strategic-number sn-gold-gatherer-percentage 25) (set-strategic-number sn-stone-gatherer-percentage 05) (set-strategic-number sn-wood-gatherer-percentage 40) (chat-local-to-self "Turned Farmers into Gold Diggers") ;(disable-self) ) ; need gold, enough stone (defrule (current-age == feudal-age) (goal I_NEED_FOOD NO) (goal I_NEED_WOOD NO) (goal I_NEED_GOLD NO) (stone-amount > 600);350 (gold-amount < 200) => (set-goal I_NEED_GOLD YES) (set-goal I_NEED_STONE NO) (set-strategic-number sn-food-gatherer-percentage 45) (set-strategic-number sn-gold-gatherer-percentage 15) (set-strategic-number sn-stone-gatherer-percentage 0) (set-strategic-number sn-wood-gatherer-percentage 40) (chat-local-to-self "Turned Stoners into Gold Diggers") ; (disable-self) ) ; need gold, enough wood (defrule (current-age == feudal-age) (goal I_NEED_FOOD NO) (goal I_NEED_WOOD NO) (goal I_NEED_GOLD NO) (wood-amount > 600) (gold-amount < 200) => (set-goal I_NEED_GOLD YES) (set-goal I_NEED_STONE NO) (set-strategic-number sn-food-gatherer-percentage 45) (set-strategic-number sn-gold-gatherer-percentage 20) (set-strategic-number sn-stone-gatherer-percentage 05) (set-strategic-number sn-wood-gatherer-percentage 30) (chat-local-to-self "Turned Lumberjacks into Gold Diggers") ; (disable-self) ) ; reset if we have enough gold now (defrule (current-age == feudal-age) (gold-amount > 350) (goal I_NEED_GOLD YES) => (set-goal I_NEED_GOLD NO) (set-strategic-number sn-food-gatherer-percentage 45) (set-strategic-number sn-gold-gatherer-percentage 10) (set-strategic-number sn-stone-gatherer-percentage 05) (set-strategic-number sn-wood-gatherer-percentage 40) ) ;(defrule ; (or ; (current-age == castle-age) ; (current-age == imperial-age) ;) ;(wood-amount < 200) ; => ;(set-goal need-wood-goal YES) ;) ; ============== BUILD LISTS - FEUDEL AGE =================================================== ; building villagers (defrule (current-age == feudal-age) (goal GOAL_FEUDAL_LEVEL_1 YES) (unit-type-count-total villager < feudal_age_villagers_1) (can-train villager) => (train villager) ;(chat-local-to-self "villager") ) (defrule (current-age == feudal-age) (unit-type-count-total villager < dark_age_villagers) (can-train-with-escrow villager) => (release-escrow food) (train villager) ;(chat-local-to-self "villager") ) (defrule (current-age == feudal-age) (goal GOAL_FEUDAL_LEVEL_2 YES) (unit-type-count-total villager < feudal_age_villagers_2) (can-train villager) => (train villager) ;(chat-local-to-self "villager") ) ;;;;;;;; building war units ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; building archers (defrule (current-age == feudal-age) (goal GOAL_FEUDAL_LEVEL_1 YES) (unit-type-count-total archer < feudal_age_archer_1) (can-train archer ) => (train archer) (chat-local-to-self "archer at ur service") ) (defrule (current-age == feudal-age) (goal GOAL_FEUDAL_LEVEL_1 YES) (unit-type-count-total archer < feudal_age_archer_1) (can-train-with-escrow archer ) => (release-escrow wood) (release-escrow gold) (train archer) (set-escrow-percentage wood 15) (set-escrow-percentage gold 15) (chat-local-to-self "archer at ur service-escrow") ) (defrule (current-age == feudal-age) (goal GOAL_FEUDAL_LEVEL_2 YES) (building-type-count-total archery-range > 0) (unit-type-count-total archer < feudal_age_archer_2) (can-train archer ) => (train archer) ;(chat-local-to-self "archer at ur service") ) ; building skirmisher ;(defrule ; (current-age == feudal-age) ; (goal GOAL_FEUDAL_LEVEL_1 YES) ; (unit-type-count-total skirmisher < feudal_age_skirmisher_1 ) ; (can-train-with-escrow skirmisher ) ;=> ; (release-escrow wood) ; (release-escrow food) ; (train skirmisher) ; (set-escrow-percentage wood 20) ; (set-escrow-percentage gold 20) ;(chat-local-to-self "skirmisher at ur service") ;) (defrule (current-age == feudal-age) (goal GOAL_FEUDAL_LEVEL_2 YES) (building-type-count-total archery-range > 0) (unit-type-count-total skirmisher < feudal_age_skirmisher_2 ) (can-train skirmisher ) => (train skirmisher) ;(chat-local-to-self "skirmisher at ur service") ) ; building man-at-arms ;(defrule ; (current-age == feudal-age) ; (goal GOAL_FEUDAL_LEVEL_1 YES) ; (unit-type-count-total man-at-arms < feudal_age_man-at-arms_1 ) ; (can-train-with-escrow man-at-arms) ;=> ; (release-escrow food) ; (release-escrow gold) ; (train man-at-arms) ; (set-escrow-percentage food 20) ; (set-escrow-percentage gold 20) ;(chat-local-to-self "man-at-arm at ur service") ;) (defrule (current-age == feudal-age) (goal GOAL_FEUDAL_LEVEL_2 YES) (unit-type-count-total man-at-arms < feudal_age_man-at-arms_2 ) (can-train man-at-arms) => (train man-at-arms) ;(chat-local-to-self "man-at-arm at ur service") ) ; building spearman (defrule (current-age == feudal-age) (goal GOAL_FEUDAL_LEVEL_1 YES) (unit-type-count-total spearman < feudal_age_spearman_1) (can-train spearman) => (train spearman) (chat-local-to-self "spearman at ur service") ) (defrule (current-age == feudal-age) (goal GOAL_FEUDAL_LEVEL_1 YES) (unit-type-count-total spearman < feudal_age_spearman_1) (can-train-with-escrow spearman) => (release-escrow wood) (release-escrow food) (train spearman) (set-escrow-percentage wood 15) (set-escrow-percentage food 15) (chat-local-to-self "spearman at ur service-escrow") ) (defrule (current-age == feudal-age) (goal GOAL_FEUDAL_LEVEL_2 YES) (unit-type-count-total spearman < feudal_age_spearman_2) (can-train spearman) => (train spearman) ;(chat-local-to-self "spearman at ur service") ) ;;;;;;; building army buildings ;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;; building civilian buildings ;;;;;;;;;;;;;;;;;;;;;;;;;; ; building a farm (defrule (current-age == feudal-age) ;(or ; (wood-amount > 150) ; (goal I_NEED_FOOD YES) ; ) (building-type-count-total farm < feudal_age_farms_1) (idle-farm-count < 1) (can-build farm) => (build farm) ;(chat-local-to-self "Farm Fudd !!!") ) ; if food is far away, then build a mill (defrule (current-age == feudal-age) (dropsite-min-distance food > feudal_age_min_distance) (can-build mill) => (build mill) ) ; if lumber camp is far away then build one (defrule (current-age == feudal-age) ;(goal GOAL_RESEARCHING_CASTLE 0) (resource-found wood) (building-type-count-total lumber-camp < feudal_age_max_camps) (dropsite-min-distance wood > feudal_age_min_distance) (can-build lumber-camp) => (build lumber-camp) ;(chat-local-to-self "Timber !!!") ) ; if mining camp is far away then build one (gold) (defrule (current-age == feudal-age) ;(goal GOAL_RESEARCHING_CASTLE 0) (resource-found gold) (building-type-count-total mining-camp < feudal_age_max_camps) (dropsite-min-distance gold > feudal_age_min_distance) (can-build mining-camp) => (build mining-camp) ;(chat-local-to-self "Glimmer !!!") ) ; if mining camp is far away then build one (stone) (defrule (current-age == feudal-age) ; (goal GOAL_RESEARCHING_CASTLE 0) (resource-found stone) (building-type-count-total mining-camp < feudal_age_max_camps) (dropsite-min-distance stone > feudal_age_min_distance) (can-build mining-camp) => (build mining-camp) ;(chat-local-to-self "Stone !!!") ) ; if #'s right then shuld not c the following messages (defrule (current-age == feudal-age) (building-type-count-total mining-camp == feudal_age_max_camps) => (chat-local-to-self "need more mining camps") (disable-self) ) (defrule (current-age == feudal-age) (building-type-count-total lumber-camp == feudal_age_max_camps) => (chat-local-to-self "need more lumber camps") (disable-self) ) ; =========================================================================================================================== ; ============== CASTLE AGE ================================================================================================= ; =========================================================================================================================== ; rule to advance to next age (defrule (current-age == castle-age) (can-research imperial-age) (goal GOAL_FEUDAL_LEVEL_2 YES) (goal GOAL_RESEARCHING_IMPERIAL NO) => (research imperial-age) (chat-local-to-self "Researching IMPERIAL Age level-2") (set-goal GOAL_RESEARCHING_IMPERIAL YES) (disable-self) ) (defrule (current-age == castle-age) (can-research-with-escrow imperial-age) (goal GOAL_FEUDAL_LEVEL_2 YES) (goal GOAL_RESEARCHING_IMPERIAL NO) => (release-escrow food) (release-escrow gold) (research imperial-age) (chat-local-to-self "Researching IMPERIAL Age level-2 Escrow") (set-goal GOAL_RESEARCHING_IMPERIAL YES) (disable-self) ) (defrule (current-age == castle-age) (can-research imperial-age) (food-amount > 1000) (gold-amount > 300) (goal GOAL_RESEARCHING_IMPERIAL NO) => (research imperial-age) (chat-local-to-self "Researching IMPERIAL ") (set-goal GOAL_RESEARCHING_IMPERIAL YES) (disable-self) ) (defrule (current-age == castle-age) (can-research-with-escrow imperial-age) (goal GOAL_RESEARCHING_IMPERIAL NO) => (release-escrow food) (release-escrow gold) (research imperial-age) (chat-local-to-self "Researching IMPERIAL with escrow") (set-goal GOAL_RESEARCHING_IMPERIAL YES) (disable-self) ) ; make sure we have reached castle age (defrule (current-age == castle-age) => (set-goal GOAL_RESEARCHING_CASTLE NO) (set-goal IN_CASTLE_OR_IMPERIAL YES) (chat-local-to-self "Made it to Castle Age") (release-escrow food) (release-escrow wood) (release-escrow gold) (taunt 11) (disable-self) ) ; rest all need-stuff goals (defrule (current-age == castle-age) => (set-goal I_NEED_FOOD NO) ;5 (set-goal I_NEED_WOOD NO) ;6 (set-goal I_NEED_GOLD NO) ;7 (set-goal I_NEED_STONE NO) ;8 (set-goal DRASTIC_CIVIL_TIMES NO) (disable-self) ) (defrule (current-age == castle-age) => ;(set-escrow-percentage wood 0) (set-escrow-percentage food 15) (set-escrow-percentage gold 25) ;(set-escrow-percentage stone 0) (release-escrow wood) (chat-local-to-self "Escrow set for castle") (disable-self) ) ; ======================= CONSTANTS FOR CASTLE AGE ==================================================== (defconst castle_age_villagers_1 54) (defconst castle_age_villagers_2 54) (defconst castle_age_monk_1 2) (defconst castle_age_monk_2 4) (defconst elephant 2) (defconst castle_age_crossbowman_1 4) (defconst castle_age_elite-skirmisher_1 5) (defconst castle_age_cavalry-archer_1 1) (defconst castle_age_long-swordsman_1 3) (defconst castle_age_pikeman_1 6) (defconst castle_age_camel_1 3) ;(defconst castle_age_knight_1 0) (defconst castle_age_mangonel_1 1) (defconst castle_age_scorpion_1 1) (defconst castle_age_crossbowman_2 7) (defconst castle_age_elite-skirmisher_2 8) (defconst castle_age_cavalry-archer_2 4) (defconst castle_age_long-swordsman_2 7) (defconst castle_age_pikeman_2 7) (defconst castle_age_camel_2 5) ;(defconst castle_age_knight_2 0) (defconst castle_age_mangonel_2 3) (defconst castle_age_scorpion_2 3) (defconst castle_age_crossbowman_3 10) (defconst castle_age_elite-skirmisher_3 12) (defconst castle_age_cavalry-archer_3 10) (defconst castle_age_long-swordsman_3 10) (defconst castle_age_pikeman_3 10) (defconst castle_age_camel_3 8) ;(defconst castle_age_knight_3 0) (defconst castle_age_mangonel_3 4) (defconst castle_age_scorpion_3 4) ; =============== VILLAGER ASSIGNMENT - CASTLE AGE =============================================== (defrule (current-age == castle-age) => (set-strategic-number sn-percent-civilian-explorers 0) (set-strategic-number sn-percent-civilian-builders 20) (set-strategic-number sn-percent-civilian-gatherers 80) (set-strategic-number sn-food-gatherer-percentage 30) (set-strategic-number sn-gold-gatherer-percentage 20) (set-strategic-number sn-stone-gatherer-percentage 20) (set-strategic-number sn-wood-gatherer-percentage 30) (set-strategic-number sn-maximum-wood-drop-distance -1) ; we are looking further away for stuff compared to dark-ages (set-strategic-number sn-maximum-gold-drop-distance -1) (set-strategic-number sn-maximum-stone-drop-distance -1) (set-strategic-number sn-maximum-food-drop-distance -1) (set-strategic-number sn-maximum-hunt-drop-distance 10) (set-strategic-number sn-maximum-fish-boat-drop-distance 10) (disable-self) ) (defrule (current-age == castle-age) => (set-strategic-number sn-group-commander-selection-method 2); unit with most range is the commander ;(set-strategic-number sn-number-attack-groups 0) ;strategic numbers for attack ;(set-strategic-number sn-minimum-attack-group-size 5) ;(set-strategic-number sn-maximum-attack-group-size 10) (set-strategic-number sn-number-defend-groups 5);strategic numbers for defence (set-strategic-number sn-minimum-defend-group-size 4) (set-strategic-number sn-maximum-defend-group-size 10) (disable-self) ) ; ==================== GOALS - CASTLE AGE =============================== ;;;;;;;;;;;;;;;;;; CIVIL goals to accomplish ;;;;;;;;;;;;;;;;;;;;;;;;;;; ; start castle age with goal-1 (defrule (current-age == castle-age) (goal GOAL_CIVIL_CASTLE_LEVEL_1 NO) ;(goal GOAL_FEUDAL_LEVEL_2 NO) (unit-type-count-total villager < castle_age_villagers_1) (unit-type-count-total monk < castle_age_monk_1) => (set-goal GOAL_CIVIL_CASTLE_LEVEL_1 YES) (set-goal GOAL_CIVIL_CASTLE_LEVEL_2 NO) (chat-local-to-self "Goal CIVIL 1 set") (disable-self) ) ; check if we have achieved level 1. If yes the set level 2 ; we need a monastery (defrule (current-age == castle-age) (goal GOAL_CIVIL_CASTLE_LEVEL_1 YES) (goal GOAL_CIVIL_CASTLE_LEVEL_2 NO) (unit-type-count-total villager >= castle_age_villagers_1) (unit-type-count-total monk >= castle_age_monk_1) (building-type-count-total monastery > 0) => (set-goal GOAL_CIVIL_CASTLE_LEVEL_1 NO) (set-goal GOAL_CIVIL_CASTLE_LEVEL_2 YES) ;(set-strategic-number sn-percent-civilian-builders 10) ;(set-strategic-number sn-percent-civilian-gatherers 90) (chat-local-to-self "Goal CIVIL 1 achieved, Goal CIVIL 2 set") ) ;;;;;;;;;;;;;;;;;; ARMY goals to accomplish ;;;;;;;;;;;;;;;;;;;;;;;;;;; ; start castle age with goal-1 (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_1 NO) ;(goal GOAL_FEUDAL_LEVEL_2 NO) (unit-type-count-total crossbowman < castle_age_crossbowman_1 ) (unit-type-count-total cavalry-archer < castle_age_cavalry-archer_1 ) (unit-type-count-total long-swordsman < castle_age_long-swordsman_1 ) (unit-type-count-total pikeman < castle_age_pikeman_1 ) (unit-type-count-total camel < castle_age_camel_1) ;(unit-type-count-total knight < castle_age_knight_1) => (set-goal GOAL_ARMY_CASTLE_LEVEL_1 YES) (set-goal GOAL_ARMY_CASTLE_LEVEL_2 NO) (set-goal GOAL_ARMY_CASTLE_LEVEL_3 NO) (chat-local-to-self "Goal ARMY 1 set") (disable-self) ) ; check if we have achieved level 1. If yes the set level 2 (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_2 NO) (unit-type-count-total crossbowman >= castle_age_crossbowman_1 ) (unit-type-count-total cavalry-archer >= castle_age_cavalry-archer_1 ) (unit-type-count-total long-swordsman >= castle_age_long-swordsman_1 ) (unit-type-count-total pikeman >= castle_age_pikeman_1 ) (unit-type-count-total camel >= castle_age_camel_1) ;(unit-type-count-total knight >= castle_age_knight_1) => (set-goal GOAL_ARMY_CASTLE_LEVEL_1 NO) (set-goal GOAL_ARMY_CASTLE_LEVEL_2 YES) (set-goal GOAL_ARMY_CASTLE_LEVEL_3 NO) (chat-local-to-self "Goal ARMY 1 achieved, Goal ARMY 2 set") (disable-self) ) ; check if we have achieved level 1. If yes the set level 2 (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_2 NO) (military-population > 25) => (set-goal GOAL_ARMY_CASTLE_LEVEL_1 NO) (set-goal GOAL_ARMY_CASTLE_LEVEL_2 YES) (set-goal GOAL_ARMY_CASTLE_LEVEL_3 NO) (chat-local-to-self "Goal ARMY 1 achieved, Goal ARMY 2 set") (disable-self) ) ; check if we have achieved level 2. If yes the set level 3 (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_1 NO) (goal GOAL_ARMY_CASTLE_LEVEL_2 YES) (goal GOAL_ARMY_CASTLE_LEVEL_3 NO) (unit-type-count-total crossbowman >= castle_age_crossbowman_2 ) (unit-type-count-total cavalry-archer >= castle_age_cavalry-archer_2 ) (unit-type-count-total long-swordsman >= castle_age_long-swordsman_2 ) (unit-type-count-total pikeman >= castle_age_pikeman_2 ) (unit-type-count-total camel >= castle_age_camel_2) ;(unit-type-count-total knight >= castle_age_knight_2) (unit-type-count-total mangonel >= castle_age_mangonel_2) => (set-goal GOAL_ARMY_CASTLE_LEVEL_1 NO) (set-goal GOAL_ARMY_CASTLE_LEVEL_2 NO) (set-goal GOAL_ARMY_CASTLE_LEVEL_3 YES) (chat-local-to-self "Goal ARMY 2 achieved, Goal ARMY 3 set") ) ; ============== BUILD LISTS - CASTLE AGE ============================== ; building villagers ;(defrule ; (current-age == castle-age) ; (goal GOAL_CIVIL_CASTLE_LEVEL_1 YES) ; (unit-type-count-total villager < castle_age_villagers_1) ; (can-train villager) ;=> ; (train villager) ;(chat-local-to-self "villager") ;) (defrule (current-age == castle-age) ; (goal GOAL_CIVIL_CASTLE_LEVEL_2 YES) (unit-type-count-total villager < castle_age_villagers_2) (can-train villager) => (train villager) ;(chat-local-to-self "villager") ) ; building monks (defrule (current-age == castle-age) (goal GOAL_CIVIL_CASTLE_LEVEL_1 YES) (unit-type-count-total monk < castle_age_monk_1) (can-train monk ) => (train monk ) ;(chat-local-to-self "Jai Monk baba ") ) (defrule (current-age == castle-age) (goal GOAL_CIVIL_CASTLE_LEVEL_1 YES) (unit-type-count-total monk < castle_age_monk_1) (can-train-with-escrow monk ) => (release-escrow gold) (train monk ) (set-escrow-percentage gold 25) (chat-local-to-self "Jai Monk baba - ESCROW ") ) (defrule (current-age == castle-age) (goal GOAL_CIVIL_CASTLE_LEVEL_2 YES) (unit-type-count-total monk < castle_age_monk_2) (can-train monk ) => (train monk ) ;(chat-local-to-self "Jai Monk baba ") ) ;;;;;;;; building war units ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;; building crossbow (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_1 YES) (unit-type-count-total archer-line < castle_age_crossbowman_1) (can-train archer-line ) => (train archer-line ) ;(chat-local-to-self "crossbowman at ur service") ) (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_2 YES) (unit-type-count-total archer-line < castle_age_crossbowman_2) (can-train archer-line ) => (train archer-line ) ;(chat-local-to-self "crossbowman at ur service") ) (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_3 YES) (unit-type-count-total archer-line < castle_age_crossbowman_3) (can-train archer-line ) => (train archer-line ) ;(chat-local-to-self "crossbowman at ur service") ) ;;;;;;;;;; building elite-skirmisher (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_1 YES) (unit-type-count-total skirmisher-line < castle_age_elite-skirmisher_1) (can-train skirmisher-line ) => (train skirmisher-line ) ;(chat-local-to-self "elite-skirmisher at ur service") ) (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_2 YES) (unit-type-count-total skirmisher-line < castle_age_elite-skirmisher_2) (can-train skirmisher-line ) => (train skirmisher-line ) ;(chat-local-to-self "elite-skirmisherat ur service") ) (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_3 YES) (unit-type-count-total skirmisher-line < castle_age_elite-skirmisher_3) (can-train skirmisher-line ) => (train skirmisher-line ) ;(chat-local-to-self "elite-skirmisherat ur service") ) ;;;;;;; building cavalry-archer (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_1 YES) (unit-type-count-total cavalry-archer < castle_age_cavalry-archer_1) (can-train cavalry-archer) => (train cavalry-archer) ;(chat-local-to-self "cavalry-archer at ur service") ) (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_2 YES) (unit-type-count-total cavalry-archer < castle_age_cavalry-archer_2) (can-train cavalry-archer) => (train cavalry-archer) ;(chat-local-to-self "cavalry-archer at ur service") ) (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_3 YES) (unit-type-count-total cavalry-archer < castle_age_cavalry-archer_3) (can-train cavalry-archer) => (train cavalry-archer) ;(chat-local-to-self "cavalry-archer at ur service") ) ;;;;;;;;;; building long-swordsman (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_1 YES) (unit-type-count-total militiaman-line < castle_age_long-swordsman_1) (can-train militiaman-line ) => (train militiaman-line ) ;(chat-local-to-self "long-swordsman at ur service") ) (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_2 YES) (unit-type-count-total militiaman-line < castle_age_long-swordsman_2) (can-train militiaman-line ) => (train militiaman-line ) ;(chat-local-to-self "long-swordsman at ur service") ) (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_3 YES) (unit-type-count-total militiaman-line < castle_age_long-swordsman_3) (can-train militiaman-line ) => (train militiaman-line ) ;(chat-local-to-self "long-swordsman at ur service") ) ;;;;;;;;;; building pikeman (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_1 YES) (unit-type-count-total spearman-line < castle_age_pikeman_1) (can-train spearman-line ) => (train spearman-line ) ;(chat-local-to-self "pikeman-1 at ur service") ) (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_2 YES) (unit-type-count-total spearman-line < castle_age_pikeman_2) (can-train spearman-line ) => (train spearman-line ) ;(chat-local-to-self "pikeman-2 at ur service") ) (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_3 YES) (unit-type-count-total spearman-line < castle_age_pikeman_3) (can-train spearman-line ) => (train spearman-line ) ;(chat-local-to-self "pikeman-3 at ur service") ) ;;;;;;;;;; building camel (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_1 YES) (unit-type-count-total camel < castle_age_crossbowman_1) (can-train camel) => (train camel) ;(chat-local-to-self "camel at ur service") ) (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_2 YES) (unit-type-count-total camel < castle_age_crossbowman_2) (can-train camel) => (train camel) ;(chat-local-to-self "camel at ur service") ) (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_3 YES) (unit-type-count-total camel < castle_age_crossbowman_3) (can-train camel) => (train camel) ;(chat-local-to-self "camel at ur service") ) ;;;;;;;;;;;; seige-worshop items ; mangonal (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_1 YES) (unit-type-count-total mangonel < castle_age_mangonel_1 ) (can-train mangonel ) => (train mangonel ) (chat-local-to-self "mangonel at ur service-level-1") ) (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_2 YES) (unit-type-count-total mangonel < castle_age_mangonel_2 ) (can-train mangonel ) => (train mangonel ) (chat-local-to-self "mangonel at ur service-level-2") ) (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_3 YES) (unit-type-count-total mangonel < castle_age_mangonel_3 ) (can-train mangonel ) => (train mangonel ) (chat-local-to-self "mangonel at ur service-level-3") ) ; scorpian (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_1 YES) (unit-type-count-total scorpion < castle_age_scorpion_1 ) (can-train scorpion ) => (train scorpion ) (chat-local-to-self "scorpion at ur service-level-1") ) (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_2 YES) (unit-type-count-total scorpion < castle_age_scorpion_2 ) (can-train scorpion ) => (train scorpion ) (chat-local-to-self "scorpion at ur service-level-2") ) (defrule (current-age == castle-age) (goal GOAL_ARMY_CASTLE_LEVEL_3 YES) (unit-type-count-total scorpion < castle_age_scorpion_3 ) (can-train scorpion ) => (train scorpion ) (chat-local-to-self "scorpion at ur service-level-3") ) ;;;;;;;;;;;;; build my elephant only if i have castle (defrule (current-age == castle-age) ; (goal GOAL_ARMY_CASTLE_LEVEL_2 YES) (unit-type-count-total my-unique-unit < elephant) (unit-type-count-total monk > 1) (can-train my-unique-unit ) => (train my-unique-unit ) (chat-local-to-self "elephant at ur service") ) ;;;;;;; building army buildings ;;;;;;;;;;;;;;;;;;;;;;;;;; ;=========================================================================================================================== ; =============== IMPERIAL AGE ============================================================================================ ;=========================================================================================================================== ; make sure we have reached castle age (defrule (current-age == imperial-age) => (set-goal GOAL_RESEARCHING_IMPERIAL NO) (chat-local-to-self "Made it to Imperial Age") (set-goal GOAL_ARMY_IMPERIAL_LEVEL_1 YES) (taunt 11) (disable-self) ) ; rest all need-stuff goals (defrule (current-age == imperial-age) => (set-goal I_NEED_FOOD NO) ;5 (set-goal I_NEED_WOOD NO) ;6 (set-goal I_NEED_GOLD NO) ;7 (set-goal I_NEED_STONE NO) ;8 (set-goal DRASTIC_CIVIL_TIMES NO) (disable-self) ) ; setting excrow for imperial (defrule (current-age == imperial-age) => (set-escrow-percentage wood 0) (set-escrow-percentage food 15) (set-escrow-percentage gold 15) (set-escrow-percentage stone 0) (chat-local-to-self "Escrow set for imperial") (disable-self) ) ; =============== VILLAGER ASSIGNMENT - IMPERIAL AGE =============================================== (defrule (current-age == imperial-age) => (set-strategic-number sn-percent-civilian-explorers 0) (set-strategic-number sn-percent-civilian-builders 15) (set-strategic-number sn-percent-civilian-gatherers 85) (set-strategic-number sn-food-gatherer-percentage 30) (set-strategic-number sn-gold-gatherer-percentage 20) (set-strategic-number sn-stone-gatherer-percentage 15) (set-strategic-number sn-wood-gatherer-percentage 35) (set-strategic-number sn-maximum-wood-drop-distance -1) ; we are looking further away for stuff compared to dark-ages (set-strategic-number sn-maximum-gold-drop-distance -1) (set-strategic-number sn-maximum-stone-drop-distance -1) (set-strategic-number sn-maximum-food-drop-distance -1) (set-strategic-number sn-maximum-hunt-drop-distance 10) (set-strategic-number sn-maximum-fish-boat-drop-distance 10) (disable-self) ) (defrule (current-age == imperial-age) => (set-strategic-number sn-group-commander-selection-method 2); unit with most range is the commander (set-strategic-number sn-number-attack-groups 5) ;strategic numbers for attack (set-strategic-number sn-minimum-attack-group-size 5) (set-strategic-number sn-maximum-attack-group-size 10) (set-strategic-number sn-number-defend-groups 1);strategic numbers for defence (set-strategic-number sn-minimum-defend-group-size 5) (set-strategic-number sn-maximum-defend-group-size 10) (disable-self) ) ; ======================= CONSTANTS FOR IMPERIAL AGE ==================================================== (defconst imperial_age_villagers_1 55) (defconst imperial_age_monk_1 2) (defconst imperial_age_monk_2 4) ;archery (defconst imperial_age_archer-line_1 0) ; die (defconst imperial_age_skirmisher-line_1 5) (defconst imperial_age_cavalry-archer-line_1 0) ; die (defconst imperial_age_hand-cannoneer_1 6) ; barracks (defconst imperial_age_militiaman-line_1 7) (defconst imperial_age_spearman-line_1 7) ; exceptional vs cav ;stable (defconst imperial_age_camel-line_1 5) (defconst imperial_age_knight-line_1 0) ; die ; castle (defconst imperial_age_my-unique-unit-line_1 1) (defconst imperial_age_trebuchet_1 2) ; seige-workshop (defconst imperial_age_scorpion-line_1 3) (defconst imperial_age_mangonel-line_1 3) ;archery (defconst imperial_age_archer-line_2 0) ; die (defconst imperial_age_skirmisher-line_2 10) (defconst imperial_age_cavalry-archer-line_2 0) ; die (defconst imperial_age_hand-cannoneer_2 13) ; barracks (defconst imperial_age_militiaman-line_2 10) (defconst imperial_age_spearman-line_2 10) ; exceptional vs cav ;stable (defconst imperial_age_camel-line_2 10) (defconst imperial_age_knight-line_2 0) ; die ; castle (defconst imperial_age_my-unique-unit-line_2 1) (defconst imperial_age_trebuchet_2 4) ; seige-workshop (defconst imperial_age_scorpion-line_2 5) (defconst imperial_age_mangonel-line_2 5) ;;;;;;;;;;;;;;;;;; ARMY goals to accomplish ;;;;;;;;;;;;;;;;;;;;;;;;;;; ; release all escrow (defrule (research-completed ri-chemistry) (research-completed ri-hand-cannon) (unit-type-count-total hand-cannoneer >= imperial_age_hand-cannoneer_1) => (set-goal HAND_CANNONEER_READY YES) (disable-self) ) (defrule (goal HAND_CANNONEER_READY YES) (escrow-amount gold > 0) => (release-escrow gold) (chat-local-to-self "All escrow-gold-released") ) (defrule (goal HAND_CANNONEER_READY YES) (escrow-amount wood > 0) => (release-escrow wood) (chat-local-to-self "All escrow-wood-released") ) (defrule (goal HAND_CANNONEER_READY YES) (escrow-amount food > 0) => (release-escrow food) (chat-local-to-self "All escrow-food-released") ) ; start imperial age with goal-1 (defrule (current-age == imperial-age) (goal GOAL_ARMY_IMPERIAL_LEVEL_1 NO) ;(goal GOAL_FEUDAL_LEVEL_2 NO) (unit-type-count-total skirmisher-line < imperial_age_skirmisher-line_1 ) (unit-type-count-total hand-cannoneer < imperial_age_hand-cannoneer_1 ) (unit-type-count-total militiaman-line < imperial_age_militiaman-line_1 ) (unit-type-count-total spearman-line < imperial_age_spearman-line_1 ) (unit-type-count-total camel-line < imperial_age_camel-line_1) (unit-type-count-total my-unique-unit-line < imperial_age_my-unique-unit-line_1) (unit-type-count-total scorpion-line < imperial_age_scorpion-line_1 ) (unit-type-count-total mangonel-line < imperial_age_mangonel-line_1 ) => (set-goal GOAL_ARMY_IMPERIAL_LEVEL_1 YES) (set-goal GOAL_ARMY_IMPERIAL_LEVEL_2 NO) (chat-local-to-self "Goal ARMY 1 set - Imperial") (disable-self) ) (defrule (current-age == imperial-age) (goal GOAL_ARMY_IMPERIAL_LEVEL_1 YES) (goal GOAL_ARMY_IMPERIAL_LEVEL_2 NO) (unit-type-count-total skirmisher-line >= imperial_age_skirmisher-line_2 ) (unit-type-count-total hand-cannoneer >= imperial_age_hand-cannoneer_2 ) (unit-type-count-total militiaman-line >= imperial_age_militiaman-line_2 ) (unit-type-count-total spearman-line >= imperial_age_spearman-line_2 ) (unit-type-count-total camel-line >= imperial_age_camel-line_2) (unit-type-count-total my-unique-unit-line >= imperial_age_my-unique-unit-line_2) (unit-type-count-total scorpion-line >= imperial_age_scorpion-line_2 ) (unit-type-count-total mangonel-line >= imperial_age_mangonel-line_2 ) => (set-goal GOAL_ARMY_IMPERIAL_LEVEL_1 NO) (set-goal GOAL_ARMY_IMPERIAL_LEVEL_2 YES) (chat-local-to-self "Goal ARMY 1 set - Imperial") (disable-self) ) ; ============== BUILD LISTS - IMPERIAL AGE ============================== (defrule (current-age == imperial-age) ; (goal GOAL_CIVIL_CASTLE_LEVEL_2 YES) (unit-type-count-total villager < imperial_age_villagers_1) (can-train villager) => (train villager) ;(chat-local-to-self "villager") ) ; building monks (defrule (current-age == imperial-age) (goal GOAL_ARMY_IMPERIAL_LEVEL_1 YES) (unit-type-count-total monk < imperial_age_monk_1) (can-train monk ) => (train monk ) (chat-local-to-self "Jai Monk baba ") ) (defrule (current-age == imperial-age) (goal GOAL_ARMY_IMPERIAL_LEVEL_2 YES) (unit-type-count-total monk < imperial_age_monk_2) (can-train monk ) => (train monk ) (chat-local-to-self "Jai Monk baba ") ) ;;;;;;;; building war units ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;; building hand-cannoneer (defrule (current-age == imperial-age) (goal GOAL_ARMY_IMPERIAL_LEVEL_1 YES) (unit-type-count-total hand-cannoneer < imperial_age_hand-cannoneer_1 ) (can-train hand-cannoneer ) => (train hand-cannoneer ) ;(chat-local-to-self "skirmisher at ur service") ) (defrule (current-age == imperial-age) (goal GOAL_ARMY_IMPERIAL_LEVEL_1 YES) (unit-type-count-total hand-cannoneer < imperial_age_hand-cannoneer_1 ) (can-train-with-escrow hand-cannoneer ) => (release-escrow food) (release-escrow gold) (train hand-cannoneer ) (set-escrow-percentage food 15) (set-escrow-percentage gold 15) (chat-local-to-self "hand-cannoneer with-escrow") ) (defrule (current-age == imperial-age) (goal GOAL_ARMY_IMPERIAL_LEVEL_2 YES) (unit-type-count-total hand-cannoneer < imperial_age_hand-cannoneer_2 ) (can-train hand-cannoneer ) => (train hand-cannoneer ) ;(chat-local-to-self "skirmisher at ur service") ) ;;;;;;;;;; building skirmisher-line (defrule (current-age == imperial-age) (goal GOAL_ARMY_IMPERIAL_LEVEL_1 YES) (unit-type-count-total skirmisher-line < imperial_age_skirmisher-line_1 ) (can-train skirmisher-line ) => (train skirmisher-line ) ;(chat-local-to-self "crossbowman at ur service") ) (defrule (current-age == imperial-age) (goal GOAL_ARMY_IMPERIAL_LEVEL_2 YES) (unit-type-count-total skirmisher-line < imperial_age_skirmisher-line_2 ) (can-train skirmisher-line ) => (train skirmisher-line ) ;(chat-local-to-self "crossbowman at ur service") ) ;;;;;;;;;; building militiaman-line (defrule (current-age == imperial-age) (goal GOAL_ARMY_IMPERIAL_LEVEL_1 YES) (unit-type-count-total militiaman-line < imperial_age_militiaman-line_1 ) (can-train militiaman-line ) => (train militiaman-line ) ;(chat-local-to-self "militiaman at ur service") ) (defrule (current-age == imperial-age) (goal GOAL_ARMY_IMPERIAL_LEVEL_2 YES) (unit-type-count-total militiaman-line < imperial_age_militiaman-line_2 ) (can-train militiaman-line ) => (train militiaman-line ) ;(chat-local-to-self "militiaman at ur service") ) ;;;;;;;;;; building spearman-line (defrule (current-age == imperial-age) (goal GOAL_ARMY_IMPERIAL_LEVEL_1 YES) (unit-type-count-total spearman-line < imperial_age_spearman-line_1 ) (can-train spearman-line ) => (train spearman-line ) ;(chat-local-to-self "spearman at ur service") ) (defrule (current-age == imperial-age) (goal GOAL_ARMY_IMPERIAL_LEVEL_2 YES) (unit-type-count-total spearman-line < imperial_age_spearman-line_2 ) (can-train spearman-line ) => (train spearman-line ) ;(chat-local-to-self "spearman at ur service") ) ;;;;;;;;;; building camel-line (defrule (current-age == imperial-age) (goal GOAL_ARMY_IMPERIAL_LEVEL_1 YES) (unit-type-count-total camel-line < imperial_age_camel-line_1 ) (can-train camel-line ) => (train camel-line ) ;(chat-local-to-self "camel at ur service") ) (defrule (current-age == imperial-age) (goal GOAL_ARMY_IMPERIAL_LEVEL_2 YES) (unit-type-count-total camel-line < imperial_age_camel-line_2 ) (can-train camel-line ) => (train camel-line ) ;(chat-local-to-self "camel at ur service") ) ;;;;;;;;;; building my-unique-unit-line (defrule (current-age == imperial-age) (goal GOAL_ARMY_IMPERIAL_LEVEL_1 YES) (unit-type-count-total my-unique-unit-line < imperial_age_my-unique-unit-line_1 ) (can-train my-unique-unit-line ) => (train my-unique-unit-line ) ;(chat-local-to-self "my-unique-unit at ur service") ) (defrule (current-age == imperial-age) (goal GOAL_ARMY_IMPERIAL_LEVEL_2 YES) (unit-type-count-total my-unique-unit-line < imperial_age_my-unique-unit-line_2 ) (can-train my-unique-unit-line ) => (train my-unique-unit-line ) ;(chat-local-to-self "my-unique-unit at ur service") ) ;;;;;;;;;; building trebuchet (defrule (current-age == imperial-age) (goal GOAL_ARMY_IMPERIAL_LEVEL_1 YES) (unit-type-count-total trebuchet < imperial_age_trebuchet_1 ) (can-train trebuchet) => (train trebuchet) ;(chat-local-to-self "my-unique-unit at ur service") ) (defrule (current-age == imperial-age) (goal GOAL_ARMY_IMPERIAL_LEVEL_2 YES) (unit-type-count-total trebuchet < imperial_age_trebuchet_2 ) (can-train trebuchet) => (train trebuchet) ;(chat-local-to-self "my-unique-unit at ur service") ) ;;;;;;;;;; building scorpion-line (defrule (current-age == imperial-age) (goal GOAL_ARMY_IMPERIAL_LEVEL_1 YES) (unit-type-count-total scorpion-line < imperial_age_scorpion-line_1 ) (can-train scorpion-line ) => (train scorpion-line ) ;(chat-local-to-self "scorpionat ur service") ) (defrule (current-age == imperial-age) (goal GOAL_ARMY_IMPERIAL_LEVEL_2 YES) (unit-type-count-total scorpion-line < imperial_age_scorpion-line_2 ) (can-train scorpion-line ) => (train scorpion-line ) ;(chat-local-to-self "scorpionat ur service") ) ;;;;;;;;;; building mangonel-line (defrule (current-age == imperial-age) (goal GOAL_ARMY_IMPERIAL_LEVEL_1 YES) (unit-type-count-total mangonel-line < imperial_age_mangonel-line_1 ) (can-train mangonel-line ) => (train mangonel-line ) ;(chat-local-to-self "scorpionat ur service") ) (defrule (current-age == imperial-age) (goal GOAL_ARMY_IMPERIAL_LEVEL_2 YES) (unit-type-count-total mangonel-line < imperial_age_mangonel-line_2 ) (can-train mangonel-line ) => (train mangonel-line ) ;(chat-local-to-self "scorpionat ur service") ) ;=========================================================================================================================== ; =============== NEED STUFF GOALS FOR CASTLE & IMPERIAL =================================================================== ; =============== CIVILIAN BUILD LIST FOR CASTLE & IMPERIAL ================================================================ ;=========================================================================================================================== ;;;;;;;;;;;; drastic-time need stuff goals ;;;;;;;;;;;;;;;;;;;;;; (defrule (goal IN_CASTLE_OR_IMPERIAL YES) (goal DRASTIC_CIVIL_TIMES NO) (food-amount < 50) (wood-amount < 50) => (set-goal DRASTIC_CIVIL_TIMES YES) ;(set-goal I_NEED_WOOD YES) (set-strategic-number sn-food-gatherer-percentage 5) (set-strategic-number sn-gold-gatherer-percentage 10) (set-strategic-number sn-stone-gatherer-percentage 5) (set-strategic-number sn-wood-gatherer-percentage 80) (chat-local-to-self "Drastic civil measures") ) ;reset if enuff wood (defrule (goal IN_CASTLE_OR_IMPERIAL YES) (goal DRASTIC_CIVIL_TIMES YES) (wood-amount > 350) => (set-goal DRASTIC_CIVIL_TIMES NO) ;(set-goal I_NEED_WOOD YES) (set-strategic-number sn-food-gatherer-percentage 30) (set-strategic-number sn-gold-gatherer-percentage 20) (set-strategic-number sn-stone-gatherer-percentage 20) (set-strategic-number sn-wood-gatherer-percentage 30) (chat-local-to-self "Drastic civil measures over") ) ;;;;;;;;;; need stuff goals ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; The key idea is that we take villagers away only from that ; particular resource, that we have enough of and reassign them ; to the scarcer resource ; ORDER OF PREFERENCE ... FOOD > GOLD > WOOD > STONE ;;;;;;;;;;;;;;;;;; need food ;(right now not bothering with gold becoz, there %age is already low) ; need food, enough wood (defrule (goal IN_CASTLE_OR_IMPERIAL YES) (goal DRASTIC_CIVIL_TIMES NO) (goal I_NEED_FOOD NO) (food-amount < crtical_food_amount ) (wood-amount > 800) => (set-goal I_NEED_FOOD YES) (set-goal I_NEED_WOOD NO) (set-goal I_NEED_GOLD NO) (set-goal I_NEED_STONE NO) (set-strategic-number sn-food-gatherer-percentage 45) (set-strategic-number sn-gold-gatherer-percentage 20) (set-strategic-number sn-stone-gatherer-percentage 20) (set-strategic-number sn-wood-gatherer-percentage 15) (chat-local-to-self "Turned Lumberjacks into Farmers ") ) ; need food, enough stone (defrule (goal IN_CASTLE_OR_IMPERIAL YES) (goal DRASTIC_CIVIL_TIMES NO) (goal I_NEED_FOOD NO) (food-amount < crtical_food_amount ) (stone-amount > 600) => (set-goal I_NEED_FOOD YES) (set-goal I_NEED_WOOD NO) (set-goal I_NEED_GOLD NO) (set-goal I_NEED_STONE NO) (set-strategic-number sn-food-gatherer-percentage 45) (set-strategic-number sn-gold-gatherer-percentage 20) (set-strategic-number sn-stone-gatherer-percentage 05) (set-strategic-number sn-wood-gatherer-percentage 30) (chat-local-to-self "Turned Stoners into Farmers ") ) ; reset if we have enough food now (defrule (goal IN_CASTLE_OR_IMPERIAL YES) (food-amount > 500) (goal I_NEED_FOOD YES) => (set-goal I_NEED_FOOD NO) (set-strategic-number sn-food-gatherer-percentage 30) (set-strategic-number sn-gold-gatherer-percentage 20) (set-strategic-number sn-stone-gatherer-percentage 20) (set-strategic-number sn-wood-gatherer-percentage 30) (chat-local-to-self "Reset need food") ) ;;;;;;;;;;; need gold ; need gold, enough food (defrule (goal IN_CASTLE_OR_IMPERIAL YES) (goal DRASTIC_CIVIL_TIMES NO) (goal I_NEED_FOOD NO) (goal I_NEED_GOLD NO) ;(goal I_NEED_FOOD NO) (gold-amount < crtical_gold_amount ) (food-amount > 1000) => (set-goal I_NEED_GOLD YES) (set-goal I_NEED_WOOD NO) (set-goal I_NEED_STONE NO) (set-strategic-number sn-food-gatherer-percentage 15) (set-strategic-number sn-gold-gatherer-percentage 35) (set-strategic-number sn-stone-gatherer-percentage 20) (set-strategic-number sn-wood-gatherer-percentage 30) (chat-local-to-self "Turned Farmers into Gold Diggers") ) ; need gold, enough wood (defrule (goal IN_CASTLE_OR_IMPERIAL YES) (goal DRASTIC_CIVIL_TIMES NO) (goal I_NEED_FOOD NO) (goal I_NEED_GOLD NO) (gold-amount < crtical_gold_amount ) (wood-amount > 800) => (set-goal I_NEED_GOLD YES) (set-goal I_NEED_WOOD NO) (set-goal I_NEED_STONE NO) (set-strategic-number sn-food-gatherer-percentage 30) (set-strategic-number sn-gold-gatherer-percentage 35) (set-strategic-number sn-stone-gatherer-percentage 20) (set-strategic-number sn-wood-gatherer-percentage 15) (chat-local-to-self "Turned Lumberjacks into Gold Diggers") ) ; need gold, enough stone (defrule (goal IN_CASTLE_OR_IMPERIAL YES) (goal DRASTIC_CIVIL_TIMES NO) (goal I_NEED_FOOD NO) (goal I_NEED_GOLD NO) (gold-amount < crtical_gold_amount ) (stone-amount > 600) => (set-goal I_NEED_GOLD YES) (set-goal I_NEED_WOOD NO) (set-goal I_NEED_STONE NO) (set-strategic-number sn-food-gatherer-percentage 30) (set-strategic-number sn-gold-gatherer-percentage 35) (set-strategic-number sn-stone-gatherer-percentage 5) (set-strategic-number sn-wood-gatherer-percentage 30) (chat-local-to-self "Turned Stoners into Gold Diggers") ) ; reset if we have enough gold now (defrule (goal IN_CASTLE_OR_IMPERIAL YES) (gold-amount > 400) (goal I_NEED_GOLD YES) => (set-goal I_NEED_GOLD NO) (set-strategic-number sn-food-gatherer-percentage 30) (set-strategic-number sn-gold-gatherer-percentage 20) (set-strategic-number sn-stone-gatherer-percentage 20) (set-strategic-number sn-wood-gatherer-percentage 30) (chat-local-to-self "Reset need gold") ) ;;;;;;;;;;;;;;;;;; need wood ; need wood, enough food (defrule (goal IN_CASTLE_OR_IMPERIAL YES) (goal DRASTIC_CIVIL_TIMES NO) (goal I_NEED_FOOD NO) (goal I_NEED_GOLD NO) (goal I_NEED_WOOD NO) (wood-amount < crtical_wood_amount) (food-amount > 800) => (set-goal I_NEED_WOOD YES) (set-goal I_NEED_STONE NO) (set-strategic-number sn-food-gatherer-percentage 20) (set-strategic-number sn-gold-gatherer-percentage 20) (set-strategic-number sn-stone-gatherer-percentage 20) (set-strategic-number sn-wood-gatherer-percentage 40) (chat-local-to-self "Turned Farmers into Lumberjacks") ) ; need wood, enough gold (defrule (goal IN_CASTLE_OR_IMPERIAL YES) (goal DRASTIC_CIVIL_TIMES NO) (goal I_NEED_FOOD NO) (goal I_NEED_GOLD NO) (goal I_NEED_WOOD NO) (wood-amount < crtical_wood_amount) (gold-amount > 400) => (set-goal I_NEED_WOOD YES) (set-goal I_NEED_STONE NO) (set-strategic-number sn-food-gatherer-percentage 30) (set-strategic-number sn-gold-gatherer-percentage 10) (set-strategic-number sn-stone-gatherer-percentage 20) (set-strategic-number sn-wood-gatherer-percentage 40) (chat-local-to-self "Turned Gold Diggers into Lumberjacks") ) ; need wood, enough stone (defrule (goal IN_CASTLE_OR_IMPERIAL YES) (goal DRASTIC_CIVIL_TIMES NO) (goal I_NEED_FOOD NO) (goal I_NEED_GOLD NO) (goal I_NEED_WOOD NO) (wood-amount < crtical_wood_amount) (stone-amount > 600);350 => (set-goal I_NEED_WOOD YES) (set-goal I_NEED_STONE NO) (set-strategic-number sn-food-gatherer-percentage 30) (set-strategic-number sn-gold-gatherer-percentage 20) (set-strategic-number sn-stone-gatherer-percentage 10) (set-strategic-number sn-wood-gatherer-percentage 40) (chat-local-to-self "Turned Stoners into Lumberjacks") ) ; reset if we have enough wood now (defrule (goal IN_CASTLE_OR_IMPERIAL YES) (wood-amount > 500) (goal I_NEED_WOOD YES) => (set-goal I_NEED_WOOD NO) (set-strategic-number sn-food-gatherer-percentage 30) (set-strategic-number sn-gold-gatherer-percentage 20) (set-strategic-number sn-stone-gatherer-percentage 20) (set-strategic-number sn-wood-gatherer-percentage 30) (chat-local-to-self "Reset need wood") ) ;;;;;;;;;;; need stone ; need stone, enough gold (defrule (goal IN_CASTLE_OR_IMPERIAL YES) (goal DRASTIC_CIVIL_TIMES NO) (goal I_NEED_FOOD NO) (goal I_NEED_GOLD NO) (goal I_NEED_WOOD NO) (goal I_NEED_STONE NO) (building-type-count-total castle < 1) (wall-completed-percentage 2 < 40) (stone-amount < crtical_stone_amount) (gold-amount > 400) => (set-goal I_NEED_STONE YES) (set-strategic-number sn-food-gatherer-percentage 30) (set-strategic-number sn-gold-gatherer-percentage 10) (set-strategic-number sn-stone-gatherer-percentage 30) (set-strategic-number sn-wood-gatherer-percentage 30) (chat-local-to-self "Turned Gold Diggers into Stoners") ) ; need stone, enough food (defrule (goal IN_CASTLE_OR_IMPERIAL YES) (goal DRASTIC_CIVIL_TIMES NO) (goal I_NEED_FOOD NO) (goal I_NEED_GOLD NO) (goal I_NEED_WOOD NO) (goal I_NEED_STONE NO) (building-type-count-total castle < 1) (wall-completed-percentage 2 < 40) (stone-amount < crtical_stone_amount) (food-amount > 900);350 => (set-goal I_NEED_STONE YES) (set-strategic-number sn-food-gatherer-percentage 20) (set-strategic-number sn-gold-gatherer-percentage 20) (set-strategic-number sn-stone-gatherer-percentage 30) (set-strategic-number sn-wood-gatherer-percentage 30) (chat-local-to-self "Turned Farmers into Stoners") ) ; need stone, enough wood (defrule (goal IN_CASTLE_OR_IMPERIAL YES) (goal DRASTIC_CIVIL_TIMES NO) (goal I_NEED_FOOD NO) (goal I_NEED_GOLD NO) (goal I_NEED_WOOD NO) (goal I_NEED_STONE NO) (building-type-count-total castle < 1) (wall-completed-percentage 2 < 40) (stone-amount < crtical_stone_amount) (wood-amount > 900);350 => (set-goal I_NEED_STONE YES) (set-strategic-number sn-food-gatherer-percentage 30) (set-strategic-number sn-gold-gatherer-percentage 20) (set-strategic-number sn-stone-gatherer-percentage 30) (set-strategic-number sn-wood-gatherer-percentage 20) (chat-local-to-self "Turned Lumberjacks into Stoners ") ) ; reset if we have enough wood now (defrule (goal IN_CASTLE_OR_IMPERIAL YES) (stone-amount > 300) (goal I_NEED_STONE YES) => (set-goal I_NEED_STONE NO) (set-strategic-number sn-food-gatherer-percentage 30) (set-strategic-number sn-gold-gatherer-percentage 20) (set-strategic-number sn-stone-gatherer-percentage 20) (set-strategic-number sn-wood-gatherer-percentage 30) (chat-local-to-self "Reset need stone") ) ;;;;;;; building civilian buildings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; building a farm (defrule (or (current-age == castle-age) (current-age == imperial-age) ) (or (wood-amount > 100) (goal I_NEED_FOOD YES) ) (building-type-count-total farm < castle-imperial_age_farms) (idle-farm-count < 1) (food-amount < 1500 ) (can-build farm) => (build farm) ;(chat-local-to-self "Farm Fudd !!!") ) ; if food is far away, then build a mill (defrule (or (current-age == castle-age) (current-age == imperial-age) ) (dropsite-min-distance food > castle-imperial_age_min_distance) (can-build mill) => (build mill) ) ; if lumber camp is far away then build one (defrule (or (current-age == castle-age) (current-age == imperial-age) ) (resource-found wood) (building-type-count-total lumber-camp < castle-imperial_age_max_camps) (dropsite-min-distance wood > castle-imperial_age_min_distance) (can-build lumber-camp) => (build lumber-camp) ;(chat-local-to-self "Timber !!!") ) ; if mining camp is far away then build one (gold) (defrule (or (current-age == castle-age) (current-age == imperial-age) ) (resource-found gold) (building-type-count-total mining-camp < castle-imperial_age_max_camps) (dropsite-min-distance gold > castle-imperial_age_min_distance) (can-build mining-camp) => (build mining-camp) ;(chat-local-to-self "Glimmer !!!") ) ; if mining camp is far away then build one (stone) (defrule (or (current-age == castle-age) (current-age == imperial-age) ) (resource-found stone) (building-type-count-total mining-camp < castle-imperial_age_max_camps) (dropsite-min-distance stone > castle-imperial_age_min_distance) (can-build mining-camp) => (build mining-camp) ;(chat-local-to-self "Stone !!!") ) ; building a 2nd town-cemter (defrule (or (current-age == castle-age) (current-age == imperial-age) ) (building-type-count-total siege-workshop > 0) (building-type-count-total town-center < 2) (wood-amount > 750) (can-build town-center) => (build town-center ) (set-escrow-percentage wood 15) (chat-local-to-self "2nd town-center ") ) ;(defrule ; (or ; (current-age == castle-age) ; (current-age == imperial-age) ; ) ; (building-type-count-total town-center < 2) ; (wood-amount > 500) ; (can-build-with-escrow town-center ) ;=> ; (release-escrow wood) ; (build town-center ) ; (set-escrow-percentage wood 20) ; (chat-local-to-self "2nd town-center escrow ") ;) ;=========================================================================================================================== ; =============== RESEARCH ITEMS FOR ALL AGES =========================================================================== ;=========================================================================================================================== ;;;;;;;;; TOWN CENTER RESEARCH SRUFF ;;;;;;;;;;;;;;;;;;;;;;;;;; (defrule (can-research ri-loom) (not (can-train villager)) => (research ri-loom) (chat-local-to-self "Research loom") ) ;;;;;;;;; STABLE RESEARCH STUFF ;;;;;;;;;;;;;;;;;;;;;;;;;; (defrule (or (unit-type-count-total camel-line >= 5) (unit-type-count-total knight-line >= 5) ) (can-research ri-husbandry) => (research ri-husbandry) ) ;;;;;;;;; BARRACKS RESEARCH SRUFF ;;;;;;;;;;;;;;;;;;;;;;;;;; ; have to research man-at-arms (done in FEUDAL) (defrule (can-research ri-man-at-arms) => (research ri-man-at-arms) (chat-local-to-self "man-at-arms researched") ) ; have to research pikeman(done in CASTLE) (defrule (unit-type-count-total monk > 0) (can-research ri-pikeman) => (research ri-pikeman) (chat-local-to-self "pikeman researched") ) ; have to research long-swordsman (done in CASTLE) (defrule (unit-type-count-total monk > 0) ;(research-completed ri-pikeman) (can-research ri-long-swordsman) => (research ri-long-swordsman) (chat-local-to-self "long-swordsman researched") ) ;;;;;;;;;;;; ARCHERY RANGE RESEARCH STUFF ;;;;;;;;;;;;;;;;;;; ; build skirmisher line if lot of archers are detected (defrule (unit-type-count-total monk > 0) (can-research ri-elite-skirmisher) => (research ri-elite-skirmisher) (chat-local-to-self "researching elite skirmisher") ) ; have to research cross-bowman (done in CASTLE) (defrule (unit-type-count-total monk > 0) ;(research-completed ri-elite-skirmisher) (can-research ri-crossbow) => (research ri-crossbow) (chat-local-to-self "crossbow researched") ) ; research hand cannon (defrule (can-research ri-hand-cannon) => (research ri-hand-cannon) (chat-local-to-self "researching ri-hand-cannon") ) ; research hand cannon with escrow (defrule (can-research-with-escrow ri-hand-cannon) => (release-escrow food) (release-escrow gold) (research ri-hand-cannon) (set-escrow-percentage food 15) (set-escrow-percentage gold 20) (chat-local-to-self "researching ri-hand-cannon with escrow") ) ;;;;;;;;; STABLE RESEARCH SRUFF ;;;;;;;;;;;;;;;;;;;;;;;;;; ; research HEAVY CAMEL (defrule (goal GOAL_ARMY_IMPERIAL_LEVEL_2 YES) (can-research ri-heavy-camel) => (research ri-heavy-camel) (chat-local-to-self "researching heavy-camel") ) ;;;;;;;;;;;; CASTLE RESEARCH STUFF ;;;;;;;;;;;;;;;;;; ;RESEARCH CONSCRIPTION (defrule (research-completed ri-chemistry) (research-completed ri-hand-cannon) (can-research ri-conscription) => (research ri-conscription) (chat-local-to-self "researching conscription") ) ;;;;;;;;;;;; SEIGE WORKSHOP RESEARCH STUFF ;;;;;;;;;;;;;;;;;; ;(defrule ; (goal GOAL_ARMY_IMPERIAL_LEVEL_2 YES) ; (research-completed ri-heavy-camel) ; (can-research ri-heavy-scorpion) ;=> ; (research ri-heavy-scorpion) ; (chat-local-to-self "researching heavy-scorpion") ;) ;;;;;;;;;;;; UNIVERSITY RESEARCH STUFF ;;;;;;;;;;;;;;;;;; ; research murder holes (defrule (building-type-count castle > 0) ; atleast one castle (wall-completed-percentage 2 > 75) (can-research ri-murder-holes) => (research ri-murder-holes) (chat-local-to-self "murder-holes researched") ) ; research gaurd-tower, only if i have 2 gaurd-towrs (defrule (building-type-count-total watch-tower >= 2) (wall-completed-percentage 2 > 75) (can-research ri-guard-tower) => (research ri-guard-tower) (chat-local-to-self "guard-tower researched") ) ;gotta research chemistry (imperial-age) (defrule (can-research ri-chemistry) => (research ri-chemistry) ) (defrule (can-research-with-escrow ri-chemistry) => (release-escrow food) (release-escrow gold) (research ri-chemistry) (set-escrow-percentage food 15) (set-escrow-percentage gold 20) ) ; research ballistics if have enuff range weapons (defrule (or (or (or (unit-type-count-total skirmisher-line >= 8) (unit-type-count-total archer-line >= 7) ) (or (unit-type-count-total hand-cannoneer >= 5) (unit-type-count-total scorpion-line >= 2) ) ) (unit-type-count-total mangonel-line >= 2) ) (can-research ri-ballistics) => (research ri-ballistics) (chat-local-to-self "ballistics") ) ;;;;;;;;;;;;; BLACKSMITH RESEARCH STUFF ;;;;;;;;;;;;;;;;;;;;; ; researching fletching, to give archers more power (done in feudal) ; gives more power to town center, towers and castle too ; do this anyways.....always A (defrule (building-type-count-total archery-range > 0) ;(unit-type-count-total archer-line >= 5) (can-research ri-fletching) => (research ri-fletching) (chat-local-to-self "fletching research") ) ; researching bodkin-arrow, to give archers more power (done in castle) A (defrule ;(building-type-count-total archery-range > 0) ;(or (unit-type-count-total skirmisher-line > 7) ; (or (unit-type-count-total archer-line > 7) ; (unit-type-count-total cavalry-archer-line > 7))) (unit-type-count-total monk > 0) (can-research ri-bodkin-arrow) ;(food-amount > 400) ;;(gold-amount > 200) (can-research ri-bodkin-arrow) => (research ri-bodkin-arrow) (chat-local-to-self "bodkin-arrow research") ) ;padded archer armor..... (done in feudal) D (defrule (or (unit-type-count-total skirmisher-line >= 5) (unit-type-count-total archer-line >= 5 ) ) (can-research ri-padded-archer-armor) => (research ri-padded-archer-armor) (chat-local-to-self "ri-padded-archer-armor research") ) ; research scale mail armor (infantry) D (defrule (or (unit-type-count-total militiaman-line >= 5) (unit-type-count-total spearman-line >= 5) ) (can-research ri-scale-mail) => (research ri-scale-mail) (chat-local-to-self "scale-mail-armor research") ) ; research chain mail armor (infantry) D (defrule (or (unit-type-count-total militiaman-line >= 5) (unit-type-count-total spearman-line >= 5) ) (unit-type-count-total monk > 0) (can-research ri-chain-mail) => (research ri-chain-mail) (chat-local-to-self "chain-mail-armor research") ) ; research chain mail armor (infantry) D (defrule (goal GOAL_ARMY_IMPERIAL_LEVEL_2 YES) (research-completed ri-heavy-camel) (can-research ri-plate-mail) => (research ri-plate-mail) (chat-local-to-self "plate-mail-armor research") ) ;research forging for infantry (feudal) ; 150 f A (defrule (or (unit-type-count-total militiaman-line >= 7) (unit-type-count-total spearman-line >= 7) ) (research-completed ri-scale-mail) (can-research ri-forging) => (research ri-forging) (chat-local-to-self "forging research") ) ;research iron-casting for infantry (imperial) ; A (defrule (or (unit-type-count-total militiaman-line >= 7) (unit-type-count-total spearman-line >= 7) ) (goal HAND_CANNONEER_READY YES) (can-research ri-iron-casting) => (research ri-iron-casting) (chat-local-to-self "iron-casting research") ) ;;;;;;;;;;;;;;;; LUMBER & MINING CAMP STUFF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; double-bit-axe (defrule (building-type-count-total lumber-camp > 0) (can-research ri-double-bit-axe) => (research ri-double-bit-axe) (chat-local-to-self "ri-double-bit-axe research") ) ; bow-saw (defrule (building-type-count-total lumber-camp > 0) ; (food-amount > 650) ; (wood-amount > 600) (can-research ri-bow-saw) => (research ri-bow-saw) (chat-local-to-self "bow-saw research") ) ; gold mining - only of double-bit-axe is done (defrule (research-completed ri-double-bit-axe) (building-type-count-total barracks > 0) (building-type-count-total archery-range > 0) (or (unit-type-count-total archer-line > 4) (unit-type-count-total skirmisher-line > 4) ) (can-research ri-gold-mining) => (research ri-gold-mining) (chat-local-to-self "gold-mining research") ) ; gold shaft mining - only if imperial-age ; or if we r running low on gold.... (defrule (current-age == imperial-age) (goal HAND_CANNONEER_READY YES) (can-research ri-gold-shaft-mining) => (research ri-gold-shaft-mining) (chat-local-to-self "gold-shaft-mining research") ) (defrule (current-age == castle-age) (gold-amount < 800) (wood-amount > 350) (food-amount > 1000) (can-research ri-gold-shaft-mining) => (research ri-gold-shaft-mining) (chat-local-to-self "gold-shaft-mining research-dire condition") ) ; stone mining- only if gold-mining + all thos military buildings is done (defrule (or (current-age == castle-age) (goal GOAL_RESEARCHING_CASTLE YES) ) (research-completed ri-gold-mining) (building-type-count-total barracks > 0) (building-type-count-total archery-range > 0) (building-type-count-total blacksmith > 0) (building-type-count-total monastery > 0) (can-research ri-stone-mining) => (research ri-stone-mining) (chat-local-to-self "stone-mining research") ) ;;;;;;;;;;;;;;;; Mill and Farm STUFF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defrule (can-research ri-horse-collar) => (research ri-horse-collar) (chat-local-to-self "horse-collar research") ) ;=========================================================================================================================== ; =============== BUILDING ITEMS FOR MISC STUFF =========================================================================== ;=========================================================================================================================== ;;;;;;;;;; wall and gates and towers ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defrule (true) => (enable-wall-placement 2) (disable-self) ) ; if we have one barrack and one archery range, then build wall. (defrule (building-type-count-total archery-range > 0) (building-type-count-total barracks > 0) ;(building-type-count-total castle > 0) (can-build-wall 2 stone-wall) => ;(chat-local-to-self "Stone Wall") (build-wall 2 stone-wall) ) ; if we have one barrack and one archery range,and 50% of wall is build then build gate. (defrule (building-type-count-total archery-range > 0) (building-type-count-total barracks > 0) ;(building-type-count-total castle > 0) (wall-completed-percentage 2 > 50) (can-build-gate 2) => (build-gate 2) (chat-local-to-self "Stone Gate 1") (disable-self) ) ; if we have one barrack and one archery range,and 70% of wall is build then build gate. (defrule (building-type-count-total archery-range > 0) (building-type-count-total barracks > 0) (building-type-count-total castle > 0) (wall-completed-percentage 2 > 75) ; (building-type-count-total gate <= 2) (can-build-gate 2) => (build-gate 2) (disable-self) (chat-local-to-self "Stone Gate 2") ) ; i will try to build forward-tower in the begining ; if it fails then build other ones closer to home (feudal) (defrule (building-type-count-total watch-tower-line < 1) (research-completed ri-fletching) (can-build watch-tower-line) (not (town-under-attack)) => (build-forward watch-tower-line) (chat-local-to-self "Forward watch tower") (disable-self) ) ; build a forward bombard-tower XXXXXXXXXX not researched (defrule (building-type-count-total bombard-tower < 1) (can-build bombard-tower) (not (town-under-attack)) => (build-forward bombard-tower) (chat-local-to-self "Forward bombard tower") (disable-self) ) ; minimum of 2 towers (defrule (building-type-count-total watch-tower-line < 2) (wall-completed-percentage 2 > 50) (can-build watch-tower-line) (not (town-under-attack)) => (build watch-tower-line) ;(chat-local-to-self "Closer to home watch tower") ) ; building more than 2 towers only after castle is done (defrule (building-type-count-total watch-tower-line < 4) (building-type-count-total castle > 0) (wall-completed-percentage 2 > 50) (can-build watch-tower-line) (not (town-under-attack)) => (build watch-tower-line) ; (chat-local-to-self "Closer to home watch tower") ) ;;;;;;;;;;;;;; fishing ship and other fish stuff;;;;;;;;;;;;;; ; only if we have 1 archery-range and one barracks ; build a dock to give us constant supply of fish (defrule (building-type-count-total archery-range > 1) (building-type-count-total barracks > 1 ) (can-build dock) => (build dock) (chat-local-to-self "1st dock ") ; 150 W (disable-self) ) ; build a fishing ship to gove us constant supply of fish (defrule (can-train fishing-ship) (building-type-count-total archery-range > 0) (building-type-count-total barracks > 0) => (train fishing-ship) (chat-local-to-self "1st fishing-ship ") ; 75 W (disable-self) ) (defrule (building-type-count-total archery-range > 1) (building-type-count-total barracks > 1) (building-type-count-total stable > 0) (building-type-count-total blacksmith > 0) (building-type-count-total fish-trap < 1) (can-build fish-trap) => (build fish-trap) (chat-local-to-self "1st fishing-trap ") ; 75 W ) ;;;;;;;;; building 2nd of stuff, only if we r not under attack ;;;;;;;;;;;;;;;; ; build a barrack ; 2nd barrack only if 2 archery range (defrule (building-type-count-total barracks < 2) (building-type-count-total archery-range > 1) (or (unit-type-count-total militiaman-line > 5) (unit-type-count-total spearman-line > 5) ) (not (town-under-attack)) (can-build barracks) => (build barracks) (chat-local-to-self "2nd barracks") ) ; build a archery range ; 2nd archery range only if atleast 1 barrack and atleast 2 of line (defrule (building-type-count-total archery-range < 2) (building-type-count-total barracks > 0) (or (unit-type-count-total archer-line > 3) (unit-type-count-total skirmisher-line > 3) ) (not (town-under-attack)) (can-build archery-range) => (build archery-range) (chat-local-to-self "2nd archery-range") ) ; build 2nd castle forward ; then disable since we dont want to keep loosing it. (defrule (building-type-count-total archery-range >= 2) (building-type-count-total barracks >= 2) (building-type-count-total stable >= 1) (building-type-count-total monastery >= 1) (building-type-count-total siege-workshop >= 1) (building-type-count-total university >= 1) (building-type-count-total watch-tower-line >= 2) (wall-completed-percentage 2 > 95) (building-type-count-total castle < 2) (not (town-under-attack)) (can-build castle) => (build-forward castle) (chat-local-to-self "2nd castle") (disable-self) ) ; build further castles.... (defrule (building-type-count-total archery-range >= 2) (building-type-count-total barracks >= 2) (building-type-count-total stable >= 1) (building-type-count-total monastery >= 1) (building-type-count-total siege-workshop >= 1) (building-type-count-total university >= 1) (building-type-count-total watch-tower-line >= 2) (wall-completed-percentage 2 > 95) (building-type-count-total castle <= 3) (not (town-under-attack)) (can-build castle) => (build castle) (chat-local-to-self "More castles") ) ;=========================================================================================================================== ; =============== MARKET ================================================================================================== ;=========================================================================================================================== (defrule (goal IN_CASTLE_OR_IMPERIAL YES) (or (food-amount > 1500) (or (wood-amount > 1500) (or (stone-amount > 1000) (gold-amount > 1200) ) ) ) ; (wood-amount > 400) (building-type-count-total market < 1) (can-build market) => (build market) ) ;;;;;;;;;;;; food ; selling food (castle) (defrule (food-amount > 2000) (can-sell-commodity food) => (sell-commodity food) ) ; selling food in imeprial (defrule (current-age == imperial-age) (food-amount >= 1250) (can-sell-commodity food) => (sell-commodity food) ) ; buying food (defrule (goal I_NEED_FOOD YES) (gold-amount >= 450) (can-buy-commodity food) => (buy-commodity food) ) ;;;;;;;; wood ;selling wood (defrule (wood-amount > 2000) (can-sell-commodity wood) => (sell-commodity wood) ) ; buying wood (defrule (goal I_NEED_WOOD YES) (gold-amount >= 450) (can-buy-commodity wood) => (buy-commodity wood) ) ;;;;;;;;;;;;; stone ;selling stone if we have all the stuff built (defrule (building-type-count-total castle >= 2) (wall-completed-percentage 2 > 95) (building-type-count-total watch-tower-line >= 3) (stone-amount > 500) (can-sell-commodity stone) => (sell-commodity stone) ) ; sell stone if it is in excess (defrule (stone-amount > 2000) (can-sell-commodity stone) => (sell-commodity stone) ) ; buying stone (defrule (goal I_NEED_STONE YES) (gold-amount >= 450) (can-buy-commodity stone) => (buy-commodity stone) ) ; weird rule to control stone miners... ;selling stone if we have all the stuff built (defrule (goal DRASTIC_CIVIL_TIMES NO) (goal I_NEED_FOOD NO) (goal I_NEED_GOLD NO) (goal I_NEED_WOOD NO) (goal I_NEED_STONE NO) (building-type-count-total castle >= 2) (wall-completed-percentage 2 > 75) (building-type-count-total watch-tower-line >= 3) (stone-amount > 500) => (set-strategic-number sn-stone-gatherer-percentage 5) (sell-commodity stone) ) ;=========================================================================================================================== ; =============== SPECIAL CONDITIONS WHEN ENEMY STUFF IS DETECTED ========================================================== ;=========================================================================================================================== ;;;;;;;;;;;;;; build skirmisher line if lot of archers are detected (defrule (town-under-attack) (or (players-unit-type-count any-enemy archer-line >= 10) (players-unit-type-count any-enemy cavalry-archer-line >= 10) ) (unit-type-count-total skirmisher-line <= 10) (can-train skirmisher-line) => (train skirmisher-line) ;(chat-local-to-self "Detected enemy-archer-line, making skirmisher-line") ) ;;;;;;;;;;;;;; build spearman-line if lot of cavalary is detected (defrule (town-under-attack) (or (or (players-unit-type-count any-enemy camel-line >= 10) (players-unit-type-count any-enemy knight-line >= 10) ) (or (players-unit-type-count any-enemy scout-cavalry-line >= 10) (players-unit-type-count any-enemy cavalry-archer-line >= 10) ) ) (unit-type-count-total spearman-line <= 10) (can-train spearman-line) => (train spearman-line) ;(chat-local-to-self "Detected knights or camels, making spearman-line") ) ;=========================================================================================================================== ; =============== ATTACK !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ========================================================== ;=========================================================================================================================== ; feudal-age rush ;(defrule ; (current-age == feudal-age) ; (players-military-population any-enemy < 20) ; (military-population > 20) ;=> ; (set-strategic-number sn-percent-attack-soldiers 100) ; (attack-now) ; (chat-local-to-self "1st attack") ;(disable-self) ;) ; strategic numbers for attack stuff we dont want to change (defrule (true) => (set-strategic-number sn-consecutive-idle-unit-limit 0); (set-strategic-number sn-enemy-sighted-response-distance 10); (set-strategic-number sn-percent-enemy-sighted-response 90) ; everyone goes to help anohter one being attack (set-strategic-number sn-task-ungrouped-soldiers 0) ; dont spread out (set-strategic-number sn-attack-group-gather-spacing 1) ;shuld always be close togather (set-strategic-number sn-scale-minimum-attack-group-size 1) (set-strategic-number sn-scale-maximum-attack-group-size 10) (set-strategic-number sn-attack-group-size-randomness 0) (set-strategic-number sn-attack-intelligence 1) (set-strategic-number sn-percent-attack-soldiers 0) (disable-self) ) ;strategic numbers for target evaluation (defrule (true) => (set-strategic-number sn-target-evaluation-siege-weapon 1) ; make them attack each other (set-strategic-number sn-target-evaluation-distance 10); (set-strategic-number sn-target-evaluation-time-kill-ratio 1000) (set-strategic-number sn-target-evaluation-damage-capability 1) (disable-self) ) ;(set-strategic-number sn-number-attack-groups 0) ;strategic numbers for attack ;(set-strategic-number sn-minimum-attack-group-size 5) ;(set-strategic-number sn-maximum-attack-group-size 10) (defrule (town-under-attack) (goal IN_CASTLE_OR_IMPERIAL YES) (military-population >= 40) (players-military-population any-enemy >= 30) => (set-strategic-number sn-percent-enemy-sighted-response 100) ; everyone goes to help anohter one being attack (set-strategic-number sn-enemy-sighted-response-distance 30) (set-strategic-number sn-percent-attack-soldiers 100) (set-strategic-number sn-task-ungrouped-soldiers 0) (set-difficulty-parameter ability-to-dodge-missiles 70) (set-difficulty-parameter ability-to-maintain-distance 70) ;(chat-local-to-self "Bring it On !!!") ) ;retreat to safety (defrule (town-under-attack) (goal IN_CASTLE_OR_IMPERIAL YES) (military-population < 20) (players-military-population any-enemy >= 30) => (set-strategic-number sn-enemy-sighted-response-distance 10); (set-strategic-number sn-percent-attack-soldiers 30) (set-difficulty-parameter ability-to-dodge-missiles 20) (set-difficulty-parameter ability-to-maintain-distance 20) ;(chat-local-to-self "I am Doomed") ) ; castle-age rush (defrule (current-age == imperial-age) ; (players-military-population any-enemy < 20) (military-population > 45) (goal GOAL_ARMY_IMPERIAL_LEVEL_2 YES) => (set-strategic-number sn-percent-enemy-sighted-response 100) ; everyone goes to help anohter one being attack (set-strategic-number sn-percent-attack-soldiers 100) (set-strategic-number sn-enemy-sighted-response-distance 75) (attack-now) (chat-local-to-self "Main attack") (disable-self) ) (defrule (enemy-captured-relics) (military-population > 40) => (set-strategic-number sn-percent-enemy-sighted-response 100) ; everyone goes to help anohter one being attack (set-strategic-number sn-percent-attack-soldiers 100) (set-strategic-number sn-enemy-sighted-response-distance 75) (attack-now) (chat-local-to-self "Relic attack") (disable-self) ) ;;;;;; what to do when progressing through ages ;;;;;;;;;;;;;;;; ; building stuff (defrule (goal GOAL_RESEARCHING_FEUDAL YES) (building-type-count-total barracks < 1) (can-build barracks) => (build barracks) (chat-local-to-self "1st barracks") ) (defrule (goal GOAL_RESEARCHING_FEUDAL YES) => (set-strategic-number sn-food-gatherer-percentage 50) (set-strategic-number sn-wood-gatherer-percentage 50) ) (defrule (goal GOAL_RESEARCHING_CASTLE YES) (building-type-count-total stable < 1) (can-build stable) => (build stable) (chat-local-to-self "1st stable") ) (defrule (goal GOAL_RESEARCHING_IMPERIAL YES) (can-research ri-ballistics) => (research ri-ballistics) (chat-local-to-self "ballistics") )