From 0ebaef1ba9948638ab00d89108267e5693730d45 Mon Sep 17 00:00:00 2001 From: Sveinung Kvilhaugsvik Date: Thu, 15 Apr 2021 10:32:08 +0200 Subject: [PATCH 1/4] Action prob: custom AttackNonNative detection. Requested by serge_alard See osdn #42001 --- common/actions.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/common/actions.c b/common/actions.c index 27225802e8..3db1185311 100644 --- a/common/actions.c +++ b/common/actions.c @@ -6016,6 +6016,17 @@ 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_WIPE_UNITS) + || 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", "Wipe 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