31 #define LOG_DIPLOMAT LOG_DEBUG
42 if (pimprove->sabotage > 0) {
57 const struct player *target_player)
62 if (actor_research != target_research) {
73 == TECH_PREREQS_KNOWN))) {
91 struct unit *actor_unit,
92 struct city *target_city,
93 int sub_tgt_id,
int count_tech)
151 int incite_cost, expenses;
156 if (incite_cost <= actor_player->
economic.
gold - 2 * expenses) {
173 if (count_impr > 0) {
183 if (count_impr > 0) {
219 const enum effect_type casus_belli_eft[] = {
220 EFT_CASUS_BELLI_SUCCESS,
221 EFT_CASUS_BELLI_CAUGHT,
224 for (i = 0; i <
ARRAY_SIZE(casus_belli_eft); i++) {
226 casus_belli_eft[i], paction,
231 case CBR_VICTIM_ONLY:
235 case CBR_INTERNATIONAL_OUTRAGE:
258 move_fragment_cost +=
264 struct tile *from_tile;
271 actor_unit->
tile = from_tile;
291 return MAX(0, utility);
299 struct unit *actor_unit,
300 struct city *target_city)
319 int tgt_impr_vul = 0;
324 int impr_vul = pimprove->sabotage;
331 impr_vul =
MAX(impr_vul, 100);
340 if (impr_vul >= tgt_impr_vul) {
342 tgt_impr_vul = impr_vul;
enum action_actor_kind action_get_actor_kind(const struct action *paction)
Get the actor kind of an action.
enum action_target_kind action_get_target_kind(const struct action *paction)
Get the target kind of an action.
bool action_has_result(const struct action *paction, enum action_result result)
Returns TRUE iff performing the specified action has the specified result.
void dai_calc_data(const struct player *pplayer, int *trade, int *expenses, int *income)
Returns the total amount of trade generated (trade) and total amount of gold needed as upkeep (expens...
struct player * city_owner(const struct city *pcity)
Return the owner of the city.
struct tile * city_tile(const struct city *pcity)
Return the tile location of the city.
const char * city_name_get(const struct city *pcity)
Return the name of the city.
#define city_built_iterate(_pcity, _p)
#define city_built_iterate_end
int city_incite_cost(struct player *pplayer, struct city *pcity)
Returns the cost to incite a city.
int dai_action_choose_sub_tgt_unit_vs_city(struct action *paction, struct unit *actor_unit, struct city *target_city)
Returns the sub target id of the sub target chosen for the specified action performed by the specifie...
static Tech_type_id choose_tech_to_steal(const struct player *actor_player, const struct player *target_player)
Pick a tech for actor_player to steal from target_player.
adv_want dai_action_value_unit_vs_city(struct action *paction, struct unit *actor_unit, struct city *target_city, int sub_tgt_id, int count_tech)
Returns the utility of having the specified unit perform the specified action to the specified city t...
static int count_sabotagable_improvements(struct city *pcity)
Number of improvements that can be sabotaged in pcity.
int diplomats_unignored_tech_stealings(struct unit *pdiplomat, struct city *pcity)
Returns the amount of tech thefts from a city not ignored by the EFT_STEALINGS_IGNORE effect.
int get_city_bonus(const struct city *pcity, enum effect_type effect_type, enum vision_layer vlayer)
Returns the effect bonus at a city.
Impr_type_id improvement_number(const struct impr_type *pimprove)
Return the improvement index.
#define fc_assert_msg(condition, message,...)
#define fc_assert_ret_val(condition, val)
static int map_move_cost_unit(const struct civ_map *nmap, struct unit *punit, const struct tile *ptile)
enum casus_belli_range casus_belli_range_for(const struct player *offender, const struct player *tgt_plr, const enum effect_type outcome, const struct action *paction, const struct tile *tgt_tile)
Return the Casus Belli range when offender performs paction to tgt_plr at tgt_tile and the outcome is...
bool pplayers_at_war(const struct player *pplayer, const struct player *pplayer2)
Returns true iff players can attack each other.
bool pplayers_allied(const struct player *pplayer, const struct player *pplayer2)
Returns true iff players are allied.
struct research * research_get(const struct player *pplayer)
Returns the research structure associated with the player.
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
Returns state of the tech for current research.
bool research_invention_gettable(const struct research *presearch, const Tech_type_id tech, bool allow_holes)
Returns TRUE iff the given tech can be given to the players sharing the research immediately.
#define UNIT_LOG(_, punit, msg,...)
struct packet_game_info info
struct player_economic economic
Tech_type_id advance_number(const struct advance *padvance)
Return the advance index.
#define advance_iterate(_start, _p)
#define advance_iterate_end
int unit_pays_mp_for_action(const struct action *paction, const struct unit *punit)
Returns the amount of movement points successfully performing the specified action will consume in th...
const struct unit_type * unit_type_get(const struct unit *punit)
Return the unit type for this unit.
bool utype_pays_for_regular_move_to_tgt(const struct action *paction, const struct unit_type *utype)
Returns TRUE iff successfully performing the specified action always will cost the actor unit of the ...
bool utype_is_moved_to_tgt_by_action(const struct action *paction, const struct unit_type *utype)
Returns TRUE iff successfully performing the specified action always will move the actor unit of the ...
int unit_build_shield_cost_base(const struct unit *punit)
Returns the number of shields this unit represents.
bool utype_is_consumed_by_action(const struct action *paction, const struct unit_type *utype)
Returns TRUE iff performing the specified action will consume an actor unit of the specified type.
bool utype_is_unmoved_by_action(const struct action *paction, const struct unit_type *utype)
Returns TRUE iff successfully performing the specified action never will move the actor unit from its...