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 files README, COPYING and CREDITS in the root of the source
23 * tree for related information and legal notices. It is expected
24 * that future projects/authors will amend these files as needed.
28 * caploss.c: Lose your capital (kiss of death)
30 * Known contributors to this file:
36 #include "commodity.h"
43 #include "prototypes.h"
47 caploss(struct sctstr *sp, natid coun, char *msg)
60 if ((xrel(natp, natp->nat_xcap) != xrel(natp, sp->sct_x)) ||
61 (yrel(natp, natp->nat_ycap) != yrel(natp, sp->sct_y)))
63 if (coun == player->cnum) {
64 player->nstat &= ~CAP;
67 /* Ok, has the country owner reset their capital yet after it was last sacked? */
68 if (natp->nat_flags & NF_SACKED)
69 return; /* No, so not really the capital yet, so return */
70 pr(msg, natp->nat_cnam);
71 gain = lose = natp->nat_money / 2;
74 natp->nat_money -= lose;
75 /* Your capital has now been sacked, no more sacking until you reset it */
76 natp->nat_flags |= NF_SACKED;
78 wu(0, coun, "* %s just sacked your capital! *\n", cname(player->cnum));
81 gain = (0.2 + 0.8 * (sp->sct_effic / 100.0)) * gain;
82 player->dolcost -= gain;
85 wu(0, coun, "You lost $%ld and they gained $%ld\n", lose, gain);
87 "Your capital has been moved to %s. You must use 'capital' to reset it.\n",
88 xyas(natp->nat_xcap, natp->nat_ycap, coun));
89 wu(0, 0, "%s just took %s's capital and gained $%d\n",
90 cname(player->cnum), cname(coun), -(int)(player->dolcost));
92 for (loan_num = 0; getloan(loan_num, &loan); loan_num++) {
93 if (loan.l_ldur != 0 && loan.l_loner == coun) {
94 loan.l_loner = player->cnum;
95 putloan(loan_num, &loan);
96 pr("Loan %d has been transfered over to you\n", loan_num);
101 for (comm_num = 0; getcomm(comm_num, &comm); comm_num++) {
102 if (comm.com_owner == coun) {
103 if (comm.com_owner == comm.com_maxbidder)
104 comm.com_maxbidder = player->cnum;
105 comm.com_owner = player->cnum;
106 putcomm(comm_num, &comm);
107 pr("You now own commodity #%d.\n", comm_num);
111 nreport(player->cnum, N_SACK_CAP, coun, 1);