任务单 #42960

firepower of ship not reduced when attacking from city

开放日期: 2021-10-01 04:06 最后更新: 2021-11-22 23:09

报告人:
属主:
类型:
状态:
关闭
组件:
里程碑:
优先:
5 - Medium
严重性:
5 - Medium
处理结果:
Fixed
文件:
3

Details

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).

任务单历史 (3/14 Histories)

2021-10-01 04:06 Updated by: log65536
  • New Ticket "firepower of ship not reduced when attacking from city" created
2021-10-01 08:37 Updated by: log65536
评论

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.

(Edited, 2021-10-01 08:38 Updated by: log65536)
2021-10-01 10:19 Updated by: 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.
Yeah, that seems hairy to resolve correctly.
2021-10-01 15:42 Updated by: log65536
评论

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.

2021-10-01 15:59 Updated by: log65536
评论

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.

2021-10-01 15:59 Updated by: cazfi
评论

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)

2021-10-01 16:09 Updated by: log65536
评论

Writing at the same time - this was nice :)

2021-11-08 08:17 Updated by: cazfi
  • 处理结果 Update from to Accepted
  • 里程碑 Update from (无) to 2.6.6 (关闭)
评论

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.

2021-11-21 07:14 Updated by: cazfi
评论

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.

2021-11-21 07:22 Updated by: cazfi
评论

Reply To cazfi

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)

2021-11-22 23:09 Updated by: cazfi
  • 状态 Update from 开启 to 关闭
  • 属主 Update from (无) to cazfi
  • 处理结果 Update from Accepted to Fixed

编辑

Please login to add comment to this ticket » 登录名