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

Function zap_steed

src/zap.c:3086–3141  ·  view source on GitHub ↗

you've zapped a wand downwards while riding * Return TRUE if the steed was hit by the wand. * Return FALSE if the steed was not hit by the wand. */

Source from the content-addressed store, hash-verified

3084 * Return FALSE if the steed was not hit by the wand.
3085 */
3086staticfn boolean
3087zap_steed(struct obj *obj) /* wand or spell */
3088{
3089 int steedhit = FALSE;
3090
3091 gb.bhitpos.x = u.usteed->mx, gb.bhitpos.y = u.usteed->my;
3092 gn.notonhead = FALSE;
3093 switch (obj->otyp) {
3094 /*
3095 * Wands that are allowed to hit the steed
3096 * Carefully test the results of any that are
3097 * moved here from the bottom section.
3098 */
3099 case WAN_PROBING:
3100 probe_monster(u.usteed);
3101 learnwand(obj);
3102 steedhit = TRUE;
3103 break;
3104 case WAN_TELEPORTATION:
3105 case SPE_TELEPORT_AWAY:
3106 /* you go together */
3107 tele();
3108 /* same criteria as when unmounted (zapyourself) */
3109 if ((Teleport_control && !Stunned) || !couldsee(u.ux0, u.uy0)
3110 || distu(u.ux0, u.uy0) >= 16)
3111 learnwand(obj);
3112 steedhit = TRUE;
3113 break;
3114
3115 /* Default processing via bhitm() for these */
3116 case SPE_CURE_SICKNESS:
3117 case WAN_MAKE_INVISIBLE:
3118 case WAN_CANCELLATION:
3119 case SPE_CANCELLATION:
3120 case WAN_POLYMORPH:
3121 case SPE_POLYMORPH:
3122 case WAN_STRIKING:
3123 case SPE_FORCE_BOLT:
3124 case WAN_SLOW_MONSTER:
3125 case SPE_SLOW_MONSTER:
3126 case WAN_SPEED_MONSTER:
3127 case SPE_HEALING:
3128 case SPE_EXTRA_HEALING:
3129 case SPE_DRAIN_LIFE:
3130 case WAN_OPENING:
3131 case SPE_KNOCK:
3132 (void) bhitm(u.usteed, obj);
3133 steedhit = TRUE;
3134 break;
3135
3136 default:
3137 steedhit = FALSE;
3138 break;
3139 }
3140 return steedhit;
3141}
3142
3143/*

Callers 1

weffectsFunction · 0.85

Calls 4

probe_monsterFunction · 0.85
learnwandFunction · 0.85
teleFunction · 0.85
bhitmFunction · 0.85

Tested by

no test coverage detected