box obj was hit with spell or wand effect otmp; returns true if something happened */
| 1053 | /* box obj was hit with spell or wand effect otmp; |
| 1054 | returns true if something happened */ |
| 1055 | boolean |
| 1056 | boxlock(struct obj *obj, struct obj *otmp) /* obj *is* a box */ |
| 1057 | { |
| 1058 | boolean res = 0; |
| 1059 | |
| 1060 | switch (otmp->otyp) { |
| 1061 | case WAN_LOCKING: |
| 1062 | case SPE_WIZARD_LOCK: |
| 1063 | if (!obj->olocked) { /* lock it; fix if broken */ |
| 1064 | Soundeffect(se_klunk, 50); |
| 1065 | pline("Klunk!"); |
| 1066 | obj->olocked = 1; |
| 1067 | obj->obroken = 0; |
| 1068 | if (Role_if(PM_WIZARD)) |
| 1069 | obj->lknown = 1; |
| 1070 | else |
| 1071 | obj->lknown = 0; |
| 1072 | res = 1; |
| 1073 | } /* else already closed and locked */ |
| 1074 | break; |
| 1075 | case WAN_OPENING: |
| 1076 | case SPE_KNOCK: |
| 1077 | if (obj->olocked) { /* unlock; isn't broken so doesn't need fixing */ |
| 1078 | Soundeffect(se_klick, 50); |
| 1079 | pline("Klick!"); |
| 1080 | obj->olocked = 0; |
| 1081 | res = 1; |
| 1082 | if (Role_if(PM_WIZARD)) |
| 1083 | obj->lknown = 1; |
| 1084 | else |
| 1085 | obj->lknown = 0; |
| 1086 | } else /* silently fix if broken */ |
| 1087 | obj->obroken = 0; |
| 1088 | break; |
| 1089 | case WAN_POLYMORPH: |
| 1090 | case SPE_POLYMORPH: |
| 1091 | /* maybe start unlocking chest, get interrupted, then zap it; |
| 1092 | we must avoid any attempt to resume unlocking it */ |
| 1093 | if (gx.xlock.box == obj) |
| 1094 | reset_pick(); |
| 1095 | break; |
| 1096 | } |
| 1097 | return res; |
| 1098 | } |
| 1099 | |
| 1100 | /* Door/secret door was hit with spell or wand effect otmp; |
| 1101 | returns true if something happened */ |
no test coverage detected