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

Function do_takeoff

src/do_wear.c:2823–2896  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2821}
2822
2823staticfn struct obj *
2824do_takeoff(void)
2825{
2826 struct obj *otmp = (struct obj *) 0;
2827 boolean was_twoweap = u.twoweap;
2828 struct takeoff_info *doff = &svc.context.takeoff;
2829
2830 svc.context.takeoff.mask |= I_SPECIAL; /* set flag for cancel_doff() */
2831 if (doff->what == W_WEP) {
2832 if (!cursed(uwep)) {
2833 setuwep((struct obj *) 0);
2834 if (was_twoweap)
2835 You("are no longer wielding either weapon.");
2836 else
2837 You("are %s.", empty_handed());
2838 }
2839 } else if (doff->what == W_SWAPWEP) {
2840 setuswapwep((struct obj *) 0);
2841 You("%sno longer %s.", was_twoweap ? "are " : "",
2842 was_twoweap ? "wielding two weapons at once"
2843 : "have a second weapon readied");
2844 } else if (doff->what == W_QUIVER) {
2845 setuqwep((struct obj *) 0);
2846 You("no longer have ammunition readied.");
2847 } else if (doff->what == WORN_ARMOR) {
2848 otmp = uarm;
2849 if (!cursed(otmp))
2850 (void) Armor_off();
2851 } else if (doff->what == WORN_CLOAK) {
2852 otmp = uarmc;
2853 if (!cursed(otmp))
2854 (void) Cloak_off();
2855 } else if (doff->what == WORN_BOOTS) {
2856 otmp = uarmf;
2857 if (!cursed(otmp))
2858 (void) Boots_off();
2859 } else if (doff->what == WORN_GLOVES) {
2860 otmp = uarmg;
2861 if (!cursed(otmp))
2862 (void) Gloves_off();
2863 } else if (doff->what == WORN_HELMET) {
2864 otmp = uarmh;
2865 if (!cursed(otmp))
2866 (void) Helmet_off();
2867 } else if (doff->what == WORN_SHIELD) {
2868 otmp = uarms;
2869 if (!cursed(otmp))
2870 (void) Shield_off();
2871 } else if (doff->what == WORN_SHIRT) {
2872 otmp = uarmu;
2873 if (!cursed(otmp))
2874 (void) Shirt_off();
2875 } else if (doff->what == WORN_AMUL) {
2876 otmp = uamul;
2877 if (!cursed(otmp))
2878 Amulet_off();
2879 } else if (doff->what == LEFT_RING) {
2880 otmp = uleft;

Callers 2

take_offFunction · 0.85
remarm_swapwepFunction · 0.85

Calls 15

cursedFunction · 0.85
setuwepFunction · 0.85
YouFunction · 0.85
empty_handedFunction · 0.85
setuswapwepFunction · 0.85
setuqwepFunction · 0.85
Armor_offFunction · 0.85
Cloak_offFunction · 0.85
Boots_offFunction · 0.85
Gloves_offFunction · 0.85
Helmet_offFunction · 0.85
Shield_offFunction · 0.85

Tested by

no test coverage detected