| 960 | } |
| 961 | |
| 962 | staticfn void |
| 963 | Amulet_on(struct obj *amul) |
| 964 | { |
| 965 | boolean on_msg_done = FALSE; |
| 966 | |
| 967 | /* make sure amulet isn't wielded/alt-wielded/quivered, before wearing */ |
| 968 | remove_worn_item(amul, FALSE); |
| 969 | setworn(amul, W_AMUL); |
| 970 | |
| 971 | switch (uamul->otyp) { |
| 972 | case AMULET_OF_ESP: |
| 973 | case AMULET_OF_LIFE_SAVING: |
| 974 | case AMULET_VERSUS_POISON: |
| 975 | case AMULET_OF_REFLECTION: |
| 976 | case FAKE_AMULET_OF_YENDOR: |
| 977 | break; |
| 978 | case AMULET_OF_MAGICAL_BREATHING: { |
| 979 | boolean was_in_poison_gas; |
| 980 | |
| 981 | /* amulet is already on; we need to check hero's gas-cloud status |
| 982 | when it was off */ |
| 983 | EMagical_breathing &= ~W_AMUL; |
| 984 | was_in_poison_gas = region_danger(); |
| 985 | EMagical_breathing |= W_AMUL; |
| 986 | if (was_in_poison_gas) { |
| 987 | makeknown(AMULET_OF_MAGICAL_BREATHING); |
| 988 | on_msg(uamul); |
| 989 | on_msg_done = TRUE; |
| 990 | You("are no longer bothered by the poison gas."); |
| 991 | } |
| 992 | /* no need to check for becoming able to breathe underwater; |
| 993 | if we are underwater, we already can or we would have drowned */ |
| 994 | break; |
| 995 | } |
| 996 | case AMULET_OF_UNCHANGING: |
| 997 | if (Slimed) |
| 998 | make_slimed(0L, (char *) 0); |
| 999 | break; |
| 1000 | case AMULET_OF_CHANGE: { |
| 1001 | boolean call_it = FALSE; |
| 1002 | int new_sex, orig_sex = poly_gender(); |
| 1003 | |
| 1004 | /* in normal play it's not possible to put on an amulet of change |
| 1005 | while already wearing an amulet of unchanging, but in wizard |
| 1006 | mode the Unchanging attribute can be set via #wizintrinsic */ |
| 1007 | if (!Unchanging) |
| 1008 | change_sex(); |
| 1009 | |
| 1010 | new_sex = poly_gender(); |
| 1011 | if (new_sex != orig_sex) |
| 1012 | makeknown(AMULET_OF_CHANGE); |
| 1013 | on_msg(uamul); /* show 'z - amulet of change (being worn)' */ |
| 1014 | on_msg_done = TRUE; |
| 1015 | |
| 1016 | /* Don't use same message as polymorph */ |
| 1017 | if (new_sex != orig_sex) { |
| 1018 | newsym(u.ux, u.uy); /* glyphmon flag and tile have changed */ |
| 1019 | disp.botl = TRUE; /* role name or rank title might have changed */ |
no test coverage detected