Feature #2026 » 0013-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_UNITS;
|
||
|
}
|
||
|
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_UNITS;
|
||
|
}
|
||
|
return selected;
|
||
|
}
|
||
|
return selected;
|
||
|
return ACTION_NONE;
|
||
|
}
|
||
|
/**********************************************************************//**
|
||
| ... | ... | |
|
if (can_unit_attack_tile(punit, NULL, ptile)
|
||
|
&& (pdef = get_defender(nmap, punit, ptile, NULL))
|
||
|
/* 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 | ||
|---|---|---|
|
#define FC__DAIUNIT_H
|
||
|
/* common */
|
||
|
#include "actres.h"
|
||
|
#include "combat.h"
|
||
|
#include "fc_types.h"
|
||
|
#include "terrain.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 */
|
||
- « Previous
- 1
- 2
- Next »