2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
4 * Ken Stevens, Steve McClure
6 * This program 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 2 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, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
23 * related information and legal notices. It is expected that any future
24 * projects/authors will amend these files as needed.
28 * sabo.c: Spy terrorist bombing
30 * Known contributors to this file:
51 if (!snxtitem(&ni, EF_LAND, player->argp[1]))
54 while (nxtitem(&ni, &land)) {
57 if (!(lchr[(int)land.lnd_type].l_flags & L_SPY)) {
58 pr("%s is not a spy.\n", prland(&land));
61 if (land.lnd_ship >= 0) {
62 pr("%s is on ship %d.\n", prland(&land), land.lnd_ship);
65 if (land.lnd_land >= 0) {
66 pr("%s is on unit %d.\n", prland(&land), land.lnd_land);
69 if (!getsect(land.lnd_x, land.lnd_y, §))
71 if (land.lnd_item[I_SHELL] == 0) {
72 pr("%s has no shells.\n", prland(&land));
75 --land.lnd_item[I_SHELL];
77 odds = LND_SPY_DETECT_CHANCE(land.lnd_effic);
80 "%s spy shot in %s during sabotage attempt.\n",
82 xyas(sect.sct_x, sect.sct_y, sect.sct_own));
83 pr("%s was shot and killed.\n", prland(&land));
85 putland(land.lnd_uid, &land);
89 dam = landgun(3 * land.lnd_effic, 7);
90 if (sect.sct_item[I_SHELL] > 20)
91 dam += seagun(land.lnd_effic,
92 random() % (sect.sct_item[I_SHELL] / 10));
93 if (sect.sct_item[I_PETROL] > 100)
94 dam += seagun(land.lnd_effic,
95 random() % (sect.sct_item[I_PETROL] / 50));
97 pr("Explosion in %s causes %d damage.\n",
98 xyas(land.lnd_x, land.lnd_y, land.lnd_own), dam);
101 "Sabotage in sector %s caused %d damage.\n",
102 xyas(sect.sct_x, sect.sct_y, sect.sct_own), dam);
105 /* hack: hide the spy so it don't gets blasted by sectdamage() */
107 putland(land.lnd_uid, &land);
109 sectdamage(§, dam, 0);
112 land.lnd_own = player->cnum;
114 pr("%s dies in explosion.\n", prland(&land));
117 putland(land.lnd_uid, &land);