A reminder that any rule change here should also update the Combat section of helpdata.txt, which in the meantime has been edited to reflect GNAPATCH#3830.
Reply To log65536
the sole purpose to handle the attacker-ship-offshore/defender-ship-in-city case, maybe replace it with a simple literal check for defender-in-city, and refrain from considering the attacker tile altogether.
cazfi への返信
Reply To log65536
the sole purpose to handle the attacker-ship-offshore/defender-ship-in-city case, maybe replace it with a simple literal check for defender-in-city, and refrain from considering the attacker tile altogether.
I don't think there need to be a city involved. Ships can bombard units on shore anywhere.
The non-city case is handled by the first clause of the check (!is_native_tile(unit_type(attacker), unit_tile(defender)) i.e. non-native-attack). The second clause (!can_exist_at_tile(unit_type(defender), unit_tile(attacker))) has any effect only when a city is involved (since non-native attack where "defender can_exist_at_tile of attacker" is only possible in the attacker-ship-offshore/defender-ship-in-city and attacker-ship-in-city/defender-land-unit-on-land-tile cases; of those we only want the former case to be rejected for reduction of firepower).
Yeah, that seems hairy to resolve correctly.
The counter-intuitive stuff is the second clause, thus my suggestion to simplify it with a simple check for a city.
Now come to think of it more carefully, you are right, the second clause also takes effect in the attacker-ship-offshore/defender-helicopter-on-land case, therefore the second clause cannot be replaced by a city check. A city check should be in addition to it. I forgot that Helicopters are not Unreachable.
No, I read the code so that the main reason of that check is to distinguish between a land unit on shore, and a helicopter unit above land (in classic ruleset - in custom rulesets it may apply to other units native to both land and sea)
Writing at the same time - this was nice :)
Do you think the attached patches do the right thing? They *add* the check for the possibility that the attacker is in a city (or transport) on non-native terrain.
The patch has the issue that when a ship attacks against a Helicopter from a city, it's considered land bombardment.
1) I conclude that correct behavior in all situations is not possible without additional information from the rulesets -> fix to that not possible in d3f branches (S2_6 & S3_0)
2) I think that the patch here is the least bad solution for S2_6 & S3_0 - it handles typical attack against land units always correctly. So I still plan to push the patch.
It is an old rule that when a ship attacks a land unit, both firepowers are reduced to 1.
Problem is, GNAPATCH#3830 (github commit here) seems to have unintentionally caused a rule change: after this commit, the firepowers are not reduced when the ship attacks from a city.
This has strategic implications, as it makes ships useful as fire-back city defenders against land assaults.
To reproduce, open attached savegame, take the Spanish, activate the Cruiser in Barcelona, and inspect the chance to win against the Austrian Mech. Inf.
If you do this in 2.5, the chance is 50%; if you do it in 3.0.0-beta2, the chance is 98%.
The easiest fix would be to just add a hard-coded check for the attacker-in-city case.
Alternatively, since the patch originally introduced the offending check !can_exist_at_tile(unit_type(defender), unit_tile(attacker)) with the sole purpose to handle the attacker-ship-offshore/defender-ship-in-city case, maybe replace it with a simple literal check for defender-in-city, and refrain from considering the attacker tile altogether.
In any case, the discussion in GNAPATCH#3830 makes it clear that formulating this via tile nativity is very confusing. And the rationale behind this rule is hard to generalize -- it makes sense for classic, but is it the right thing to do in other rulesets? Maybe this should not be hard coded. Currently there is a "FirePower1" bonus to reduce defender firepower, maybe something similar can be added to also reduce attacker firepower. In that case, the logic that the classic ruleset needs to express becomes quite simple: reduce both firepowers to 1 when a Sea unit attacks a Land unit, irrespective of terrain (since classic Land units cannot defend on oceanic terrain anyway).