| 1917 | } |
| 1918 | |
| 1919 | int |
| 1920 | armoroff(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: |
no test coverage detected