88269980 发表于 2009-1-6 10:05:33

郑成功AI语法教学简介

郑成功AI语法教学简介

三国迷 发表于 2009-1-6 12:18:27

有乱码                       
--------------------补充段----------------------

我帮你直接转上来吧...顺便把BIG5乱码转好成简体了。


文明:
;*************************黑暗时代******************************
;研发织布技术
(defrule
(current-age == dark-age)
(not (can-train villager))
(can-research ri-loom)
=>
(research ri-loom)
(disable-self)
)
;*************************封建时代******************************
;如没研发织布技术
(defrule
(can-research ri-loom)
=>
(research ri-loom)
)
;研发双面斧
(defrule
(can-research ri-double-bit-axe)
=>
(research ri-double-bit-axe)
)
;研发兽耕技术
(defrule
(can-research ri-horse-collar)
=>
(research ri-horse-collar)
)
;*************************城堡时代******************************
;研发重装长枪兵
(defrule
(can-research ri-pikeman)
=>
(research ri-pikeman)
)
;研发轮轴技术
(defrule
(current-age == castle-age)
(can-research ri-wheel-barrow)
=>
(research ri-wheel-barrow)
)
;研发 望技术
(defrule
(can-research ri-town-watch)
=>
(research ri-town-watch)
)
;研发弓形锯
(defrule
(current-age == castle-age)
(can-research ri-bow-saw)
=>
(research ri-bow-saw)
)
;研发重型耕牦
(defrule
(current-age == castle-age)
(can-research ri-heavy-plow)
=>
(research ri-heavy-plow)
)
;研发采金技术
(defrule
(can-research ri-gold-mining)
=>
(research ri-gold-mining)
)
;研发采石技术
(defrule
(can-research ri-stone-mining)
=>
(research ri-stone-mining)
)
;*************************帝王时代******************************
;研发徵兵技术
(defrule
(current-age == imperial-age)
(can-research ri-conscription)
=>
(research ri-conscription)
)
;研发城镇巡逻
(defrule
(current-age == imperial-age)
(can-research ri-town-patrol)
=>
(research ri-town-patrol)
)
;研发采金装置
(defrule
(current-age == imperial-age)
(can-research ri-gold-shaft-mining)
=>
(research ri-gold-shaft-mining)
)
;研发采石装置
(defrule
(current-age == imperial-age)
(can-research ri-stone-shaft-mining)
=>
(research ri-stone-shaft-mining)
)
;研发双人锯
(defrule
(current-age == imperial-age)
(can-research ri-two-man-saw)
=>
(research ri-two-man-saw)
)
;研发轮耕制度
(defrule
(current-age == imperial-age)
(can-research ri-crop-rotation)
=>
(research ri-crop-rotation)
)
;研发手推车
(defrule
(current-age == imperial-age)
(can-research ri-hand-cart)
=>
(research ri-hand-cart)
)
;研发铸币技术
(defrule
(current-age == imperial-age)
(can-research ri-coinage)
=>
(research ri-coinage)
)
;研发怠行制度
(defrule
(current-age == imperial-age)
(can-research ri-banking)
=>
(research ri-banking)
)
;研发城射垛孔
(defrule
(building-type-count-total castle > 0)
(can-research ri-murder-holes)
=>
(research ri-murder-holes)
)
;研发公会制度
(defrule
(current-age == imperial-age)
(can-research ri-guilds)
=>
(research ri-guilds)
)
;研发围篱
(defrule
(current-age == imperial-age)
(can-research ri-hoardings)
=>
(research ri-hoardings)
)
;研发砖瓦技术
(defrule
(current-age == imperial-age)
(can-research ri-masonry)
=>
(research ri-masonry)
)
;研发建筑学
(defrule
(current-age == imperial-age)
(can-research ri-architecture)
=>
(research ri-architecture)
)
;研发攻城工程师
(defrule
(current-age == imperial-age)
(can-research ri-siege-engineers)
=>
(research ri-siege-engineers)
)
;研发弹道技术
(defrule
(current-age == imperial-age)
(can-research ri-ballistics)
=>
(research ri-ballistics)
)
;研发化学
(defrule
(current-age == imperial-age)
(can-research ri-chemistry)
=>
(research ri-chemistry)
)
;研发炮塔
(defrule
(current-age == imperial-age)
(can-research ri-bombard-tower)
=>
(research ri-bombard-tower)
)
;攻城武器制造所研发
;研发中型投石车
(defrule
(current-age == imperial-age)
(can-research ri-onager)
=>
(research ri-onager)
)
;研发重型投石车
(defrule
(current-age == imperial-age)
(can-research ri-siege-onager)
=>
(research ri-siege-onager)
)
;研发装甲冲撞车
(defrule
(current-age == imperial-age)
(can-research ri-capped-ram)
=>
(research ri-capped-ram)
)
;研发重型冲撞车
(defrule
(current-age == imperial-age)
(can-research ri-siege-ram)
=>
(research ri-siege-ram)
)
;研发重弩炮
(defrule
(current-age == imperial-age)
(can-research ri-heavy-scorpion)
=>
(research ri-heavy-scorpion)
)
;马厩系研发
;研发血统
(defrule
(can-research ri-bloodlines)
=>
(research ri-bloodlines)
)
;研发耕作技术(马系)
(defrule
(can-research ri-husbandry)
=>
(research ri-husbandry)
)
;研发轻骑兵
(defrule
(current-age == imperial-age)
(can-research ri-light-cavalry)
=>
(research ri-light-cavalry)
)
;研发匈牙利轻骑兵
(defrule
(current-age == imperial-age)
(can-research ri-hussar)
=>
(research ri-hussar)
)
;研发骑兵
(defrule
(can-research ri-cavalier)
=>
(research ri-cavalier)
)
;研发游侠
(defrule
(can-research ri-paladin)
=>
(research ri-paladin)
)
;研发重装骆驼兵
(defrule
(can-research ri-heavy-camel)
=>
(research ri-heavy-camel)
)
;军营系研发
;研发戟兵
(defrule
(can-research ri-halberdier)
=>
(research ri-halberdier)
)
;研发追踪技术
(defrule
(current-age == imperial-age)
(can-research ri-tracking)
=>
(research ri-tracking)
)
;研发护卫技术
(defrule
(current-age == imperial-age)
(can-research ri-squires)
=>
(research ri-squires)
)
;研发装甲步兵
(defrule
(can-research ri-man-at-arms)
=>
(research ri-man-at-arms)
)
;研发长剑兵
(defrule
(can-research ri-long-swordsman)
=>
(research ri-long-swordsman)
)
;研发双手剑兵
(defrule
(can-research ri-two-handed-swordsman)
=>
(research ri-two-handed-swordsman)
)
;研发剑兵勇士
(defrule
(can-research ri-champion)
=>
(research ri-champion)
)
;研发精锐鹰战士
(defrule
(can-research ri-elite-eagle-warrior)
=>
(research ri-elite-eagle-warrior)
)
;兵器升级
;研发缎造技术
(defrule
(can-research ri-forging)
=>
(research ri-forging)
)
;研发绝世好箭
(defrule
(can-research ri-fletching)
=>
(research ri-fletching)
)
;研发铸铁技术
(defrule
(can-research ri-iron-casting)
=>
(research ri-iron-casting)
)
;研发羽箭
(defrule
(can-research ri-bodkin-arrow)
=>
(research ri-bodkin-arrow)
)
;研发强力护腕
(defrule
(current-age == imperial-age)
(can-research ri-bracer)
=>
(research ri-bracer)
)
;研发鼓风炉
(defrule
(can-research ri-blast-furnace)
=>
(research ri-blast-furnace)
)
;研发鳞甲
(defrule
(can-research ri-scale-mail)
=>
(research ri-scale-mail)
)
;研发链甲
(defrule
(can-research ri-chain-mail)
=>
(research ri-chain-mail)
)
;研发板甲
(defrule
(can-research ri-plate-mail)
=>
(research ri-plate-mail)
)
;研发弓兵护甲
(defrule
(can-research ri-padded-archer-armor)
=>
(research ri-padded-archer-armor)
)
;研发弓兵皮甲
(defrule
(can-research ri-leather-archer-armor)
=>
(research ri-leather-archer-armor)
)
;研发弓兵链甲
(defrule
(can-research ri-ring-archer-armor)
=>
(research ri-ring-archer-armor)
)
;研发特殊科技
(defrule
(current-age == imperial-age)
(can-research my-unique-research)
=>
(research my-unique-research)
)
;研发鳞铠甲
(defrule
(can-research ri-scale-barding)
=>
(research ri-scale-barding)
)
;研发链铠甲
(defrule
(can-research ri-chain-barding)
=>
(research ri-chain-barding)
)
;研发铁铠甲
(defrule
(can-research ri-plate-barding)
=>
(research ri-plate-barding)
)
;射箭场研发
;研发弩兵
(defrule
(can-research ri-crossbow)
=>
(research ri-crossbow)
)
;研发强弩兵
(defrule
(can-research ri-arbalest)
=>
(research ri-arbalest)
)
;研发战矛兵
(defrule
(can-research ri-elite-skirmisher)
=>
(research ri-elite-skirmisher)
)
;研发安息人战术
(defrule
(can-research ri-parthian-tactics)
=>
(research ri-parthian-tactics)
)
;研发姆指环
(defrule
(can-research ri-thumb-ring)
=>
(research ri-thumb-ring)
)
;研发重装马骑弓兵
(defrule
(can-research ri-heavy-cavalry-archer)
=>
(research ri-heavy-cavalry-archer)
)
;老头院研发
;研发忠诚信仰
(defrule
(gold-amount > 2000)
(can-research ri-faith)
=>
(research ri-faith)
)
;研发异端邪说
(defrule
(gold-amount > 2000)
(can-research ri-heresy)
=>
(research ri-heresy)
)
;研发赎罪思想
(defrule
(gold-amount > 2000)
(can-research ri-atonement)
=>
(research ri-atonement)
)
;研发宗教狂热
(defrule
(gold-amount > 2000)
(can-research ri-fervor)
=>
(research ri-fervor)
)
;研发救赎思想
(defrule
(gold-amount > 2000)
(can-research ri-redemption)
=>
(research ri-redemption)
)
;研发神圣思想
(defrule
(gold-amount > 2000)
(can-research ri-sanctity)
=>
(research ri-sanctity)
)
;研发印刷技术
(defrule
(gold-amount > 2000)
(can-research ri-block-printing)
=>
(research ri-block-printing)
)
;研发启示思想
(defrule
(gold-amount > 2000)
(can-research ri-illumination)
=>
(research ri-illumination)
)
;研发神权政治
(defrule
(gold-amount > 2000)
(can-research ri-theocracy)
=>
(research ri-theocracy)
)
;研发特殊技能
(defrule
(can-research my-unique-research)
=>
(research my-unique-research)
)
;研发特种部队
(defrule
(can-research my-unique-unit-upgrade)
=>
(research my-unique-unit-upgrade)
)
;渔港研发
(defrule
(can-research ri-dry-dock)
=>
(research ri-dry-dock)
)
(defrule
(can-research ri-careening)
=>
(research ri-careening)
)
(defrule
(can-research ri-cannon-galleon)
=>
(research ri-cannon-galleon)
)
(defrule
(can-research ri-deck-guns)
=>
(research ri-deck-guns)
)
(defrule
(can-research ri-war-galley)
=>
(research ri-war-galley)
)
(defrule
(can-research ri-fast-fire-ship)
=>
(research ri-fast-fire-ship)
)
(defrule
(can-research ri-heated-shot)
=>
(research ri-heated-shot)
)
(defrule
(can-research ri-elite-turtle-ship)
=>
(research ri-elite-turtle-ship)
)



