breaking crystal armor

Instead of a 5% chance for crystal plate mail or crystal helmet to
break each time it's subjected to breakage, switch to a 10% chance
but the damage is treated as erosion rather than break/don't-break.
'crystal foo' will need to go through four stages of damage before
breaking:  cracked crystal foo, very cracked crystal foo, thoroughly
cracked crystal foo, then gone.  Crackproof handling is included,
described as tempered crystal foo.

It mostly still applies to throwing and kicking the item.  Having
some hits trigger damage might be worthwhile but isn't implemented.

Object creation within lua code probably needs to be updated, and
when the Mitre of Holiness is created in the priest/priestess quest
it should start out as tempered (erodeproof).  Perhaps it ought to
be erodeproof regardless of where/how it's created.
This commit is contained in:
PatR
2023-06-14 15:54:04 -07:00
parent 450f060132
commit e9c58c2fe4
11 changed files with 105 additions and 63 deletions

View File

@@ -1039,7 +1039,9 @@ add_erosion_words(struct obj* obj, char* prefix)
Strcat(prefix, "thoroughly ");
break;
}
Strcat(prefix, is_rustprone(obj) ? "rusty " : "burnt ");
Strcat(prefix, is_rustprone(obj) ? "rusty "
: is_crackable(obj) ? "cracked "
: "burnt ");
}
if (obj->oeroded2 && !iscrys) {
switch (obj->oeroded2) {
@@ -1052,21 +1054,21 @@ add_erosion_words(struct obj* obj, char* prefix)
}
Strcat(prefix, is_corrodeable(obj) ? "corroded " : "rotted ");
}
/* note: it is possible for an item to be both eroded and erodeproof
(cursed scroll of destroy armor read while confused erodeproofs an
item of armor without repairing existing erosion) */
if (rknown && obj->oerodeproof)
Strcat(prefix, iscrys
? "fixed "
: is_rustprone(obj)
? "rustproof "
: is_corrodeable(obj)
? "corrodeproof " /* "stainless"? */
: is_flammable(obj)
? "fireproof "
: "");
Strcat(prefix, iscrys ? "fixed "
: is_rustprone(obj) ? "rustproof "
: is_corrodeable(obj) ? "corrodeproof "
: is_flammable(obj) ? "fireproof "
: is_crackable(obj) ? "tempered " /* hardened */
: "");
}
/* used to prevent rust on items where rust makes no difference */
boolean
erosion_matters(struct obj* obj)
erosion_matters(struct obj *obj)
{
switch (obj->oclass) {
case TOOL_CLASS:
@@ -1564,8 +1566,7 @@ not_fully_identified(struct obj* otmp)
&& otmp->oclass != BALL_CLASS)) /* (useless) */
return FALSE;
else /* lack of `rknown' only matters for vulnerable objects */
return (boolean) (is_rustprone(otmp) || is_corrodeable(otmp)
|| is_flammable(otmp));
return (boolean) is_damageable(otmp);
}
/* format a corpse name (xname() omits monster type; doname() calls us);
@@ -3617,7 +3618,9 @@ readobjnam_preparse(struct _readobjnam_data *d)
|| !strncmpi(d->bp, "corrodeproof ", l = 13)
|| !strncmpi(d->bp, "fixed ", l = 6)
|| !strncmpi(d->bp, "fireproof ", l = 10)
|| !strncmpi(d->bp, "rotproof ", l = 9)) {
|| !strncmpi(d->bp, "rotproof ", l = 9)
|| !strncmpi(d->bp, "tempered ", l = 9)
|| !strncmpi(d->bp, "crackproof ", l = 11)) {
d->erodeproof = 1;
} else if (!strncmpi(d->bp, "lit ", l = 4)
|| !strncmpi(d->bp, "burning ", l = 8)) {
@@ -3689,7 +3692,8 @@ readobjnam_preparse(struct _readobjnam_data *d)
} else if (!strncmpi(d->bp, "rusty ", l = 6)
|| !strncmpi(d->bp, "rusted ", l = 7)
|| !strncmpi(d->bp, "burnt ", l = 6)
|| !strncmpi(d->bp, "burned ", l = 7)) {
|| !strncmpi(d->bp, "burned ", l = 7)
|| !strncmpi(d->bp, "cracked ", l = 8)) {
d->eroded = 1 + d->very;
d->very = 0;
} else if (!strncmpi(d->bp, "corroded ", l = 9)
@@ -4846,7 +4850,8 @@ readobjnam(char *bp, struct obj *no_wish)
if (erosion_matters(d.otmp)) {
/* wished-for item shouldn't be eroded unless specified */
d.otmp->oeroded = d.otmp->oeroded2 = 0;
if (d.eroded && (is_flammable(d.otmp) || is_rustprone(d.otmp)))
if (d.eroded && (is_flammable(d.otmp) || is_rustprone(d.otmp)
|| is_crackable(d.otmp)))
d.otmp->oeroded = d.eroded;
if (d.eroded2 && (is_corrodeable(d.otmp) || is_rottable(d.otmp)))
d.otmp->oeroded2 = d.eroded2;