2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2000, 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 * shoo.c: Shoot some conquered populace or pigeons.
30 * Known contributors to this file:
52 struct nstr_sect nstr;
62 int vec[I_MAX + 1], mil, nsec;
66 ip = whatitem(player->argp[1], "Shoot what <civ or uw> ");
67 if (ip == 0 || (ip->i_vtype != V_CIVIL && ip->i_vtype != V_UW))
70 if (!snxtsct(&nstr, player->argp[2]))
72 sprintf(prompt, "number of %s to shoot (max 999)? ", ip->i_name);
73 p = getstarg(player->argp[3], prompt, buf);
74 if (p == 0 || (targets = atoi(p)) <= 0)
78 while (nxtsct(&nstr, §)) {
81 if (getvec(VT_ITEM, vec, (s_char *)§, EF_SECTOR) <= 0)
85 snxtitem_xy(&ni, EF_LAND, sect.sct_x, sect.sct_y);
86 while (nxtitem(&ni, (s_char *)&land)) {
87 mil += total_mil(&land);
89 if (lchr[(int)land.lnd_type].l_flags & L_SECURITY) {
90 mil += total_mil(&land);
95 if (vec[item] == 0 || vec[I_CIVIL] > mil * 10)
97 nshot = vec[item] > targets ? targets : vec[item];
98 m = ((double)nshot + 4.0) / 5.0;
100 if (m > sect.sct_mobil) {
101 nshot = sect.sct_mobil * 5;
105 * Each security unit lowers the cost of
106 * shooting a person by 10%. However, you
107 * can't go lower than 50% of normal cost
111 m = ((float)m * (1.0 - ((float)nsec * 0.1)));
116 if (m > sect.sct_mobil)
118 mob_cost = roundavg(m);
119 sect.sct_mobil -= (u_char)mob_cost;
121 pr("BANG!! (thump) %d %s shot in %s!\n",
122 nshot, ip->i_name, xyas(sect.sct_x, sect.sct_y, player->cnum));
123 if (chance(nshot / 100.0))
124 nreport(player->cnum, N_SHOOT_CIV, sect.sct_oldown, 1);
125 if (vec[item] <= 0 && ip->i_vtype == V_CIVIL &&
126 (sect.sct_own != sect.sct_oldown)) {
127 sect.sct_oldown = sect.sct_own;
128 pr(" %s is now completely yours\n",
129 xyas(sect.sct_x, sect.sct_y, player->cnum));
131 putvar(ip->i_vtype, vec[item], (s_char *)§, EF_SECTOR);