事件:
;举兵
(defrule
(game-time > 1)
=>
(taunt 14)
(chat-to-all "为重振大明朝光辉...我郑成功在此举兵!!!")
(disable-self)
)
;香港脚
(defrule
(game-time > 60)
=>
(taunt 24)
(chat-to-all "真虽!!香港脚又发作了......")
(disable-self)
)
;叫嚣
(defrule
(game-time > 120)
=>
(taunt 16)
(chat-to-all "这里有这堋多红毛番.....都赶他们出去吧!")
(disable-self)
)
;国歌
(defrule
(game-time > 180)
=>
(taunt 4)
(chat-to-all "三民~~主义~~吾党~~所宗~~以建~~民~~国~~以进~~大~~同.....")
(disable-self)
)
;主权声明
(defrule
(game-time > 240)
=>
(taunt 19)
(chat-to-all "亲爱的番民们.....你们已侵犯我大明朝的 土!..识相点马上离开要不然别怪我们心狠手辣!")
(disable-self)
)
;奶
(defrule
(game-time > 300)
=>
(taunt 9)
(chat-to-all "这番妞长得挺不错的啦~~~奶子不错!")
(disable-self)
)
;劝降
(defrule
(game-time > 360)
=>
(taunt 7)
(chat-to-all "立刻举手投降!!")
(disable-self)
)
;劝降失败
(defrule
(game-time > 480)
=>
(taunt 7)
(chat-to-all "哼!你们竟然不离开.....这是你们自找的!我将顷全军之力打败你们!!")
(disable-self)
)
;引歌悲壮
(defrule
(game-time > 720)
=>
(taunt 41)
(chat-to-all "国仇未报.....家恨未雪....我郑成功誓言收复失土!!")
(disable-self)
)
;练兵
(defrule
(game-time > 1020)
=>
(taunt 1)
(chat-to-all "好!不愧是我们郑家军....个个身强体健!!铁铮铮的好汉!")
(disable-self)
)
;屯田
(defrule
(game-time > 1140)
=>
(taunt 3)
(chat-to-all "将士们!举起你的双手来开垦吧 !")
(disable-self)
)
;火药
(defrule
(game-time > 1320)
=>
(taunt 26)
(chat-to-all "嗯...将来的战争可缺不了火炮啊......")
(disable-self)
)
;盛世
(defrule
(game-time > 1500)
=>
(taunt 17)
(chat-to-all "现在兵强马壮....反清复明举日可待了!")
(disable-self)
)
(defrule
(game-time > 840)
(food-amount < 1000)
=>
(cc-add-resource food 10)
)
(defrule
(game-time > 720)
(wood-amount < 1000)
=>
(cc-add-resource wood 10)
)
(defrule
(game-time > 1000)
(gold-amount < 1000)
=>
(cc-add-resource gold 10)
)
(defrule
(current-age == castle-age)
(stone-amount < 1000)
=>
(cc-add-resource stone 10)
)
;go for monastaries
(defrule
(enemy-captured-relics)
=>
(set-strategic-number sn-special-attack-type1 1)
)
;stop attacking monastaries
(defrule
(not (enemy-captured-relics))
=>
(set-strategic-number sn-special-attack-type1 0)
)
;开始攻击
(defrule
(game-time > 1800)
=>
(attack-now)
(taunt 23)
(chat-to-all "开炮~~~!!收复我大明国的江山!!!")
(enable-timer TIMER-ATTACK 45)
(set-strategic-number sn-number-defend-groups 0)
(set-strategic-number sn-percent-attack-soldiers 100)
(disable-self)
)
;持续进攻
(defrule
(current-age == imperial-age)
(timer-triggered TIMER-ATTACK)
=>
(attack-now)
(taunt 31)
(chat-to-all " 攻击敌人!!冲啊~~~~!")
(disable-timer TIMER-ATTACK)
(enable-timer TIMER-ATTACK 45)
(set-strategic-number sn-number-defend-groups 10)
(set-strategic-number sn-percent-attack-soldiers 90)
)




