unitm.c formatting

Some inconsequential stuff I've extracted out of a patch I've stalled
out on.
This commit is contained in:
PatR
2018-10-20 00:43:16 -07:00
parent 530b2f06f1
commit 69eb642620
+24 -22
View File
@@ -354,12 +354,14 @@ register struct monst *mtmp;
Strcpy(buf, y_monnam(mtmp)); Strcpy(buf, y_monnam(mtmp));
buf[0] = highc(buf[0]); buf[0] = highc(buf[0]);
You("stop. %s is in the way!", buf); You("stop. %s is in the way!", buf);
context.travel = context.travel1 = context.mv = context.run = 0; context.travel = context.travel1 = context.mv = context.run
= 0;
return TRUE; return TRUE;
} else if ((mtmp->mfrozen || (!mtmp->mcanmove) } else if ((mtmp->mfrozen || (!mtmp->mcanmove)
|| (mtmp->data->mmove == 0)) && rn2(6)) { || (mtmp->data->mmove == 0)) && rn2(6)) {
pline("%s doesn't seem to move!", Monnam(mtmp)); pline("%s doesn't seem to move!", Monnam(mtmp));
context.travel = context.travel1 = context.mv = context.run = 0; context.travel = context.travel1 = context.mv = context.run
= 0;
return TRUE; return TRUE;
} else } else
return FALSE; return FALSE;
@@ -423,7 +425,7 @@ register struct monst *mtmp;
(void) hitum(mtmp, youmonst.data->mattk); (void) hitum(mtmp, youmonst.data->mattk);
mtmp->mstrategy &= ~STRAT_WAITMASK; mtmp->mstrategy &= ~STRAT_WAITMASK;
atk_done: atk_done:
/* see comment in attack_checks() */ /* see comment in attack_checks() */
/* we only need to check for this if we did an attack_checks() /* we only need to check for this if we did an attack_checks()
* and it returned 0 (it's okay to attack), and the monster didn't * and it returned 0 (it's okay to attack), and the monster didn't
@@ -807,7 +809,8 @@ int dieroll;
silvermsg = TRUE; silvermsg = TRUE;
silverobj = TRUE; silverobj = TRUE;
} }
if (artifact_light(obj) && obj->lamplit && mon_hates_light(mon)) if (artifact_light(obj) && obj->lamplit
&& mon_hates_light(mon))
lightobj = TRUE; lightobj = TRUE;
if (u.usteed && !thrown && tmp > 0 if (u.usteed && !thrown && tmp > 0
&& weapon_type(obj) == P_LANCE && mon != u.ustuck) { && weapon_type(obj) == P_LANCE && mon != u.ustuck) {
@@ -1550,6 +1553,7 @@ register struct attack *mattk;
register struct permonst *pd = mdef->data; register struct permonst *pd = mdef->data;
int armpro, tmp = d((int) mattk->damn, (int) mattk->damd); int armpro, tmp = d((int) mattk->damn, (int) mattk->damd);
boolean negated; boolean negated;
struct obj *mongold;
armpro = magic_negation(mdef); armpro = magic_negation(mdef);
/* since hero can't be cancelled, only defender's armor applies */ /* since hero can't be cancelled, only defender's armor applies */
@@ -1689,18 +1693,16 @@ register struct attack *mattk;
case AD_SGLD: case AD_SGLD:
/* This you as a leprechaun, so steal /* This you as a leprechaun, so steal
real gold only, no lesser coins */ real gold only, no lesser coins */
{ mongold = findgold(mdef->minvent);
struct obj *mongold = findgold(mdef->minvent); if (mongold) {
if (mongold) { obj_extract_self(mongold);
obj_extract_self(mongold); if (merge_choice(invent, mongold) || inv_cnt(FALSE) < 52) {
if (merge_choice(invent, mongold) || inv_cnt(FALSE) < 52) { addinv(mongold);
addinv(mongold); Your("purse feels heavier.");
Your("purse feels heavier."); } else {
} else { You("grab %s's gold, but find no room in your knapsack.",
You("grab %s's gold, but find no room in your knapsack.", mon_nam(mdef));
mon_nam(mdef)); dropy(mongold);
dropy(mongold);
}
} }
} }
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
@@ -1711,8 +1713,9 @@ register struct attack *mattk;
tmp = 1; tmp = 1;
if (!negated && tmp < mdef->mhp) { if (!negated && tmp < mdef->mhp) {
char nambuf[BUFSZ]; char nambuf[BUFSZ];
boolean u_saw_mon = boolean u_saw_mon = (canseemon(mdef)
canseemon(mdef) || (u.uswallow && u.ustuck == mdef); || (u.uswallow && u.ustuck == mdef));
/* record the name before losing sight of monster */ /* record the name before losing sight of monster */
Strcpy(nambuf, Monnam(mdef)); Strcpy(nambuf, Monnam(mdef));
if (u_teleport_mon(mdef, FALSE) && u_saw_mon if (u_teleport_mon(mdef, FALSE) && u_saw_mon
@@ -1794,9 +1797,9 @@ register struct attack *mattk;
case AD_DRCO: case AD_DRCO:
if (!negated && !rn2(8)) { if (!negated && !rn2(8)) {
Your("%s was poisoned!", mpoisons_subj(&youmonst, mattk)); Your("%s was poisoned!", mpoisons_subj(&youmonst, mattk));
if (resists_poison(mdef)) if (resists_poison(mdef)) {
pline_The("poison doesn't seem to affect %s.", mon_nam(mdef)); pline_The("poison doesn't seem to affect %s.", mon_nam(mdef));
else { } else {
if (!rn2(10)) { if (!rn2(10)) {
Your("poison was deadly..."); Your("poison was deadly...");
tmp = mdef->mhp; tmp = mdef->mhp;
@@ -1941,12 +1944,11 @@ explum(mdef, mattk)
register struct monst *mdef; register struct monst *mdef;
register struct attack *mattk; register struct attack *mattk;
{ {
boolean resistance; /* only for cold/fire/elec */
register int tmp = d((int) mattk->damn, (int) mattk->damd); register int tmp = d((int) mattk->damn, (int) mattk->damd);
You("explode!"); You("explode!");
switch (mattk->adtyp) { switch (mattk->adtyp) {
boolean resistance; /* only for cold/fire/elec */
case AD_BLND: case AD_BLND:
if (!resists_blnd(mdef)) { if (!resists_blnd(mdef)) {
pline("%s is blinded by your flash of light!", Monnam(mdef)); pline("%s is blinded by your flash of light!", Monnam(mdef));