mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-16 18:31:32 +00:00
17 lines
719 B
Plaintext
17 lines
719 B
Plaintext
faifile 'level_up_attack_move.fat'
|
|
|
|
# If move is chosen, attacker (me) will attack enemy unit (target) from the hex #
|
|
# with highest defensive value. This move will only be chosen if the attacker #
|
|
# can level up with a kill of target and has a high probability of killing in #
|
|
# a single round #
|
|
|
|
# function returns best defensive loc reachable by attacker to attack enemy #
|
|
def get_best_defense_loc(moves, attacker, enemy)
|
|
choose(filter(map(filter(moves, src=attacker.loc), dst),
|
|
distance_between(self, enemy.loc) = 1),
|
|
defense_on(attacker.loc, self));
|
|
|
|
attack(me.loc, get_best_defense_loc(my_moves.moves, me, target), target.loc)
|
|
|
|
faiend
|