经济:
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+                                                                     黑暗时代                                                                                     +
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;找寻食物
(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)
(disable-self)
)
;停止寻找食物当找到食物
(defrule
(current-age == dark-age)
(or
(resource-found food)
(game-time > 75) ;fail-safe for scandanavia - deer aren't food duh!
)
=>
(set-strategic-number sn-percent-civilian-gatherers 89)
(set-strategic-number sn-percent-civilian-builders 10)
(set-strategic-number sn-percent-civilian-explorers 1)
(disable-self)
)
;伐木
(defrule
(current-age == dark-age)
(wood-amount < 100)
=>
(set-strategic-number sn-food-gatherer-percentage 80)
(set-strategic-number sn-wood-gatherer-percentage 20)
(set-strategic-number sn-camp-max-distance 40)
(disable-self)
)
;制造村民
(defrule
(and(current-age == dark-age)(unit-type-count-total villager < 22))
(can-train villager)
=>
(train villager)
)
;建造房屋
(defrule
(current-age == dark-age)
(housing-headroom < 6)
(building-type-count-total house < 40)
(can-build house)
=>
(build house)
)
;盖码头(大陆如果盟友要贸易)
(defrule
(wood-amount > 300)
(building-type-count-total dock < 2)
(can-build dock)
=>
(build dock)
)
;建造第一个磨坊
(defrule
(current-age == dark-age)
(building-type-count-total mill == 0)
(or
(resource-found food)
(game-time > 100)
)
(can-build mill)
=>
(build mill)
)
;盖伐木场
(defrule
(current-age == dark-age)

(building-type-count-total lumber-camp == 0)
(or(resource-found wood)(game-time > 50))
(can-build lumber-camp)
=>
(build lumber-camp)
)
;前进到封建时代
(defrule
(current-age == dark-age)
(food-amount > 500)
(can-research feudal-age)
=>
(research feudal-age)
(set-strategic-number sn-food-gatherer-percentage 47)
(set-strategic-number sn-wood-gatherer-percentage 43)
(set-strategic-number sn-gold-gatherer-percentage 10)
(set-strategic-number sn-camp-max-distance 40)
(set-goal GOAL-RESEARCHING-FEUDAL 1)
(set-goal GOAL-DISABLE-MILL-BUILDING 1)
)
;盖采矿场
(defrule
(current-age == dark-age)
(resource-found gold)
(can-build mining-camp)
(building-type-count-total lumber-camp > 0)
(building-type-count-total mining-camp == 0)
(goal GOAL-RESEARCHING-FEUDAL 1)
=>
(build mining-camp)
(set-goal GOAL-DISABLE-MILL-BUILDING 0)
)
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+                                                                        封建时代                                                                                  +
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;种田
(defrule
(current-age == feudal-age)
(wood-amount > 100)
(idle-farm-count < 1)
(can-build farm)
=>
(build farm)
)
;disable mills until blacksmith is built
(defrule
(current-age == feudal-age)
=>
(set-goal GOAL-DISABLE-MILL-BUILDING 1)
(disable-self)
)
;盖兵工厂
(defrule
(current-age != dark-age)
(building-type-count-total market > 0)
(building-type-count-total blacksmith == 0)
(can-build blacksmith)
=>
(build blacksmith)
(set-goal GOAL-DISABLE-MILL-BUILDING 0)
(disable-self)
)
;重盖兵工厂
(defrule
(current-age != dark-age)
(building-type-count-total market > 0)
(building-type-count-total blacksmith == 0)
(can-build blacksmith)
=>
(build blacksmith)
)
;盖市集
(defrule
(current-age != dark-age)
(building-type-count-total market == 0)
(can-build market)
=>
(build market)
)
;制造村民
(defrule
(current-age == feudal-age)
(unit-type-count-total villager < 25)
(can-train villager)
=>
(train villager)
)
;盖房子
(defrule
(current-age == feudal-age)
(housing-headroom < 6)
(building-type-count-total house < 40)
(can-build house)
=>
(build house)
)
;前进到城堡时代
(defrule
(current-age == feudal-age)
(unit-type-count-total villager > 24)
(food-amount > 800)
(gold-amount > 200)
(can-research castle-age)
=>
(research castle-age)
(set-goal GOAL-RESEARCHING-CASTLE 1)
(set-goal GOAL-DISABLE-MILL-BUILDING 1)
(set-strategic-number sn-food-gatherer-percentage 45)
(set-strategic-number sn-wood-gatherer-percentage 35)
(set-strategic-number sn-gold-gatherer-percentage 15)
(set-strategic-number sn-stone-gatherer-percentage 5)
)
;盖军营
(defrule
(current-age == feudal-age)
(building-type-count-total barracks < 1)
(can-build barracks)
=>
(build barracks)
)
;盖马厩
(defrule
(current-age == feudal-age)
(building-type-count-total stable < 2)
(can-build stable)
=>
(build stable)
)
;盖射箭场
(defrule
(current-age == feudal-age)
(building-type-count-total archery-range < 1)
(can-build archery-range)
=>
(build archery-range)
)
;盖采矿场
(defrule
(current-age == feudal-age)
(resource-found gold)
(dropsite-min-distance gold < 3)
(can-build mining-camp)
(building-type-count-total lumber-camp > 0)
(building-type-count-total mining-camp < 2)
=>
(build mining-camp)
)
;盖采矿场
(defrule
(current-age == feudal-age)
(resource-found stone)
(dropsite-min-distance stone < 3)
(can-build mining-camp)
(building-type-count-total lumber-camp > 0)
(building-type-count-total mining-camp < 2)
=>
(build mining-camp)
)
;盖伐木场
(defrule
(current-age == feudal-age)
(dropsite-min-distance wood < 3)
(building-type-count-total lumber-camp < 2)
(resource-found wood)
(can-build lumber-camp)
=>
(build lumber-camp)
)
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+                                                                         城堡时代                                                                                 +
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;种田
(defrule
(current-age == castle-age)
(wood-amount > 100)
(idle-farm-count < 1)
(can-build farm)
=>
(build farm)
)
;盖城镇
(defrule
(can-build town-center)
(building-type-count-total town-center < 5)
=>
(build town-center)
)
;盖军营
(defrule
(current-age == castle-age)
(building-type-count-total barracks < 2)
(can-build barracks)
=>
(build barracks)
)
;盖马厩
(defrule
(current-age == castle-age)
(building-type-count-total stable < 4)
(can-build stable)
=>
(build stable)
)
;盖攻城武器制造所
(defrule
(current-age == castle-age)
(building-type-count-total siege-workshop < 1)
(can-build siege-workshop)
=>
(build siege-workshop)
)
;盖修道院
(defrule
(or
(current-age == castle-age)
(current-age == imperial-age) ;allows for rebuilding if lost
)
(building-type-count-total monastery == 0)
(can-build monastery)
=>
(build monastery)
)
;盖学院
(defrule
(or
(current-age == castle-age)
(current-age == imperial-age)
)
(building-type-count-total university == 0)
(can-build university)
=>
(build university)
)
(defrule
(current-age == castle-age)
(game-time > 1700)
(building-type-count-total university == 0)
(can-build university)
(goal GOAL-I-AM-THE-SHOT 1)
=>
(build university)
)
; Villager training
(defrule
(current-age == castle-age)
(unit-type-count-total villager < 60)
(can-train villager)
=>
(train villager)
)
;盖房子
(defrule
(current-age == castle-age)
(housing-headroom < 6)
(building-type-count-total house < 40)
(can-build house)
=>
(build house)
)
;前进到帝王时代
(defrule
(current-age == castle-age)
(unit-type-count-total villager > 59)
(food-amount > 1000)
(gold-amount > 800)
(can-research imperial-age)
=>
(research imperial-age)
;re-allocate villagers to feed champ flood
(set-strategic-number sn-food-gatherer-percentage 50)
(set-strategic-number sn-wood-gatherer-percentage 30)
(set-strategic-number sn-gold-gatherer-percentage 20)
;extend camp distance
(set-strategic-number sn-camp-max-distance 80)
(set-goal GOAL-START-THE-IMPERIAL-ARMY 1)
)
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+                                                                           帝王时代                                                                               +
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;生村民至100
(defrule
(current-age == imperial-age)
(unit-type-count-total villager < 100)
(can-train villager)
=>
(train villager)
)
;盖房子
(defrule
(current-age == imperial-age)
(housing-headroom < 10)
(building-type-count-total house < 40)
(can-build house)
=>
(build house)
)
;种田
(defrule
(current-age == imperial-age)
(wood-amount > 100)
(idle-farm-count < 1)
(can-build farm)
=>
(build farm)
)
;盖城堡
(defrule
(building-type-count-total castle < 12)
(can-build castle)
=>
(build castle)
)
;盖攻城武器制造所
(defrule
(current-age == imperial-age)
(building-type-count-total siege-workshop < 2)
(can-build siege-workshop)
=>
(build siege-workshop)
)
;盖马厩
(defrule
(current-age == imperial-age)
(building-type-count-total stable < 5)
(can-build stable)
=>
(build stable)
)
;盖军营
(defrule
(current-age == imperial-age)
(building-type-count-total barracks < 5)
(can-build barracks)
=>
(build barracks)
)
;盖炮塔
(defrule
(current-age == imperial-age)
(building-type-count-total bombard-tower < 20)
(research-completed ri-bombard-tower)
(can-build bombard-tower)
=>
(build bombard-tower)
)



