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

Function arti_invoke_cost

src/artifact.c:2105–2128  ·  view source on GitHub ↗

return TRUE if artifact object's invoke cost can be paid (and pay it) */

Source from the content-addressed store, hash-verified

2103
2104/* return TRUE if artifact object's invoke cost can be paid (and pay it) */
2105staticfn boolean
2106arti_invoke_cost(struct obj *obj)
2107{
2108 if (obj->age > svm.moves) {
2109 int pw_cost = arti_invoke_cost_pw(obj);
2110
2111 if (pw_cost < 0 || u.uen < pw_cost) {
2112 /* the artifact is tired :-) */
2113 You_feel("that %s %s ignoring you.", the(xname(obj)),
2114 otense(obj, "are"));
2115 /* and just got more so; patience is essential... */
2116 obj->age += (long) d(3, 10);
2117 return FALSE;
2118 } else {
2119 /* you pay invoke cost with your own magic */
2120 You_feel("drained...");
2121 u.uen -= pw_cost;
2122 disp.botl = TRUE;
2123 }
2124 } else {
2125 obj->age = svm.moves + rnz(100);
2126 }
2127 return TRUE;
2128}
2129
2130staticfn int
2131arti_invoke(struct obj *obj)

Callers 1

arti_invokeFunction · 0.85

Calls 7

arti_invoke_cost_pwFunction · 0.85
You_feelFunction · 0.85
theFunction · 0.85
xnameFunction · 0.85
otenseFunction · 0.85
dFunction · 0.85
rnzFunction · 0.85

Tested by

no test coverage detected