2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2016, 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 * shoo.c: Shoot some conquered populace or pigeons.
29 * Known contributors to this file:
45 struct nstr_sect nstr;
56 ip = whatitem(player->argp[1], "Shoot what <civ or uw> ");
57 if (!ip || (ip->i_uid != I_CIVIL && ip->i_uid != I_UW))
60 if (!snxtsct(&nstr, player->argp[2]))
62 sprintf(prompt, "number of %s to shoot? ", ip->i_name);
63 p = getstarg(player->argp[3], prompt, buf);
64 if (!p || (targets = atoi(p)) <= 0)
66 while (nxtsct(&nstr, §)) {
69 mil = security_strength(§, &nsec);
70 if (sect.sct_item[item] == 0 || sect.sct_item[I_CIVIL] > mil * 10)
72 nshot = sect.sct_item[item] > targets ? targets : sect.sct_item[item];
73 if (nshot > sect.sct_mobil * 5)
74 nshot = sect.sct_mobil * 5;
77 * Each security unit lowers the cost of
78 * shooting a person by 10%. However, you
79 * can't go lower than 50% of normal cost
83 m *= 1.0 - nsec * 0.1;
88 if (m > sect.sct_mobil)
90 sect.sct_mobil -= roundavg(m);
91 sect.sct_item[item] -= nshot;
92 pr("BANG!! (thump) %d %s shot in %s!\n",
93 nshot, ip->i_name, xyas(sect.sct_x, sect.sct_y, player->cnum));
94 if (chance(nshot / 100.0))
95 nreport(player->cnum, N_SHOOT_CIV, sect.sct_oldown, 1);
96 if (sect.sct_item[item] <= 0 && item == I_CIVIL
97 && (sect.sct_own != sect.sct_oldown)) {
98 sect.sct_oldown = sect.sct_own;
99 pr(" %s is now completely yours\n",
100 xyas(sect.sct_x, sect.sct_y, player->cnum));