军团:
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+                                                                        黑暗时代                                                                                                +
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+                                                                        封建时代                                                                                                +
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;生长枪兵
(defrule
(current-age == feudal-age)
(can-train spearman-line)
(unit-type-count-total spearman-line < 10)
=>
(train spearman-line)
)
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+                                                                        城堡时代                                                                                                +
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;生长枪兵
(defrule
(current-age == castle-age)
(can-train spearman-line)
(unit-type-count-total spearman-line < 20)
=>
(train spearman-line)
)
;生鹰战士
(defrule
(current-age == castle-age)
(can-train eagle-warrior-line)
(unit-type-count-total eagle-warrior-line < 30)
=>
(train eagle-warrior-line)
)
;生骑兵
(defrule
(current-age == castle-age)
(can-train knight-line)
(unit-type-count-total knight-line < 25)
=>
(train knight-line)
)
;生特殊部队
(defrule
(current-age == castle-age)
(can-train my-unique-unit-line)
(unit-type-count-total my-unique-unit-line < 20)
=>
(train my-unique-unit-line)
)
;生冲车队
(defrule
(current-age == castle-age)
(can-train battering-ram-line)
(unit-type-count-total battering-ram-line < 2)
=>
(train battering-ram-line)
)
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+                                                                        帝王时代                                                                                                +
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;生巨投
(defrule
;packed trebuchet
(unit-type-count-total trebuchet < 15)
;unpacked trebuchet
(unit-type-count-total 42 < 15)
(can-train trebuchet)
=>
(train trebuchet)
)
;生步兵
(defrule
(current-age == imperial-age)
(can-train militiaman-line)
(research-completed ri-champion)
(unit-type-count-total militiaman-line < 40)
=>
(train militiaman-line)
)
;生骑兵
(defrule
(current-age == imperial-age)
(can-train knight-line)
(unit-type-count-total knight-line < 40)
=>
(train knight-line)
)
;生轻骑兵
(defrule
(current-age == imperial-age)
(can-train scout-cavalry-line)
(research-completed ri-light-cavalry)
(unit-type-count-total scout-cavalry-line < 40)
=>
(train scout-cavalry-line)
)
;生弓兵
(defrule
(current-age == imperial-age)
(can-train archer-line)
(research-completed ri-crossbow)
(unit-type-count-total archer-line < 40)
=>
(train archer-line)
)
;生骆驼兵
(defrule
(current-age == imperial-age)
(can-train camel-line)
(unit-type-count-total camel-line < 40)
=>
(train camel-line)
)
;生长枪兵
(defrule
(current-age == imperial-age)
(can-train spearman-line)
(unit-type-count-total spearman-line < 40)
=>
(train spearman-line)
)
;生鹰战士
(defrule
(current-age == imperial-age)
(can-train eagle-warrior-line)
(unit-type-count-total eagle-warrior-line < 40)
=>
(train eagle-warrior-line)
)
;生马弓兵
(defrule
(current-age == imperial-age)
(can-train cavalry-archer-line)
(unit-type-count-total cavalry-archer-line < 40)
=>
(train cavalry-archer-line)
)
;生特殊部队
(defrule
(current-age == imperial-age)
(can-train my-unique-unit-line)
(unit-type-count-total my-unique-unit-line < 40)
=>
(train my-unique-unit-line)
)
;生老头
(defrule
(can-train monk)
(unit-type-count-total monk < 5)
=>
(train monk)
)
;生毛兵
(defrule
(current-age == imperial-age)
(can-train skirmisher-line)
(unit-type-count-total skirmisher-line < 40)
=>
(train skirmisher-line)
)
;生火枪队
(defrule
(current-age == imperial-age)
(can-train hand-cannoneer)
(unit-type-count-total hand-cannoneer < 40)
=>
(train hand-cannoneer)
)
;生冲车队
(defrule
(current-age == imperial-age)
(can-train battering-ram-line)
(unit-type-count-total battering-ram-line < 5)
=>
(train battering-ram-line)
)
;生投石车
(defrule
(current-age == imperial-age)
(can-train mangonel-line)
(unit-type-count-total mangonel-line < 5)
=>
(train mangonel-line)
)
;生火炮队
(defrule
(current-age == imperial-age)
(can-train bombard-cannon)
(unit-type-count-total bombard-cannon < 10)
=>
(train bombard-cannon)
)
;生弩炮(後勤)
(defrule
(current-age == imperial-age)
(can-train scorpion-line)
(unit-type-count-total scorpion-line < 40)
=>
(train scorpion-line)
)
;生奴炮船
(defrule
(can-train galley-line)
(unit-type-count-total galley-line < 20)
=>
(train galley-line)
)
;生火战船
(defrule
(can-train fire-ship-line)
(unit-type-count-total fire-ship-line < 10)
=>
(train fire-ship-line)
)
;生火炮船
(defrule
(current-age == imperial-age)
(can-train cannon-galleon-line)
(unit-type-count-total cannon-galleon-line < 10)
=>
(train cannon-galleon-line)
)
;生龟甲船
(defrule
(current-age == imperial-age)
(can-train turtle-ship-line)
(unit-type-count-total turtle-ship-line < 10)
=>
(train turtle-ship-line)
)
;生偷渡船
(defrule
(current-age == imperial-age)
(can-train transport-ship)
(unit-type-count-total transport-ship < 1)
=>
(train transport-ship)
)



