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

Function initedog

src/dog.c:44–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44void
45initedog(struct monst *mtmp, boolean everything)
46{
47 struct edog *edogp = EDOG(mtmp);
48 long minhungry = svm.moves + 1000L;
49 schar minimumtame = is_domestic(mtmp->data) ? 10 : 5;
50
51 mtmp->mtame = max(minimumtame, mtmp->mtame);
52 mtmp->mpeaceful = 1;
53 mtmp->mavenge = 0;
54 set_malign(mtmp); /* recalc alignment now that it's tamed */
55 if (everything) {
56 mtmp->mleashed = 0;
57 mtmp->meating = 0;
58 edogp->droptime = 0;
59 edogp->dropdist = 10000;
60 edogp->apport = ACURR(A_CHA);
61 edogp->whistletime = 0;
62 /* edogp->hungrytime = 0L; // set below */
63 edogp->ogoal.x = -1; /* force error if used before set */
64 edogp->ogoal.y = -1;
65 edogp->abuse = 0;
66 edogp->revivals = 0;
67 edogp->mhpmax_penalty = 0;
68 edogp->killed_by_u = 0;
69 } else {
70 if (edogp->apport <= 0)
71 edogp->apport = 1;
72 }
73 /* always set for newly tamed pet or feral former pet; hungrytime might
74 already be higher when taming magic affects already tame monst */
75 if (edogp->hungrytime < minhungry)
76 edogp->hungrytime = minhungry;
77 /* livelog first pet, but only if you didn't start with one (the starting
78 * pet will be initialized before in_moveloop is true) */
79 if (!u.uconduct.pets && program_state.in_moveloop) {
80 /* "obtained" a pet rather than "tamed" it because it might have come
81 * from a figurine or some other method in which it was created tame
82 * using an() is safe unless it somehow becomes possible to tame a
83 * unique monster */
84 livelog_printf(LL_CONDUCT, "obtained %s first pet (%s)",
85 uhis(), an(mon_pmname(mtmp)));
86 }
87 u.uconduct.pets++;
88}
89
90staticfn int
91pet_type(void)

Callers 5

make_familiarFunction · 0.85
makedogFunction · 0.85
tamedogFunction · 0.85
cloneuFunction · 0.85
seffect_lightFunction · 0.85

Calls 4

set_malignFunction · 0.85
livelog_printfFunction · 0.85
anFunction · 0.85
mon_pmnameFunction · 0.85

Tested by

no test coverage detected