From 8502f2cab428ac43a73871ff55253355228577c7 Mon Sep 17 00:00:00 2001 From: Sveinung Kvilhaugsvik Date: Thu, 15 Apr 2021 10:32:08 +0200 Subject: [PATCH 1/2] Action prob: custom AttackNonNative detection. Requested by serge_alard See osdn #42001 --- common/actions.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/actions.c b/common/actions.c index 1882dfdd28..153b209d41 100644 --- a/common/actions.c +++ b/common/actions.c @@ -5988,6 +5988,16 @@ action_prob_vs_units_full(const struct unit* actor_unit, return ACTPROB_IMPOSSIBLE; } + if ((action_id_has_result_safe(act_id, ACTRES_ATTACK) + || action_id_has_result_safe(act_id, ACTRES_NUKE_UNITS)) + && !is_native_tile(unit_type_get(actor_unit), target_tile) + && !can_attack_non_native(unit_type_get(actor_unit))) { + /* Hard coded rule: can't "Nuke Units", "Suicide Attack", or "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