Project

General

Profile

Bug #1910 ยป 0053-dai_rampage_want-Consider-fake-generalized-attack-ac.patch

Marko Lindqvist, 01/18/2026 08:26 AM

View differences:

ai/default/daiunit.c
return TRUE;
}
/**********************************************************************//**
Select attack kind of action to do against the tile.
Returns ACTION_NONE if no attack action possible.
**************************************************************************/
enum gen_action dai_select_tile_attack_action(struct civ_map *nmap,
struct unit *punit,
struct tile *ptile)
{
enum gen_action selected;
if ((selected = select_actres_action_unit_on_stack(nmap, ACTRES_ATTACK,
punit, ptile))
== ACTION_NONE
&& (selected = select_actres_action_unit_on_stack(nmap, ACTRES_COLLECT_RANSOM,
punit, ptile))
== ACTION_NONE) {
return ACTION_NONE;
}
return selected;
}
/**********************************************************************//**
This function appraises the location (x, y) for a quick hit-n-run
operation. We do not take into account reinforcements: rampage is for
......
if (can_unit_attack_tile(punit, nullptr, ptile)
&& (pdef = get_defender(nmap, punit, ptile, nullptr))
/* Action enablers might prevent attacking */
&& (is_action_enabled_unit_on_stack(nmap, ACTION_ATTACK,
punit, ptile)
|| is_action_enabled_unit_on_stack(nmap, ACTION_COLLECT_RANSOM,
punit, ptile))) {
&& dai_select_tile_attack_action(nmap, punit, ptile) != ACTION_NONE) {
/* See description of kill_desire() about these variables. */
int attack = unit_att_rating_now(punit);
int benefit = stack_cost(punit, pdef);
ai/default/daiunit.h
void dai_switch_to_explore(struct ai_type *ait, struct unit *punit,
struct tile *target, enum override_bool *allow);
enum gen_action dai_select_tile_attack_action(struct civ_map *nmap,
struct unit *punit,
struct tile *ptile);
#endif /* FC__DAIUNIT_H */
    (1-1/1)