From 28ecbfa4be298df11d27e7f523b44444691a0a14 Mon Sep 17 00:00:00 2001 From: Sveinung Kvilhaugsvik Date: Wed, 28 Apr 2021 13:14:00 +0200 Subject: [PATCH] dai_unit_attack(): support "Explode Nuclear". The introduction of explode_nuclear_max_range made a ruleset where "Explode Nuclear" is able target a neighbor tile possible. Support it in dai_unit_attack(). See osdn #42096 --- ai/default/aitools.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ai/default/aitools.c b/ai/default/aitools.c index ef4c21cc55..95da35a55f 100644 --- a/ai/default/aitools.c +++ b/ai/default/aitools.c @@ -875,6 +875,19 @@ bool dai_unit_attack(struct ai_type *ait, struct unit *punit, struct tile *ptile /* Choose "Nuke Units". */ unit_do_action(unit_owner(punit), punit->id, tile_index(ptile), 0, "", ACTION_NUKE_UNITS); + } else if (action_id_get_target_kind(ACTION_NUKE) == ATK_TILE + && is_action_enabled_unit_on_tile(ACTION_NUKE, + punit, ptile, NULL)) { + /* Choose "Explode Nuclear". */ + unit_do_action(unit_owner(punit), punit->id, tile_index(ptile), + 0, "", ACTION_NUKE); + } else if (action_id_get_target_kind(ACTION_NUKE) == ATK_CITY + && (tcity = tile_city(ptile)) + && is_action_enabled_unit_on_city(ACTION_NUKE, + punit, tcity)) { + /* Choose "Explode Nuclear". */ + unit_do_action(unit_owner(punit), punit->id, tcity->id, + 0, "", ACTION_NUKE); } else if (action_id_get_target_kind(ACTION_NUKE_CITY) == ATK_TILE && is_action_enabled_unit_on_tile(ACTION_NUKE_CITY, punit, ptile, NULL)) { -- 2.30.2