MCPcopy Create free account
hub / github.com/NetHack/NetHack / u_slip_free

Function u_slip_free

src/mhitu.c:1046–1085  ·  view source on GitHub ↗

check whether slippery clothing protects from hug or wrap attack */

Source from the content-addressed store, hash-verified

1044
1045/* check whether slippery clothing protects from hug or wrap attack */
1046boolean
1047u_slip_free(
1048 struct monst *mtmp,
1049 struct attack *mattk)
1050{
1051 struct obj *obj;
1052
1053 /* greased armor does not protect against AT_ENGL+AD_WRAP */
1054 if (mattk->aatyp == AT_ENGL)
1055 return FALSE;
1056
1057 obj = (uarmc ? uarmc : uarm);
1058 if (!obj)
1059 obj = uarmu;
1060 if (mattk->adtyp == AD_DRIN)
1061 obj = uarmh;
1062
1063 /* if your cloak/armor is greased, monster slips off; this
1064 protection might fail (33% chance) when the armor is cursed */
1065 if (obj && (obj->greased || obj->otyp == OILSKIN_CLOAK)
1066 && (!obj->cursed || rn2(3))) {
1067 pline_mon(mtmp, "%s %s your %s %s!", Monnam(mtmp),
1068 (mattk->adtyp == AD_WRAP) ? "slips off of"
1069 : "grabs you, but cannot hold onto",
1070 obj->greased ? "greased" : "slippery",
1071 /* avoid "slippery slippery cloak"
1072 for undiscovered oilskin cloak */
1073 (obj->greased || objects[obj->otyp].oc_name_known)
1074 ? xname(obj)
1075 : cloak_simple_name(obj));
1076
1077 if (obj->greased && !rn2(2)) {
1078 pline_The("grease wears off.");
1079 obj->greased = 0;
1080 update_inventory();
1081 }
1082 return TRUE;
1083 }
1084 return FALSE;
1085}
1086
1087/* armor that sufficiently covers the body might be able to block magic */
1088int

Callers 3

mhitm_ad_drinFunction · 0.85
mhitm_ad_wrapFunction · 0.85
mhitm_ad_physFunction · 0.85

Calls 7

rn2Function · 0.85
pline_monFunction · 0.85
MonnamFunction · 0.85
xnameFunction · 0.85
cloak_simple_nameFunction · 0.85
pline_TheFunction · 0.85
update_inventoryFunction · 0.85

Tested by

no test coverage detected