Make AI prioritize fleeing at low health

This commit is contained in:
Jakub 2026-05-24 17:04:39 +08:00
parent 57ec098b10
commit d4d0806abb

View file

@ -90,13 +90,15 @@
#f))) #f)))
(when (< 0.5 (random)) (when (< 0.5 (random))
(set-order-stance! o (pick-random '(high mid low)))) (set-order-stance! o (pick-random '(high mid low))))
(when (or (< 1 (unit-health enemy-unit))
(< 0.5 (random)))
(set-order-atk! (set-order-atk!
o o
(let ((roll (random))) (let ((roll (random)))
(cond (cond
((> 0.6 roll) (unit-hand-pos enemy-unit)) ((> 0.6 roll) (unit-hand-pos enemy-unit))
((> 0.8 roll) (rotate-pos-cc (unit-hand-pos enemy-unit))) ((> 0.8 roll) (rotate-pos-cc (unit-hand-pos enemy-unit)))
(else (rotate-pos (unit-hand-pos enemy-unit)))))) (else (rotate-pos (unit-hand-pos enemy-unit)))))))
o)) o))
(define (win) (define (win)