Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. Read more...

Feature #867744

Unhardcode fortifying rules

Added by Alexandro Ignatiev over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Category:
General
Sprint/Milestone:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

A long awaited step towards compatibility with commercial games as well as general flexibility: let the defense bonus a unit may get somewhere if fortifies be defined by a get_unittype_bonus()-calculated effect. Also, let cities don't have auto fortify; replace it on just an additional defense bonus. In civ1, civ2 and possibly civ2civ3 rulesets the bonus should have negative reqs for cities with walls and fortresses (also, maybe in civ2civ3 we can enlarge Civ3 likeness setting it to 25 rather than 50). "CanFortify" class flag goes unhardcoded or abandoned. "Cant_Fortify" type flag should be for compatibility redesigned so that units with it have 2/3 of defense strength in cities.

The latter change presumes this way to preserve current behaviour in other rulesets: turn the bonus off in cities (but not in fortresses), for "BadWallAttacker"s not to be weakened at unwalled cities, add an AlwaysOnCityCenter +50% defending extra (maybe AutoOnCityCenter with another defense and conflicting with oter extras if other defending extras may appear there, for adjusting the defense) and remove it by "city_destroyed" callback. Let this extra be non-native for classes that currently can't fortify.


Related issues

Related to Freeciv - Feature #871170: defense_multiplication(): Rework to take defender unit instead of unit typeClosed

<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>
Related to Freeciv - Feature #870905: Unitstate FortifiedClosed

<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>
Related to Freeciv - Bug #877782: helpdata claims that fortify bonus is 50%Closed

<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>
Related to Freeciv - Bug #877786: data/helpdata.txt still documents old hard coded fortification bonus rulesNew

<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>
Blocks Freeciv - Feature #871628: Follow fortifying rules from commercial games in the rulesetsClosed

<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>

History

#1 Updated by Alexandro Ignatiev over 2 years ago

Maybe more easy compatibility will be achieved if we design the effect as "negative values are applied by absolute disregarding of if the unit is fortified".

#2 Updated by Alexandro Ignatiev over 2 years ago

Or maybe do this effect via get_unit_bonus? Combined with a unit-ranged counter, it would allow gradual fortification CivIV-style. But maybe such an effect, with all AI and UI related features, should be postponed to some later version and/or did in a more hardcoded way.

#3 Updated by Marko Lindqvist over 2 years ago

  • Related to Feature #871170: defense_multiplication(): Rework to take defender unit instead of unit type added

#4 Updated by Marko Lindqvist over 2 years ago

#5 Updated by Marko Lindqvist over 2 years ago

Attached patch implements effect type "Fortify_Defense_Bonus" that replaces hardcoded fortifying defense bonuses for fortified units and units in cities.
The unit class flag "CanFortify" and unit type flag "Cant_Fortify" are left untouched, as they still control if unit can perform fortifying/fortified activities.

#6 Updated by Alexandro Ignatiev over 2 years ago

Then, civN compatibility for fortifying bonus goes to the next ticket? (Actually, it's a task of itself to find all cases when the game considers units in cities having fortified bonus). The flags are unhardcoded effectively (we should change their documentation in units.ruleset at least), "Fortify" for some while already has an action enabler that allows us to ignore explorer's reports of enemy moves around.

#7 Updated by Marko Lindqvist over 2 years ago

Alexandro Ignatiev wrote:

Then, civN compatibility for fortifying bonus goes to the next ticket?

Yes, further development and ruleset changes should have their own tickets.

#8 Updated by Marko Lindqvist over 2 years ago

  • Status changed from Resolved to In Progress

Planned reimplementation of Feature #870905 will mean this patch needs changing too.

#9 Updated by Marko Lindqvist over 2 years ago

- Rebased, and adjusted, on top of new version of Feature #870905
- Fixed an error in creation of the compatibility effect in rscompat.c

#10 Updated by Marko Lindqvist over 2 years ago

  • Blocks Feature #871628: Follow fortifying rules from commercial games in the rulesets added

#11 Updated by Marko Lindqvist over 2 years ago

  • Status changed from Resolved to In Progress

Current patch makes autogames to differ though it should not.

#12 Updated by Marko Lindqvist over 2 years ago

Marko Lindqvist wrote:

Current patch makes autogames to differ though it should not.

get_fortified_defense_power() does not care if unit can fortify or not, it always calls defense_multiplication() with fortified set. Before this patch defense_multiplication() checked itself if the unit can truly be fortified even if the caller said it is fortified.

#13 Updated by Marko Lindqvist over 2 years ago

- Make get_fortified_defense_power() to check if unit can fortify

#14 Updated by Marko Lindqvist over 2 years ago

  • Status changed from Resolved to Closed
  • Assignee set to Marko Lindqvist

#15 Updated by Sveinung Kvilhaugsvik about 2 years ago

  • Related to Bug #877782: helpdata claims that fortify bonus is 50% added

#16 Updated by Sveinung Kvilhaugsvik about 2 years ago

  • Related to Bug #877786: data/helpdata.txt still documents old hard coded fortification bonus rules added

Also available in: Atom PDF