2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2012, Dave Pare, Jeff Bailey, Thomas Ruschak,
4 * Ken Stevens, Steve McClure, Markus Armbruster
6 * Empire is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 * See files README, COPYING and CREDITS in the root of the source
22 * tree for related information and legal notices. It is expected
23 * that future projects/authors will amend these files as needed.
27 * sabo.c: Spy terrorist bombing
29 * Known contributors to this file:
31 * Markus Armbruster, 2003-2010
43 struct lndstr land, tmp;
48 if (!snxtitem(&ni, EF_LAND, player->argp[1], NULL))
51 while (nxtitem(&ni, &land)) {
54 if (!(lchr[(int)land.lnd_type].l_flags & L_SPY)) {
55 pr("%s is not a spy.\n", prland(&land));
58 if (land.lnd_ship >= 0) {
59 pr("%s is on ship %d.\n", prland(&land), land.lnd_ship);
62 if (land.lnd_land >= 0) {
63 pr("%s is on unit %d.\n", prland(&land), land.lnd_land);
66 if (!getsect(land.lnd_x, land.lnd_y, §))
68 if (land.lnd_item[I_SHELL] == 0) {
69 pr("%s has no shells.\n", prland(&land));
73 odds = LND_SPY_DETECT_CHANCE(land.lnd_effic);
76 "%s spy shot in %s during sabotage attempt.\n",
78 xyas(sect.sct_x, sect.sct_y, sect.sct_own));
79 pr("%s was shot and killed.\n", prland(&land));
81 putland(land.lnd_uid, &land);
85 dam = lnd_sabo(&land, sect.sct_item);
89 pr("Explosion in %s causes %d damage.\n",
90 xyas(land.lnd_x, land.lnd_y, player->cnum), dam);
93 "Sabotage in sector %s caused %d damage.\n",
94 xyas(sect.sct_x, sect.sct_y, sect.sct_own), dam);
97 /* hack: hide the spy so it don't gets blasted by sectdamage() */
100 putland(land.lnd_uid, &tmp);
101 land.lnd_seqno = tmp.lnd_seqno;
103 sectdamage(§, dam);
107 pr("%s dies in explosion.\n", prland(&land));
110 putland(land.lnd_uid, &land);