Tin of to the rescue? Decide whether current occupation is an attempt to eat a tin of something capable of saving hero's life. We don't care about consumption of non-tinned food here because special effects there take place on first bite rather than at end of occupation. [Popeye the Sailor gets out of trouble by eating tins of spinach. :-] */
| 3917 | effects there take place on first bite rather than at end of occupation. |
| 3918 | [Popeye the Sailor gets out of trouble by eating tins of spinach. :-] */ |
| 3919 | boolean |
| 3920 | Popeye(int threat) |
| 3921 | { |
| 3922 | struct obj *otin; |
| 3923 | int mndx; |
| 3924 | |
| 3925 | if (go.occupation != opentin) |
| 3926 | return FALSE; |
| 3927 | otin = svc.context.tin.tin; |
| 3928 | /* make sure hero still has access to tin */ |
| 3929 | if (!carried(otin) |
| 3930 | && (!obj_here(otin, u.ux, u.uy) || !can_reach_floor(TRUE))) |
| 3931 | return FALSE; |
| 3932 | /* unknown tin is assumed to be helpful */ |
| 3933 | if (!otin->known) |
| 3934 | return TRUE; |
| 3935 | /* known tin is helpful if it will stop life-threatening problem */ |
| 3936 | mndx = otin->corpsenm; |
| 3937 | switch (threat) { |
| 3938 | /* note: not used; hunger code bypasses stop_occupation() when eating */ |
| 3939 | case HUNGER: |
| 3940 | return (boolean) (mndx != NON_PM || otin->spe == 1); |
| 3941 | /* flesh from lizards and acidic critters stops petrification */ |
| 3942 | case STONED: |
| 3943 | return (boolean) (ismnum(mndx) |
| 3944 | && (mndx == PM_LIZARD || acidic(&mons[mndx]))); |
| 3945 | /* polymorph into a fiery monster */ |
| 3946 | case SLIMED: |
| 3947 | return (boolean) polyfood(otin); |
| 3948 | /* no tins can cure these (yet?) */ |
| 3949 | case SICK: |
| 3950 | case VOMITING: |
| 3951 | break; |
| 3952 | default: |
| 3953 | break; |
| 3954 | } |
| 3955 | return FALSE; |
| 3956 | } |
| 3957 | |
| 3958 | /* the hero has swallowed a monster whole as a purple worm or similar, and has |
| 3959 | finished digesting its corpse (called via ga.afternmv) */ |
no test coverage detected