Page 1 of 1

More flexible Attack_Bonus (and Range)

Posted: Sun May 03, 2020 5:32 am
by soundnfury
In my Aviation ruleset I want to be able to have a building Sector Control, whose effect is "50% attack bonus to friendly units attacking Air units within the city's borders (i.e. City_Radius_Sq)". There are two things I would need to make that possible:
  1. Defender unit reqs for Attack_Bonus (currently the reqs use the attacking unit only)
  2. A Range value of City_Radius to specify "defender is within city borders" (rather than the current City range, which AIUI applies only to a city containing the defending unit)
For (1) it might make sense to have separate AttackerType and DefenderType (and AttackerClass and AttackerFlag, etc.) requirement types, with the existing Unit ones being kept as aliases for whichever they currently mean on any given effect.
As an alternative to (2), City_Adjacent (search any city adjacent to the defender's tile) could also work.
In either case, the range would need to only count cities belonging to the attacking player — the bonus shouldn't be given to enemies!

Stretch goal: I also want a Great Wonder, Dowding System, which acts as a Sector Control in every city. range=Player wouldn't quite do what I want, as it'd apply over the whole map rather than just "within borders of any friendly city", so I'd need yet another new Range value, Player_City_Radius, to mean "within City_Radius of any Player city" (and for symmetry one could also implement Alliance_City_Radius and World_City_Radius with the obvious semantics).

I realise this is all pretty complex and not very generic, so it's unlikely to happen. But hey, the board is called Wishlist ;)

Re: More flexible Attack_Bonus (and Range)

Posted: Sun May 03, 2020 6:39 am
by cazfi
soundnfury wrote:City_Adjacent (search any city adjacent to the defender's tile) could also work.
"CityTile", "Center", "Adjacent" ?

Re: More flexible Attack_Bonus (and Range)

Posted: Sun May 03, 2020 10:06 am
by Ignatus
soundnfury wrote:In my Aviation ruleset I want to be able to have a building Sector Control, whose effect is "50% attack bonus to friendly units attacking Air units within the city's borders (i.e. City_Radius_Sq)". There are two things I would need to make that possible:
  1. Defender unit reqs for Attack_Bonus (currently the reqs use the attacking unit only)
  2. A Range value of City_Radius to specify "defender is within city borders" (rather than the current City range, which AIUI applies only to a city containing the defending unit)
(1) - in v.3.1 we likely shall have defender-related defense bonus HRM#867744
(2) - a Lua kludge could place some extra on tiles within city radii if the building is built in a city and add/remove it on radius changes (building_built, build_lost, city_size_change signals).

Re: More flexible Attack_Bonus (and Range)

Posted: Fri May 08, 2020 4:25 pm
by soundnfury
cazfi wrote:
soundnfury wrote:City_Adjacent (search any city adjacent to the defender's tile) could also work.
"CityTile", "Center", "Adjacent" ?
AIUI that just tests that you are adjacent to a city; I don't see how to combine it with "and that city contains building X". Unless having both in the same reqs vector forces them to apply to the same city, but I'd expect not.
Ignatus wrote:(1) - in v.3.1 we likely shall have defender-related defense bonus HRM#867744
Intriguing. I guess "33% defence malus" accomplishes the same effect as I'm after.
Ignatus wrote:(2) - a Lua kludge could place some extra on tiles within city radii if the building is built in a city and add/remove it on radius changes (building_built, build_lost, city_size_change signals).
Sounds plausible; guess I'll have to learn some Lua then ;)

Thanks for the help, and I look forward to using this when the time comes to port my ruleset to 3.1 :)

Re: More flexible Attack_Bonus (and Range)

Posted: Fri May 08, 2020 7:46 pm
by Ignatus
soundnfury wrote: AIUI that just tests that you are adjacent to a city; I don't see how to combine it with "and that city contains building X". Unless having both in the same reqs vector forces them to apply to the same city, but I'd expect not.
Yes, alas, almost all unit-ranged effects consider a city only when a unit is on its center.