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 #848689

Figure out unit_can_defend_here() while transported

Added by Sveinung Kvilhaugsvik over 2 years ago. Updated 7 months ago.

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

0%

Estimated time:

Description

Should being able to be unloaded by the transport count as being able to defend (like it does now) or should a unit that can't alight be considered useless as a defender? What about a unit that can alight but can't be unloaded?

"Transport Alight" and "Transport Unload" can have ruleset defined side effects from Lua and effects. Should a transported unit be forced to unload before it can defend? What if it becomes unable to defend while performing the exit transport action? What if it becomes a worse defender?

My suspicion is that the answer to these questions should be answered by rule set. A Laser Gun loaded on a ship should be able to defend against an incoming attack while transported. A Legion on a River Boat should have to alight first and suffer the mp punishment from exiting. A unit that is unloaded slowly should not be able to defend.


Related issues

Related to Freeciv - Feature #848492: New action "Transport Unload"Closed

<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>
Blocks Freeciv - Task #673656: S3_1 datafile format freeze (d3f)Closed

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

History

#1 Updated by Sveinung Kvilhaugsvik over 2 years ago

  • Blocks Task #673656: S3_1 datafile format freeze (d3f) added

#3 Updated by Sveinung Kvilhaugsvik over 2 years ago

#4 Updated by Sveinung Kvilhaugsvik over 2 years ago

Possible solution (brain storm-level): 2 phases. First prepare each unit to defend. Then check legality / best defender.

Prepare to defend
This makes the ruleset able to force units at a tile under attack to prepare them self. This should put them in a state where they legally can defend. Get a requirement vector and a list of actions from the ruleset. The requirement vector is evaluated against each possible defender unit. If a unit matches the requirement vector it will be forced to perform the first legal action in the action list. (Can probably be implemented as an action auto performer.) Example: Prepare to defend is triggered by a transported unit at a tile it can exist on and does alight in the requirement vector.

May need to special case transports unloading cargo since that is a unit preparing another unit, not a unit preparing it self.

Pick defender
Get another requirement vector from the ruleset. A unit can defend at the tile if this vector is fulfilled (and hard coded limitations are fulfilled). Pick the best defender as normal. Example: the requirement vector forbids units inside transports from defending.

#5 Updated by Marko Lindqvist 10 months ago

Sveinung Kvilhaugsvik wrote:

Possible solution (brain storm-level): 2 phases. First prepare each unit to defend. Then check legality / best defender.

Certainly solution that involved is not going to get implemented to S3_1 at this point (where we are trying to tie loose ends preventing d3f)? It might be worth to make that a future goal -> new ticket.

For S3_1 I'm thinking that maybe we should just add a boolean for a unit type that tells if it can defend when that involves unloading from a transport, i.e., keep current rules except prevent it from defending when the unit type has been marked unable to do so.

#6 Updated by Marko Lindqvist 7 months ago

Marko Lindqvist wrote:

For S3_1 I'm thinking that maybe we should just add a boolean for a unit type that tells if it can defend when that involves unloading from a transport, i.e., keep current rules except prevent it from defending when the unit type has been marked unable to do so.

That's what attached patches do.

#7 Updated by Marko Lindqvist 7 months ago

Sveinung Kvilhaugsvik wrote:

A Laser Gun loaded on a ship should be able to defend against an incoming attack while transported.

-> https://osdn.net/projects/freeciv/ticket/43541

#8 Updated by Marko Lindqvist 7 months ago

What I dislike in the current patch is that the thing cannot be controlled on unit type level, but this is unit class level flag. Exceptions to the default are more likely wanted to just a couple of unit types than entire classes.

#9 Updated by Marko Lindqvist 7 months ago

- Make the setting per unit type
- Make it a separate enum instead of flag, so future rules are easier to add
- Default to old rule of all units alighting when possible (also; no rules in any ruleset changed in this patch)

#10 Updated by Marko Lindqvist 7 months ago

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

Also available in: Atom PDF