Project

General

Profile

Feature #1089 ยป 0073-AI-Pass-civ_map-to-dai_wants_defender_against.patch

Marko Lindqvist, 11/09/2024 02:01 PM

View differences:

ai/default/daimilitary.c
vulnerability = vulnerability * 100 / (defbonus_pct + 100);
/* Pass the order for a new defender type against it
* to the scientific advisor, urgency considered */
(void) dai_wants_defender_against(ait, pplayer, pcity, utype,
(void) dai_wants_defender_against(ait, nmap, pplayer, pcity, utype,
vulnerability / MAX(move_time, 1));
if (utype_acts_hostile(unit_type_get(punit)) && 2 >= move_time) {
ai/default/daitech.c
cheapest to research.
**************************************************************************/
struct unit_type *dai_wants_defender_against(struct ai_type *ait,
const struct civ_map *nmap,
struct player *pplayer,
struct city *pcity,
const struct unit_type *att, int want)
......
int att_idx = utype_index(att);
int defbonus = 100
+ get_unittype_bonus(pplayer, ptile, att, NULL, EFT_DEFEND_BONUS);
const struct civ_map *nmap = &(wld.map);
unit_type_iterate(deftype) {
int mp_pct = deftype->cache.defense_mp_bonuses_pct[att_idx] + 100;
ai/default/daitech.h
struct player *pplayer,
struct city *pcity, int role, int want);
struct unit_type *dai_wants_defender_against(struct ai_type *ait,
const struct civ_map *nmap,
struct player *pplayer,
struct city *pcity,
const struct unit_type *att,
    (1-1/1)