MCPcopy Index your code
hub / github.com/NetHack/NetHack / mount_steed

Function mount_steed

src/steed.c:196–383  ·  view source on GitHub ↗

Start riding, with the given monster */

Source from the content-addressed store, hash-verified

194
195/* Start riding, with the given monster */
196boolean
197mount_steed(
198 struct monst *mtmp, /* The animal */
199 boolean force) /* Quietly force this animal */
200{
201 struct obj *otmp;
202 char buf[BUFSZ];
203 struct permonst *ptr;
204
205 /* Sanity checks */
206 if (u.usteed) {
207 You("are already riding %s.", mon_nam(u.usteed));
208 return (FALSE);
209 }
210
211 /* Is the player in the right form? */
212 if (Hallucination && !force) {
213 pline("Maybe you should find a designated driver.");
214 return (FALSE);
215 }
216 /* While riding, Wounded_legs refers to the steed's
217 * legs, not the hero's legs.
218 * That opens up a potential abuse where the player
219 * can mount a steed, then dismount immediately to
220 * heal leg damage, because leg damage is always
221 * healed upon dismount (Wounded_legs context switch).
222 * By preventing a hero with Wounded_legs from
223 * mounting a steed, the potential for abuse is
224 * reduced. However, dismounting still immediately
225 * heals the steed's wounded legs. [In 3.4.3 and
226 * earlier, that unintentionally made the hero's
227 * temporary 1 point Dex loss become permanent.]
228 */
229 if (Wounded_legs) {
230 char qbuf[QBUFSZ];
231
232 legs_in_no_shape("riding", FALSE);
233 Sprintf(qbuf, "Heal your leg%s?",
234 ((HWounded_legs & BOTH_SIDES) == BOTH_SIDES) ? "s" : "");
235 if (force && wizard && y_n(qbuf) == 'y')
236 heal_legs(0);
237 else
238 return (FALSE);
239 }
240
241 if (Upolyd && (!humanoid(gy.youmonst.data)
242 || verysmall(gy.youmonst.data)
243 || bigmonst(gy.youmonst.data)
244 || slithy(gy.youmonst.data))) {
245 You("won't fit on a saddle.");
246 return (FALSE);
247 }
248 if (!force && (near_capacity() > SLT_ENCUMBER)) {
249 You_cant("do that while carrying so much stuff.");
250 return (FALSE);
251 }
252
253 /* Can the player reach and see the monster? */

Callers 1

dorideFunction · 0.85

Calls 15

YouFunction · 0.85
mon_namFunction · 0.85
legs_in_no_shapeFunction · 0.85
heal_legsFunction · 0.85
near_capacityFunction · 0.85
You_cantFunction · 0.85
a_monnamFunction · 0.85
test_moveFunction · 0.85
body_partFunction · 0.85
which_armorFunction · 0.85
MonnamFunction · 0.85
anFunction · 0.85

Tested by

no test coverage detected