Distinguish between sacking and obliterating a capital
Make caploss() transfer money, loans and market lots to the player only if he actually took the capital, not if he obliterated it to deity. To make this work, caploss() needs to be called after the sector is updated for damage and change of ownership. Change callers accordingly. Closes #914049.
This commit is contained in:
parent
f6308422c3
commit
221e88f106
3 changed files with 19 additions and 14 deletions
|
@ -51,8 +51,10 @@ caploss(struct sctstr *sp, natid coun, char *msg)
|
|||
struct comstr comm;
|
||||
long lose;
|
||||
long gain;
|
||||
int loan_num = 0;
|
||||
int comm_num = 0;
|
||||
char *verb;
|
||||
int loan_num, comm_num;
|
||||
|
||||
CANT_HAPPEN(sp->sct_own && sp->sct_own != player->cnum);
|
||||
|
||||
natp = getnatp(coun);
|
||||
if (natp->nat_stat != STAT_ACTIVE)
|
||||
|
@ -71,18 +73,20 @@ caploss(struct sctstr *sp, natid coun, char *msg)
|
|||
lose = 3000;
|
||||
natp->nat_money -= lose;
|
||||
putnat(natp);
|
||||
wu(0, coun, "* %s just sacked your capital! *\n", cname(player->cnum));
|
||||
|
||||
if (gain >= 0) {
|
||||
if (gain >= 0 && sp->sct_own) {
|
||||
gain = (0.2 + 0.8 * (sp->sct_effic / 100.0)) * gain;
|
||||
player->dolcost -= gain;
|
||||
} else
|
||||
gain = 0;
|
||||
verb = sp->sct_own ? "sacked" : "obliterated";
|
||||
wu(0, coun, "* %s just %s your capital! *\n",
|
||||
cname(player->cnum), verb);
|
||||
wu(0, coun, "You lost $%ld and they gained $%ld\n", lose, gain);
|
||||
wu(0, coun, "You need to use 'capital' to activate a new capital.\n");
|
||||
wu(0, 0, "%s just took %s's capital and gained $%d\n",
|
||||
cname(player->cnum), cname(coun), -(int)(player->dolcost));
|
||||
if (opt_LOANS) {
|
||||
wu(0, 0, "%s just %s %s's capital and gained $%ld\n",
|
||||
cname(player->cnum), verb, cname(coun), gain);
|
||||
|
||||
if (opt_LOANS && sp->sct_own) {
|
||||
for (loan_num = 0; getloan(loan_num, &loan); loan_num++) {
|
||||
if (loan.l_status == LS_SIGNED && loan.l_loner == coun) {
|
||||
loan.l_loner = player->cnum;
|
||||
|
@ -91,7 +95,7 @@ caploss(struct sctstr *sp, natid coun, char *msg)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (opt_MARKET) {
|
||||
if (opt_MARKET && sp->sct_own) {
|
||||
for (comm_num = 0; getcomm(comm_num, &comm); comm_num++) {
|
||||
if (comm.com_owner == 0)
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue