getobj callback for object to apply - this is more complex than most other * callbacks because there are a lot of appliables */
| 4148 | /* getobj callback for object to apply - this is more complex than most other |
| 4149 | * callbacks because there are a lot of appliables */ |
| 4150 | staticfn int |
| 4151 | apply_ok(struct obj *obj) |
| 4152 | { |
| 4153 | if (!obj) |
| 4154 | return GETOBJ_EXCLUDE; |
| 4155 | |
| 4156 | /* all tools, all wands (breaking), all spellbooks (flipping through - |
| 4157 | including blank/novel/Book of the Dead) */ |
| 4158 | if (obj->oclass == TOOL_CLASS || obj->oclass == WAND_CLASS |
| 4159 | || obj->oclass == SPBOOK_CLASS) |
| 4160 | return GETOBJ_SUGGEST; |
| 4161 | |
| 4162 | /* applying coins to flip them is a minor easter egg, so do not suggest |
| 4163 | coin application to the player */ |
| 4164 | if (obj->oclass == COIN_CLASS) |
| 4165 | return GETOBJ_DOWNPLAY; |
| 4166 | |
| 4167 | /* certain weapons */ |
| 4168 | if (obj->oclass == WEAPON_CLASS |
| 4169 | && (is_pick(obj) || is_axe(obj) || is_pole(obj) |
| 4170 | || obj->otyp == BULLWHIP)) |
| 4171 | return GETOBJ_SUGGEST; |
| 4172 | |
| 4173 | if (obj->oclass == POTION_CLASS) { |
| 4174 | /* permit applying unknown potions, but don't suggest them */ |
| 4175 | if (!obj->dknown || !objects[obj->otyp].oc_name_known) |
| 4176 | return GETOBJ_DOWNPLAY; |
| 4177 | |
| 4178 | /* only applicable potion is oil, and it will only be suggested as a |
| 4179 | choice when already discovered */ |
| 4180 | if (obj->otyp == POT_OIL) |
| 4181 | return GETOBJ_SUGGEST; |
| 4182 | } |
| 4183 | |
| 4184 | /* certain foods */ |
| 4185 | if (obj->otyp == CREAM_PIE || obj->otyp == EUCALYPTUS_LEAF |
| 4186 | || obj->otyp == LUMP_OF_ROYAL_JELLY) |
| 4187 | return GETOBJ_SUGGEST; |
| 4188 | |
| 4189 | if (obj->otyp == BANANA && Hallucination) |
| 4190 | return GETOBJ_DOWNPLAY; |
| 4191 | |
| 4192 | if (is_graystone(obj)) { |
| 4193 | /* The only case where we don't suggest a gray stone is if we KNOW it |
| 4194 | isn't a touchstone. */ |
| 4195 | if (!obj->dknown) |
| 4196 | return GETOBJ_SUGGEST; |
| 4197 | |
| 4198 | if (obj->otyp != TOUCHSTONE |
| 4199 | && (objects[TOUCHSTONE].oc_name_known |
| 4200 | || objects[obj->otyp].oc_name_known)) |
| 4201 | return GETOBJ_EXCLUDE_SELECTABLE; |
| 4202 | |
| 4203 | return GETOBJ_SUGGEST; |
| 4204 | } |
| 4205 | |
| 4206 | /* item can't be applied; if picked anyway, |
| 4207 | _EXCLUDE would yield "That is a silly thing to apply.", |
nothing calls this directly
no outgoing calls
no test coverage detected