home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GameStar Special 2002 April
/
GSSH42002.iso
/
MODS
/
AgeOfEmpires2
/
Raw.exe
/
AI
/
defensive.per
< prev
next >
Wrap
Text File
|
2001-05-21
|
20KB
|
934 lines
;Svede
; This AI file is used for the Saxons in my Battle of Mount Badon Scenario for an ES competition.
; ============== GROUPS - most of these will work for any file
(defrule
(true)
=>
(set-strategic-number sn-percent-enemy-sighted-response 100)
(set-strategic-number sn-enemy-sighted-response-distance 25)
(set-strategic-number sn-blot-exploration-map 1)
(disable-self)
)
; ============== ATTACK GROUPS - changing percent attack soldiers will make an AI weak or tough
(defrule
(true)
=>
(set-strategic-number sn-town-defend-priority 7)
(set-strategic-number sn-task-ungrouped-soldiers 25)
(set-strategic-number sn-percent-attack-soldiers 3)
(set-strategic-number sn-number-defend-groups 22)
(set-strategic-number sn-number-explore-groups 0)
(disable-self)
)
; ============== VILLAGER ASSIGNMENT - most of these will work for any file
(defrule
(true)
=>
(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 35)
(set-strategic-number sn-gold-gatherer-percentage 40)
(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)
(disable-self)
)
; ============== ATTACKING - The AI will attack once at 1100 seconds and then again every 1400 sec, provided it has enough defense soldiers.
(defrule
(game-time > 2000)
=>
(attack-now)
(enable-timer 7 2000)
(disable-self)
(chat-local-to-self "first attack")
)
(defrule
(timer-triggered 7)
(defend-soldier-count >= 100)
=>
(attack-now)
(disable-timer 7)
(enable-timer 7 2000)
(chat-local-to-self "other attacks")
)
; ============== BUILD LISTS
;maintain housing
(defrule
(housing-headroom less-than 4)
(population-headroom greater-than 0)
(can-build house)
=>
(build house)
(chat-local-to-self "house")
)
(defrule
(building-type-count-total blacksmith less-than 1)
(can-build blacksmith)
=>
(build blacksmith)
(chat-local-to-self "blacksmith")
)
(defrule
(building-type-count-total market less-than 1)
(can-build market)
=>
(build market)
(chat-local-to-self "market")
)
(defrule
(building-type-count-total university less-than 1)
(can-build university)
=>
(build university)
(chat-local-to-self " university ")
)
(defrule
(building-type-count-total monastery less-than 1)
(can-build monastery)
=>
(build monastery)
(chat-local-to-self " monastery ")
)
(defrule
(building-type-count-total castle less-than 1)
(can-build castle)
=>
(build castle)
(chat-local-to-self "castle")
)
(defrule
(building-type-count-total barracks less-than 1)
(can-build barracks)
=>
(build barracks)
(chat-local-to-self "barracks")
)
(defrule
(building-type-count-total archery-range less-than 1)
(can-build archery-range)
=>
(build archery-range)
(chat-local-to-self "range")
)
; ============== MILITARY UNITS
(defrule
(unit-type-count-total militiaman-line < 15)
(can-train militiaman-line)
=>
(train militiaman-line)
(chat-local-to-self "infantry")
)
(defrule
(unit-type-count-total spearman-line < 15)
(can-train spearman-line)
=>
(train spearman-line)
(chat-local-to-self "spearman")
)
(defrule
(unit-type-count-total throwing-axeman-line < 50)
(can-train throwing-axeman-line)
=>
(train throwing-axeman-line)
(chat-local-to-self "axeman")
)
(defrule
(unit-type-count-total archer-line < 15)
(can-train archer-line)
=>
(train archer-line)
(chat-local-to-self "archer")
)
(defrule
(unit-type-count-total skirmisher-line < 50)
(can-train skirmisher-line)
=>
(train skirmisher-line)
(chat-local-to-self "skirmisher")
)
; ========================== UPGRADES - I usually use the same rules for upgrades for all civs. If the AI has a certain number of units, it tries to upgrade them. There are no rules for Hand Cannons or Bombards below.
; problem with escrow - give up
(defrule
(or
(or
(escrow-amount wood > 2000)
(escrow-amount food > 2000)
)
(or
(escrow-amount gold > 3000)
(escrow-amount stone > 3000)
)
)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(set-goal 16 0)
)
; ////////////////////////////////////////////////////
; sets initial goal for escrow to make sure there are villagers
; sets escrow
(defrule
(true)
=>
(set-escrow-percentage wood 40)
(set-escrow-percentage food 40)
(set-escrow-percentage gold 40)
(set-escrow-percentage stone 40)
)
; /////////////////////////////////////////////////////
;UNIT UPGRADES
(defrule
(goal 16 0)
(unit-type-count man-at-arms > 6)
(can-research-with-escrow ri-long-swordsman)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-long-swordsman)
(chat-local-to-self "research long swordsman ")
)
(defrule
(goal 16 0)
(unit-type-count long-swordsman > 6)
(can-research-with-escrow ri-two-handed-swordsman)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-two-handed-swordsman)
(chat-local-to-self "research two-handed-swordsman")
)
(defrule
(goal 16 0)
(unit-type-count two-handed-swordsman > 6)
(can-research-with-escrow ri-champion)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-champion)
(chat-local-to-self "research champion")
)
(defrule
(goal 16 0)
(unit-type-count-total spearman > 2)
(can-research-with-escrow ri-pikeman)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-pikeman)
(chat-local-to-self "research pike")
)
(defrule
(goal 16 0)
(unit-type-count archer > 6)
(can-research-with-escrow ri-crossbow)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-crossbow)
(chat-local-to-self "research crossbow")
)
(defrule
(unit-type-count-total skirmisher > 2)
(can-research-with-escrow ri-elite-skirmisher)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-elite-skirmisher)
(chat-local-to-self "research elite skirmisher")
)
; ////////////////////////WEAPONS//////////////////
(defrule
(goal 16 0)
(can-research-with-escrow ri-forging)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-forging)
(chat-local-to-self "research forging")
)
(defrule
(goal 16 0)
(can-research-with-escrow ri-iron-casting)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-iron-casting)
(chat-local-to-self "research iron-casting")
)
(defrule
(goal 16 0)
(can-research-with-escrow ri-blast-furnace)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-blast-furnace)
(chat-local-to-self "research blast-furnace")
)
;ARCHER UPGRADES -- cost food/gold
(defrule
(goal 16 0)
(can-research-with-escrow ri-fletching)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-fletching)
(chat-local-to-self "research fletching")
)
(defrule
(goal 16 0)
(can-research-with-escrow ri-bodkin-arrow)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-bodkin-arrow)
(chat-local-to-self "research bodkin-arrow")
)
(defrule
(goal 16 0)
(can-research-with-escrow ri-bracer)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-bracer)
(chat-local-to-self "research bracer")
)
(defrule
(goal 16 0)
(or
(unit-type-count-total archer-line > 3)
(or
(unit-type-count-total skirmisher-line > 3)
(unit-type-count-total cavalry-archer-line > 3)
)
)
(can-research-with-escrow ri-padded-archer-armor)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-padded-archer-armor)
(chat-local-to-self "research padded-archer-armor")
)
(defrule
(goal 16 0)
(or
(unit-type-count-total archer-line > 3)
(or
(unit-type-count-total skirmisher-line > 3)
(unit-type-count-total cavalry-archer-line > 3)
)
)
(can-research-with-escrow ri-leather-archer-armor)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-leather-archer-armor)
(chat-local-to-self "research leather-archer-armor")
)
(defrule
(goal 16 0)
(or
(unit-type-count-total archer-line > 3)
(or
(unit-type-count-total skirmisher-line > 3)
(unit-type-count-total cavalry-archer-line > 3)
)
)
(can-research-with-escrow ri-ring-archer-armor)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-ring-archer-armor)
(chat-local-to-self "research ring-archer-armor")
)
(defrule
(goal 16 0)
(or
(unit-type-count-total militiaman-line > 3)
(unit-type-count-total spearman-line > 3)
)
(can-research-with-escrow ri-scale-mail)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-scale-mail)
(chat-local-to-self "research scale-mail")
)
(defrule
(goal 16 0)
(or
(unit-type-count-total militiaman-line > 3)
(unit-type-count-total spearman-line > 3)
)
(can-research-with-escrow ri-chain-mail)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-chain-mail)
(chat-local-to-self "research chain-mail")
)
(defrule
(goal 16 0)
(or
(unit-type-count-total militiaman-line > 3)
(unit-type-count-total spearman-line > 3)
)
(can-research-with-escrow ri-plate-mail)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-plate-mail)
(chat-local-to-self "research plate-mail")
)
(defrule
(goal 16 0)
(or
(unit-type-count-total militiaman-line > 3)
(unit-type-count-total spearman-line > 3)
)
(can-research-with-escrow ri-tracking)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-tracking)
(chat-local-to-self "research tracking")
)
(defrule
(goal 16 0)
(or
(unit-type-count-total militiaman-line > 3)
(unit-type-count-total spearman-line > 3)
)
(can-research-with-escrow ri-squires)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-squires)
(chat-local-to-self "research squires")
)
;FORTRESS UPGRADES
(defrule
(goal 16 0)
(can-research-with-escrow ri-hoardings)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-hoardings)
(chat-local-to-self "research hoardings")
)
;OTHER RESEARCH ITEMS
(defrule
(goal 16 0)
(can-research-with-escrow ri-ballistics)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-ballistics)
(chat-local-to-self "research ballistics ")
)
(defrule
(goal 16 0)
(can-research-with-escrow ri-conscription)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-conscription)
(chat-local-to-self "research conscription")
)
;university stuff
(defrule
(goal 16 0)
(can-research-with-escrow ri-masonry)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-masonry)
(chat-local-to-self "research masonry")
)
(defrule
(goal 16 0)
(can-research-with-escrow ri-architecture)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-architecture)
(chat-local-to-self "research architecture")
)
(defrule
(goal 16 0)
(can-research-with-escrow ri-stonecutting)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-stonecutting)
(chat-local-to-self "research stonecutting")
)
; ////////////////////MONK/////////////////
(defrule
(goal 16 0)
(or
(cc-players-unit-type-count any-enemy monk > 1)
(unit-type-count-total war-elephant-line > 2)
)
(can-research-with-escrow ri-faith)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-faith)
(chat-local-to-self "research faith")
)
(defrule
(goal 16 0)
(cc-players-unit-type-count any-enemy monk > 2)
(can-research-with-escrow ri-atonement)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-atonement)
(chat-local-to-self "research atonement")
)
(defrule
(goal 16 0)
(unit-type-count-total monk > 2)
(can-research-with-escrow ri-block-printing)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-block-printing)
(chat-local-to-self "research block printing")
)
(defrule
(goal 16 0)
(unit-type-count-total monk > 2)
(can-research-with-escrow ri-illumination)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-illumination)
(chat-local-to-self "research illumination")
)
(defrule
(goal 16 0)
(unit-type-count-total monk > 2)
(can-research-with-escrow ri-fervor)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-fervor)
(chat-local-to-self "research fervor")
)
(defrule
(goal 16 0)
(unit-type-count-total monk > 2)
(can-research-with-escrow ri-redemption)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-redemption)
(chat-local-to-self "research redemption")
)
(defrule
(goal 16 0)
(unit-type-count-total monk > 2)
(can-research-with-escrow ri-sanctity)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-sanctity)
(chat-local-to-self "research sanctity")
)
;TOWERS
(defrule
(goal 16 0)
(building-type-count-total watch-tower > 1)
(can-research-with-escrow ri-guard-tower)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-guard-tower)
(chat-local-to-self "research guard tower")
)
(defrule
(goal 16 0)
(building-type-count-total guard-tower > 1)
(can-research-with-escrow ri-keep)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-keep)
(chat-local-to-self "research keep")
)
(defrule
(goal 16 0)
(or
(building-type-count-total castle > 0)
(building-type-count-total watch-tower-line > 2)
)
(can-research-with-escrow ri-murder-holes)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-murder-holes)
(chat-local-to-self "research murder-holes")
)
(defrule
(goal 16 0)
(or
(building-type-count-total castle > 0)
(building-type-count-total watch-tower-line > 2)
)
(can-research-with-escrow ri-fortified-wall)
=>
(release-escrow wood)
(release-escrow food)
(release-escrow gold)
(release-escrow stone)
(research ri-fortified-wall)
(chat-local-to-self "research fortifications")
)
; ================ MARKET - just buys and sells when the price is right and stockpile low
; ///////////////////////// FEUDAL
(defrule
(current-age == feudal-age)
(gold-amount >= 500)
(wood-amount <= 100)
(commodity-buying-price wood <= 100)
(can-buy-commodity wood)
=>
(chat-local-to-self "Wood panic")
(buy-commodity wood)
)
(defrule
(current-age == feudal-age)
(gold-amount >= 500)
(food-amount <= 100)
(commodity-buying-price food <= 100)
(can-buy-commodity food)
=>
(chat-local-to-self "Food panic")
(buy-commodity food)
)
(defrule
(current-age == feudal-age)
(gold-amount >= 600)
(stone-amount <= 100)
(commodity-buying-price stone <= 200)
(can-buy-commodity stone)
=>
(chat-local-to-self "need stone")
(buy-commodity stone)
)
(defrule
(current-age == feudal-age)
(wood-amount >= 500)
(or
(gold-amount < 100)
(food-amount < 100)
)
(commodity-selling-price wood >= 50)
(can-sell-commodity wood)
=>
(chat-local-to-self "Gold panic; sell wood")
(sell-commodity wood)
)
(defrule
(current-age == feudal-age)
(food-amount >= 1000)
(or
(gold-amount < 100)
(wood-amount < 100)
)
(can-sell-commodity food)
=>
(chat-local-to-self "excess food")
(sell-commodity food)
)
(defrule
(current-age == feudal-age)
(stone-amount >= 1000)
(or
(gold-amount < 100)
(wood-amount < 100)
)
(can-sell-commodity stone)
=>
(chat-local-to-self "excess stone")
(sell-commodity stone)
)
;****************************CASTLE
(defrule
(current-age == castle-age)
(gold-amount >= 1000)
(wood-amount <= 200)
(commodity-buying-price wood <= 100)
(can-buy-commodity wood)
=>
(chat-local-to-self "Wood panic")
(buy-commodity wood)
)
(defrule
(current-age == castle-age)
(gold-amount >= 500)
(wood-amount <= 100)
(can-buy-commodity wood)
=>
(chat-local-to-self "Wood panic")
(buy-commodity wood)
)
(defrule
(current-age == castle-age)
(gold-amount >= 1000)
(food-amount <= 200)
(commodity-buying-price food <= 100)
(can-buy-commodity food)
=>
(chat-local-to-self "Food panic")
(buy-commodity food)
)
(defrule
(current-age == castle-age)
(gold-amount >= 500)
(food-amount <= 100)
(can-buy-commodity food)
=>
(chat-local-to-self "Food panic")
(buy-commodity food)
)
(defrule
(current-age == castle-age)
(gold-amount >= 1200)
(stone-amount <= 200)
(commodity-buying-price stone <= 200)
(can-buy-commodity stone)
=>
(chat-local-to-self "need stone")
(buy-commodity stone)
)
(defrule
(current-age == castle-age)
(wood-amount >= 1000)
(or
(gold-amount < 200)
(food-amount < 200)
)
(commodity-selling-price wood >= 25)
(can-sell-commodity wood)
=>
(chat-local-to-self "Gold panic; sell wood")
(sell-commodity wood)
)
(defrule
(current-age == castle-age)
(food-amount >= 1200)
(or
(gold-amount < 200)
(wood-amount < 200)
)
(can-sell-commodity food)
=>
(chat-local-to-self "excess food")
(sell-commodity food)
)
(defrule
(current-age == castle-age)
(stone-amount >= 1000)
(or
(gold-amount < 200)
(wood-amount < 200)
)
(can-sell-commodity stone)
=>
(chat-local-to-self "excess stone")
(sell-commodity stone)
)