29 const struct tile *,
const char *);
35 int actor_id,
struct unit *actor)
78 paction, EFT_ACTION_SUCCESS_TARGET_MOVE_COST);
99 struct player *victim_player,
100 const bool int_outrage)
110 if (oplayer != offender) {
116 }
else if (victim_player && offender != victim_player) {
136 struct player *victim_player,
const struct tile *victim_tile,
139 const enum effect_type eft)
141 enum casus_belli_range cbr;
146 if (cbr >= CBR_VICTIM_ONLY) {
152 const bool int_outrage = (cbr == CBR_INTERNATIONAL_OUTRAGE);
155 notify_actor(offender, paction, offender, victim_player, victim_tile,
157 notify_victim(victim_player, paction, offender, victim_player,
158 victim_tile, victim_link);
165 notify_global(oplayer, paction, offender, victim_player, victim_tile,
180 if (victim_player !=
nullptr && victim_player != offender) {
195 const struct tile *victim_tile,
const char *victim_link)
197 if (!victim_player || offender == victim_player) {
207 _(
"You have caused an incident getting caught"
208 " trying to do %s to %s."),
216 _(
"You have caused an incident getting caught"
217 " trying to do %s to %s %s."),
224 _(
"You have caused an incident getting caught"
225 " trying to do %s at %s."),
245 const struct tile *victim_tile,
const char *victim_link)
247 if (!victim_player || offender == victim_player) {
257 _(
"The %s have caused an incident getting caught"
258 " trying to do %s to %s."),
267 _(
"The %s have caused an incident getting caught"
268 " trying to do %s to your %s."),
276 _(
"The %s have caused an incident getting caught"
277 " trying to do %s at %s."),
298 const struct tile *victim_tile,
const char *victim_link)
300 if (receiver == offender) {
303 _(
"Getting caught while trying to do %s gives "
304 "everyone a casus belli against you."),
306 }
else if (receiver == victim_player) {
309 _(
"Getting caught while trying to do %s to you gives "
310 "everyone a casus belli against the %s."),
313 }
else if (victim_player ==
nullptr) {
316 _(
"You now have a casus belli against the %s. "
317 "They got caught trying to do %s."),
323 _(
"You now have a casus belli against the %s. "
324 "They got caught trying to do %s to the %s."),
339 struct player *victim_player,
340 const struct tile *victim_tile,
341 const char *victim_link)
346 EFT_CASUS_BELLI_CAUGHT);
356 const struct tile *victim_tile,
const char *victim_link)
358 if (!victim_player || offender == victim_player) {
368 _(
"You have caused an incident doing %s to %s."),
376 _(
"You have caused an incident doing %s to %s %s."),
383 _(
"You have caused an incident doing %s at %s."),
401 const struct action *paction,
403 struct player *victim_player,
404 const struct tile *victim_tile,
405 const char *victim_link)
407 if (!victim_player || offender == victim_player) {
417 _(
"The %s have caused an incident doing %s to %s."),
426 _(
"The %s have caused an incident doing "
435 _(
"The %s have caused an incident doing %s at %s."),
454 const struct action *paction,
456 struct player *victim_player,
457 const struct tile *victim_tile,
458 const char *victim_link)
460 if (receiver == offender) {
463 _(
"Doing %s gives everyone a casus belli against you."),
465 }
else if (receiver == victim_player) {
468 _(
"Doing %s to you gives everyone a casus belli against "
472 }
else if (victim_player ==
nullptr) {
475 _(
"You now have a casus belli against the %s. "
482 _(
"You now have a casus belli against the %s. "
483 "They did %s to the %s."),
498 struct player *victim_player,
499 const struct tile *victim_tile,
500 const char *victim_link)
505 EFT_CASUS_BELLI_SUCCESS);
516 struct player *victim_player,
517 const struct tile *victim_tile,
518 const char *victim_link)
523 EFT_CASUS_BELLI_COMPLETE);
530 struct unit *actor_unit)
554 case ASTK_EXTRA_NOT_THERE:
562 if (pextra !=
nullptr) {
569 tgt_tile, tgt_extra))) {
593 const enum action_auto_perf_cause
cause,
const struct unit *actor,
600 output,
nullptr,
nullptr, &autoperformer->reqs,
603 return autoperformer;
612 #define action_auto_perf_acquire_targets(_target_extra_) \
614 (target_city ? target_city \
615 : action_tgt_city(actor, unit_tile(actor), true)); \
616 tgt_tile = (target_tile ? target_tile \
617 : action_tgt_tile(actor, unit_tile(actor), \
618 _target_extra_, true)); \
620 (target_unit ? target_unit \
621 : action_tgt_unit(actor, unit_tile(actor), true));
632 const enum action_auto_perf_cause cause,
struct unit *
actor,
634 const struct tile *target_tile,
const struct city *target_city,
635 const struct unit *target_unit,
const struct extra_type *target_extra)
639 const struct city *tgt_city;
640 const struct tile *tgt_tile;
641 const struct unit *tgt_unit;
651 actor_id = actor->
id;
661 #define perform_action_to(act, actor, tgtid, tgt_extra) \
662 if (unit_perform_action(unit_owner(actor), actor->id, tgtid, tgt_extra, \
663 nullptr, act, ACT_REQ_RULES)) { \
664 return action_by_number(act); \
719 const enum action_auto_perf_cause cause, struct
unit *actor,
721 const struct tile *target_tile,
const struct city *target_city,
722 const struct unit *target_unit,
const struct extra_type *target_extra)
726 const struct city *tgt_city;
727 const struct tile *tgt_tile;
728 const struct unit *tgt_unit;
798 const struct unit *act_unit,
799 const struct city *tgt_city,
800 const struct player *tgt_player,
801 const struct action *paction)
804 tgt_player, paction);
bool is_action_enabled_unit_on_unit(const action_id wanted_action, const struct unit *actor_unit, const struct unit *target_unit)
Returns TRUE if actor_unit can do wanted_action to target_unit as far as action enablers are concerne...
struct act_prob action_prob_self(const struct unit *actor_unit, const action_id act_id)
Get the actor unit's probability of successfully performing the chosen action on itself.
bool action_prob_possible(const struct act_prob probability)
Returns TRUE iff the given action probability belongs to an action that may be possible.
int action_dice_roll_odds(const struct player *act_player, const struct unit *act_unit, const struct city *tgt_city, const struct player *tgt_player, const struct action *paction)
Returns the odds of an action not failing its dice roll.
bool is_action_enabled_unit_on_self(const action_id wanted_action, const struct unit *actor_unit)
Returns TRUE if actor_unit can do wanted_action to itself as far as action enablers are concerned.
bool is_action_enabled_unit_on_city(const action_id wanted_action, const struct unit *actor_unit, const struct city *target_city)
Returns TRUE if actor_unit can do wanted_action to target_city as far as action enablers are concerne...
struct act_prob action_prob_vs_city(const struct unit *actor_unit, const action_id act_id, const struct city *target_city)
Get the actor unit's probability of successfully performing the chosen action on the target city.
struct act_prob action_prob_vs_unit(const struct unit *actor_unit, const action_id act_id, const struct unit *target_unit)
Get the actor unit's probability of successfully performing the chosen action on the target unit.
enum action_sub_target_kind action_get_sub_target_kind(const struct action *paction)
Get the sub target kind of an action.
struct act_prob action_prob_vs_tile(const struct unit *actor_unit, const action_id act_id, const struct tile *target_tile, const struct extra_type *target_extra)
Get the actor unit's probability of successfully performing the chosen action on the target tile.
struct act_prob action_prob_vs_units(const struct unit *actor_unit, const action_id act_id, const struct tile *target_tile)
Get the actor unit's probability of successfully performing the chosen action on all units at the tar...
bool is_action_enabled_unit_on_units(const action_id wanted_action, const struct unit *actor_unit, const struct tile *target_tile)
Returns TRUE if actor_unit can do wanted_action to all units on the target_tile as far as action enab...
const QString action_name_translation(const struct action *action)
Get the action name used when displaying the action in the UI.
struct act_prob action_prob_fall_back(const struct act_prob *ap1, const struct act_prob *ap2)
Returns ap1 with ap2 as fall back in cases where ap1 doesn't happen.
bool is_action_enabled_unit_on_tile(const action_id wanted_action, const struct unit *actor_unit, const struct tile *target_tile, const struct extra_type *target_extra)
Returns TRUE if actor_unit can do wanted_action to the target_tile as far as action enablers are conc...
enum unit_activity action_get_activity(const struct action *paction)
Returns the unit activity this action may cause or ACTIVITY_LAST if the action doesn't result in a un...
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.
#define action_auto_perf_by_cause_iterate(_cause_, _act_perf_)
#define action_auto_perf_actions_iterate_end
#define action_auto_perf_by_cause_iterate_end
#define action_auto_perf_actions_iterate(_autoperf_, _act_id_)
#define action_id_get_actor_kind(act_id)
#define ACTPROB_IMPOSSIBLE
#define action_id_get_target_kind(act_id)
void call_incident(enum incident_type type, enum casus_belli_range scope, const struct action *paction, struct player *violator, struct player *victim)
Call incident function of victim.
int get_target_bonus_effects(struct effect_list *plist, const struct player *target_player, const struct player *other_player, const struct city *target_city, const struct impr_type *target_building, const struct tile *target_tile, const struct unit *target_unit, const struct unit_type *target_unittype, const struct output_type *target_output, const struct specialist *target_specialist, const struct action *target_action, enum effect_type effect_type, enum vision_layer vision_layer, enum national_intelligence nintel)
Returns the effect bonus of a given type for any target.
const struct ft_color ftc_server
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
const char * nation_plural_for_player(const struct player *pplayer)
Return the (translated) plural noun of the given nation of a player.
const char * nation_adjective_for_player(const struct player *pplayer)
Return the (translated) adjective for the given nation of a player.
void notify_player(const struct player *pplayer, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
Similar to notify_conn_packet (see also), but takes player as "destination".
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...
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
Returns diplomatic state type between two players.
#define players_iterate_end
#define players_iterate(_pplayer)
void send_player_all_c(struct player *src, struct conn_list *dest)
Send all information about a player (player_info and all player_diplstates) to the given connections.
void player_update_last_war_action(struct player *pplayer)
Update last war action timestamp (affects player mood).
bool are_reqs_active(const struct player *target_player, const struct player *other_player, const struct city *target_city, const struct impr_type *target_building, const struct tile *target_tile, const struct unit *target_unit, const struct unit_type *target_unittype, const struct output_type *target_output, const struct specialist *target_specialist, const struct action *target_action, const struct requirement_vector *reqs, const enum req_problem_type prob_type, const enum vision_layer vision_layer, const enum national_intelligence nintel)
Checks the requirement(s) to see if they are active on the given target.
enum action_auto_perf_cause cause
enum act_tgt_compl target_complexity
struct city * tile_city(const struct tile *ptile)
Return the city on this tile (or nullptr), checking for city center.
bool unit_is_alive(int id)
Check if unit with given id is still alive.
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_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.