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)))
(when (< 0.5 (random))
(set-order-stance! o (pick-random '(high mid low))))
(set-order-atk!
o
(let ((roll (random)))
(cond
((> 0.6 roll) (unit-hand-pos enemy-unit))
((> 0.8 roll) (rotate-pos-cc (unit-hand-pos enemy-unit)))
(else (rotate-pos (unit-hand-pos enemy-unit))))))
(when (or (< 1 (unit-health enemy-unit))
(< 0.5 (random)))
(set-order-atk!
o
(let ((roll (random)))
(cond
((> 0.6 roll) (unit-hand-pos enemy-unit))
((> 0.8 roll) (rotate-pos-cc (unit-hand-pos enemy-unit)))
(else (rotate-pos (unit-hand-pos enemy-unit)))))))
o))
(define (win)