wangzhen 发表于 2020-5-30 21:49:15

单位建造建筑多次

本帖最后由 wangzhen 于 2020-5-30 21:52 编辑

(defrule
(game-time > 0)
=>
         (set-strategic-number sn-percent-civilian-gatherers90)
      (set-strategic-numbersn-percent-civilian-builders10)
      (set-strategic-number sn-enable-new-building-system1)
      (set-strategic-number sn-enable-training-queue1)
      (set-strategic-number sn-maximum-food-drop-distance 15)
      (set-strategic-number sn-maximum-wood-drop-distance 15)
      (set-strategic-number sn-maximum-gold-drop-distance 15)
      (set-strategic-number sn-maximum-stone-drop-distance 15)
      (set-strategic-number sn-maximum-hunt-drop-distance 8)
      (set-strategic-number sn-cap-civilian-explorers 0)
      (set-strategic-number sn-percent-civilian-explorers 0)
      (set-strategic-number sn-percent-enemy-sighted-response 100)
      (set-strategic-number sn-hits-before-alliance-change 25)
      (set-strategic-number sn-number-explore-groups 1)
      (set-strategic-number sn-percent-attack-soldiers 0)
      (set-strategic-number sn-task-ungrouped-soldiers 0)
      (set-strategic-number sn-number-attack-groups 0)
      (set-strategic-number sn-enemy-sighted-response-distance 10)
      (set-strategic-number sn-total-number-explorers 0)
      (set-strategic-number sn-relic-return-distance 0)
    (disable-self)
)   

(defrule
(true)
=>
   (set-strategic-number sn-food-gatherer-percentage 55)    采集分配
   (set-strategic-number sn-wood-gatherer-percentage 30)
   (set-strategic-number sn-gold-gatherer-percentage 10)
   (set-strategic-number sn-stone-gatherer-percentage 5)
   (disable-self)
)

建造建筑
(defrule
    (population-cap > 0)
      (housing-headroom < 6)
      (can-build house)
=>
         (build house)
)      



(defrule
(unit-type-count-totalvillagerc:>22)
(building-type-count-total barracks c:< 2)
=>
(build barracks)
)      

(defrule
    (building-type-count-total town-center c:< 3)
      (can-build town-center)
=>
         (build town-center)
)      

(defrule
    (building-type-count-total market c:< 1)
      (can-build market)
=>
         (build market)
)      

(defrule
    (building-type-count-total blacksmith c:< 1)
      (can-build blacksmith)
=>
         (build blacksmith)
)      

(defrule
    (unit-type-count-totalvillagerc:==5)
      (building-type-count-total lumber-camp c:< 1)
      (can-build lumber-camp)
      
=>
    (build lumber-camp)
      (disable-self)
)

(defrule
    (unit-type-count-totalvillagerc:>=15)
      (building-type-count-total lumber-camp c:== 1)
      (can-build lumber-camp)
      
=>
    (build lumber-camp)
      (disable-self)
)

(defrule
    (unit-type-count-totalvillagerc:>=15)
      (building-type-count-total mining-camp c:< 2)
      (can-build mining-camp)
      
=>
(build mining-camp)
)

(defrule
    (unit-type-count-totalvillagerc:>5)
      (building-type-count-total 68 c:< 1)
      
      
=>
    (build 68) 磨坊建造多次


(defrule
   (building-type-count-total farm c:< 10)
   (can-build farm)
=>
         (build farm)
)

科技
(defrule
    (food-amount < 50)
      (can-research ri-loom)
      =>
      (research ri-loom)
      )

(defrule
    (unit-type-count-totalvillager>=25)
      (research-available feudal-age)
      =>
      (research feudal-age )
      )

(defrule
    (unit-type-count-totalvillager>=25)
      (research-available castle-age)
      =>
      (research castle-age )
      )

训练单位
(defrule
(unit-type-count-totalvillagerc:<30)
(food-amount greater-than 50)
=>
(train villager)
)

军营建造无数个
磨坊建造无数个 除非在建造后面加disable self不然不会停止。

newtonerdai 发表于 2020-5-31 16:52:49

请问,你这是在求助还是分享,请选择正确的分类,方便他人理解。
如果是求助,请指明你遇到的问题。
如果是分享,我个人建议加点注释帮助读者理解,并告诉我们代码的核心功能和意义。。。

wangzhen 发表于 2020-5-31 19:10:37

newtonerdai 发表于 2020-5-31 16:52
请问,你这是在求助还是分享,请选择正确的分类,方便他人理解。
如果是求助,请指明你遇到的问题。
如果是 ...

谢谢 在求助 按上面代码 磨坊和军营只建造一次 运行后结果他建造超过一个 不懂哪里出问题了
页: [1]
查看完整版本: 单位建造建筑多次