wesnoth/data/ai/formula/level_up_attack_move.fai
Douglas Hains dc825fb3b5 added level up attack candidate move
registered move in scenario-formula.cfg and added units to test functionality
2008-08-18 07:00:02 +00:00

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