dipping in acid
Add checks to allow erosion of objects #dip'd in acid. From a bug report.
This commit is contained in:
@@ -79,6 +79,7 @@ flyers can get out of pits more easily than non-flyers
|
||||
allow use of the < command to try to exit a pit
|
||||
clean up messages when you stop levitation while riding a flying steed
|
||||
account for all attacks when determining max_passive_dmg
|
||||
dipping in acid can erode the dipped object
|
||||
|
||||
|
||||
Platform- and/or Interface-Specific Fixes
|
||||
|
||||
@@ -2361,7 +2361,7 @@ E void NDECL(uwepgone);
|
||||
E void NDECL(uswapwepgone);
|
||||
E void NDECL(uqwepgone);
|
||||
E void NDECL(untwoweapon);
|
||||
E void FDECL(erode_obj, (struct obj *,BOOLEAN_P,BOOLEAN_P));
|
||||
E boolean FDECL(erode_obj, (struct obj *,BOOLEAN_P,BOOLEAN_P,BOOLEAN_P));
|
||||
E int FDECL(chwepon, (struct obj *,int));
|
||||
E int FDECL(welded, (struct obj *));
|
||||
E void FDECL(weldmsg, (struct obj *));
|
||||
|
||||
@@ -1734,7 +1734,7 @@ boolean acid_dmg;
|
||||
struct obj *otmph = some_armor(victim);
|
||||
|
||||
if (otmph && (otmph != uarmf)) {
|
||||
erode_obj(otmph, acid_dmg, FALSE);
|
||||
(void) erode_obj(otmph, acid_dmg, FALSE, FALSE);
|
||||
if (carried(otmph)) update_inventory();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -891,7 +891,7 @@ mdamagem(magr, mdef, mattk)
|
||||
pline("It burns %s!", mon_nam(mdef));
|
||||
}
|
||||
if (!rn2(30)) erode_armor(mdef, TRUE);
|
||||
if (!rn2(6)) erode_obj(MON_WEP(mdef), TRUE, TRUE);
|
||||
if (!rn2(6)) (void) erode_obj(MON_WEP(mdef), TRUE, TRUE, FALSE);
|
||||
break;
|
||||
case AD_RUST:
|
||||
if (magr->mcan) break;
|
||||
|
||||
@@ -2487,7 +2487,7 @@ register struct attack *mattk;
|
||||
}
|
||||
} else tmp = 0;
|
||||
if (!rn2(30)) erode_armor(mtmp, TRUE);
|
||||
if (!rn2(6)) erode_obj(MON_WEP(mtmp), TRUE, TRUE);
|
||||
if (!rn2(6)) (void)erode_obj(MON_WEP(mtmp), TRUE, TRUE, FALSE);
|
||||
goto assess_dmg;
|
||||
case AD_STON: /* cockatrice */
|
||||
{
|
||||
|
||||
@@ -1888,6 +1888,11 @@ dodip()
|
||||
}
|
||||
}
|
||||
|
||||
if (potion->otyp == POT_ACID) {
|
||||
if (erode_obj(obj, TRUE, FALSE, TRUE))
|
||||
goto poof;
|
||||
}
|
||||
|
||||
if (potion->otyp == POT_OIL) {
|
||||
boolean wisx = FALSE;
|
||||
if (potion->lamplit) { /* burning */
|
||||
|
||||
@@ -863,7 +863,8 @@ unsigned trflags;
|
||||
if (rust_dmg(uarms, "shield", 1, TRUE, &youmonst))
|
||||
break;
|
||||
if (u.twoweap || (uwep && bimanual(uwep)))
|
||||
erode_obj(u.twoweap ? uswapwep : uwep, FALSE, TRUE);
|
||||
(void) erode_obj(u.twoweap ? uswapwep : uwep,
|
||||
FALSE, TRUE, FALSE);
|
||||
glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
|
||||
/* Not "metal gauntlets" since it gets called
|
||||
* even if it's leather for the message
|
||||
@@ -872,7 +873,7 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
|
||||
case 2:
|
||||
pline("%s your right %s!", A_gush_of_water_hits,
|
||||
body_part(ARM));
|
||||
erode_obj(uwep, FALSE, TRUE);
|
||||
(void) erode_obj(uwep, FALSE, TRUE, FALSE);
|
||||
goto glovecheck;
|
||||
default:
|
||||
pline("%s you!", A_gush_of_water_hits);
|
||||
@@ -1932,7 +1933,7 @@ register struct monst *mtmp;
|
||||
break;
|
||||
target = MON_WEP(mtmp);
|
||||
if (target && bimanual(target))
|
||||
erode_obj(target, FALSE, TRUE);
|
||||
(void) erode_obj(target, FALSE, TRUE, FALSE);
|
||||
glovecheck: target = which_armor(mtmp, W_ARMG);
|
||||
(void) rust_dmg(target, "gauntlets", 1, TRUE, mtmp);
|
||||
break;
|
||||
@@ -1940,7 +1941,7 @@ glovecheck: target = which_armor(mtmp, W_ARMG);
|
||||
if (in_sight)
|
||||
pline("%s %s's right %s!", A_gush_of_water_hits,
|
||||
mon_nam(mtmp), mbodypart(mtmp, ARM));
|
||||
erode_obj(MON_WEP(mtmp), FALSE, TRUE);
|
||||
(void) erode_obj(MON_WEP(mtmp), FALSE, TRUE, FALSE);
|
||||
goto glovecheck;
|
||||
default:
|
||||
if (in_sight)
|
||||
|
||||
@@ -2417,17 +2417,17 @@ struct attack *mattk; /* null means we find one internally */
|
||||
|
||||
case AD_ACID:
|
||||
if(!rn2(6)) {
|
||||
erode_obj(obj, TRUE, FALSE);
|
||||
(void) erode_obj(obj, TRUE, FALSE, FALSE);
|
||||
}
|
||||
break;
|
||||
case AD_RUST:
|
||||
if(!mon->mcan) {
|
||||
erode_obj(obj, FALSE, FALSE);
|
||||
(void) erode_obj(obj, FALSE, FALSE, FALSE);
|
||||
}
|
||||
break;
|
||||
case AD_CORR:
|
||||
if(!mon->mcan) {
|
||||
erode_obj(obj, TRUE, FALSE);
|
||||
(void) erode_obj(obj, TRUE, FALSE, FALSE);
|
||||
}
|
||||
break;
|
||||
case AD_ENCH:
|
||||
|
||||
24
src/wield.c
24
src/wield.c
@@ -597,20 +597,23 @@ untwoweapon()
|
||||
return;
|
||||
}
|
||||
|
||||
/* Maybe rust object, or corrode it if acid damage is called for */
|
||||
void
|
||||
erode_obj(target, acid_dmg, fade_scrolls)
|
||||
/* Maybe rust object, or corrode it if acid damage is called for.
|
||||
* Returns TRUE if something happened. */
|
||||
boolean
|
||||
erode_obj(target, acid_dmg, fade_scrolls, for_dip)
|
||||
struct obj *target; /* object (e.g. weapon or armor) to erode */
|
||||
boolean acid_dmg;
|
||||
boolean fade_scrolls;
|
||||
boolean for_dip;
|
||||
{
|
||||
int erosion;
|
||||
struct monst *victim;
|
||||
boolean vismon;
|
||||
boolean visobj;
|
||||
boolean ret = FALSE;
|
||||
|
||||
if (!target)
|
||||
return;
|
||||
return FALSE;
|
||||
victim = carried(target) ? &youmonst :
|
||||
mcarried(target) ? target->ocarry : (struct monst *)0;
|
||||
vismon = victim && (victim != &youmonst) && canseemon(victim);
|
||||
@@ -620,6 +623,7 @@ boolean fade_scrolls;
|
||||
|
||||
if (target->greased) {
|
||||
grease_protect(target,(char *)0,victim);
|
||||
ret = TRUE;
|
||||
} else if (target->oclass == SCROLL_CLASS) {
|
||||
if(fade_scrolls && target->otyp != SCR_BLANK_PAPER
|
||||
#ifdef MAIL
|
||||
@@ -633,15 +637,16 @@ boolean fade_scrolls;
|
||||
}
|
||||
target->otyp = SCR_BLANK_PAPER;
|
||||
target->spe = 0;
|
||||
ret = TRUE;
|
||||
}
|
||||
} else if (target->oerodeproof ||
|
||||
(acid_dmg ? !is_corrodeable(target) : !is_rustprone(target))) {
|
||||
if (flags.verbose || !(target->oerodeproof && target->rknown)) {
|
||||
if ((victim == &youmonst) || vismon)
|
||||
if (((victim == &youmonst) || vismon) && !for_dip)
|
||||
pline("%s not affected.", Yobjnam2(target, "are"));
|
||||
/* no message if not carried */
|
||||
/* no message if not carried or dipping */
|
||||
}
|
||||
if (target->oerodeproof) target->rknown = TRUE;
|
||||
if (target->oerodeproof) target->rknown = !for_dip;
|
||||
} else if (erosion < MAX_ERODE) {
|
||||
if ((victim == &youmonst) || vismon || visobj)
|
||||
pline("%s%s!", Yobjnam2(target, acid_dmg ? "corrode" : "rust"),
|
||||
@@ -651,8 +656,9 @@ boolean fade_scrolls;
|
||||
target->oeroded2++;
|
||||
else
|
||||
target->oeroded++;
|
||||
ret = TRUE;
|
||||
} else {
|
||||
if (flags.verbose) {
|
||||
if (flags.verbose && !for_dip) {
|
||||
if (victim == &youmonst)
|
||||
pline("%s completely %s.",
|
||||
Yobjnam2(target, Blind ? "feel" : "look"),
|
||||
@@ -663,6 +669,8 @@ boolean fade_scrolls;
|
||||
acid_dmg ? "corroded" : "rusty");
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -3136,7 +3136,7 @@ struct obj **ootmp; /* to return worn armor for caller to disintegrate */
|
||||
break;
|
||||
}
|
||||
tmp = d(nd,6);
|
||||
if (!rn2(6)) erode_obj(MON_WEP(mon), TRUE, TRUE);
|
||||
if (!rn2(6)) (void) erode_obj(MON_WEP(mon), TRUE, TRUE, FALSE);
|
||||
if (!rn2(6)) erode_armor(mon, TRUE);
|
||||
break;
|
||||
}
|
||||
@@ -3265,8 +3265,10 @@ xchar sx, sy;
|
||||
exercise(A_STR, FALSE);
|
||||
}
|
||||
/* using two weapons at once makes both of them more vulnerable */
|
||||
if (!rn2(u.twoweap ? 3 : 6)) erode_obj(uwep, TRUE, TRUE);
|
||||
if (u.twoweap && !rn2(3)) erode_obj(uswapwep, TRUE, TRUE);
|
||||
if (!rn2(u.twoweap ? 3 : 6))
|
||||
(void) erode_obj(uwep, TRUE, TRUE, FALSE);
|
||||
if (u.twoweap && !rn2(3))
|
||||
(void) erode_obj(uswapwep, TRUE, TRUE, FALSE);
|
||||
if (!rn2(6)) erode_armor(&youmonst, TRUE);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user