From fad06f61e7c0d7865dd4489e9126fdb7397ec9fa Mon Sep 17 00:00:00 2001 From: Erik Lunna Date: Thu, 5 Dec 2024 09:23:23 +0100 Subject: [PATCH] Lessen harshness of enchanting antimagic items. We'll be a bit more lenient, so that there is a reasonable chance of enchanting these items up at least a little bit at first. I tried to match the behavior of ring enchantment, so that there is a low chance of failure at low enchantment, but it scales at you get higher. For enchant armor: +0 0% +1 14% +2 29% +3 43% +4 57% For enchant weapon: Wep Chance of failure +0 0% +1 8% +2 15% +3 23% +4 31% +5 38% +6 46% +7 54% +8 62% +9 69% +10 77% +11 85% +12 92% --- src/read.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/read.c b/src/read.c index 9cb5ae049..8524de32c 100644 --- a/src/read.c +++ b/src/read.c @@ -1385,13 +1385,13 @@ seffect_enchant_armor(struct obj **sobjp) return; } - /* Items which provide magic resistance also resist enchanting. - * They don't resist when their enchantment is negative, that is + /* Items which provide magic resistance also can resist enchanting. + * They don't resist when their enchantment is zero or negative, that is * "un"-enchanting a bad enchantment. But for anything starting at - * +0 has a 1 in (enchantment + 2) chance of failure. */ + * +1 has a x in 7 chance of failure. */ resists_magic = objects[otmp->otyp].oc_oprop == ANTIMAGIC || defends(AD_MAGM, otmp);; - if (resists_magic && otmp->spe >= 0 && rn2(otmp->spe + 2)) { + if (resists_magic && otmp->spe > rn2(7) + 1) { pline("%s vibrates and resists!", Yname2(otmp)); return; } @@ -1839,7 +1839,7 @@ seffect_enchant_weapon(struct obj **sobjp) /* Items that grant magic resistance themselves resist enchantment. */ resists_magic = uwep && (objects[uwep->otyp].oc_oprop == ANTIMAGIC || defends(AD_MAGM, uwep)); - if (uwep && resists_magic && uwep->spe >= 0 && rn2(uwep->spe + 2)) { + if (uwep && resists_magic && uwep->spe > rn2(13) + 1) { pline("%s vibrates and resists!", Yname2(uwep)); return; }