From 89b0323c9f59d94bd44069c09b9068d76f6c9893 Mon Sep 17 00:00:00 2001 From: Sveinung Kvilhaugsvik Date: Thu, 15 Apr 2021 10:32:08 +0200 Subject: [PATCH] Action prob: custom AttackNonNative detection. Requested by serge_alard See osdn #42001 --- common/actions.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/common/actions.c b/common/actions.c index 19a592426d..2c8b01ca0c 100644 --- a/common/actions.c +++ b/common/actions.c @@ -4048,6 +4048,14 @@ action_prob_vs_units_full(const struct unit* actor_unit, return ACTPROB_IMPOSSIBLE; } + if ((action_id_has_result_safe(act_id, ACTION_ATTACK)) + && !is_native_tile(unit_type_get(actor_unit), target_tile) + && !can_attack_non_native(unit_type_get(actor_unit))) { + /* Hard coded rule: can't "Attack" units on non native tile without + * "AttackNonNative" and not "Only_Native_Attack". */ + return ACTPROB_IMPOSSIBLE; + } + /* Invisible units at this tile can make the action legal or illegal. * Invisible units can be stacked with visible units. The possible * existence of invisible units therefore makes the result uncertain. */ -- 2.30.2