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

Function armoroff

src/do_wear.c:1919–2008  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1917}
1918
1919int
1920armoroff(struct obj *otmp)
1921{
1922 static char offdelaybuf[60];
1923 int delay = -objects[otmp->otyp].oc_delay;
1924 const char *what = 0;
1925
1926 if (cursed(otmp))
1927 return 0;
1928 /* this used to make assumptions about which types of armor had
1929 delays and which didn't; now both are handled for all types */
1930 if (delay) {
1931 nomul(delay);
1932 gm.multi_reason = "disrobing";
1933 switch (objects[otmp->otyp].oc_armcat) {
1934 case ARM_SUIT:
1935 what = suit_simple_name(otmp);
1936 ga.afternmv = Armor_off;
1937 break;
1938 case ARM_SHIELD:
1939 what = shield_simple_name(otmp);
1940 ga.afternmv = Shield_off;
1941 break;
1942 case ARM_HELM:
1943 what = helm_simple_name(otmp);
1944 ga.afternmv = Helmet_off;
1945 break;
1946 case ARM_GLOVES:
1947 what = gloves_simple_name(otmp);
1948 ga.afternmv = Gloves_off;
1949 break;
1950 case ARM_BOOTS:
1951 what = boots_simple_name(otmp);
1952 ga.afternmv = Boots_off;
1953 break;
1954 case ARM_CLOAK:
1955 what = cloak_simple_name(otmp);
1956 ga.afternmv = Cloak_off;
1957 break;
1958 case ARM_SHIRT:
1959 what = shirt_simple_name(otmp);
1960 ga.afternmv = Shirt_off;
1961 break;
1962 default:
1963 impossible("Taking off unknown armor (%d: %d), delay %d",
1964 otmp->otyp, objects[otmp->otyp].oc_armcat, delay);
1965 break;
1966 }
1967 if (what) {
1968 /* sizeof offdelaybuf == 60; increase it if this becomes longer */
1969 Snprintf(offdelaybuf, sizeof offdelaybuf,
1970 "You finish taking off your %s.", what);
1971 gn.nomovemsg = offdelaybuf;
1972 }
1973 } else {
1974 /* no delay so no '(*afternmv)()' or 'nomovemsg' */
1975 switch (objects[otmp->otyp].oc_armcat) {
1976 case ARM_SUIT:

Callers 1

armor_or_accessory_offFunction · 0.85

Calls 15

cursedFunction · 0.85
nomulFunction · 0.85
suit_simple_nameFunction · 0.85
shield_simple_nameFunction · 0.85
helm_simple_nameFunction · 0.85
gloves_simple_nameFunction · 0.85
boots_simple_nameFunction · 0.85
cloak_simple_nameFunction · 0.85
shirt_simple_nameFunction · 0.85
Armor_offFunction · 0.85
Shield_offFunction · 0.85
Helmet_offFunction · 0.85

Tested by

no test coverage detected