some reformatting for read.c
This commit is contained in:
+37
-20
@@ -1188,7 +1188,8 @@ seffect_enchant_armor(struct obj **sobjp)
|
|||||||
useup(otmp);
|
useup(otmp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (s < -100) s = -100; /* avoid integer overflow with very negative armor */
|
if (s < -100)
|
||||||
|
s = -100; /* avoid integer overflow with very negative armor */
|
||||||
|
|
||||||
/* Base power of the enchantment:
|
/* Base power of the enchantment:
|
||||||
|
|
||||||
@@ -1201,19 +1202,25 @@ seffect_enchant_armor(struct obj **sobjp)
|
|||||||
|
|
||||||
/* Elven/artifact and nonmagical armor is easier to enchant;
|
/* Elven/artifact and nonmagical armor is easier to enchant;
|
||||||
blessed scrolls are more effective. */
|
blessed scrolls are more effective. */
|
||||||
if (special_armor) ++s;
|
if (special_armor)
|
||||||
if (!objects[otmp->otyp].oc_magic) ++s;
|
++s;
|
||||||
if (sblessed) ++s;
|
if (!objects[otmp->otyp].oc_magic)
|
||||||
|
++s;
|
||||||
|
if (sblessed)
|
||||||
|
++s;
|
||||||
|
|
||||||
if (s <= 0) {
|
if (s <= 0) {
|
||||||
s = 0;
|
s = 0;
|
||||||
if (otmp->spe > 0 && !rn2(otmp->spe)) s = 1;
|
if (otmp->spe > 0 && !rn2(otmp->spe))
|
||||||
|
s = 1;
|
||||||
} else {
|
} else {
|
||||||
s = rnd(s);
|
s = rnd(s);
|
||||||
}
|
}
|
||||||
if (s > 11) s = 11; /* unlikely but possible: avoids an overflow later */
|
if (s > 11)
|
||||||
|
s = 11; /* unlikely but possible: avoids an overflow later */
|
||||||
|
|
||||||
if (scursed) s = -s;
|
if (scursed)
|
||||||
|
s = -s;
|
||||||
|
|
||||||
if (s >= 0 && Is_dragon_scales(otmp)) {
|
if (s >= 0 && Is_dragon_scales(otmp)) {
|
||||||
unsigned was_lit = otmp->lamplit;
|
unsigned was_lit = otmp->lamplit;
|
||||||
@@ -1286,16 +1293,24 @@ seffect_enchant_armor(struct obj **sobjp)
|
|||||||
staticfn boolean
|
staticfn boolean
|
||||||
disintegrate_cursed_armor(void)
|
disintegrate_cursed_armor(void)
|
||||||
{
|
{
|
||||||
struct obj *armors[7] = { NULL };
|
struct obj *armors[10];
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
if (uarm && uarm->cursed) armors[idx++] = uarm;
|
armors[0] = NULL;
|
||||||
if (uarmc && uarmc->cursed) armors[idx++] = uarmc;
|
if (uarm && uarm->cursed)
|
||||||
if (uarmh && uarmh->cursed) armors[idx++] = uarmh;
|
armors[idx++] = uarm;
|
||||||
if (uarms && uarms->cursed) armors[idx++] = uarms;
|
if (uarmc && uarmc->cursed)
|
||||||
if (uarmg && uarmg->cursed) armors[idx++] = uarmg;
|
armors[idx++] = uarmc;
|
||||||
if (uarmf && uarmf->cursed) armors[idx++] = uarmf;
|
if (uarmh && uarmh->cursed)
|
||||||
if (uarmu && uarmu->cursed) armors[idx++] = uarmu;
|
armors[idx++] = uarmh;
|
||||||
|
if (uarms && uarms->cursed)
|
||||||
|
armors[idx++] = uarms;
|
||||||
|
if (uarmg && uarmg->cursed)
|
||||||
|
armors[idx++] = uarmg;
|
||||||
|
if (uarmf && uarmf->cursed)
|
||||||
|
armors[idx++] = uarmf;
|
||||||
|
if (uarmu && uarmu->cursed)
|
||||||
|
armors[idx++] = uarmu;
|
||||||
if (!idx)
|
if (!idx)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@@ -1616,6 +1631,7 @@ seffect_enchant_weapon(struct obj **sobjp)
|
|||||||
boolean scursed = sobj->cursed;
|
boolean scursed = sobj->cursed;
|
||||||
boolean confused = (Confusion != 0);
|
boolean confused = (Confusion != 0);
|
||||||
boolean old_erodeproof, new_erodeproof;
|
boolean old_erodeproof, new_erodeproof;
|
||||||
|
int s;
|
||||||
|
|
||||||
/* [What about twoweapon mode? Proofing/repairing/enchanting both
|
/* [What about twoweapon mode? Proofing/repairing/enchanting both
|
||||||
would be too powerful, but shouldn't we choose randomly between
|
would be too powerful, but shouldn't we choose randomly between
|
||||||
@@ -1648,11 +1664,12 @@ seffect_enchant_weapon(struct obj **sobjp)
|
|||||||
uwep->oerodeproof = new_erodeproof ? 1 : 0;
|
uwep->oerodeproof = new_erodeproof ? 1 : 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!chwepon(sobj, scursed ? -1
|
s = scursed ? -1
|
||||||
: !uwep ? 1
|
: !uwep ? 1 /* guard further tests against null pointer */
|
||||||
: (uwep->spe >= 9) ? !rn2(uwep->spe)
|
: (uwep->spe >= 9) ? (rn2(uwep->spe) == 0) /* usually 0, maybe 1 */
|
||||||
: sblessed ? rnd(3 - uwep->spe / 3)
|
: sblessed ? rnd(3 - uwep->spe / 3) /* >= 9 case prevents rnd(0) */
|
||||||
: 1))
|
: 1; /* uncursed */
|
||||||
|
if (!chwepon(sobj, s))
|
||||||
*sobjp = 0; /* nothing enchanted: strange_feeling -> useup */
|
*sobjp = 0; /* nothing enchanted: strange_feeling -> useup */
|
||||||
if (uwep)
|
if (uwep)
|
||||||
cap_spe(uwep);
|
cap_spe(uwep);
|
||||||
|
|||||||
Reference in New Issue
Block a user