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

Function cost

src/write.c:13–57  ·  view source on GitHub ↗

* returns base cost of a scroll or a spellbook */

Source from the content-addressed store, hash-verified

11 * returns base cost of a scroll or a spellbook
12 */
13staticfn int
14cost(struct obj *otmp)
15{
16 if (otmp->oclass == SPBOOK_CLASS)
17 return (10 * objects[otmp->otyp].oc_level);
18
19 switch (otmp->otyp) {
20#ifdef MAIL_STRUCTURES
21 case SCR_MAIL:
22 return 2;
23#endif
24 case SCR_LIGHT:
25 case SCR_GOLD_DETECTION:
26 case SCR_FOOD_DETECTION:
27 case SCR_MAGIC_MAPPING:
28 case SCR_AMNESIA:
29 case SCR_FIRE:
30 case SCR_EARTH:
31 return 8;
32 case SCR_DESTROY_ARMOR:
33 case SCR_CREATE_MONSTER:
34 case SCR_PUNISHMENT:
35 return 10;
36 case SCR_CONFUSE_MONSTER:
37 return 12;
38 case SCR_IDENTIFY:
39 return 14;
40 case SCR_ENCHANT_ARMOR:
41 case SCR_REMOVE_CURSE:
42 case SCR_ENCHANT_WEAPON:
43 case SCR_CHARGING:
44 return 16;
45 case SCR_SCARE_MONSTER:
46 case SCR_STINKING_CLOUD:
47 case SCR_TAMING:
48 case SCR_TELEPORTATION:
49 return 20;
50 case SCR_GENOCIDE:
51 return 30;
52 case SCR_BLANK_PAPER:
53 default:
54 impossible("You can't write such a weird scroll!");
55 }
56 return 1000;
57}
58
59/* getobj callback for object to write on */
60staticfn int

Callers 1

dowriteFunction · 0.85

Calls 1

impossibleFunction · 0.70

Tested by

no test coverage detected