[ 本帖最后由 ?三国迷 于 2009-1-6 12:24 编辑 ]

三国迷 发表于 2009-1-6 12:25:08

这个AI不错,有时间我和电脑打局发展看看
收藏了```
-----------------------再补充-----------------------
主要AI:
;*国姓爷的光荣 v1.0 台湾英雄郑成功怒海狂杀* AoK:TC 2002/10/20 by 阿贤
; Constants
;中断变数
(defconst GOAL-RESEARCHING-FEUDAL 1)
(defconst GOAL-READY-FOR-CASTLE 2)
(defconst GOAL-RESEARCHING-CASTLE 3)
(defconst GOAL-I-AM-THE-SHOT 4)
(defconst GOAL-DISABLE-MILL-BUILDING 5)
(defconst GOAL-SLING-SUSPEND-TRIBUTE 6)
(defconst GOAL-START-THE-IMPERIAL-ARMY 7)
(defconst GOAL-NO-WOOD-NEEDED 8)
(defconst GOAL-NO-FOOD-NEEDED 9)
(defconst GOAL-NO-GOLD-NEEDED 10)
(defconst GOAL-NO-STONE-NEEDED 11)
(defconst GOAL-MOBILISE-DEFENCE 12)
;时间变数
(defconst TIMER-WHO-IS-THE-BOSS 1)
(defconst TIMER-ATTACK 2)
;taunts
;登入介绍
(defrule
(true)
=>
(chat-to-all "郑成功AI载入........成功!")
(disable-self)
)                        马爆, 城快
;中断
(defrule
(true)
=>
(set-goal GOAL-RESEARCHING-FEUDAL 0)
(set-goal GOAL-READY-FOR-CASTLE 0)
(set-goal GOAL-RESEARCHING-CASTLE 0)
(set-goal GOAL-I-AM-THE-SHOT 2)
(set-goal GOAL-DISABLE-MILL-BUILDING 0)
(set-goal GOAL-SLING-SUSPEND-TRIBUTE 0)
(set-goal GOAL-START-THE-IMPERIAL-ARMY 0)
(set-goal GOAL-NO-WOOD-NEEDED 0)
(set-goal GOAL-NO-FOOD-NEEDED 0)
(set-goal GOAL-NO-GOLD-NEEDED 0)
(set-goal GOAL-NO-STONE-NEEDED 0)
(set-goal GOAL-MOBILISE-DEFENCE 0)
(disable-self)
)
;战略变数
(defrule
(true)
=>       村民总任务分配
(set-strategic-number sn-percent-civilian-gatherers 90)
(set-strategic-number sn-percent-civilian-builders 10)
(set-strategic-number sn-percent-civilian-explorers 0)
      村民采集分配
(set-strategic-number sn-food-gatherer-percentage 100)
(set-strategic-number sn-wood-gatherer-percentage 0)
(set-strategic-number sn-gold-gatherer-percentage 0)
(set-strategic-number sn-stone-gatherer-percentage 0)
(disable-self)
)
(defrule
(true)
=>       村民采集距离
(set-strategic-number sn-relic-return-distance 200)
(disable-self)
)
(defrule
(true)
=>       发动一次进攻
(set-strategic-number sn-special-attack-type1 -1) 首位特殊攻击类别
(set-strategic-number sn-special-attack-influence1 0) 特殊攻击类别目标评估等级
(disable-self)
)
(defrule
(true)
=>攻击积分 先游戏者因数   容许村民自卫
(set-strategic-number sn-attack-winning-player 0)
(set-strategic-number sn-allow-civilian-defense 1)
(disable-self)
)
(defrule
(true)
=>      建造建筑物配置随机性
(set-strategic-number sn-random-placement-factor 100)
(disable-self)
)
(defrule
(true)
=>       使电脑游戏者设定该 <资源种类> 的贡品资源百分比为
(set-escrow-percentage food 0)
(set-escrow-percentage wood 0)
(set-escrow-percentage gold 0)
(set-escrow-percentage stone 0)
(disable-self)
)
(defrule
   (true)
=>
   (set-strategic-number sn-initial-exploration-required 0) 首次建造所 已探索地图百分比
   (set-strategic-number sn-cap-civilian-explorers 2)探索工人定额
   (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)最大探索部队规模
   (set-strategic-number sn-percent-half-exploration 40)探索单位减半所 已探索地图百分比
   (set-strategic-number sn-percentage-explore-exterminators 40)最大探索部队规模
   (disable-self)
)
(defrule
   (true)
=>
   (set-strategic-number sn-percent-civilian-builders 10)建筑工人比率
   (set-strategic-number sn-percent-civilian-gatherers 90) 采集工人比率
   (set-strategic-number sn-cap-civilian-builders 10) 建筑工人定额
   (set-strategic-number sn-cap-civilian-gatherers 99)采集工人定额
   (disable-self)
)
(defrule
   (true)
=>
   (set-strategic-number sn-maximum-wood-drop-distance 7) 最大采集木材距离
   (set-strategic-number sn-maximum-food-drop-distance 10) 最大采集食物距离
   (set-strategic-number sn-maximum-hunt-drop-distance 15)最大狩猎距离
   (set-strategic-number sn-maximum-gold-drop-distance 5) 最大采集黄金距离
   (set-strategic-number sn-maximum-stone-drop-distance 5) 最大采集石头距离
   (disable-self)
)
(defrule
   (true)
=>
   (set-strategic-number sn-food-dropsite-distance 5)食物储存所距离
   (set-strategic-number sn-wood-dropsite-distance 7)木材储存所距离
   (set-strategic-number sn-stone-dropsite-distance 5)石头储存所距离
   (set-strategic-number sn-gold-dropsite-distance 5) 黄金储存所距离
   (disable-self)
)
(defrule
   (true)
=>
   (set-strategic-number sn-mill-max-distance 35)最大磨坊距离
   (set-strategic-number sn-camp-max-distance 25) 最大营地距离
   (disable-self)
)
(defrule
   (true)
=>
   (set-strategic-number sn-minimum-town-size 8) 最小城镇规模
   (set-strategic-number sn-maximum-town-size 10) 最大城镇规模
   (set-strategic-number sn-intelligent-gathering 1) 智慧采集系统
   (set-strategic-number sn-minimum-dropsite-buffer 1)最小储存所缓冲区距离
   (set-strategic-number sn-retask-gather-amount 0)最小再指派采集工人采集数量
   (set-strategic-number sn-max-retask-gather-amount 0)最大再指派采集工人采集数量
   (disable-self)
)
(defrule
   (true)
=>
   (set-strategic-number sn-number-attack-groups 0)攻击部队数量
   (set-strategic-number sn-minimum-attack-group-size 1) 最小攻击部队规模
   (set-strategic-number sn-maximum-attack-group-size 1) 最大攻击部队规模
   (set-strategic-number sn-scale-minimum-attack-group-size 0)最小估算攻击部队规模
   (set-strategic-number sn-scale-maximum-attack-group-size 0)最大估算攻击部队规模
   (set-strategic-number sn-percent-attack-soldiers 100)攻击士兵比率
   (set-strategic-number sn-target-evaluation-siege-weapon 32000) 攻城武器附加目标评估等级
   (disable-self)
)
(defrule
   (true)
=>
   (set-strategic-number sn-group-commander-selection-method 2)部队长选择方式
   (set-strategic-number sn-group-form-distance 10) 部队组织距离
   (set-strategic-number sn-attack-group-gather-spacing 0) 攻击部队集合点留间隔
   (set-strategic-number sn-attack-separation-time-randomness 0)攻击部队规模随机性
   (set-strategic-number sn-attack-intelligence 1)智慧攻击系统
   (set-strategic-number sn-percent-enemy-sighted-response 0)敌视回应比率
   (set-strategic-number sn-enemy-sighted-response-distance 0)敌视回应距离
   (disable-self)
)
(defrule
   (true)
=>
   (set-strategic-number sn-number-defend-groups 1)防御部队数量
   (set-strategic-number sn-maximum-defend-group-size 60)最大防御部队规模
   (set-strategic-number sn-gold-defend-priority 0)金矿防御等级
   (set-strategic-number sn-stone-defend-priority 0)石矿防御等级
   (set-strategic-number sn-forage-defend-priority 0)果树丛防御等级
   (set-strategic-number sn-relic-defend-priority 0)遗迹防御等级
   (set-strategic-number sn-town-defend-priority 0)城镇防御等级
   (set-strategic-number sn-defense-distance 0)防御距离
   (set-strategic-number sn-defend-overlap-distance 5)防御部队互搭距离
   (disable-self)
)
(defrule
   (true)
=>
   (set-strategic-number sn-group-leader-defense-distance 1) 部队长防御距离
   (set-strategic-number sn-task-ungrouped-soldiers 0)指派未归队士兵
   (set-strategic-number sn-allow-civilian-defense 1) 容许村民自卫
   (set-difficulty-parameter ability-to-maintain-distance 100)
   (set-difficulty-parameter ability-to-dodge-missiles 0)
   (set-strategic-number sn-consecutive-idle-unit-limit 1)部队闲置时限
   (set-strategic-number sn-sentry-distance 0) 站岗距离
   (set-strategic-number sn-sentry-distance-variation 0) 站岗距离变量
   (set-strategic-number sn-zero-priority-distance 0)零指令等级距离
   (set-strategic-number sn-attack-separation-time-randomness 0)攻击间隔时间随机性
   (disable-self)
)
; 被敌人偷打反击
(defrule
(true)
=>
(set-goal GOAL-MOBILISE-DEFENCE 0)
)
(defrule
(town-under-attack)
(or
(or
(players-unit-type-count any-enemy militiaman-line > 2)
(players-unit-type-count any-enemy skirmisher-line > 2)
)
(or
(players-unit-type-count any-enemy battering-ram-line > 0)
(players-unit-type-count any-enemy knight-line > 1)
)
)
=>
(set-goal GOAL-MOBILISE-DEFENCE 1)
)
;所有时期
;扩展基地
(defrule
(current-age == feudal-age)
=>
(set-strategic-number sn-maximum-town-size 15)
(set-strategic-number sn-minimum-town-size 10)
(disable-self)
)
(defrule
(or
(current-age == castle-age)
(game-time > 1020)
)
=>
(set-strategic-number sn-maximum-town-size 20)
(set-strategic-number sn-minimum-town-size 12)
(disable-self)
)
(defrule
(or
(current-age == imperial-age)
(game-time > 1860)
)
=>
(set-strategic-number sn-maximum-town-size 25)
(set-strategic-number sn-minimum-town-size 15)
(disable-self)
)
(defrule
(game-time > 1800)
=>
(set-strategic-number sn-maximum-town-size 30)
(set-strategic-number sn-minimum-town-size 18)
)
(defrule
(game-time > 2100)
=>
(set-strategic-number sn-maximum-town-size 35)
(set-strategic-number sn-minimum-town-size 21)
)
(defrule
(game-time > 3000)
=>
(set-strategic-number sn-maximum-town-size 50)
(set-strategic-number sn-minimum-town-size 20)
)
(defrule
(game-time > 4000)
=>
(set-strategic-number sn-maximum-town-size 60)
(set-strategic-number sn-minimum-town-size 30)
)
(defrule
(game-time > 2400)
=>
(set-strategic-number sn-maximum-town-size 40)
(set-strategic-number sn-minimum-town-size 25)
;extend walking distances for that long game
(set-strategic-number sn-maximum-wood-drop-distance 15)
(set-strategic-number sn-maximum-food-drop-distance 20)
(set-strategic-number sn-maximum-hunt-drop-distance 25)
(set-strategic-number sn-maximum-gold-drop-distance 12)
(set-strategic-number sn-maximum-stone-drop-distance 12)
(disable-self)
)
(defrule
(game-time > 5000)
=>
(set-strategic-number sn-maximum-town-size 100)
(set-strategic-number sn-minimum-town-size 50)
;extend walking distances for that long game
(set-strategic-number sn-maximum-wood-drop-distance 50)
(set-strategic-number sn-maximum-food-drop-distance 50)
(set-strategic-number sn-maximum-hunt-drop-distance 50)
(set-strategic-number sn-maximum-gold-drop-distance 50)
(set-strategic-number sn-maximum-stone-drop-distance 50)
(disable-self)
)
(defrule
(game-time > 1800)
=>
(set-strategic-number sn-camp-max-distance 10)
(disable-self)
)
(defrule
(game-time greater-than 45)
(building-type-count town-center less-than 1)
(can-build town-center)
=>
(build town-center)
)
; build subsequent mills
(defrule
(building-type-count-total lumber-camp > 0)
(building-type-count-total mill > 0)
(building-type-count-total mill < 2)
(or
(sheep-and-forage-too-far)
(wood-amount >= 200)
)
(can-build mill)
(goal GOAL-DISABLE-MILL-BUILDING 0)
=>
(build mill)
)
;卖出多馀的资源
;木材
(defrule
(building-type-count-total market > 0)
(and(wood-amount > 1000)(gold-amount < 800))
=>
(sell-commodity wood)
)
;食物
(defrule
(building-type-count-total market > 0)
(and(food-amount > 1100)(gold-amount < 800))
=>
(sell-commodity food)
)
;石头
(defrule
(building-type-count-total market > 0)
(and(stone-amount > 1500)(gold-amount < 200))

=>
(sell-commodity stone)
)
;买急 的资源
;木材
(defrule
(building-type-count-total market > 0)
(and(wood-amount < 300)(gold-amount > 2000))
=>
(buy-commodity wood)
)
;食物
(defrule
(building-type-count-total market > 0)
(and(food-amount < 1300)(gold-amount > 2000))
=>
(buy-commodity food)
)
;石头
(defrule
(building-type-count-total market > 0)
(and(stone-amount < 100)(gold-amount > 2000))

=>
(buy-commodity stone)
)
(load "郑成功\经济")
(load "郑成功\文明")
(load "郑成功\军团")
(load "郑成功\事件")



[ 本帖最后由 ?三国迷 于 2009-1-6 12:31 编辑 ]

♂嗜心づ恶魔 发表于 2009-1-6 19:12:34

三国充能!!!:lol !!!!!:lol

jlusa 发表于 2010-11-20 14:19:36

這幾天我特地去下載鄭成功AI 因為我們寢室沒有網路只能在寢室內連線玩

zyrryz 发表于 2012-5-31 09:51:18

dfdfdfd

tankant 发表于 2013-1-26 23:04:52

本帖最后由 tankant 于 2013-1-27 15:25 编辑

https://www.hawkaoe.net/bbs/forum ... =1&extra=#pid496533
终结你的教程,呵呵
页: [1]
查看完整版本: 郑成功AI语法教学简介