MCPcopy Create free account
hub / github.com/NetHack/NetHack / clonewiz

Function clonewiz

src/wizard.c:516–534  ·  view source on GitHub ↗

"Double Trouble" spell cast by the Wizard; caller is responsible for only casting this when there is currently one wizard in existence; the clone can't use it unless/until its creator has been killed off */

Source from the content-addressed store, hash-verified

514 only casting this when there is currently one wizard in existence;
515 the clone can't use it unless/until its creator has been killed off */
516void
517clonewiz(void)
518{
519 struct monst *mtmp2;
520
521 if ((mtmp2 = makemon(&mons[PM_WIZARD_OF_YENDOR], u.ux, u.uy, MM_NOWAIT))
522 != 0) {
523 mtmp2->msleeping = mtmp2->mtame = mtmp2->mpeaceful = 0;
524 if (!u.uhave.amulet && rn2(2)) { /* give clone a fake */
525 (void) add_to_minv(mtmp2,
526 mksobj(FAKE_AMULET_OF_YENDOR, TRUE, FALSE));
527 }
528 if (!Protection_from_shape_changers) {
529 mtmp2->m_ap_type = M_AP_MONSTER;
530 mtmp2->mappearance = ROLL_FROM(wizapp);
531 }
532 newsym(mtmp2->mx, mtmp2->my);
533 }
534}
535
536/* also used by newcham() */
537int

Callers 1

mcast_clone_wizFunction · 0.85

Calls 5

makemonFunction · 0.85
rn2Function · 0.85
add_to_minvFunction · 0.85
mksobjFunction · 0.85
newsymFunction · 0.85

Tested by

no test coverage detected