| 101 | } |
| 102 | |
| 103 | staticfn struct permonst * |
| 104 | pick_familiar_pm(struct obj *otmp, boolean quietly) |
| 105 | { |
| 106 | struct permonst *pm = (struct permonst *) 0; |
| 107 | |
| 108 | if (otmp) { /* figurine; otherwise spell */ |
| 109 | int mndx = otmp->corpsenm; |
| 110 | |
| 111 | assert(ismnum(mndx)); |
| 112 | pm = &mons[mndx]; |
| 113 | /* activating a figurine provides one way to exceed the |
| 114 | maximum number of the target critter created--unless |
| 115 | it has a special limit (erinys, Nazgul) */ |
| 116 | if ((svm.mvitals[mndx].mvflags & G_EXTINCT) |
| 117 | && mbirth_limit(mndx) != MAXMONNO) { |
| 118 | if (!quietly) |
| 119 | /* have just been given "You <do something with> |
| 120 | the figurine and it transforms." message */ |
| 121 | pline("... into a pile of dust."); |
| 122 | return (struct permonst *) 0; |
| 123 | } |
| 124 | } else if (!rn2(3)) { |
| 125 | pm = &mons[pet_type()]; |
| 126 | } else { |
| 127 | int skill = spell_skilltype(SPE_CREATE_FAMILIAR); |
| 128 | int max = 3 * P_SKILL(skill); |
| 129 | |
| 130 | pm = rndmonst_adj(0, max); |
| 131 | if (!pm && !quietly) |
| 132 | There("seems to be nothing available for a familiar."); |
| 133 | } |
| 134 | return pm; |
| 135 | } |
| 136 | |
| 137 | struct monst * |
| 138 | make_familiar(struct obj *otmp, coordxy x, coordxy y, boolean quietly) |
no test coverage detected