61 struct tile *pdefender_tile,
62 int *att_vet,
int *def_vet);
68 const struct action *paction,
69 struct unit *pdiplomat,
72 struct player **defender_owner);
74 const struct city *pcity,
75 const struct action *paction);
77 struct unit *pdiplomat,
81 const struct action *paction);
99 struct city *pcity,
const struct action *paction)
124 pdiplomat, NULL, ctile, NULL)) {
135 _(
"Your %s was caught attempting to do %s!"),
141 _(
"You caught %s %s attempting to do %s in %s!"),
149 cplayer, ctile, clink);
152 wipe_unit(pdiplomat, ULR_CAUGHT, cplayer);
163 _(
"Your %s poisoned the water supply of %s."),
167 _(
"%s is suspected of poisoning the water supply of %s."),
181 _(
"Your %s destroyed %s by poisoning its water supply."),
185 _(
"%s is suspected of destroying %s by poisoning its"
192 cplayer, ctile, clink);
216 struct city *tgt_city,
const struct action *paction)
219 struct player *tgt_player;
220 struct tile *tgt_tile;
222 const char *tgt_city_link;
241 log_debug(
"spread plague: unit: %d", act_unit->
id);
246 act_unit, NULL, tgt_tile, NULL)) {
258 _(
"Your %s was caught attempting to do %s!"),
264 _(
"You caught %s %s attempting to do %s in %s!"),
272 tgt_player, tgt_tile, tgt_city_link);
275 wipe_unit(act_unit, ULR_CAUGHT, tgt_player);
290 notify_player(act_player, tgt_tile, E_UNIT_ACTION_ACTOR_SUCCESS,
293 _(
"Your %s did %s to %s."),
296 notify_player(tgt_player, tgt_tile, E_UNIT_ACTION_TARGET_HOSTILE,
299 _(
"%s done to %s, %s suspected."),
305 tgt_player, tgt_tile, tgt_city_link);
309 tgt_tile, tgt_city_link, paction);
327 const struct action *paction)
335 struct trade_route_packet_list *routes;
350 if (cplayer == pplayer) {
360 pcity->
id, pcity->
id);
387 routes = trade_route_packet_list_new();
388 package_city(pcity, &city_packet, &nat_packet, &rally_packet,
389 &web_packet, routes,
TRUE);
401 trade_route_packet_list_destroy(routes);
418 pcity->
id, pcity->
id);
434 const struct action *paction,
489 struct city *pcity,
const struct action *paction)
506 if (cplayer == pplayer) {
520 _(
"You have established an embassy in %s."),
524 _(
"The %s have established an embassy in %s."),
554 struct unit *pvictim,
555 const struct action *paction)
572 log_debug(
"sabotage-unit: unit: %d", pdiplomat->
id);
589 if (pvictim->
hp < 2) {
596 _(
"Your %s's successful sabotage killed the %s %s."),
603 _(
"Your %s was killed by %s sabotage!"),
614 _(
"Your %s succeeded in sabotaging the %s %s."),
621 _(
"Your %s was sabotaged by the %s!"),
649 struct unit *pvictim,
const struct action *paction)
653 struct tile *victim_tile;
656 const struct unit_type *act_utype, *victim_type;
669 diplomat_id = pdiplomat->
id;
674 if (uplayer == pplayer) {
684 "bribe-unit: already got unique unit");
695 _(
"You don't have enough gold to bribe the %s %s."),
698 log_debug(
"bribe-unit: not enough gold");
737 _(
"Your %s succeeded in bribing the %s."),
745 _(
"Your %s was bribed by the %s."),
752 bounce = ((NULL != pcity
755 || 1 < unit_list_size(
unit_tile(pvictim)->units));
767 log_normal(
"%s has bribed %s but has not %d gold at payment time, "
776 victim_tile, victim_link);
787 uplayer, NULL, paction,
813 struct tile *tgt_tile,
const struct action *paction)
816 struct player *tgt_player = NULL;
824 act_unit_id = act_unit->
id;
829 act_unit, NULL, tgt_tile,
845 tgt_player, tgt_tile,
tile_link(tgt_tile));
865 times = pcity->
steal - bonus;
898 const struct action *paction)
900 struct research *presearch, *cresearch;
921 if (cplayer == pplayer) {
952 }
else if (technology !=
A_UNSET) {
983 if (times > 0 && expected_kills) {
986 log_debug(
"steal-tech: difficulty: impossible");
995 log_debug(
"steal-tech: difficulty: %d", count);
1008 if (times > 0 && expected_kills) {
1012 _(
"%s was expecting your attempt to steal technology "
1013 "again. Your %s was caught and executed."),
1019 _(
"The %s %s failed to steal technology again from %s. "
1020 "We were prepared for the attempt."),
1028 _(
"Your %s was caught in the attempt of"
1029 " stealing technology from %s."),
1035 _(
"The %s %s failed to steal technology from %s."),
1044 wipe_unit(pdiplomat, ULR_CAUGHT, cplayer);
1048 tech_stolen =
steal_a_tech(pplayer, cplayer, technology);
1050 if (tech_stolen ==
A_NONE) {
1053 _(
"No new technology found in %s."),
1096 PL_(
"Your %d gold prepared to incite the revolt was lost!",
1097 "Your %d gold prepared to incite the revolt was lost!",
1098 revolt_gold), revolt_gold);
1107 PL_(
"Your security service captured %d gold prepared "
1108 "to incite your town!",
1109 "Your security service captured %d gold prepared "
1110 "to incite your town!", revolt_gold), revolt_gold);
1141 struct city *pcity,
const struct action *paction)
1159 if (cplayer == pplayer) {
1177 _(
"You don't have enough gold to subvert %s."),
1199 _(
"Your %s was caught in the attempt"
1200 " of inciting a revolt!"),
1203 _(
"You caught %s %s attempting"
1204 " to incite a revolt in %s!"),
1213 cplayer, ctile, clink);
1215 wipe_unit(pdiplomat, ULR_CAUGHT, cplayer);
1233 _(
"Revolt incited in %s, you now rule the city!"),
1236 _(
"%s has revolted, %s influence suspected."),
1248 cplayer, ctile, clink);
1291 const struct action *paction)
1327 _(
"Your %s was caught in the attempt"
1328 " of industrial sabotage!"),
1332 _(
"You caught %s %s attempting sabotage in %s!"),
1341 wipe_unit(pdiplomat, ULR_CAUGHT, cplayer);
1350 if (pimprove->sabotage > 0) {
1355 log_debug(
"sabotage: count of improvements: %d", count);
1368 _(
"Your %s could not find anything to sabotage in %s."),
1373 log_debug(
"sabotage: random: nothing to do");
1376 if (count == 0 ||
fc_rand (2) == 1) {
1378 log_debug(
"sabotage: random: targeted production");
1384 if (pimprove->sabotage > 0) {
1394 if (NULL != ptarget) {
1395 log_debug(
"sabotage: random: targeted improvement: %d (%s)",
1399 log_error(
"sabotage: random: targeted improvement error!");
1402 }
else if (improvement < 0) {
1405 log_debug(
"sabotage: specified target production");
1408 if (pimprove == NULL) {
1409 log_error(
"sabotage: requested for invalid improvement %d", improvement);
1420 log_debug(
"sabotage: specified target improvement: %d (%s)",
1425 _(
"You cannot sabotage a %s!"),
1429 log_debug(
"sabotage: disallowed target improvement: %d (%s)",
1436 _(
"Your %s could not find the %s to sabotage in %s."),
1442 log_debug(
"sabotage: target improvement not found: %d (%s)",
1449 if (NULL == ptarget) {
1461 _(
"Your %s succeeded in destroying"
1462 " the production of %s in %s."),
1468 _(
"The production of %s was destroyed in %s,"
1469 " %s are suspected."),
1473 log_debug(
"sabotage: sabotaged production");
1475 int vulnerability = ptarget->
sabotage;
1484 vulnerability -= (vulnerability
1488 if (
fc_rand(100) >= vulnerability) {
1492 _(
"Your %s was caught in the attempt of sabotage!"),
1496 _(
"You caught %s %s attempting"
1497 " to sabotage the %s in %s!"),
1507 wipe_unit(pdiplomat, ULR_CAUGHT, cplayer);
1508 log_debug(
"sabotage: caught in capital or on city walls");
1515 _(
"Your %s destroyed the %s in %s."),
1521 _(
"The %s destroyed the %s in %s."),
1525 log_debug(
"sabotage: sabotaged improvement: %d (%s)",
1562 struct city *tgt_city,
const struct action *paction)
1564 struct player *tgt_player;
1565 struct tile *tgt_tile;
1567 const char *tgt_city_link;
1589 if (tgt_player == act_player) {
1607 act_unit, NULL, tgt_tile,
1618 _(
"Your %s was caught attempting to steal gold!"),
1620 notify_player(tgt_player, tgt_tile, E_ENEMY_DIPLOMAT_FAILED,
1623 _(
"You caught %s %s attempting"
1624 " to steal your gold in %s!"),
1631 tgt_player, tgt_tile, tgt_city_link);
1634 wipe_unit(act_unit, ULR_CAUGHT, tgt_player);
1649 gold_take =
fc_rand(gold_take) + 1;
1651 log_debug(
"steal gold: will take %d gold", gold_take);
1657 gold_give = gold_take
1661 log_debug(
"steal gold: will give %d gold", gold_give);
1669 PL_(
"Your %s stole %d gold from %s.",
1670 "Your %s stole %d gold from %s.", gold_give),
1671 unit_link(act_unit), gold_give, tgt_city_link);
1674 PL_(
"%d gold stolen from %s, %s suspected.",
1675 "%d gold stolen from %s, %s suspected.", gold_take),
1676 gold_take, tgt_city_link,
1681 tgt_player, tgt_tile, tgt_city_link);
1685 tgt_tile, tgt_city_link, paction);
1704 struct city *tgt_city,
1705 const struct action *paction)
1707 struct player *tgt_player;
1708 struct tile *tgt_tile;
1711 int normal_tile_prob;
1713 const char *tgt_city_link;
1731 if (tgt_player == act_player) {
1739 log_debug(
"steal some maps: unit: %d", act_unit->
id);
1744 act_unit, NULL, tgt_tile,
1749 log_debug(
"steal some maps: infiltrated");
1755 _(
"Your %s was caught in an attempt of"
1756 " stealing parts of the %s world map!"),
1759 notify_player(tgt_player, tgt_tile, E_ENEMY_DIPLOMAT_FAILED,
1761 _(
"You caught %s %s attempting to steal"
1762 " parts of your world map in %s!"),
1769 tgt_player, tgt_tile, tgt_city_link);
1772 wipe_unit(act_unit, ULR_CAUGHT, tgt_player);
1777 log_debug(
"steal some maps: succeeded");
1780 normal_tile_prob = 100
1783 .player = act_player,
1798 EFT_MAPS_STOLEN_PCT);
1809 _(
"Your %s stole parts of the %s world map in %s."),
1814 _(
"The %s are suspected of stealing"
1815 " parts of your world map in %s."),
1821 tgt_player, tgt_tile, tgt_city_link);
1825 tgt_tile, tgt_city_link, paction);
1840 struct city *tgt_city,
const struct action *paction)
1842 struct player *tgt_player;
1843 struct tile *tgt_tile;
1845 const char *tgt_city_link;
1866 log_debug(
"suitcase nuke: unit: %d", act_unit->
id);
1871 act_unit, NULL, tgt_tile,
1876 log_debug(
"suitcase nuke: infiltrated");
1882 _(
"Your %s was caught in an attempt of"
1883 " hiding a nuke in %s!"),
1886 notify_player(tgt_player, tgt_tile, E_ENEMY_DIPLOMAT_FAILED,
1888 _(
"You caught %s %s attempting to hide a nuke in %s!"),
1895 tgt_player, tgt_tile, tgt_city_link);
1898 wipe_unit(act_unit, ULR_CAUGHT, tgt_player);
1907 _(
"Your %s hid a nuke in %s."),
1911 _(
"The %s are suspected of hiding a nuke in %s."),
1917 tgt_tile, tgt_city_link, paction);
1935 tgt_player, tgt_tile, tgt_city_link);
1960 struct unit *pdefender,
1961 struct tile *pdefender_tile,
1962 int *att_vet,
int *def_vet)
2010 .
tile = pdefender_tile,
2016 chance =
CLIP(0, chance, 100);
2021 *att_vet = (100 - chance) * 2;
2022 *def_vet = chance * 2;
2024 return (
int)
fc_rand(100) < chance;
2045 const struct action *paction,
2046 struct unit *pdiplomat,
2047 struct unit *pvictim,
2049 struct player **defender_owner)
2068 if (defender_owner != NULL) {
2070 *defender_owner = uplayer;
2074 &att_vet, &def_vet)) {
2083 _(
"An enemy %s has been eliminated by your %s."),
2084 link_unit, link_diplomat);
2087 if (uplayer == cplayer || cplayer == NULL) {
2090 _(
"Your %s has been eliminated defending %s"
2091 " against a %s."), link_unit, link_city,
2097 _(
"A %s %s has been eliminated defending %s "
2100 link_unit, link_city, link_diplomat);
2104 _(
"Your %s has been eliminated defending %s %s "
2105 "against a %s."), link_unit,
2107 link_city, link_diplomat);
2110 if (uplayer == cplayer || cplayer == NULL) {
2113 _(
"Your %s has been eliminated defending "
2114 "against a %s."), link_unit, link_diplomat);
2118 _(
"A %s %s has been eliminated defending "
2121 link_unit, link_diplomat);
2124 _(
"Your %s has been eliminated defending "
2125 "against a %s."), link_unit, link_diplomat);
2142 const char *victim_link;
2149 _(
"Your %s was eliminated by a defending %s."),
2150 link_diplomat, link_unit);
2153 if (uplayer == cplayer || cplayer == NULL) {
2155 _(
"Eliminated a %s %s while infiltrating %s."),
2157 link_diplomat, link_city);
2160 _(
"A %s %s eliminated a %s %s while infiltrating "
2163 link_diplomat, link_city);
2165 _(
"Your %s eliminated a %s %s while infiltrating "
2168 link_diplomat, link_city);
2171 if (uplayer == cplayer || cplayer == NULL) {
2173 _(
"Eliminated a %s %s while infiltrating our troops."),
2178 _(
"A %s %s eliminated a %s %s while infiltrating our "
2184 _(
"Your %s eliminated a %s %s while infiltrating our "
2185 "troops."), link_unit,
2223 ptile, victim_link);
2225 wipe_unit(pdiplomat, ULR_ELIMINATED, uplayer);
2244 const struct city *pcity,
2245 const struct action *paction)
2259 ptile, vlink, paction);
2272 struct unit *pdiplomat,
2276 const struct action *paction)
2279 struct city *spyhome;
2303 ||
fc_rand (100) < escapechance)) {
2306 _(
"Your %s has successfully completed"
2307 " the mission and returned unharmed to %s."),
2319 log_error(
"Bug in diplomat_escape: Spy can't teleport.");
2327 _(
"Your %s was captured after completing"
2328 " the mission in %s."),
2333 _(
"Your %s was captured after completing"
const char * action_name_translation(const struct action *action)
enum action_target_kind action_get_target_kind(const struct action *paction)
#define action_has_result(_act_, _res_)
#define BV_ISSET(bv, bit)
bool has_capability(const char *cap, const char *capstr)
bool city_has_building(const struct city *pcity, const struct impr_type *pimprove)
const char * city_name_get(const struct city *pcity)
#define city_tile(_pcity_)
static citizens city_size_get(const struct city *pcity)
#define city_owner(_pcity_)
#define city_built_iterate(_pcity, _p)
#define city_built_iterate_end
void nullify_prechange_production(struct city *pcity)
bool city_empty_food_stock(struct city *pcity)
int city_incite_cost(struct player *pplayer, struct city *pcity)
bool city_reduce_size(struct city *pcity, citizens pop_loss, struct player *destroyer, const char *reason)
bool city_refresh(struct city *pcity)
struct unit * get_diplomatic_defender(const struct unit *act_unit, const struct unit *pvictim, const struct tile *tgt_tile)
#define conn_list_iterate(connlist, pconn)
#define conn_list_iterate_end
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
void establish_embassy(struct player *pplayer, struct player *aplayer)
static void diplomat_escape_full(struct player *pplayer, struct unit *pdiplomat, bool city_related, struct tile *ptile, const char *vlink, const struct action *paction)
bool spy_steal_some_maps(struct player *act_player, struct unit *act_unit, struct city *tgt_city, const struct action *paction)
int diplomats_unignored_tech_stealings(struct unit *pdiplomat, struct city *pcity)
bool spy_sabotage_unit(struct player *pplayer, struct unit *pdiplomat, struct unit *pvictim, const struct action *paction)
static bool diplomat_may_lose_gold(struct player *dec_player, struct player *inc_player, int revolt_gold)
bool diplomat_embassy(struct player *pplayer, struct unit *pdiplomat, struct city *pcity, const struct action *paction)
void spy_send_sabotage_list(struct connection *pc, struct unit *pdiplomat, struct city *pcity, const struct action *paction, int request_kind)
static bool diplomat_infiltrate_tile(struct player *pplayer, struct player *cplayer, const struct action *paction, struct unit *pdiplomat, struct unit *pvictim, struct tile *ptile, struct player **defender_owner)
bool diplomat_get_tech(struct player *pplayer, struct unit *pdiplomat, struct city *pcity, Tech_type_id technology, const struct action *paction)
bool diplomat_sabotage(struct player *pplayer, struct unit *pdiplomat, struct city *pcity, Impr_type_id improvement, const struct action *paction)
bool diplomat_incite(struct player *pplayer, struct unit *pdiplomat, struct city *pcity, const struct action *paction)
static void diplomat_escape(struct player *pplayer, struct unit *pdiplomat, const struct city *pcity, const struct action *paction)
bool spy_steal_gold(struct player *act_player, struct unit *act_unit, struct city *tgt_city, const struct action *paction)
bool spy_spread_plague(struct player *act_player, struct unit *act_unit, struct city *tgt_city, const struct action *paction)
bool spy_nuke_city(struct player *act_player, struct unit *act_unit, struct city *tgt_city, const struct action *paction)
static bool diplomat_success_vs_defender(struct unit *patt, struct unit *pdef, struct tile *pdefender_tile, int *att_vet, int *def_vet)
bool diplomat_investigate(struct player *pplayer, struct unit *pdiplomat, struct city *pcity, const struct action *paction)
static void diplomat_charge_movement(struct unit *pdiplomat, struct tile *ptile)
bool diplomat_bribe(struct player *pplayer, struct unit *pdiplomat, struct unit *pvictim, const struct action *paction)
bool spy_attack(struct player *act_player, struct unit *act_unit, struct tile *tgt_tile, const struct action *paction)
bool spy_poison(struct player *pplayer, struct unit *pdiplomat, struct city *pcity, const struct action *paction)
int count_diplomats_on_tile(struct tile *ptile)
int get_target_bonus_effects(struct effect_list *plist, const struct req_context *context, const struct player *other_player, enum effect_type effect_type)
int get_city_bonus(const struct city *pcity, enum effect_type effect_type)
int get_unit_bonus(const struct unit *punit, enum effect_type effect_type)
#define PL_(String1, String2, n)
const char * tile_link(const struct tile *ptile)
const struct ft_color ftc_server
const char * city_link(const struct city *pcity)
const char * unit_link(const struct unit *punit)
const char * unit_tile_link(const struct unit *punit)
struct impr_type * improvement_by_number(const Impr_type_id id)
Impr_type_id improvement_number(const struct impr_type *pimprove)
const char * improvement_rule_name(const struct impr_type *pimprove)
Impr_type_id improvement_index(const struct impr_type *pimprove)
const char * improvement_name_translation(const struct impr_type *pimprove)
#define improvement_iterate_end
#define improvement_iterate(_p)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
#define log_debug(message,...)
#define log_normal(message,...)
#define log_error(message,...)
#define fc_assert_ret_val_msg(condition, val, message,...)
static int map_move_cost_unit(const struct civ_map *nmap, struct unit *punit, const struct tile *ptile)
struct vision_site * map_get_player_city(const struct tile *ptile, const struct player *pplayer)
bool give_distorted_map(struct player *pfrom, struct player *pto, int prob, bool reveal_cities)
const char * nation_adjective_for_player(const struct player *pplayer)
const char * nation_plural_for_player(const struct player *pplayer)
void notify_player(const struct player *pplayer, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
#define web_lsend_packet(packetname,...)
@ UNIT_INFO_CITY_SUPPORTED
void lsend_packet_city_nationalities(struct conn_list *dest, const struct packet_city_nationalities *packet, bool force_to_send)
int dsend_packet_investigate_finished(struct connection *pc, int unit_id16, int unit_id32, int city_id16, int city_id32)
void lsend_packet_trade_route_info(struct conn_list *dest, const struct packet_trade_route_info *packet)
void lsend_packet_city_info(struct conn_list *dest, const struct packet_city_info *packet, bool force_to_send)
int send_packet_city_sabotage_list(struct connection *pc, const struct packet_city_sabotage_list *packet)
void lsend_packet_unit_short_info(struct conn_list *dest, const struct packet_unit_short_info *packet, bool force_to_send)
void dlsend_packet_nuke_tile_info(struct conn_list *dest, int tile)
int dsend_packet_investigate_started(struct connection *pc, int unit_id16, int unit_id32, int city_id16, int city_id32)
void lsend_packet_city_rally_point(struct conn_list *dest, const struct packet_city_rally_point *packet, bool force_to_send)
struct unit * player_unit_by_number(const struct player *pplayer, int unit_id)
const char * player_name(const struct player *pplayer)
bool pplayers_allied(const struct player *pplayer, const struct player *pplayer2)
static bool is_barbarian(const struct player *pplayer)
void send_player_all_c(struct player *src, struct conn_list *dest)
void send_player_info_c(struct player *src, struct conn_list *dest)
const char * universal_name_translation(const struct universal *psource, char *buf, size_t bufsz)
struct research * research_get(const struct player *pplayer)
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
bool research_invention_gettable(const struct research *presearch, const Tech_type_id tech, bool allow_holes)
void script_server_signal_emit(const char *signal_name,...)
#define CLIP(lower, current, upper)
enum moves_actor_kind moves_actor
struct action::@12::@13 is_unit
struct universal production
struct unit_list * units_supported
int incite_gold_capt_chance
struct civ_game::@30::@34 server
int incite_gold_loss_chance
struct conn_list * est_connections
struct packet_game_info info
bool tech_steal_allow_holes
bool steal_maps_reveals_all_cities
bool poison_empties_food_stock
bool combat_odds_scaled_veterancy
struct conn_list * connections
struct player_economic economic
#define sz_strlcpy(dest, src)
struct advance * valid_advance_by_number(const Tech_type_id id)
struct city * tile_city(const struct tile *ptile)
#define tile_owner(_tile)
bool unit_is_alive(int id)
int unit_bribe_cost(struct unit *punit, struct player *briber)
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_end
const struct unit_type * unit_type_get(const struct unit *punit)
const char * unit_name_translation(const struct unit *punit)
bool utype_player_already_has_this_unique(const struct player *pplayer, const struct unit_type *putype)
const char * utype_rule_name(const struct unit_type *punittype)
const struct veteran_level * utype_veteran_level(const struct unit_type *punittype, int level)
bool unit_has_type_flag(const struct unit *punit, enum unit_type_flag_id flag)
bool utype_is_consumed_by_action(const struct action *paction, const struct unit_type *utype)
const char * utype_name_translation(const struct unit_type *punittype)