According to
https://civilization.fandom.com/wiki/Immortal_(Civ6) The
Immortal is the Persian unique Melee class unit that replaces the Swordsman, with a ranged attack (Range 2) and the ability to capture cities.
"Note that, by default, the Immortal attacks in melee. This matters because the right-click attack shortcut will trigger a melee attack instead of a ranged shot (as it does for ranged units). If you want your Immortal to shoot the target instead of approaching and attacking it in melee, you should explicitly give a ranged strike command, and not right-click!"
As I understand it, ' the ability to capture cities' is an
implicit property of
melee units which expresses itself in
approaching and occupying an attacked target's tile.
Compare a warrior & a slinger in making 1 move onto a flat tile next to an enemy unit and then using its 2nd movement point for a killing attack: the warrior occupies the enemy tile by destroying & replacing the enemy unit / city belonging directly; the slinger may kill an enemy unit, but cannot replace the enemy unit / city belonging directly.
As implemented such implicit behaviour cannot be influenced by the
.xml &
.sql files from which the game's database is build nor by the interpreted
.lua scripts, because it is coded inside the DLL.
So for a ranged unit becoming able to capture a undefended city at health=0 one needs the C++ source files (
.cpp), make this modification & compile a new custom DLL to replace the given.
Modder access to the C++ source files would require the decision to actually release those source files "to the best fans they have".
.