Feature #2026 » 0037-AI-Enable-rampage-when-unit-can-do-Nuke-Tile-attack.patch
| ai/default/daiunit.c | ||
|---|---|---|
|
**************************************************************************/
|
||
|
enum gen_action dai_select_tile_attack_action(struct civ_map *nmap,
|
||
|
struct unit *punit,
|
||
|
struct tile *ptile)
|
||
|
struct tile *ptile,
|
||
|
enum action_target_kind *kind)
|
||
|
{
|
||
|
enum gen_action selected;
|
||
|
if ((selected = select_actres_action_unit_on_stack(nmap, ACTRES_CAPTURE_UNITS,
|
||
|
punit, ptile))
|
||
|
== ACTION_NONE
|
||
|
&& (selected = select_actres_action_unit_on_stack(nmap, ACTRES_COLLECT_RANSOM,
|
||
|
!= ACTION_NONE
|
||
|
|| (selected = select_actres_action_unit_on_stack(nmap, ACTRES_COLLECT_RANSOM,
|
||
|
punit, ptile))
|
||
|
== ACTION_NONE
|
||
|
&& (selected = select_actres_action_unit_on_stack(nmap, ACTRES_BOMBARD,
|
||
|
!= ACTION_NONE
|
||
|
|| (selected = select_actres_action_unit_on_stack(nmap, ACTRES_BOMBARD,
|
||
|
punit, ptile))
|
||
|
== ACTION_NONE
|
||
|
&& (selected = select_actres_action_unit_on_stack(nmap, ACTRES_NUKE_UNITS,
|
||
|
!= ACTION_NONE
|
||
|
|| (selected = select_actres_action_unit_on_stack(nmap, ACTRES_NUKE_UNITS,
|
||
|
punit, ptile))
|
||
|
== ACTION_NONE
|
||
|
&& (selected = select_actres_action_unit_on_stack(nmap, ACTRES_ATTACK,
|
||
|
punit, ptile))
|
||
|
== ACTION_NONE) {
|
||
|
return ACTION_NONE;
|
||
|
!= ACTION_NONE) {
|
||
|
if (kind != nullptr) {
|
||
|
*kind = ATK_STACK;
|
||
|
}
|
||
|
return selected;
|
||
|
}
|
||
|
if ((selected = select_actres_action_unit_on_tile(nmap, ACTRES_NUKE,
|
||
|
punit, ptile))
|
||
|
!= ACTION_NONE) {
|
||
|
if (kind != nullptr) {
|
||
|
*kind = ATK_TILE;
|
||
|
}
|
||
|
return selected;
|
||
|
}
|
||
|
if ((selected = select_actres_action_unit_on_stack(nmap, ACTRES_ATTACK,
|
||
|
punit, ptile))
|
||
|
!= ACTION_NONE) {
|
||
|
if (kind != nullptr) {
|
||
|
*kind = ATK_STACK;
|
||
|
}
|
||
|
return selected;
|
||
|
}
|
||
|
return selected;
|
||
|
return ACTION_NONE;
|
||
|
}
|
||
|
/**********************************************************************//**
|
||
| ... | ... | |
|
if (can_unit_attack_tile(punit, nullptr, ptile)
|
||
|
&& (pdef = get_defender(nmap, punit, ptile, nullptr))
|
||
|
/* Action enablers might prevent attacking */
|
||
|
&& dai_select_tile_attack_action(nmap, punit, ptile) != ACTION_NONE) {
|
||
|
&& dai_select_tile_attack_action(nmap, punit, ptile, nullptr) != 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 | ||
|---|---|---|
|
enum gen_action dai_select_tile_attack_action(struct civ_map *nmap,
|
||
|
struct unit *punit,
|
||
|
struct tile *ptile);
|
||
|
struct tile *ptile,
|
||
|
enum action_target_kind *kind);
|
||
|
#endif /* FC__DAIUNIT_H */
|
||