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

Function mhurtle_step

src/dothrow.c:991–1068  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

989}
990
991staticfn boolean
992mhurtle_step(genericptr_t arg, coordxy x, coordxy y)
993{
994 struct monst *mon = (struct monst *) arg;
995 struct monst *mtmp;
996
997 if (!isok(x, y))
998 return FALSE;
999
1000 if (will_hurtle(mon, x, y) && m_in_out_region(mon, x, y)) {
1001 int res;
1002
1003 if (mon != u.usteed) {
1004 remove_monster(mon->mx, mon->my);
1005 newsym(mon->mx, mon->my);
1006 place_monster(mon, x, y);
1007 newsym(mon->mx, mon->my);
1008 } else {
1009 /* steed is hurtling, move hero which will also move steed */
1010 u.ux0 = u.ux, u.uy0 = u.uy;
1011 u_on_newpos(x, y);
1012 newsym(u.ux0, u.uy0); /* update old position */
1013 vision_recalc(0); /* new location => different lines of sight */
1014 }
1015 flush_screen(1);
1016 nh_delay_output();
1017 set_apparxy(mon);
1018 if (is_waterwall(x, y))
1019 return FALSE;
1020 res = mintrap(mon, HURTLING);
1021 if (res == Trap_Killed_Mon
1022 || res == Trap_Caught_Mon
1023 || res == Trap_Moved_Mon)
1024 return FALSE;
1025 return TRUE;
1026 }
1027 if ((mtmp = m_at(x, y)) != 0 && mtmp != mon) {
1028 if (canseemon(mon) || canseemon(mtmp))
1029 pline("%s bumps into %s.", Monnam(mon), a_monnam(mtmp));
1030 wakeup(mtmp, !svc.context.mon_moving);
1031 /* check whether 'mon' is turned to stone by touching 'mtmp' */
1032 if (touch_petrifies(mtmp->data)
1033 && !which_armor(mon, W_ARMU | W_ARM | W_ARMC)) {
1034 minstapetrify(mon, !svc.context.mon_moving);
1035 newsym(mon->mx, mon->my);
1036 }
1037 /* and whether 'mtmp' is turned to stone by being touched by 'mon' */
1038 if (touch_petrifies(mon->data)
1039 && !which_armor(mtmp, W_ARMU | W_ARM | W_ARMC)) {
1040 minstapetrify(mtmp, !svc.context.mon_moving);
1041 newsym(mtmp->mx, mtmp->my);
1042 }
1043 } else if (u_at(x, y)) {
1044 /* a monster has caused 'mon' to hurtle against hero */
1045 pline("%s bumps into you.", Some_Monnam(mon));
1046 stop_occupation();
1047 /* check whether 'mon' is turned to stone by touching poly'd hero */
1048 if (Upolyd && touch_petrifies(gy.youmonst.data)

Callers

nothing calls this directly

Calls 15

isokFunction · 0.85
will_hurtleFunction · 0.85
m_in_out_regionFunction · 0.85
newsymFunction · 0.85
place_monsterFunction · 0.85
u_on_newposFunction · 0.85
vision_recalcFunction · 0.85
flush_screenFunction · 0.85
set_apparxyFunction · 0.85
is_waterwallFunction · 0.85
mintrapFunction · 0.85
canseemonFunction · 0.85

Tested by

no test coverage detected